mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 04:29:01 +01:00
feat(share): add dev mode
This commit is contained in:
parent
6c43db692e
commit
bc86fb95b5
@ -5,6 +5,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"dev": "esrun scripts/build.ts -- --watch",
|
||||||
"build": "esrun scripts/build.ts",
|
"build": "esrun scripts/build.ts",
|
||||||
"build-scripts": "esrun scripts/build.ts -- --module=scripts",
|
"build-scripts": "esrun scripts/build.ts -- --module=scripts",
|
||||||
"build-styles": "esrun scripts/build.ts -- --module=styles",
|
"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));
|
if (!entryPoints.length) for (const mod of modules) entryPoints.push(makeEntry(mod));
|
||||||
|
|
||||||
|
|
||||||
async function runBuild() {
|
async function runBuild(watch: boolean) {
|
||||||
const before = performance.now();
|
const before = performance.now();
|
||||||
await esbuild.build({
|
const opts: esbuild.BuildOptions = {
|
||||||
entryPoints: entryPoints,
|
entryPoints: entryPoints,
|
||||||
bundle: true,
|
bundle: true,
|
||||||
splitting: true,
|
splitting: true,
|
||||||
@ -68,9 +68,16 @@ async function runBuild() {
|
|||||||
logLevel: "info",
|
logLevel: "info",
|
||||||
metafile: true,
|
metafile: true,
|
||||||
minify: process.argv.includes("--minify")
|
minify: process.argv.includes("--minify")
|
||||||
});
|
};
|
||||||
const after = performance.now();
|
if (watch) {
|
||||||
console.log(`Build actually took ${(after - before).toFixed(2)}ms`);
|
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