@greatstore/cli 0.0.11-beta.0 → 0.0.11-beta.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +17 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -989,6 +989,18 @@ function initCommand(args) {
989
989
  const outRel = flagString(args.flags, "out") ?? ".";
990
990
  const root = path6.resolve(outRel);
991
991
  const rootExisted = hasRootScaffold(root);
992
+ if (rootExisted) {
993
+ if (storeFlag !== void 0) {
994
+ throw new Error(
995
+ `Project at ${root} is already pinned to a store via .gsrc. Drop --store; a project folder ships to exactly one store.`
996
+ );
997
+ }
998
+ } else if (storeFlag === void 0) {
999
+ const example = name ? `gs init ${name} --store <slug>` : `gs init --store <slug>`;
1000
+ throw new Error(
1001
+ `--store <slug> is required when scaffolding a new project root. Run \`${example}\`.`
1002
+ );
1003
+ }
992
1004
  ensureRoot(root, rootExisted, force, { store: storeFlag });
993
1005
  if (!name) {
994
1006
  const created = rootExisted ? "Updated" : "Scaffolded";
@@ -1062,6 +1074,9 @@ function ensureComponent(componentDir, name, force) {
1062
1074
  }
1063
1075
  }
1064
1076
  function rootFiles(opts) {
1077
+ if (!opts.store) {
1078
+ throw new Error("internal: rootFiles called without a store slug");
1079
+ }
1065
1080
  return [
1066
1081
  ["package.json", rootPackageJson()],
1067
1082
  ["build.mjs", buildScript()],
@@ -1244,7 +1259,7 @@ function rootPackageJson() {
1244
1259
  ) + "\n";
1245
1260
  }
1246
1261
  function gsrc(store) {
1247
- return JSON.stringify({ store: store ?? "<your-store-slug>" }, null, 2) + "\n";
1262
+ return JSON.stringify({ store }, null, 2) + "\n";
1248
1263
  }
1249
1264
  function gitignore() {
1250
1265
  return [
@@ -1282,7 +1297,7 @@ function pascal(name) {
1282
1297
  }
1283
1298
 
1284
1299
  // src/index.ts
1285
- var VERSION = true ? "0.0.11-beta.0" : "0.0.0-dev";
1300
+ var VERSION = true ? "0.0.11-beta.1" : "0.0.0-dev";
1286
1301
  var HELP = `gs \u2014 GreatStore CLI (v${VERSION})
1287
1302
 
1288
1303
  Usage:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatstore/cli",
3
- "version": "0.0.11-beta.0",
3
+ "version": "0.0.11-beta.1",
4
4
  "description": "CLI for authoring and shipping GreatStore custom components.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",