ci: fix ts-node scripts (#5225)

- Ref: https://github.com/TypeStrong/ts-node/issues/2094
This commit is contained in:
LongYinan
2023-12-07 09:13:00 +00:00
parent 467d313730
commit febe5cc2ae
4 changed files with 13 additions and 21 deletions

View File

@@ -374,7 +374,7 @@ jobs:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
- name: Run init-db script - name: Run init-db script
run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts run: yarn workspace @affine/server exec node --loader ts-node/esm/transpile-only ./scripts/init-db.ts
env: env:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
@@ -464,7 +464,7 @@ jobs:
DATABASE_URL: postgresql://affine:affine@localhost:5432/affine DATABASE_URL: postgresql://affine:affine@localhost:5432/affine
- name: Run init-db script - name: Run init-db script
run: yarn workspace @affine/server exec ts-node ./scripts/init-db.ts run: yarn workspace @affine/server exec node --loader ts-node/esm/transpile-only ./scripts/init-db.ts
- name: Download storage.node - name: Download storage.node
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
@@ -588,7 +588,7 @@ jobs:
- name: Output check - name: Output check
if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }} if: ${{ matrix.spec.os == 'macos-latest' && matrix.spec.arch == 'arm64' }}
run: | run: |
yarn workspace @affine/electron ts-node ./scripts/macos-arm64-output-check.ts yarn workspace @affine/electron exec node --loader ts-node/esm/transpile-only ./scripts/macos-arm64-output-check.ts
- name: Upload test results - name: Upload test results
if: ${{ failure() }} if: ${{ failure() }}

View File

@@ -11,14 +11,14 @@
"homepage": "https://github.com/toeverything/AFFiNE", "homepage": "https://github.com/toeverything/AFFiNE",
"scripts": { "scripts": {
"start": "electron .", "start": "electron .",
"dev": "DEV_SERVER_URL=http://localhost:8080 yarn ts-node ./scripts/dev.ts", "dev": "DEV_SERVER_URL=http://localhost:8080 node --loader ts-node/esm/transpile-only ./scripts/dev.ts",
"dev:prod": "yarn ts-node scripts/dev.ts", "dev:prod": "yarn node --loader ts-node/esm/transpile-only scripts/dev.ts",
"build": "NODE_ENV=production ts-node scripts/build-layers.ts", "build": "NODE_ENV=production node --loader ts-node/esm/transpile-only scripts/build-layers.ts",
"build:dev": "NODE_ENV=development ts-node scripts/build-layers.ts", "build:dev": "NODE_ENV=development node --loader ts-node/esm/transpile-only scripts/build-layers.ts",
"generate-assets": "ts-node scripts/generate-assets.ts", "generate-assets": "node --loader ts-node/esm/transpile-only scripts/generate-assets.ts",
"package": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" electron-forge package", "package": "cross-env NODE_OPTIONS=\"--loader ts-node/esm/transpile-only\" electron-forge package",
"make": "cross-env NODE_OPTIONS=\"--loader ts-node/esm\" electron-forge make", "make": "cross-env NODE_OPTIONS=\"--loader ts-node/esm/transpile-only\" electron-forge make",
"make-squirrel": "yarn ts-node scripts/make-squirrel.ts" "make-squirrel": "node --loader ts-node/esm/transpile-only scripts/make-squirrel.ts"
}, },
"main": "./dist/main.js", "main": "./dist/main.js",
"devDependencies": { "devDependencies": {

View File

@@ -17,9 +17,9 @@
"scripts": { "scripts": {
"build": "node build.mjs", "build": "node build.mjs",
"dev": "node dev.mjs", "dev": "node dev.mjs",
"sync-languages": "ts-node -P ./tsconfig.node.json src/scripts/sync.ts", "sync-languages": "node --loader ts-node/esm/transpile-only src/scripts/sync.ts",
"sync-languages:check": "yarn run sync-languages --check", "sync-languages:check": "yarn run sync-languages --check",
"download-resources": "ts-node -P ./tsconfig.node.json src/scripts/download.ts" "download-resources": "node --loader ts-node/esm/transpile-only src/scripts/download.ts"
}, },
"keywords": [], "keywords": [],
"repository": { "repository": {

View File

@@ -2,7 +2,6 @@
"compilerOptions": { "compilerOptions": {
"verbatimModuleSyntax": true, "verbatimModuleSyntax": true,
// Classification follows https://www.typescriptlang.org/tsconfig // Classification follows https://www.typescriptlang.org/tsconfig
// Type Checking // Type Checking
"strict": true, "strict": true,
"exactOptionalPropertyTypes": false, "exactOptionalPropertyTypes": false,
@@ -16,7 +15,6 @@
"noPropertyAccessFromIndexSignature": false, "noPropertyAccessFromIndexSignature": false,
"noUncheckedIndexedAccess": false, "noUncheckedIndexedAccess": false,
"useUnknownInCatchVariables": true, "useUnknownInCatchVariables": true,
// Modules // Modules
"module": "ESNext", "module": "ESNext",
"moduleResolution": "bundler", "moduleResolution": "bundler",
@@ -28,16 +26,13 @@
"sourceMap": true, "sourceMap": true,
// skip type emit for @internal types // skip type emit for @internal types
// "stripInternal": true, // "stripInternal": true,
// JavaScript Support // JavaScript Support
"allowJs": false, "allowJs": false,
"checkJs": false, "checkJs": false,
// Interop Constraints // Interop Constraints
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"isolatedModules": true, "isolatedModules": true,
// Language and Environment // Language and Environment
"jsx": "preserve", "jsx": "preserve",
"jsxImportSource": "@emotion/react", "jsxImportSource": "@emotion/react",
@@ -46,11 +41,9 @@
"useDefineForClassFields": false, "useDefineForClassFields": false,
"experimentalDecorators": true, "experimentalDecorators": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
// Projects // Projects
"composite": true, "composite": true,
"incremental": true, "incremental": true,
// Completeness // Completeness
"skipLibCheck": true, // skip all type checks for .d.ts files "skipLibCheck": true, // skip all type checks for .d.ts files
"paths": { "paths": {
@@ -81,7 +74,6 @@
"@affine/native": ["./packages/frontend/native/index.d.ts"], "@affine/native": ["./packages/frontend/native/index.d.ts"],
"@affine/native/*": ["./packages/frontend/native/*"], "@affine/native/*": ["./packages/frontend/native/*"],
"@affine/storage": ["./packages/backend/storage/index.d.ts"], "@affine/storage": ["./packages/backend/storage/index.d.ts"],
// Development only // Development only
"@affine/electron/*": ["./packages/frontend/electron/src/*"] "@affine/electron/*": ["./packages/frontend/electron/src/*"]
} }