mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
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:
@@ -9,7 +9,7 @@ jobs:
|
||||
# if: github.event_name == 'pull_request_target' && github.event.action == 'closed' && github.event.pull_request.merged == true
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
node-version: [18.x]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
node-version: [18.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
@@ -29,5 +29,9 @@ jobs:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
- run: npm ci --ignore-scripts
|
||||
- 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: echo "::remove-matcher owner=circular-reference-check::"
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
(! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration'))
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x]
|
||||
node-version: [18.x]
|
||||
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
|
||||
|
||||
steps:
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14.19'
|
||||
node-version: '18.x'
|
||||
|
||||
- uses: actions/checkout@v3
|
||||
name: Checkout Base Ref
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: '14.19'
|
||||
node-version: '18.x'
|
||||
|
||||
- name: install gulp
|
||||
run: |
|
||||
|
||||
@@ -18,14 +18,14 @@ jobs:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: '16.x'
|
||||
node-version: '18.x'
|
||||
|
||||
- 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: npx npm@6 ci
|
||||
- run: npm ci
|
||||
|
||||
- name: Run ESLint
|
||||
shell: pwsh
|
||||
|
||||
Vendored
+1
-1
@@ -35,7 +35,7 @@ interface EditorExtendsNode {
|
||||
}
|
||||
|
||||
interface EditorExtendsPrefabUtils {
|
||||
addPrefabInstance(node: Node);
|
||||
addPrefabInstance(node: import('cocos/scene-graph/node').Node);
|
||||
}
|
||||
|
||||
interface EditorExtendsComponent {
|
||||
|
||||
@@ -32,7 +32,7 @@ import { ClassStash, PropertyStash, PropertyStashInternalFlag } from '../class-s
|
||||
import { getClassName, mixin } from '../../utils/js-typed';
|
||||
|
||||
// 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[];
|
||||
|
||||
@@ -80,7 +80,7 @@ export function property (
|
||||
target,
|
||||
propertyKey,
|
||||
);
|
||||
const classConstructor = target.constructor;
|
||||
const classConstructor = target.constructor as new () => unknown;
|
||||
mergePropertyOptions(
|
||||
classStash,
|
||||
propertyStash,
|
||||
@@ -133,7 +133,8 @@ function extractActualDefaultValues (classConstructor: new () => unknown): unkno
|
||||
dummyObj = new classConstructor();
|
||||
} catch (e) {
|
||||
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 {};
|
||||
}
|
||||
@@ -188,7 +189,7 @@ export function getOrCreatePropertyStash (
|
||||
function mergePropertyOptions (
|
||||
cache: ClassStash,
|
||||
propertyStash: PropertyStash,
|
||||
ctor,
|
||||
ctor: new () => unknown,
|
||||
propertyKey: Parameters<LegacyPropertyDecorator>[1],
|
||||
options,
|
||||
descriptorOrInitializer: Parameters<LegacyPropertyDecorator>[2] | undefined,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
const { pathsToModuleNameMapper } = require('ts-jest/utils');
|
||||
const { pathsToModuleNameMapper } = require('ts-jest');
|
||||
const ts = require('typescript');
|
||||
const ps = require('path');
|
||||
const tsConfig = ts.readConfigFile(ps.join(__dirname, 'tsconfig.json'), ts.sys.readFile);
|
||||
|
||||
Generated
+20114
-16183
File diff suppressed because it is too large
Load Diff
+5
-2
@@ -8,6 +8,9 @@
|
||||
"AUTHORS.txt"
|
||||
],
|
||||
"module": "index.js",
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"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",
|
||||
@@ -79,7 +82,7 @@
|
||||
"tar": "^6.1.15",
|
||||
"tmp": "^0.2.1",
|
||||
"tree-kill": "^1.2.0",
|
||||
"ts-jest": "^26.5.4",
|
||||
"ts-jest": "^28.0.8",
|
||||
"typedoc": "^0.22.13",
|
||||
"typedoc-plugin-cc": "file:scripts/typedoc-plugin",
|
||||
"typescript": "^4.3.5",
|
||||
@@ -92,7 +95,7 @@
|
||||
"dependencies": {
|
||||
"@cocos/box2d": "1.0.1",
|
||||
"@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"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import { EventTarget } from '../../../cocos/core/event/event-target';
|
||||
import { BrowserType, OS } from '../../system-info/enum-type';
|
||||
import { EventAcceleration, Acceleration } from '../../../cocos/input/types';
|
||||
import { InputEventType } from '../../../cocos/input/types/event-enum';
|
||||
import { warn } from '../../../cocos/core/platform/debug';
|
||||
|
||||
export class AccelerometerInputSource {
|
||||
private _intervalInMileSeconds = 200;
|
||||
@@ -120,12 +121,14 @@ export class AccelerometerInputSource {
|
||||
|
||||
public start (): void {
|
||||
// for iOS 13+, safari
|
||||
if (window.DeviceMotionEvent && typeof DeviceMotionEvent.requestPermission === 'function') {
|
||||
DeviceMotionEvent.requestPermission().then((response) => {
|
||||
// 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.
|
||||
// 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') {
|
||||
this._registerEvent();
|
||||
}
|
||||
}).catch((e) => {});
|
||||
}).catch((e) => { warn(e); });
|
||||
} else {
|
||||
this._registerEvent();
|
||||
}
|
||||
|
||||
@@ -25,9 +25,11 @@ function normalizePath (path) {
|
||||
|
||||
async function buildTsEngine () {
|
||||
console.log(chalk.green('building TS engine ...\n'));
|
||||
const engineBuilder = new ccbuild.EngineBuilder();
|
||||
await engineBuilder.build({
|
||||
root: engineRoot,
|
||||
await ccbuild.buildEngine({
|
||||
// NOTE: for now only OH platform supports building TS engine
|
||||
platform: 'OPEN_HARMONY',
|
||||
preserveType: true,
|
||||
engine: engineRoot,
|
||||
// TODO: some modules still cannot be compile
|
||||
features: [
|
||||
"base",
|
||||
@@ -67,12 +69,11 @@ async function buildTsEngine () {
|
||||
"custom-pipeline",
|
||||
// "light-probe",
|
||||
],
|
||||
platform: 'NATIVE',
|
||||
mode: 'BUILD',
|
||||
flagConfig: {
|
||||
DEBUG: true,
|
||||
},
|
||||
outDir: buildOutput,
|
||||
out: buildOutput,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -105,6 +106,7 @@ async function compileTsEngine () {
|
||||
"./@types/pal/input",
|
||||
"./@types/pal/env",
|
||||
"./@types/pal/pacer",
|
||||
"./@types/pal/wasm",
|
||||
].map(typePath => normalizePath(ps.join(buildOutput, typePath))),
|
||||
skipLibCheck: true,
|
||||
rootDir: buildOutput,
|
||||
|
||||
+994
-592
File diff suppressed because it is too large
Load Diff
+3805
-2968
File diff suppressed because it is too large
Load Diff
Generated
+1791
-791
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@ import { deserialize } from '../../../cocos/serialization/deserialize';
|
||||
@ccclass('Foo')
|
||||
class Foo { @property foo!: Foo | null; }
|
||||
|
||||
const EXPECTED_CAPACITY = 900;
|
||||
const EXPECTED_CAPACITY = 750;
|
||||
|
||||
test(`Deserialization capacity`, () => {
|
||||
const fooSerialized = createVeryDeepFoo(EXPECTED_CAPACITY);
|
||||
|
||||
Reference in New Issue
Block a user