create-stacki 0.1.94 → 0.1.96

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/cli.mjs CHANGED
@@ -285,6 +285,22 @@ function parseRelease(input) {
285
285
  return { format: 1, version, files };
286
286
  }
287
287
 
288
+ // studio/vendor/stacki/shared/core/assert.ts
289
+ function assert(condition, message) {
290
+ if (!condition) {
291
+ throw new Error(`Assertion failed: ${message}`);
292
+ }
293
+ }
294
+
295
+ // studio/vendor/stacki/shared/properties/studioLocal.ts
296
+ var STUDIO_LOCAL_DIRECTORY = ".stacki/studio";
297
+ var STUDIO_STATE_DIRECTORY = ".stacki/studio/state";
298
+ var STUDIO_UPDATES_DIRECTORY = ".stacki/studio/updates";
299
+ var STUDIO_LEGACY_DIRECTORIES = {
300
+ [STUDIO_STATE_DIRECTORY]: ".studio-state",
301
+ [STUDIO_UPDATES_DIRECTORY]: ".stacki-studio"
302
+ };
303
+
288
304
  // studio/vendor/stacki/electron/project/studioInstall.ts
289
305
  async function writeRelease(directory, release) {
290
306
  for (const file of release.files) {
@@ -330,8 +346,7 @@ async function installReleaseWithMode(target, release, options, validate) {
330
346
  if (path.basename(directory) !== "studio") {
331
347
  throw new Error("Updates target a project\u2019s studio directory");
332
348
  }
333
- const metadata = path.join(path.dirname(directory), ".stacki-studio");
334
- await mkdir(metadata, { recursive: true });
349
+ const metadata = await updateStorage(path.dirname(directory));
335
350
  if ((await lstat(metadata)).isSymbolicLink()) {
336
351
  throw new Error("Update storage must not be a symlink");
337
352
  }
@@ -390,6 +405,24 @@ async function activate(directory, staging, backup) {
390
405
  throw error;
391
406
  }
392
407
  }
408
+ async function updateStorage(site) {
409
+ const local = path.join(site, STUDIO_LOCAL_DIRECTORY);
410
+ const metadata = path.join(site, STUDIO_UPDATES_DIRECTORY);
411
+ const legacyName = STUDIO_LEGACY_DIRECTORIES[STUDIO_UPDATES_DIRECTORY];
412
+ if (legacyName === void 0 || legacyName === "") {
413
+ throw new Error("The older update folder must be named");
414
+ }
415
+ const legacy = path.join(site, legacyName);
416
+ await mkdir(local, { recursive: true });
417
+ await writeFile(path.join(local, ".gitignore"), "*\n");
418
+ const moved = await lstat(metadata).catch(() => void 0);
419
+ const older = await lstat(legacy).catch(() => void 0);
420
+ if (!moved && older?.isDirectory()) {
421
+ await rename(legacy, metadata);
422
+ }
423
+ await mkdir(metadata, { recursive: true });
424
+ return metadata;
425
+ }
393
426
 
394
427
  // studio/scripts/createStacki/options.ts
395
428
  function parseOptions(args) {
@@ -458,13 +491,6 @@ var COMPONENT_SOURCE_LIMITS = {
458
491
  configBytesMax: 16384
459
492
  };
460
493
 
461
- // studio/vendor/stacki/shared/core/assert.ts
462
- function assert(condition, message) {
463
- if (!condition) {
464
- throw new Error(`Assertion failed: ${message}`);
465
- }
466
- }
467
-
468
494
  // studio/vendor/stacki/shared/properties/componentDefaults.ts
469
495
  var DEFAULT_LIMITS = {
470
496
  componentsMax: 512,