@gjsify/cli 0.3.18 → 0.3.19
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.
- package/lib/commands/showcase.js +27 -5
- package/package.json +10 -10
- package/src/commands/showcase.ts +27 -5
package/lib/commands/showcase.js
CHANGED
|
@@ -2,6 +2,17 @@ import { discoverShowcases, findShowcase } from '../utils/discover-showcases.js'
|
|
|
2
2
|
import { runMinimalChecks, detectPackageManager, buildInstallCommand, } from '../utils/check-system-deps.js';
|
|
3
3
|
import { spawn } from 'node:child_process';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
function readCliVersion() {
|
|
7
|
+
try {
|
|
8
|
+
const pkgUrl = new URL('../../package.json', import.meta.url);
|
|
9
|
+
const pkg = JSON.parse(readFileSync(pkgUrl, 'utf8'));
|
|
10
|
+
return typeof pkg.version === 'string' ? pkg.version : undefined;
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
5
16
|
export const showcaseCommand = {
|
|
6
17
|
command: 'showcase [name]',
|
|
7
18
|
description: 'List or run curated gjsify showcase applications.',
|
|
@@ -79,12 +90,23 @@ export const showcaseCommand = {
|
|
|
79
90
|
}
|
|
80
91
|
process.exit(1);
|
|
81
92
|
}
|
|
82
|
-
// Delegate to `gjsify dlx <package>` — same npm-cache,
|
|
83
|
-
// symlink-swap, same `gjsify.main` resolution. Re-spawning
|
|
84
|
-
// keeps the dlx logic in one place.
|
|
85
|
-
|
|
93
|
+
// Delegate to `gjsify dlx <package>@<cli-version>` — same npm-cache,
|
|
94
|
+
// same atomic symlink-swap, same `gjsify.main` resolution. Re-spawning
|
|
95
|
+
// the CLI keeps the dlx logic in one place.
|
|
96
|
+
//
|
|
97
|
+
// Pinning to the CLI's own version is load-bearing: showcases ship in
|
|
98
|
+
// lockstep with the CLI, so users running `npx @gjsify/cli@X showcase
|
|
99
|
+
// <name>` expect the matching `@gjsify/example-*@X`. Without the pin,
|
|
100
|
+
// dlx caches the first resolved-latest on disk; subsequent CLI
|
|
101
|
+
// releases leave that cache untouched until the 7-day TTL expires,
|
|
102
|
+
// and the user gets a stale showcase that may be missing deps the
|
|
103
|
+
// newer CLI assumes (the `@gjsify/http-soup-bridge` regression
|
|
104
|
+
// reported against `@gjsify/cli@0.3.17`).
|
|
105
|
+
const cliVersion = readCliVersion();
|
|
106
|
+
const dlxSpec = cliVersion ? `${showcase.packageName}@${cliVersion}` : showcase.packageName;
|
|
107
|
+
console.log(`Running showcase: ${showcase.name} (via gjsify dlx ${dlxSpec})\n`);
|
|
86
108
|
const cliBin = fileURLToPath(new URL('../index.js', import.meta.url));
|
|
87
|
-
const child = spawn(process.execPath, [cliBin, 'dlx',
|
|
109
|
+
const child = spawn(process.execPath, [cliBin, 'dlx', dlxSpec], {
|
|
88
110
|
stdio: 'inherit',
|
|
89
111
|
});
|
|
90
112
|
await new Promise((resolvePromise, reject) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjsify/cli",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.19",
|
|
4
4
|
"description": "CLI for Gjsify",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -23,15 +23,15 @@
|
|
|
23
23
|
"cli"
|
|
24
24
|
],
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@gjsify/create-app": "^0.3.
|
|
27
|
-
"@gjsify/node-polyfills": "^0.3.
|
|
28
|
-
"@gjsify/npm-registry": "^0.3.
|
|
29
|
-
"@gjsify/resolve-npm": "^0.3.
|
|
30
|
-
"@gjsify/rolldown-plugin-gjsify": "^0.3.
|
|
31
|
-
"@gjsify/rolldown-plugin-pnp": "^0.3.
|
|
32
|
-
"@gjsify/semver": "^0.3.
|
|
33
|
-
"@gjsify/tar": "^0.3.
|
|
34
|
-
"@gjsify/web-polyfills": "^0.3.
|
|
26
|
+
"@gjsify/create-app": "^0.3.19",
|
|
27
|
+
"@gjsify/node-polyfills": "^0.3.19",
|
|
28
|
+
"@gjsify/npm-registry": "^0.3.19",
|
|
29
|
+
"@gjsify/resolve-npm": "^0.3.19",
|
|
30
|
+
"@gjsify/rolldown-plugin-gjsify": "^0.3.19",
|
|
31
|
+
"@gjsify/rolldown-plugin-pnp": "^0.3.19",
|
|
32
|
+
"@gjsify/semver": "^0.3.19",
|
|
33
|
+
"@gjsify/tar": "^0.3.19",
|
|
34
|
+
"@gjsify/web-polyfills": "^0.3.19",
|
|
35
35
|
"cosmiconfig": "^9.0.1",
|
|
36
36
|
"get-tsconfig": "^4.14.0",
|
|
37
37
|
"pkg-types": "^2.3.1",
|
package/src/commands/showcase.ts
CHANGED
|
@@ -7,6 +7,17 @@ import {
|
|
|
7
7
|
} from '../utils/check-system-deps.js';
|
|
8
8
|
import { spawn } from 'node:child_process';
|
|
9
9
|
import { fileURLToPath } from 'node:url';
|
|
10
|
+
import { readFileSync } from 'node:fs';
|
|
11
|
+
|
|
12
|
+
function readCliVersion(): string | undefined {
|
|
13
|
+
try {
|
|
14
|
+
const pkgUrl = new URL('../../package.json', import.meta.url);
|
|
15
|
+
const pkg = JSON.parse(readFileSync(pkgUrl, 'utf8')) as { version?: unknown };
|
|
16
|
+
return typeof pkg.version === 'string' ? pkg.version : undefined;
|
|
17
|
+
} catch {
|
|
18
|
+
return undefined;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
10
21
|
|
|
11
22
|
interface ShowcaseOptions {
|
|
12
23
|
name?: string;
|
|
@@ -102,12 +113,23 @@ export const showcaseCommand: Command<any, ShowcaseOptions> = {
|
|
|
102
113
|
process.exit(1);
|
|
103
114
|
}
|
|
104
115
|
|
|
105
|
-
// Delegate to `gjsify dlx <package>` — same npm-cache,
|
|
106
|
-
// symlink-swap, same `gjsify.main` resolution. Re-spawning
|
|
107
|
-
// keeps the dlx logic in one place.
|
|
108
|
-
|
|
116
|
+
// Delegate to `gjsify dlx <package>@<cli-version>` — same npm-cache,
|
|
117
|
+
// same atomic symlink-swap, same `gjsify.main` resolution. Re-spawning
|
|
118
|
+
// the CLI keeps the dlx logic in one place.
|
|
119
|
+
//
|
|
120
|
+
// Pinning to the CLI's own version is load-bearing: showcases ship in
|
|
121
|
+
// lockstep with the CLI, so users running `npx @gjsify/cli@X showcase
|
|
122
|
+
// <name>` expect the matching `@gjsify/example-*@X`. Without the pin,
|
|
123
|
+
// dlx caches the first resolved-latest on disk; subsequent CLI
|
|
124
|
+
// releases leave that cache untouched until the 7-day TTL expires,
|
|
125
|
+
// and the user gets a stale showcase that may be missing deps the
|
|
126
|
+
// newer CLI assumes (the `@gjsify/http-soup-bridge` regression
|
|
127
|
+
// reported against `@gjsify/cli@0.3.17`).
|
|
128
|
+
const cliVersion = readCliVersion();
|
|
129
|
+
const dlxSpec = cliVersion ? `${showcase.packageName}@${cliVersion}` : showcase.packageName;
|
|
130
|
+
console.log(`Running showcase: ${showcase.name} (via gjsify dlx ${dlxSpec})\n`);
|
|
109
131
|
const cliBin = fileURLToPath(new URL('../index.js', import.meta.url));
|
|
110
|
-
const child = spawn(process.execPath, [cliBin, 'dlx',
|
|
132
|
+
const child = spawn(process.execPath, [cliBin, 'dlx', dlxSpec], {
|
|
111
133
|
stdio: 'inherit',
|
|
112
134
|
});
|
|
113
135
|
await new Promise<void>((resolvePromise, reject) => {
|