add esbuild commands from sealious

Summary: Ref T2721

Reviewers: #testers, kuba-orlik

Reviewed By: #testers, kuba-orlik

Subscribers: kuba-orlik

Maniphest Tasks: T2721

Differential Revision: https://hub.sealcode.org/D1390
master
PrzZiomek2 2 years ago
parent 84a9b530d4
commit d9af5dd81f

1
.gitignore vendored

@ -5,4 +5,5 @@ lib
.nyc_output .nyc_output
coverage coverage
@types @types
dist

@ -0,0 +1,23 @@
const { build } = require("esbuild");
const glob = require("tiny-glob");
const watch = process.argv.at(-1) === "--watch";
(async () => {
let entryPoints = Object.fromEntries(
(await glob("./src/**/*.ts")).map((e) => [
e.replace(/\.ts$/, ""),
e,
])
);
build({
entryPoints,
sourcemap: true,
outdir: "./dist",
logLevel: "info",
platform: "node",
watch,
target: "node16",
format: "cjs",
});
})();

@ -4,9 +4,11 @@
"description": "module template", "description": "module template",
"main": "lib/index.js", "main": "lib/index.js",
"scripts": { "scripts": {
"build": "node ./esbuild.js",
"prepare": "rm -rf @types && npm run typecheck && npm run build-declarations && npm run build",
"test": "mocha", "test": "mocha",
"build": "tsc", "build-declarations": "tsc --emitDeclarationOnly",
"prepare": "npm run build", "typecheck": "tsc --noemit",
"clean-coverage": "rm -rf coverage .nyc_output .xunit", "clean-coverage": "rm -rf coverage .nyc_output .xunit",
"coverage": "npm run clean-coverage && nyc mocha", "coverage": "npm run clean-coverage && nyc mocha",
"test-reports": "npm run clean-coverage && nyc --reporter clover mocha --reporter xunit --reporter-option output=.xunit", "test-reports": "npm run clean-coverage && nyc --reporter clover mocha --reporter xunit --reporter-option output=.xunit",
@ -29,7 +31,9 @@
"prettier": "^2.8.7", "prettier": "^2.8.7",
"source-map-support": "^0.5.21", "source-map-support": "^0.5.21",
"ts-node": "^10.9.1", "ts-node": "^10.9.1",
"typescript": "^5.0.4" "typescript": "^5.0.4",
"esbuild": "^0.14.10",
"tiny-glob": "^0.2.9"
}, },
"types": "./@types/index.d.ts" "types": "./@types/index.d.ts"
} }

Loading…
Cancel
Save