perf: 👷 build backend with swc

Co-authored-by: pikokr <@paring@pikokr.dev>
This commit is contained in:
ThatOneCalculator 2023-01-10 16:48:49 -08:00
parent 56bb3ac355
commit 98401ff312
No known key found for this signature in database
GPG key ID: 8703CACD01000000
6 changed files with 1033 additions and 60 deletions

25
packages/backend/.swcrc Normal file
View file

@ -0,0 +1,25 @@
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"parser": {
"syntax": "typescript",
"dynamicImport": true,
"decorators": true
},
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
},
"experimental": {
"keepImportAssertions": true
},
"baseUrl": ".",
"paths": {
"@/*": [
"./src/*"
]
},
"target": "es2022"
},
"minify": false
}

View file

@ -8,8 +8,8 @@
"start:test": "NODE_ENV=test yarn node ./built/index.js",
"migrate": "typeorm migration:run -d ormconfig.js",
"revertmigration": "typeorm migration:revert -d ormconfig.js",
"build": "tsc -p tsconfig.json || echo done. && tsc-alias -p tsconfig.json",
"watch": "yarn node watch.mjs",
"build": "swc src -d built -D",
"watch": "swc src -d built -D -w",
"lint": "eslint --quiet \"src/**/*.ts\"",
"mocha": "cross-env NODE_ENV=test TS_NODE_FILES=true TS_NODE_TRANSPILE_ONLY=true TS_NODE_PROJECT=\"./test/tsconfig.json\" mocha",
"test": "yarn run mocha"
@ -77,7 +77,7 @@
"koa-send": "5.0.1",
"koa-slow": "2.1.0",
"koa-views": "7.0.2",
"mfm-js": "0.23.0",
"mfm-js": "0.23.2",
"mime-types": "2.1.35",
"mocha": "10.2.0",
"multer": "1.4.4-lts.1",
@ -119,7 +119,6 @@
"tmp": "0.2.1",
"ts-loader": "9.4.2",
"ts-node": "10.9.1",
"tsc-alias": "1.8.2",
"tsconfig-paths": "4.1.2",
"twemoji-parser": "14.0.0",
"typeorm": "0.3.11",
@ -132,7 +131,9 @@
"xev": "3.0.2"
},
"devDependencies": {
"@redocly/openapi-core": "1.0.0-beta.119",
"@redocly/openapi-core": "1.0.0-beta.120",
"@swc/cli": "^0.1.59",
"@swc/core": "^1.3.25",
"@types/bcryptjs": "2.4.2",
"@types/bull": "3.15.9",
"@types/cbor": "6.0.0",

View file

@ -60,6 +60,7 @@ html
meta(property='og:title' content=title || 'Calckey')
meta(property='og:description' content=desc || 'An open source, decentralized social media platform that\'s free forever! 🚀')
meta(property='og:image' content=img)
meta(property='og:image:alt' content=alt || 'Pfp')
style
include ../style.css

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,
});
})();

View file

@ -34,7 +34,7 @@
"json5": "2.2.3",
"katex": "0.16.4",
"matter-js": "0.18.0",
"mfm-js": "0.23.0",
"mfm-js": "0.23.2",
"photoswipe": "5.3.4",
"prismjs": "1.29.0",
"punycode": "2.1.1",

1031
yarn.lock

File diff suppressed because it is too large Load diff