perf: build backend with swc (#9463)

* feat: build backend with swc

* fix: swc build target

Co-authored-by: syuilo <Syuilotan@yahoo.co.jp>
This commit is contained in:
파링 2023-01-12 21:05:45 +09:00 committed by GitHub
parent 978a9bbb3b
commit 4579d02296
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 939 additions and 44 deletions

View File

@ -9,7 +9,17 @@
"transform": { "transform": {
"legacyDecorator": true, "legacyDecorator": true,
"decoratorMetadata": true "decoratorMetadata": true
} },
"experimental": {
"keepImportAssertions": true
},
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
]
},
"target": "es2021"
}, },
"minify": false "minify": false
} }

View File

@ -7,8 +7,8 @@
"start": "node ./built/index.js", "start": "node ./built/index.js",
"start:test": "NODE_ENV=test node ./built/index.js", "start:test": "NODE_ENV=test node ./built/index.js",
"migrate": "typeorm migration:run -d ormconfig.js", "migrate": "typeorm migration:run -d ormconfig.js",
"build": "tsc -p tsconfig.json || echo done. && tsc-alias -p tsconfig.json", "build": "swc src -d built -D",
"watch": "node watch.mjs", "watch": "swc src -d built -D -w",
"lint": "tsc --noEmit && eslint --quiet \"src/**/*.ts\"", "lint": "tsc --noEmit && eslint --quiet \"src/**/*.ts\"",
"jest": "cross-env NODE_ENV=test node --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --forceExit --runInBand", "jest": "cross-env NODE_ENV=test node --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --forceExit --runInBand",
"jest-and-coverage": "cross-env NODE_ENV=test node --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --coverage --forceExit --runInBand", "jest-and-coverage": "cross-env NODE_ENV=test node --experimental-vm-modules --experimental-import-meta-resolve node_modules/jest/bin/jest.js --coverage --forceExit --runInBand",
@ -112,7 +112,6 @@
"systeminformation": "5.17.1", "systeminformation": "5.17.1",
"tinycolor2": "1.5.2", "tinycolor2": "1.5.2",
"tmp": "0.2.1", "tmp": "0.2.1",
"tsc-alias": "1.8.2",
"tsconfig-paths": "4.1.2", "tsconfig-paths": "4.1.2",
"twemoji-parser": "14.0.0", "twemoji-parser": "14.0.0",
"typeorm": "0.3.11", "typeorm": "0.3.11",
@ -128,6 +127,7 @@
}, },
"devDependencies": { "devDependencies": {
"@redocly/openapi-core": "1.0.0-beta.117", "@redocly/openapi-core": "1.0.0-beta.117",
"@swc/cli": "^0.1.59",
"@swc/core": "1.3.25", "@swc/core": "1.3.25",
"@swc/jest": "0.2.24", "@swc/jest": "0.2.24",
"@types/accepts": "1.3.5", "@types/accepts": "1.3.5",

View File

@ -1,23 +0,0 @@
import { execa } from 'execa';
(async () => {
// なぜかchokidarが動かない影響で、watchされない
/*
execa('tsc-alias', ['-w', '-p', 'tsconfig.json'], {
stdout: process.stdout,
stderr: process.stderr,
});
*/
setInterval(() => {
execa('tsc-alias', ['-p', 'tsconfig.json'], {
stdout: process.stdout,
stderr: process.stderr,
});
}, 3000);
execa('tsc', ['-w', '-p', 'tsconfig.json'], {
stdout: process.stdout,
stderr: process.stderr,
});
})();

942
yarn.lock

File diff suppressed because it is too large Load Diff