single-file-cli 2.6.1 → 2.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,3 +28,27 @@ jobs:
28
28
  -
29
29
  name: Run tests
30
30
  run: npm test
31
+
32
+ # lib/ holds generated code that is committed, so nothing at runtime notices when it falls behind
33
+ # the core release it was built from — a stale bundle just silently runs old code, and a dev build
34
+ # (build-dev.sh, unminified, built from a local core checkout) silently replaces the released one.
35
+ # build.sh is reproducible: it pins both the core package and esbuild, so rebuilding here and
36
+ # diffing catches either case before it ships.
37
+ build-output:
38
+ runs-on: ubuntu-latest
39
+ timeout-minutes: 15
40
+ steps:
41
+ -
42
+ name: Checkout sources
43
+ uses: actions/checkout@v7
44
+ -
45
+ name: Set up Deno
46
+ uses: denoland/setup-deno@v2
47
+ with:
48
+ deno-version: v2.x
49
+ -
50
+ name: Rebuild the released artifacts
51
+ run: bash build.sh
52
+ -
53
+ name: Check lib/ matches the pinned core release
54
+ run: git diff --exit-code --stat -- lib/
package/build-dev.sh CHANGED
@@ -16,7 +16,7 @@ await build({
16
16
  ],
17
17
  bundle: true,
18
18
  globalName: 'singlefile',
19
- outdir: 'lib/',
19
+ outdir: 'lib-dev/',
20
20
  platform: 'browser',
21
21
  sourcemap: false,
22
22
  minify: false,
@@ -30,7 +30,7 @@ await build({
30
30
  ],
31
31
  bundle: true,
32
32
  globalName: 'singlefileBootstrap',
33
- outdir: 'lib/',
33
+ outdir: 'lib-dev/',
34
34
  platform: 'browser',
35
35
  sourcemap: false,
36
36
  minify: false,
@@ -43,7 +43,7 @@ await build({
43
43
  '../single-file-core/single-file-hooks-frames.js'
44
44
  ],
45
45
  bundle: true,
46
- outdir: 'lib/',
46
+ outdir: 'lib-dev/',
47
47
  platform: 'browser',
48
48
  sourcemap: false,
49
49
  minify: false,
@@ -57,7 +57,7 @@ await build({
57
57
  ],
58
58
  bundle: true,
59
59
  globalName: 'zip',
60
- outdir: 'lib/',
60
+ outdir: 'lib-dev/',
61
61
  platform: 'browser',
62
62
  sourcemap: false,
63
63
  minify: false,
@@ -70,7 +70,7 @@ await build({
70
70
  '../single-file-core/single-file-archive.js'
71
71
  ],
72
72
  bundle: true,
73
- outfile: 'lib/single-file-archive.js',
73
+ outfile: 'lib-dev/single-file-archive.js',
74
74
  platform: 'neutral',
75
75
  sourcemap: false,
76
76
  minify: false,
@@ -79,23 +79,44 @@ await build({
79
79
  });
80
80
 
81
81
  const SCRIPTS = [
82
- 'lib/single-file.js',
83
- 'lib/single-file-bootstrap.js',
84
- 'lib/zip.min.js'
82
+ 'lib-dev/single-file.js',
83
+ 'lib-dev/single-file-bootstrap.js',
84
+ 'lib-dev/zip.min.js'
85
85
  ];
86
86
 
87
87
  let script = '';
88
88
  const scripts = SCRIPTS.map(script => Deno.readTextFile(script));
89
89
  const sources = await Promise.all(scripts);
90
90
  script += 'const script = ' + JSON.stringify(sources.join(';')) + ';';
91
- const hookScript = await Deno.readTextFile('lib/single-file-hooks-frames.js');
91
+ const hookScript = await Deno.readTextFile('lib-dev/single-file-hooks-frames.js');
92
92
  script += 'const hookScript = ' + JSON.stringify(hookScript) + ';';
93
- const zipScript = await Deno.readTextFile('lib/zip.min.js');
93
+ const zipScript = await Deno.readTextFile('lib-dev/zip.min.js');
94
94
  script += 'const zipScript = ' + JSON.stringify(zipScript) + ';';
95
95
  script += 'export { script, zipScript, hookScript };';
96
- await Deno.writeTextFile('lib/single-file-bundle.js', script)
96
+ await Deno.writeTextFile('lib-dev/single-file-bundle.js', script)
97
97
  await Promise.all(SCRIPTS.map(script => Deno.remove(script)));
98
- await Deno.remove('lib/single-file-hooks-frames.js');
98
+ await Deno.remove('lib-dev/single-file-hooks-frames.js');
99
99
  const version = JSON.parse(await Deno.readTextFile('./deno.json')).version;
100
- await Deno.writeTextFile('lib/version.js', 'export const version = ' + JSON.stringify(version) + ';');
101
- " | deno run --allow-read --allow-write --allow-net --allow-run --allow-env --lock="$build_dir/build.lock" -
100
+ await Deno.writeTextFile('lib-dev/version.js', 'export const version = ' + JSON.stringify(version) + ';');
101
+ " | deno run --allow-read --allow-write --allow-net --allow-run --allow-env --lock="$build_dir/build.lock" -
102
+
103
+ # Stage a runnable tree in .dev/, with the freshly built artifacts overlaid on the hand-written
104
+ # files from lib/. Generated code never lands in the tracked lib/ directory, so a dev build cannot
105
+ # leave an unminified bundle where the release one belongs, and using the dev build is something you
106
+ # opt into by invoking .dev/single-file rather than something you get by forgetting to rebuild.
107
+ rm -rf .dev
108
+ mkdir -p .dev
109
+ cp ./single-file ./single-file-node.js ./single-file-launcher.js ./single-file-cli-api.js ./options.js ./deno.json ./package.json .dev/
110
+ cp -R ./resources .dev/resources
111
+ cp -R ./lib .dev/lib
112
+ cp lib-dev/* .dev/lib/
113
+
114
+ core_revision=$(git -C ../single-file-core rev-parse --short HEAD 2>/dev/null || echo "unknown")
115
+ if [ -n "$(git -C ../single-file-core status --porcelain 2>/dev/null | head -1)" ]; then
116
+ core_revision="$core_revision+uncommitted"
117
+ fi
118
+
119
+ echo
120
+ echo "Dev build ready: single-file-core $core_revision"
121
+ echo " run it with: node .dev/single-file <url> <output>"
122
+ echo " tracked lib/ is untouched; .dev/ and lib-dev/ are git-ignored"
package/build.sh CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  set -e
4
4
 
5
- CORE_PACKAGE="npm:single-file-core@1.5.115"
5
+ CORE_PACKAGE="npm:single-file-core@1.5.116"
6
6
  ESBUILD_PACKAGE="npm:esbuild@0.27.7"
7
7
 
8
8
  project_dir=$(pwd)
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@single-file/single-file-cli",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "SingleFile CLI",
5
5
  "exports": {
6
6
  ".": "./single-file-cli-api.js"
package/eslint.config.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import js from "@eslint/js";
2
2
 
3
3
  export default [
4
- { ignores: ["lib/single-file-archive.js"] },
4
+ { ignores: ["lib/single-file-archive.js", "lib-dev/**", ".dev/**"] },
5
5
  js.configs.recommended,
6
6
  {
7
7
  languageOptions: {