upgrade nodejs to 18.17.0 (#15899)

* upgrade nodejs to 18.17.0

fix compile-native-ts

fix type

fix eslint

fix node version on native-binding

test native ci

fix eslint

fix jest version

upgrade ts-jest

fix

reduce EXPECTED_CAPACITY

update ccbuidl

Revert "test native ci"

This reverts commit 795c8c68cf7ff7f2561db4414689ad3f6aa5c1f7.

# Conflicts:
#	scripts/native-pack-tool/package-lock.json

* detect node version

# Conflicts:
#	package.json

* use engine-strict option

* Update .nvmrc

* Update pal/input/web/accelerometer-input.ts

* fix conflict

* fix compile native ts

* download external in compile native ts

* fix
This commit is contained in:
PP
2023-08-28 15:52:24 +08:00
committed by GitHub
parent 15eec3bc26
commit 9daf2c663c
19 changed files with 26743 additions and 20559 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ jobs:
# if: github.event_name == 'pull_request_target' && github.event.action == 'closed' && github.event.pull_request.merged == true # if: github.event_name == 'pull_request_target' && github.event.action == 'closed' && github.event.pull_request.merged == true
strategy: strategy:
matrix: matrix:
node-version: [14.x] node-version: [18.x]
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
+5 -1
View File
@@ -18,7 +18,7 @@ jobs:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
strategy: strategy:
matrix: matrix:
node-version: [14.x] node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps: steps:
@@ -29,5 +29,9 @@ jobs:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- run: npm ci --ignore-scripts - run: npm ci --ignore-scripts
- run: npx gulp build-debug-infos - run: npx gulp build-debug-infos
- name: Download external
run: |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js`
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external
- run: node ./scripts/compile-native-ts.js - run: node ./scripts/compile-native-ts.js
#- run: echo "::remove-matcher owner=circular-reference-check::" #- run: echo "::remove-matcher owner=circular-reference-check::"
+1 -1
View File
@@ -18,7 +18,7 @@ jobs:
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
strategy: strategy:
matrix: matrix:
node-version: [14.x] node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ # See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps: steps:
+1 -1
View File
@@ -16,7 +16,7 @@ jobs:
steps: steps:
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14.19' node-version: '18.x'
- uses: actions/checkout@v3 - uses: actions/checkout@v3
name: Checkout Base Ref name: Checkout Base Ref
+1 -1
View File
@@ -17,7 +17,7 @@ jobs:
- uses: actions/setup-node@v2 - uses: actions/setup-node@v2
with: with:
node-version: '14.19' node-version: '18.x'
- name: install gulp - name: install gulp
run: | run: |
+2 -2
View File
@@ -18,14 +18,14 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
node-version: '16.x' node-version: '18.x'
- name: Download external - name: Download external
run: | run: |
EXT_VERSION=`node ./.github/workflows/get-native-external-version.js` EXT_VERSION=`node ./.github/workflows/get-native-external-version.js`
git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external git clone --branch $EXT_VERSION --depth 1 https://github.com/cocos/cocos-engine-external native/external
- run: npx npm@6 ci - run: npm ci
- name: Run ESLint - name: Run ESLint
shell: pwsh shell: pwsh
+1
View File
@@ -0,0 +1 @@
engine-strict=true
+1 -1
View File
@@ -1 +1 @@
14 18.17.0
+1 -1
View File
@@ -35,7 +35,7 @@ interface EditorExtendsNode {
} }
interface EditorExtendsPrefabUtils { interface EditorExtendsPrefabUtils {
addPrefabInstance(node: Node); addPrefabInstance(node: import('cocos/scene-graph/node').Node);
} }
interface EditorExtendsComponent { interface EditorExtendsComponent {
+5 -4
View File
@@ -32,7 +32,7 @@ import { ClassStash, PropertyStash, PropertyStashInternalFlag } from '../class-s
import { getClassName, mixin } from '../../utils/js-typed'; import { getClassName, mixin } from '../../utils/js-typed';
// eslint-disable-next-line @typescript-eslint/ban-types // eslint-disable-next-line @typescript-eslint/ban-types
export type SimplePropertyType = Function | string | typeof CCString | typeof CCInteger | typeof CCFloat | typeof CCBoolean; export type SimplePropertyType = Function | string | typeof CCString | typeof CCInteger | typeof CCBoolean;
export type PropertyType = SimplePropertyType | SimplePropertyType[]; export type PropertyType = SimplePropertyType | SimplePropertyType[];
@@ -80,7 +80,7 @@ export function property (
target, target,
propertyKey, propertyKey,
); );
const classConstructor = target.constructor; const classConstructor = target.constructor as new () => unknown;
mergePropertyOptions( mergePropertyOptions(
classStash, classStash,
propertyStash, propertyStash,
@@ -133,7 +133,8 @@ function extractActualDefaultValues (classConstructor: new () => unknown): unkno
dummyObj = new classConstructor(); dummyObj = new classConstructor();
} catch (e) { } catch (e) {
if (DEV) { if (DEV) {
warnID(3652, getClassName(classConstructor), e); // NOTE: here we use unknown e as a string, or sometheing supports toString() method.
warnID(3652, getClassName(classConstructor), e as string);
} }
return {}; return {};
} }
@@ -188,7 +189,7 @@ export function getOrCreatePropertyStash (
function mergePropertyOptions ( function mergePropertyOptions (
cache: ClassStash, cache: ClassStash,
propertyStash: PropertyStash, propertyStash: PropertyStash,
ctor, ctor: new () => unknown,
propertyKey: Parameters<LegacyPropertyDecorator>[1], propertyKey: Parameters<LegacyPropertyDecorator>[1],
options, options,
descriptorOrInitializer: Parameters<LegacyPropertyDecorator>[2] | undefined, descriptorOrInitializer: Parameters<LegacyPropertyDecorator>[2] | undefined,
+1 -1
View File
@@ -1,4 +1,4 @@
const { pathsToModuleNameMapper } = require('ts-jest/utils'); const { pathsToModuleNameMapper } = require('ts-jest');
const ts = require('typescript'); const ts = require('typescript');
const ps = require('path'); const ps = require('path');
const tsConfig = ts.readConfigFile(ps.join(__dirname, 'tsconfig.json'), ts.sys.readFile); const tsConfig = ts.readConfigFile(ps.join(__dirname, 'tsconfig.json'), ts.sys.readFile);
+20114 -16183
View File
File diff suppressed because it is too large Load Diff
+5 -2
View File
@@ -8,6 +8,9 @@
"AUTHORS.txt" "AUTHORS.txt"
], ],
"module": "index.js", "module": "index.js",
"engines": {
"node": ">=18.0.0"
},
"scripts": { "scripts": {
"server": "http-server . -p 8002 -o playground/index.html", "server": "http-server . -p 8002 -o playground/index.html",
"postinstall": "gulp build-debug-infos && npm run build-declaration && npm run bundle-adapter && npm run fetch-ral && npm run install:typedoc-plugin && npm run install:native-pack-tool", "postinstall": "gulp build-debug-infos && npm run build-declaration && npm run bundle-adapter && npm run fetch-ral && npm run install:typedoc-plugin && npm run install:native-pack-tool",
@@ -79,7 +82,7 @@
"tar": "^6.1.15", "tar": "^6.1.15",
"tmp": "^0.2.1", "tmp": "^0.2.1",
"tree-kill": "^1.2.0", "tree-kill": "^1.2.0",
"ts-jest": "^26.5.4", "ts-jest": "^28.0.8",
"typedoc": "^0.22.13", "typedoc": "^0.22.13",
"typedoc-plugin-cc": "file:scripts/typedoc-plugin", "typedoc-plugin-cc": "file:scripts/typedoc-plugin",
"typescript": "^4.3.5", "typescript": "^4.3.5",
@@ -92,7 +95,7 @@
"dependencies": { "dependencies": {
"@cocos/box2d": "1.0.1", "@cocos/box2d": "1.0.1",
"@cocos/cannon": "1.2.8", "@cocos/cannon": "1.2.8",
"@cocos/ccbuild": "^1.0.0-alpha.7", "@cocos/ccbuild": "2.0.3-alpha.7",
"@cocos/dragonbones-js": "^1.0.1" "@cocos/dragonbones-js": "^1.0.1"
} }
} }
+6 -3
View File
@@ -29,6 +29,7 @@ import { EventTarget } from '../../../cocos/core/event/event-target';
import { BrowserType, OS } from '../../system-info/enum-type'; import { BrowserType, OS } from '../../system-info/enum-type';
import { EventAcceleration, Acceleration } from '../../../cocos/input/types'; import { EventAcceleration, Acceleration } from '../../../cocos/input/types';
import { InputEventType } from '../../../cocos/input/types/event-enum'; import { InputEventType } from '../../../cocos/input/types/event-enum';
import { warn } from '../../../cocos/core/platform/debug';
export class AccelerometerInputSource { export class AccelerometerInputSource {
private _intervalInMileSeconds = 200; private _intervalInMileSeconds = 200;
@@ -120,12 +121,14 @@ export class AccelerometerInputSource {
public start (): void { public start (): void {
// for iOS 13+, safari // for iOS 13+, safari
if (window.DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === 'function') { // NOTE: since TS 4.4, `requestPermission` is not defined in class DeviceMotionEvent in `lib.dom.d.ts`, this should be a breaking change in TS.
DeviceMotionEvent.requestPermission().then((response) => { // Accessing the `requestPermission` would emit a type error, so we assert `DeviceMotionEvent` as any type to skip the TS type checking.
if (window.DeviceMotionEvent && typeof (DeviceMotionEvent as any).requestPermission === 'function') {
(DeviceMotionEvent as any).requestPermission().then((response) => {
if (response === 'granted') { if (response === 'granted') {
this._registerEvent(); this._registerEvent();
} }
}).catch((e) => {}); }).catch((e) => { warn(e); });
} else { } else {
this._registerEvent(); this._registerEvent();
} }
+7 -5
View File
@@ -25,9 +25,11 @@ function normalizePath (path) {
async function buildTsEngine () { async function buildTsEngine () {
console.log(chalk.green('building TS engine ...\n')); console.log(chalk.green('building TS engine ...\n'));
const engineBuilder = new ccbuild.EngineBuilder(); await ccbuild.buildEngine({
await engineBuilder.build({ // NOTE: for now only OH platform supports building TS engine
root: engineRoot, platform: 'OPEN_HARMONY',
preserveType: true,
engine: engineRoot,
// TODO: some modules still cannot be compile // TODO: some modules still cannot be compile
features: [ features: [
"base", "base",
@@ -67,12 +69,11 @@ async function buildTsEngine () {
"custom-pipeline", "custom-pipeline",
// "light-probe", // "light-probe",
], ],
platform: 'NATIVE',
mode: 'BUILD', mode: 'BUILD',
flagConfig: { flagConfig: {
DEBUG: true, DEBUG: true,
}, },
outDir: buildOutput, out: buildOutput,
}); });
} }
@@ -105,6 +106,7 @@ async function compileTsEngine () {
"./@types/pal/input", "./@types/pal/input",
"./@types/pal/env", "./@types/pal/env",
"./@types/pal/pacer", "./@types/pal/pacer",
"./@types/pal/wasm",
].map(typePath => normalizePath(ps.join(buildOutput, typePath))), ].map(typePath => normalizePath(ps.join(buildOutput, typePath))),
skipLibCheck: true, skipLibCheck: true,
rootDir: buildOutput, rootDir: buildOutput,
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1791 -791
View File
File diff suppressed because it is too large Load Diff
@@ -6,7 +6,7 @@ import { deserialize } from '../../../cocos/serialization/deserialize';
@ccclass('Foo') @ccclass('Foo')
class Foo { @property foo!: Foo | null; } class Foo { @property foo!: Foo | null; }
const EXPECTED_CAPACITY = 900; const EXPECTED_CAPACITY = 750;
test(`Deserialization capacity`, () => { test(`Deserialization capacity`, () => {
const fooSerialized = createVeryDeepFoo(EXPECTED_CAPACITY); const fooSerialized = createVeryDeepFoo(EXPECTED_CAPACITY);