Use SWC by default
This commit is contained in:
parent
6a7a7a15e4
commit
be07b20da9
2 changed files with 43 additions and 2 deletions
43
gulpfile.cjs
43
gulpfile.cjs
|
@ -1,10 +1,49 @@
|
|||
const gulp = require("gulp");
|
||||
const ts = require("gulp-typescript");
|
||||
const swc = require("gulp-swc");
|
||||
const tsProject = ts.createProject("tsconfig.json");
|
||||
const argv = require("yargs").argv;
|
||||
|
||||
// Task to compile TypeScript files
|
||||
const swcOptions = {
|
||||
jsc: {
|
||||
parser: {
|
||||
syntax: "typescript",
|
||||
tsx: false,
|
||||
decorators: true,
|
||||
dynamicImport: true,
|
||||
},
|
||||
transform: {
|
||||
react: {
|
||||
runtime: "automatic",
|
||||
},
|
||||
},
|
||||
target: "es2022",
|
||||
loose: false,
|
||||
externalHelpers: false,
|
||||
keepClassNames: true,
|
||||
},
|
||||
module: {
|
||||
type: "es6",
|
||||
strict: true,
|
||||
strictMode: true,
|
||||
lazy: false,
|
||||
noInterop: false,
|
||||
},
|
||||
sourceMaps: "inline",
|
||||
minify: false,
|
||||
};
|
||||
|
||||
// Task to compile TypeScript files using SWC
|
||||
gulp.task("scripts", () => {
|
||||
return tsProject.src().pipe(tsProject()).js.pipe(gulp.dest("dist"));
|
||||
if (argv.ts) {
|
||||
console.warn("[WARN] Using TSC compiler, will be slower than SWC");
|
||||
return gulp.src("src/**/*.ts").pipe(tsProject()).pipe(gulp.dest("dist"));
|
||||
} else {
|
||||
return gulp
|
||||
.src("src/**/*.ts")
|
||||
.pipe(swc(swcOptions))
|
||||
.pipe(gulp.dest("dist"));
|
||||
}
|
||||
});
|
||||
|
||||
// Task to copy HTML files
|
||||
|
|
|
@ -14,11 +14,13 @@
|
|||
"dependencies": {
|
||||
"@html-eslint/parser": "^0.27.0",
|
||||
"@stylistic/eslint-plugin-js": "^2.8.0",
|
||||
"@swc/core": "^1.7.26",
|
||||
"@typescript-eslint/eslint-plugin": "^8.6.0",
|
||||
"@typescript-eslint/parser": "^8.6.0",
|
||||
"compression": "^1.7.4",
|
||||
"eslint-plugin-html": "^8.1.1",
|
||||
"express": "^4.19.2",
|
||||
"gulp-swc": "^2.2.0",
|
||||
"node-fetch": "^3.3.2",
|
||||
"ts-to-jsdoc": "^2.2.0"
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue