barely-a-dev-server
Advanced tools
Comparing version 0.2.2 to 0.2.3
{ | ||
"name": "barely-a-dev-server", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -22,3 +22,5 @@ import * as esbuild from "esbuild"; | ||
console.log(`Starting esbuild with ${entryPoints.length} entry point(s).`); | ||
console.log( | ||
`[barely-a-dev-server] Starting esbuild with ${entryPoints.length} entry point(s).` | ||
); | ||
return (currentBuildResult = esbuild.build({ | ||
@@ -25,0 +27,0 @@ target: "es2020", |
@@ -1,2 +0,2 @@ | ||
import { copyFileSync, mkdirSync } from "fs"; | ||
import { copyFileSync, mkdirSync, rmdirSync, rmSync } from "fs"; | ||
import { dirname, join } from "path"; | ||
@@ -52,2 +52,20 @@ import { restartEsbuild } from "./esbuild.js"; | ||
// TODO: Is there a succinct way to clear the `outDir` contents without | ||
// removing the `dir` itself (e.g. in case someone has the folder open in | ||
// Finder)? | ||
rmSync(outDir, { recursive: true, force: true }); // Clear stale output files. | ||
if (!dev) { | ||
// `esbuild` output files will take precedence over static files, so we copy | ||
// them first and let `esbuild` override if needed. | ||
console.log("\n[barely-a-dev-server] Copying static files...\n"); | ||
for (const relativePath of await listFiles(entryRoot, () => true)) { | ||
console.log(" " + relativePath); | ||
mkdirSync(dirname(join(outDir, relativePath)), { recursive: true }); | ||
copyFileSync(join(entryRoot, relativePath), join(outDir, relativePath)); | ||
} | ||
console.log(""); | ||
// TODO: Switch to this once `node` 16 is the default in Codespaces: | ||
// await fsPromises.cp(entryRoot, outDir, { recursive: true }); | ||
} | ||
await restartEsbuild(entryRoot, outDir, dev, esbuildOptions); | ||
@@ -60,10 +78,3 @@ if (dev) { | ||
}).start(); | ||
} else { | ||
for (const relativePath of await listFiles(entryRoot, () => true)) { | ||
mkdirSync(dirname(join(outDir, relativePath)), { recursive: true }); | ||
copyFileSync(join(entryRoot, relativePath), join(outDir, relativePath)); | ||
} | ||
// TODO: Switch to this once `node` 16 is the default in Codespaces: | ||
// await fsPromises.cp(entryRoot, outDir, { recursive: true }); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11963
209