castle-web-cli 0.4.40 → 0.4.41
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/dist/init.js +18 -5
- package/kits/basic-2d/pnpm-lock.yaml +1761 -0
- package/kits/basic-3d/pnpm-lock.yaml +1769 -0
- package/package.json +1 -1
package/dist/init.js
CHANGED
|
@@ -223,12 +223,15 @@ function hasPnpm() {
|
|
|
223
223
|
// store is baked in, so this is near-instant (hardlinks from the store, no
|
|
224
224
|
// download). Fall back to npm when pnpm isn't on PATH (e.g. a laptop that never
|
|
225
225
|
// installed it). --prefer-offline uses the store/cache first; --ignore-scripts
|
|
226
|
-
// skips dep build scripts (pnpm 10 gates them and exits non-zero otherwise,
|
|
227
|
-
// the deck's deps are all prebuilt pure JS that don't need them).
|
|
228
|
-
|
|
226
|
+
// skips dep build scripts (pnpm 10+ gates them and exits non-zero otherwise,
|
|
227
|
+
// and the deck's deps are all prebuilt pure JS that don't need them). `frozen`
|
|
228
|
+
// installs straight from the shipped lockfile (skips resolution -> no network,
|
|
229
|
+
// fast + deterministic); used in published mode where the kit lockfile matches.
|
|
230
|
+
function installDeps(projectDir, frozen) {
|
|
229
231
|
if (hasPnpm()) {
|
|
230
232
|
console.log('Installing deps (pnpm)...');
|
|
231
|
-
|
|
233
|
+
const frozenFlag = frozen ? '--frozen-lockfile ' : '';
|
|
234
|
+
execSync(`pnpm install ${frozenFlag}--prefer-offline --ignore-scripts`, {
|
|
232
235
|
cwd: projectDir,
|
|
233
236
|
stdio: 'inherit',
|
|
234
237
|
});
|
|
@@ -259,10 +262,20 @@ export async function init(dir, opts = {}) {
|
|
|
259
262
|
// Always install deps so the deck is ready to serve/edit immediately.
|
|
260
263
|
// `--no-serve` only skips the serve step below (callers like the cloud
|
|
261
264
|
// launcher run their own serve, but still want deps in place).
|
|
265
|
+
//
|
|
266
|
+
// Published kit decks ship a matching pnpm-lock.yaml -> frozen install (no
|
|
267
|
+
// resolution, no network; hardlinks from the template's warm store). Workspace
|
|
268
|
+
// decks rewrite the sdk to file:../../sdk, which the shipped (published)
|
|
269
|
+
// lockfile won't match -> drop it and let pnpm resolve. Bare decks have no
|
|
270
|
+
// lockfile -> non-frozen.
|
|
271
|
+
const lockPath = path.join(projectDir, 'pnpm-lock.yaml');
|
|
272
|
+
if (resolveScaffoldRefs().workspaceMode)
|
|
273
|
+
fs.rmSync(lockPath, { force: true });
|
|
274
|
+
const frozen = fs.existsSync(lockPath);
|
|
262
275
|
console.log('');
|
|
263
276
|
let installed = false;
|
|
264
277
|
try {
|
|
265
|
-
installDeps(projectDir);
|
|
278
|
+
installDeps(projectDir, frozen);
|
|
266
279
|
installed = true;
|
|
267
280
|
}
|
|
268
281
|
catch {
|