@construct-space/cli 1.6.6 → 1.7.0

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/index.js +43 -35
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -2845,7 +2845,7 @@ function spaceDir(spaceId) {
2845
2845
  var init_appdir = () => {};
2846
2846
 
2847
2847
  // src/lib/auth.ts
2848
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, unlinkSync, existsSync as existsSync10, readdirSync as readdirSync5, statSync as statSync5 } from "fs";
2848
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, mkdirSync as mkdirSync4, unlinkSync, existsSync as existsSync10, readdirSync as readdirSync5, statSync as statSync4 } from "fs";
2849
2849
  import { join as join12, dirname as dirname4 } from "path";
2850
2850
  function listDesktopProfiles() {
2851
2851
  const dir = profilesDir();
@@ -2855,7 +2855,7 @@ function listDesktopProfiles() {
2855
2855
  for (const entry of readdirSync5(dir)) {
2856
2856
  const full = join12(dir, entry);
2857
2857
  try {
2858
- if (!statSync5(full).isDirectory())
2858
+ if (!statSync4(full).isDirectory())
2859
2859
  continue;
2860
2860
  const authPath = join12(full, "auth.json");
2861
2861
  if (!existsSync10(authPath))
@@ -5169,10 +5169,9 @@ var dist_default6 = createPrompt((config, done) => {
5169
5169
  return `${lines}${cursorHide}`;
5170
5170
  });
5171
5171
  // src/lib/utils.ts
5172
- import { execSync } from "child_process";
5172
+ import { execFileSync } from "child_process";
5173
5173
  function git(dir, ...args) {
5174
- const quoted = args.map((a) => a.includes(" ") || a.includes(":") ? `"${a}"` : a);
5175
- return execSync(`git ${quoted.join(" ")}`, { cwd: dir, encoding: "utf-8" }).trim();
5174
+ return execFileSync("git", args, { cwd: dir, encoding: "utf-8" }).trim();
5176
5175
  }
5177
5176
  function gitSafe(dir, ...args) {
5178
5177
  try {
@@ -5205,12 +5204,12 @@ function toDisplayName(name) {
5205
5204
  }
5206
5205
 
5207
5206
  // src/lib/runtime.ts
5208
- import { execSync as execSync2, spawn } from "child_process";
5207
+ import { execSync, spawn } from "child_process";
5209
5208
  import { existsSync } from "fs";
5210
5209
  import { join } from "path";
5211
5210
  function detect() {
5212
5211
  try {
5213
- const version = execSync2("bun --version", { encoding: "utf-8" }).trim().replace(/^v/, "");
5212
+ const version = execSync("bun --version", { encoding: "utf-8" }).trim().replace(/^v/, "");
5214
5213
  return { name: "bun", version, exec: "bun" };
5215
5214
  } catch {
5216
5215
  throw new Error("Bun is required. Install it: https://bun.sh");
@@ -5220,7 +5219,7 @@ function ensureDeps(root, _rt) {
5220
5219
  const nmDir = join(root, "node_modules");
5221
5220
  if (existsSync(nmDir))
5222
5221
  return;
5223
- execSync2("bun install", { cwd: root, stdio: "inherit" });
5222
+ execSync("bun install", { cwd: root, stdio: "inherit" });
5224
5223
  }
5225
5224
  function buildCmd(root, _rt) {
5226
5225
  const child = spawn("bun", ["run", "vite", "build"], { cwd: root, stdio: "inherit" });
@@ -5240,7 +5239,7 @@ function runHook(hooks, hookName, root) {
5240
5239
  const cmd = hooks?.[hookName];
5241
5240
  if (!cmd)
5242
5241
  return;
5243
- execSync2(cmd, { cwd: root, stdio: "inherit" });
5242
+ execSync(cmd, { cwd: root, stdio: "inherit" });
5244
5243
  }
5245
5244
 
5246
5245
  // src/commands/scaffold.ts
@@ -8264,7 +8263,7 @@ function copyAssetDirs(root, distDir) {
8264
8263
  const src = join6(root, name);
8265
8264
  if (!existsSync6(src) || !statSync3(src).isDirectory())
8266
8265
  continue;
8267
- cpSync(src, join6(distDir, name), { recursive: true });
8266
+ cpSync(src, join6(distDir, name), { recursive: true, verbatimSymlinks: true });
8268
8267
  copied.push(name);
8269
8268
  }
8270
8269
  return copied;
@@ -10158,7 +10157,7 @@ async function dev() {
10158
10157
 
10159
10158
  // src/commands/run.ts
10160
10159
  init_source();
10161
- import { existsSync as existsSync9, cpSync as cpSync2, mkdirSync as mkdirSync3, readdirSync as readdirSync4, chmodSync, statSync as statSync4 } from "fs";
10160
+ import { existsSync as existsSync9, cpSync as cpSync2, mkdirSync as mkdirSync3, readdirSync as readdirSync4, chmodSync, lstatSync } from "fs";
10162
10161
  import { join as join11 } from "path";
10163
10162
  init_appdir();
10164
10163
  function ensureBinExecutable(installDir) {
@@ -10170,7 +10169,9 @@ function ensureBinExecutable(installDir) {
10170
10169
  const walk = (dir) => {
10171
10170
  for (const name of readdirSync4(dir)) {
10172
10171
  const path = join11(dir, name);
10173
- const st = statSync4(path);
10172
+ const st = lstatSync(path);
10173
+ if (st.isSymbolicLink())
10174
+ continue;
10174
10175
  if (st.isDirectory()) {
10175
10176
  walk(path);
10176
10177
  } else if (st.isFile()) {
@@ -10198,7 +10199,7 @@ function install() {
10198
10199
  }
10199
10200
  const installDir = spaceDir(m.id);
10200
10201
  mkdirSync3(installDir, { recursive: true });
10201
- cpSync2(distDir, installDir, { recursive: true });
10202
+ cpSync2(distDir, installDir, { recursive: true, verbatimSymlinks: true });
10202
10203
  ensureBinExecutable(installDir);
10203
10204
  console.log(source_default.green(`Installed ${m.name} \u2192 ${installDir}`));
10204
10205
  console.log(source_default.dim(" Restart Construct to load the updated space."));
@@ -10206,15 +10207,15 @@ function install() {
10206
10207
 
10207
10208
  // src/commands/publish.ts
10208
10209
  init_source();
10209
- import { readFileSync as readFileSync8, writeFileSync as writeFileSync6, statSync as statSync7, unlinkSync as unlinkSync2 } from "fs";
10210
+ import { readFileSync as readFileSync8, writeFileSync as writeFileSync6, statSync as statSync6, unlinkSync as unlinkSync2 } from "fs";
10210
10211
  import { join as join14, basename as basename6 } from "path";
10211
10212
  init_auth();
10212
10213
 
10213
10214
  // src/lib/pack.ts
10214
- import { readdirSync as readdirSync6, statSync as statSync6, existsSync as existsSync11 } from "fs";
10215
+ import { readdirSync as readdirSync6, statSync as statSync5, existsSync as existsSync11 } from "fs";
10215
10216
  import { join as join13 } from "path";
10216
10217
  import { tmpdir } from "os";
10217
- import { execSync as execSync3 } from "child_process";
10218
+ import { execFileSync as execFileSync2 } from "child_process";
10218
10219
  var allowedDirs = [
10219
10220
  "pages",
10220
10221
  "components",
@@ -10254,7 +10255,7 @@ async function packSource(root) {
10254
10255
  entries.push(name);
10255
10256
  }
10256
10257
  for (const entry of readdirSync6(root)) {
10257
- if (statSync6(join13(root, entry)).isDirectory())
10258
+ if (statSync5(join13(root, entry)).isDirectory())
10258
10259
  continue;
10259
10260
  if (allowedRootFiles.includes(entry))
10260
10261
  continue;
@@ -10271,10 +10272,17 @@ async function packSource(root) {
10271
10272
  if (validEntries.length === 0) {
10272
10273
  throw new Error("No files to pack");
10273
10274
  }
10274
- const excludes = "--exclude=node_modules --exclude=dist --exclude=.git --exclude=*.env --exclude=*.log --exclude=*.lock --exclude=*.lockb";
10275
- const cmd = `tar czf "${tarballPath}" ${excludes} ${validEntries.join(" ")}`;
10276
- execSync3(cmd, { cwd: root });
10277
- const size = statSync6(tarballPath).size;
10275
+ const excludes = [
10276
+ "--exclude=node_modules",
10277
+ "--exclude=dist",
10278
+ "--exclude=.git",
10279
+ "--exclude=*.env",
10280
+ "--exclude=*.log",
10281
+ "--exclude=*.lock",
10282
+ "--exclude=*.lockb"
10283
+ ];
10284
+ execFileSync2("tar", ["czf", tarballPath, ...excludes, ...validEntries], { cwd: root });
10285
+ const size = statSync5(tarballPath).size;
10278
10286
  if (size > MAX_SIZE) {
10279
10287
  throw new Error(`Source exceeds maximum size of ${MAX_SIZE / 1024 / 1024}MB`);
10280
10288
  }
@@ -10447,7 +10455,7 @@ async function publish(options) {
10447
10455
  let tarballPath;
10448
10456
  try {
10449
10457
  tarballPath = await packSource(root);
10450
- const size = statSync7(tarballPath).size;
10458
+ const size = statSync6(tarballPath).size;
10451
10459
  spinner.succeed(`Source packed (${formatBytes(size)})`);
10452
10460
  } catch (err) {
10453
10461
  spinner.fail("Pack failed");
@@ -10552,7 +10560,7 @@ function validate3() {
10552
10560
 
10553
10561
  // src/commands/check.ts
10554
10562
  init_source();
10555
- import { execSync as execSync4 } from "child_process";
10563
+ import { execSync as execSync2 } from "child_process";
10556
10564
  import { existsSync as existsSync13, readFileSync as readFileSync10 } from "fs";
10557
10565
  import { join as join16 } from "path";
10558
10566
  function check() {
@@ -10596,7 +10604,7 @@ function check() {
10596
10604
  const exec2 = rt.name === "bun" ? "bun" : "npx";
10597
10605
  console.log(source_default.blue("Running type check..."));
10598
10606
  try {
10599
- execSync4(`${exec2} vue-tsc --noEmit`, { cwd: root, stdio: "inherit" });
10607
+ execSync2(`${exec2} vue-tsc --noEmit`, { cwd: root, stdio: "inherit" });
10600
10608
  console.log(source_default.green("\u2713 Type check passed"));
10601
10609
  } catch {
10602
10610
  console.error(source_default.red("\u2717 Type check failed"));
@@ -10604,7 +10612,7 @@ function check() {
10604
10612
  }
10605
10613
  console.log(source_default.blue("Running linter..."));
10606
10614
  try {
10607
- execSync4(`${exec2} eslint .`, { cwd: root, stdio: "inherit" });
10615
+ execSync2(`${exec2} eslint .`, { cwd: root, stdio: "inherit" });
10608
10616
  console.log(source_default.green("\u2713 Lint passed"));
10609
10617
  } catch {
10610
10618
  console.error(source_default.red("\u2717 Lint failed"));
@@ -10739,13 +10747,13 @@ function logout() {
10739
10747
 
10740
10748
  // src/commands/update.ts
10741
10749
  init_source();
10742
- import { execSync as execSync5 } from "child_process";
10750
+ import { execSync as execSync3 } from "child_process";
10743
10751
  var PKG_NAME = "@construct-space/cli";
10744
10752
  function update() {
10745
10753
  console.log(source_default.blue(`Current version: ${VERSION}`));
10746
10754
  let latest = VERSION;
10747
10755
  try {
10748
- latest = execSync5(`npm view ${PKG_NAME} version`, { encoding: "utf-8" }).trim();
10756
+ latest = execSync3(`npm view ${PKG_NAME} version`, { encoding: "utf-8" }).trim();
10749
10757
  } catch {}
10750
10758
  if (latest === VERSION) {
10751
10759
  console.log(source_default.green("Already on the latest version."));
@@ -10756,18 +10764,18 @@ function update() {
10756
10764
  try {
10757
10765
  if (rt.name === "bun") {
10758
10766
  try {
10759
- execSync5("bun pm cache rm", { stdio: "inherit" });
10767
+ execSync3("bun pm cache rm", { stdio: "inherit" });
10760
10768
  } catch {}
10761
- execSync5(`bun install -g ${PKG_NAME}@${latest}`, { stdio: "inherit" });
10769
+ execSync3(`bun install -g ${PKG_NAME}@${latest}`, { stdio: "inherit" });
10762
10770
  } else {
10763
- execSync5(`npm install -g --prefer-online ${PKG_NAME}@${latest}`, { stdio: "inherit" });
10771
+ execSync3(`npm install -g --prefer-online ${PKG_NAME}@${latest}`, { stdio: "inherit" });
10764
10772
  }
10765
10773
  } catch (err) {
10766
10774
  console.error(source_default.red(`Update failed: ${err.message}`));
10767
10775
  process.exit(1);
10768
10776
  }
10769
10777
  try {
10770
- const installed = execSync5(`${rt.name === "bun" ? "bun" : "npm"} ${rt.name === "bun" ? "pm ls -g" : "ls -g --depth=0"} ${PKG_NAME}`, { encoding: "utf-8" });
10778
+ const installed = execSync3(`${rt.name === "bun" ? "bun" : "npm"} ${rt.name === "bun" ? "pm ls -g" : "ls -g --depth=0"} ${PKG_NAME}`, { encoding: "utf-8" });
10771
10779
  const match = installed.match(new RegExp(PKG_NAME.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "@(\\d[^\\s]*)"));
10772
10780
  const resolved = match ? match[1] : "unknown";
10773
10781
  if (resolved && resolved !== latest) {
@@ -10785,7 +10793,7 @@ function update() {
10785
10793
  init_source();
10786
10794
  import { existsSync as existsSync15, readFileSync as readFileSync11, writeFileSync as writeFileSync7, mkdirSync as mkdirSync5 } from "fs";
10787
10795
  import { join as join18 } from "path";
10788
- import { execSync as execSync6 } from "child_process";
10796
+ import { execSync as execSync4 } from "child_process";
10789
10797
  function graphInit() {
10790
10798
  const root = process.cwd();
10791
10799
  if (!exists(root)) {
@@ -10812,7 +10820,7 @@ function graphInit() {
10812
10820
  if (!pkg.dependencies["@construct-space/graph"]) {
10813
10821
  let version = "0.1.0";
10814
10822
  try {
10815
- version = execSync6("npm view @construct-space/graph version", { encoding: "utf-8" }).trim();
10823
+ version = execSync4("npm view @construct-space/graph version", { encoding: "utf-8" }).trim();
10816
10824
  } catch {}
10817
10825
  pkg.dependencies["@construct-space/graph"] = `^${version}`;
10818
10826
  writeFileSync7(pkgPath, JSON.stringify(pkg, null, 2) + `
@@ -10823,7 +10831,7 @@ function graphInit() {
10823
10831
  }
10824
10832
  const rt = detect();
10825
10833
  console.log(source_default.dim(` Installing dependencies with ${rt.name}...`));
10826
- execSync6(rt.name === "bun" ? "bun install" : "npm install", { cwd: root, stdio: "inherit" });
10834
+ execSync4(rt.name === "bun" ? "bun install" : "npm install", { cwd: root, stdio: "inherit" });
10827
10835
  console.log();
10828
10836
  console.log(source_default.green("Graph initialized!"));
10829
10837
  console.log();
@@ -11405,7 +11413,7 @@ function graphFork(newSpaceID) {
11405
11413
  // package.json
11406
11414
  var package_default = {
11407
11415
  name: "@construct-space/cli",
11408
- version: "1.6.6",
11416
+ version: "1.7.0",
11409
11417
  description: "Construct CLI \u2014 scaffold, build, develop, and publish spaces",
11410
11418
  type: "module",
11411
11419
  bin: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@construct-space/cli",
3
- "version": "1.6.6",
3
+ "version": "1.7.0",
4
4
  "description": "Construct CLI — scaffold, build, develop, and publish spaces",
5
5
  "type": "module",
6
6
  "bin": {