betterstart-cli 0.0.66 → 0.0.68

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.js CHANGED
@@ -276,17 +276,11 @@ function runCommand(pm, script) {
276
276
  return `npm run ${script}`;
277
277
  }
278
278
  }
279
- function createNextAppCommand(pm) {
280
- switch (pm) {
281
- case "pnpm":
282
- return { bin: "pnpm", prefix: ["create", "next-app@latest"] };
283
- case "yarn":
284
- return { bin: "yarn", prefix: ["create", "next-app@latest"] };
285
- case "bun":
286
- return { bin: "bunx", prefix: ["create-next-app@latest"] };
287
- default:
288
- return { bin: "npx", prefix: ["create-next-app@latest"] };
289
- }
279
+ function createNextAppCommand() {
280
+ return {
281
+ bin: "npm",
282
+ prefix: ["exec", "--yes", "--package=create-next-app@latest", "--", "create-next-app"]
283
+ };
290
284
  }
291
285
 
292
286
  // adapters/next/config.ts
@@ -1083,6 +1077,13 @@ var CLI_PACKAGE_NAME = "betterstart-cli";
1083
1077
  var LOCAL_PACKAGE_PREFIXES = ["workspace:", "link:", "file:", "portal:"];
1084
1078
  var MIN_SUPPORTED_PNPM_MAJOR = 9;
1085
1079
  var PINNED_PNPM_PACKAGE_MANAGER = "pnpm@11.9.0";
1080
+ var FRESH_PNPM_ALLOWED_BUILDS = [
1081
+ "@parcel/watcher",
1082
+ "esbuild",
1083
+ "msgpackr-extract",
1084
+ "msw",
1085
+ "sharp"
1086
+ ];
1086
1087
  var TIPTAP_PACKAGE_PREFIX = "@tiptap/";
1087
1088
  var TIPTAP_PACKAGE_VERSION_SPEC = "^3.26.0";
1088
1089
  var CODEMIRROR_PACKAGE_SPECS = {
@@ -1261,6 +1262,31 @@ function ensurePnpmPackageManager(cwd) {
1261
1262
  fs7.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
1262
1263
  `, "utf-8");
1263
1264
  }
1265
+ function ensurePnpmAllowedBuilds(cwd, dependencies) {
1266
+ if (dependencies.length === 0) {
1267
+ return;
1268
+ }
1269
+ const workspacePath = findPnpmWorkspacePath(cwd);
1270
+ const workspaceContent = fs7.existsSync(workspacePath) ? fs7.readFileSync(workspacePath, "utf-8") : "{}\n";
1271
+ const workspaceDocument = parseDocument(workspaceContent);
1272
+ if (workspaceDocument.errors.length > 0) {
1273
+ throw new Error(
1274
+ `Could not update pnpm-workspace.yaml: ${workspaceDocument.errors[0]?.message ?? "invalid YAML"}`
1275
+ );
1276
+ }
1277
+ let workspaceChanged = false;
1278
+ for (const dependency of dependencies) {
1279
+ const valuePath = ["allowBuilds", dependency];
1280
+ const currentValue = workspaceDocument.getIn(valuePath);
1281
+ if (currentValue === void 0 || currentValue === "set this to true or false") {
1282
+ workspaceDocument.setIn(valuePath, true);
1283
+ workspaceChanged = true;
1284
+ }
1285
+ }
1286
+ if (workspaceChanged) {
1287
+ fs7.writeFileSync(workspacePath, workspaceDocument.toString({ lineWidth: 0 }), "utf-8");
1288
+ }
1289
+ }
1264
1290
  function hasDeclaredPackage(pkg, name) {
1265
1291
  if (!pkg) return false;
1266
1292
  return Object.hasOwn(pkg.dependencies ?? {}, name) || Object.hasOwn(pkg.devDependencies ?? {}, name) || Object.hasOwn(pkg.optionalDependencies ?? {}, name);
@@ -1473,12 +1499,20 @@ async function installDependenciesAsync({
1473
1499
  cwd,
1474
1500
  pm,
1475
1501
  dependencies,
1476
- devDependencies
1502
+ devDependencies,
1503
+ pnpmAllowedBuilds
1477
1504
  }) {
1478
- const installPlan = resolveDependencyInstallPlan({ cwd, pm, dependencies, devDependencies });
1505
+ const installPlan = resolveDependencyInstallPlan({
1506
+ cwd,
1507
+ pm,
1508
+ dependencies,
1509
+ devDependencies,
1510
+ pnpmAllowedBuilds
1511
+ });
1479
1512
  try {
1480
1513
  if (pm === "pnpm") {
1481
1514
  ensurePnpmPackageManager(cwd);
1515
+ ensurePnpmAllowedBuilds(cwd, installPlan.pnpmAllowedBuilds ?? []);
1482
1516
  ensurePnpmPackageExtensions(cwd, installPlan.dependencies);
1483
1517
  }
1484
1518
  if (installPlan.dependencies.length > 0) {
@@ -27097,7 +27131,7 @@ async function runInitCommand(name, options) {
27097
27131
  }
27098
27132
  const displayName = projectPrompt.projectName === "." ? path52.basename(cwd) : projectPrompt.projectName;
27099
27133
  projectName = displayName;
27100
- const { bin, prefix } = createNextAppCommand(pm);
27134
+ const { bin, prefix } = createNextAppCommand();
27101
27135
  const cnaArgs = [
27102
27136
  ...prefix,
27103
27137
  projectPrompt.projectName,
@@ -27108,7 +27142,8 @@ async function runInitCommand(name, options) {
27108
27142
  "--turbopack",
27109
27143
  "--biome",
27110
27144
  "--react-compiler",
27111
- `--use-${pm}`
27145
+ `--use-${pm}`,
27146
+ "--skip-install"
27112
27147
  ];
27113
27148
  if (srcDir) cnaArgs.push("--src-dir");
27114
27149
  else cnaArgs.push("--no-src-dir");
@@ -27444,6 +27479,7 @@ async function runInitCommand(name, options) {
27444
27479
  const depsResult = await installDependenciesAsync({
27445
27480
  cwd,
27446
27481
  pm,
27482
+ ...isFreshProject && pm === "pnpm" ? { pnpmAllowedBuilds: [...FRESH_PNPM_ALLOWED_BUILDS] } : {},
27447
27483
  dependencies: Array.from(
27448
27484
  /* @__PURE__ */ new Set([...coreDependencyPlan.dependencies, ...cliDependencyPlan?.dependencies ?? []])
27449
27485
  ),