mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 03:59:05 +01:00
feat(share): add dev mode
This commit is contained in:
parent
6c43db692e
commit
bc86fb95b5
@ -5,6 +5,7 @@
|
||||
"type": "module",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev": "esrun scripts/build.ts -- --watch",
|
||||
"build": "esrun scripts/build.ts",
|
||||
"build-scripts": "esrun scripts/build.ts -- --module=scripts",
|
||||
"build-styles": "esrun scripts/build.ts -- --module=styles",
|
||||
|
||||
@ -45,9 +45,9 @@ for (const mod of modulesRequested) {
|
||||
if (!entryPoints.length) for (const mod of modules) entryPoints.push(makeEntry(mod));
|
||||
|
||||
|
||||
async function runBuild() {
|
||||
async function runBuild(watch: boolean) {
|
||||
const before = performance.now();
|
||||
await esbuild.build({
|
||||
const opts: esbuild.BuildOptions = {
|
||||
entryPoints: entryPoints,
|
||||
bundle: true,
|
||||
splitting: true,
|
||||
@ -68,9 +68,16 @@ async function runBuild() {
|
||||
logLevel: "info",
|
||||
metafile: true,
|
||||
minify: process.argv.includes("--minify")
|
||||
});
|
||||
const after = performance.now();
|
||||
console.log(`Build actually took ${(after - before).toFixed(2)}ms`);
|
||||
};
|
||||
if (watch) {
|
||||
const ctx = esbuild.context(opts);
|
||||
(await ctx).watch();
|
||||
} else {
|
||||
await esbuild.build(opts);
|
||||
const after = performance.now();
|
||||
console.log(`Build actually took ${(after - before).toFixed(2)}ms`);
|
||||
}
|
||||
}
|
||||
|
||||
runBuild().catch(console.error);
|
||||
const watch = process.argv.includes("--watch");
|
||||
runBuild(watch).catch(console.error);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user