create-acmekit-app 2.13.46 → 2.13.48

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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.13.48
4
+
5
+ ### Patch Changes
6
+
7
+ - changes
8
+
9
+ - Updated dependencies []:
10
+ - @acmekit/telemetry@2.13.48
11
+ - @acmekit/deps@2.13.48
12
+
13
+ ## 2.13.47
14
+
15
+ ### Patch Changes
16
+
17
+ - changes
18
+
19
+ - Updated dependencies []:
20
+ - @acmekit/telemetry@2.13.47
21
+ - @acmekit/deps@2.13.47
22
+
3
23
  ## 2.13.46
4
24
 
5
25
  ### Patch Changes
@@ -6,7 +6,7 @@ import logMessage from "./log-message.js";
6
6
  import { execFileSync } from "child_process";
7
7
  const REPO_URL = "https://github.com/acmekit/acmekit";
8
8
  const BRANCH = "main";
9
- const DEFAULT_TEMPLATE = "templates/default";
9
+ const DEFAULT_TEMPLATE = "templates/app";
10
10
  const PLUGIN_TEMPLATE = "templates/plugin";
11
11
  export default async function cloneRepo({ directoryName = "", repoUrl, abortController, verbose = false, isPlugin = false, }) {
12
12
  if (repoUrl) {
@@ -1,7 +1,7 @@
1
1
  import path from "path";
2
2
  import execute from "./execute.js";
3
3
  import logMessage from "./log-message.js";
4
- import { existsSync, rmSync } from "fs";
4
+ import { appendFileSync, existsSync, readFileSync, rmSync } from "fs";
5
5
  export default class PackageManager {
6
6
  packageManager;
7
7
  packageManagerVersion;
@@ -149,6 +149,26 @@ export default class PackageManager {
149
149
  }
150
150
  }
151
151
  }
152
+ /**
153
+ * If the project directory is inside an existing pnpm workspace, ensure
154
+ * `confirmModulesPurge: false` is set in the workspace root's
155
+ * `pnpm-workspace.yaml` so that `pnpm install` doesn't block on an
156
+ * interactive purge confirmation prompt.
157
+ */
158
+ ensureWorkspaceConfig(cwd) {
159
+ let dir = path.resolve(cwd);
160
+ while (dir !== path.dirname(dir)) {
161
+ dir = path.dirname(dir);
162
+ const wsFile = path.join(dir, "pnpm-workspace.yaml");
163
+ if (existsSync(wsFile)) {
164
+ const content = readFileSync(wsFile, "utf-8");
165
+ if (!content.includes("confirmModulesPurge")) {
166
+ appendFileSync(wsFile, "\nconfirmModulesPurge: false\n");
167
+ }
168
+ return;
169
+ }
170
+ }
171
+ }
152
172
  async installDependencies(execOptions) {
153
173
  if (!this.packageManager) {
154
174
  await this.setPackageManager(execOptions);
@@ -157,6 +177,12 @@ export default class PackageManager {
157
177
  if (execOptions.cwd && typeof execOptions.cwd === "string") {
158
178
  await this.removeLockFiles(execOptions.cwd);
159
179
  }
180
+ // Ensure pnpm workspace config allows non-interactive installs
181
+ if (this.packageManager === "pnpm" &&
182
+ execOptions.cwd &&
183
+ typeof execOptions.cwd === "string") {
184
+ this.ensureWorkspaceConfig(execOptions.cwd);
185
+ }
160
186
  const commands = {
161
187
  yarn: "yarn",
162
188
  pnpm: "pnpm install",
@@ -213,7 +239,7 @@ export default class PackageManager {
213
239
  }
214
240
  const formats = {
215
241
  yarn: `yarn acmekit ${command}`,
216
- pnpm: `pnpm acmekit ${command}`,
242
+ pnpm: `pnpm exec acmekit ${command}`,
217
243
  npm: `npx acmekit ${command}`,
218
244
  };
219
245
  const commandStr = formats[this.packageManager || "npm"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-acmekit-app",
3
- "version": "2.13.46",
3
+ "version": "2.13.48",
4
4
  "description": "Create a AcmeKit project using a single command.",
5
5
  "type": "module",
6
6
  "exports": "./dist/index.js",
@@ -14,8 +14,8 @@
14
14
  "test": "../../../node_modules/.bin/jest --passWithNoTests src"
15
15
  },
16
16
  "dependencies": {
17
- "@acmekit/deps": "2.13.46",
18
- "@acmekit/telemetry": "2.13.46",
17
+ "@acmekit/deps": "2.13.48",
18
+ "@acmekit/telemetry": "2.13.48",
19
19
  "boxen": "^5.0.1",
20
20
  "chalk": "^4.1.2",
21
21
  "commander": "^11.0.0",
@@ -341,6 +341,7 @@ describe("PackageManager", () => {
341
341
 
342
342
  it("should execute pnpm install when using pnpm", async () => {
343
343
  mockExecute.mockResolvedValue({ stdout: "", stderr: "" })
344
+ mockExistsSync.mockReturnValue(false)
344
345
 
345
346
  const pm = new PackageManager(processManager)
346
347
  pm["packageManager"] = "pnpm"
@@ -537,7 +538,7 @@ describe("PackageManager", () => {
537
538
  await pm.runAcmeKitCommand("seed", { cwd: "/test/path" })
538
539
 
539
540
  expect(mockExecute).toHaveBeenCalledWith(
540
- ["pnpm acmekit seed", { cwd: "/test/path" }],
541
+ ["pnpm exec acmekit seed", { cwd: "/test/path" }],
541
542
  { verbose: false }
542
543
  )
543
544
  })
@@ -16,7 +16,7 @@ type CloneRepoOptions = {
16
16
 
17
17
  const REPO_URL = "https://github.com/acmekit/acmekit"
18
18
  const BRANCH = "main"
19
- const DEFAULT_TEMPLATE = "templates/default"
19
+ const DEFAULT_TEMPLATE = "templates/app"
20
20
  const PLUGIN_TEMPLATE = "templates/plugin"
21
21
 
22
22
  export default async function cloneRepo({
@@ -2,7 +2,7 @@ import path from "path"
2
2
  import execute, { VerboseOptions } from "./execute.js"
3
3
  import logMessage from "./log-message.js"
4
4
  import ProcessManager from "./process-manager.js"
5
- import { existsSync, rmSync } from "fs"
5
+ import { appendFileSync, existsSync, readFileSync, rmSync } from "fs"
6
6
 
7
7
  export type PackageManagerType = "npm" | "yarn" | "pnpm"
8
8
 
@@ -193,6 +193,27 @@ export default class PackageManager {
193
193
  }
194
194
  }
195
195
 
196
+ /**
197
+ * If the project directory is inside an existing pnpm workspace, ensure
198
+ * `confirmModulesPurge: false` is set in the workspace root's
199
+ * `pnpm-workspace.yaml` so that `pnpm install` doesn't block on an
200
+ * interactive purge confirmation prompt.
201
+ */
202
+ private ensureWorkspaceConfig(cwd: string): void {
203
+ let dir = path.resolve(cwd)
204
+ while (dir !== path.dirname(dir)) {
205
+ dir = path.dirname(dir)
206
+ const wsFile = path.join(dir, "pnpm-workspace.yaml")
207
+ if (existsSync(wsFile)) {
208
+ const content = readFileSync(wsFile, "utf-8")
209
+ if (!content.includes("confirmModulesPurge")) {
210
+ appendFileSync(wsFile, "\nconfirmModulesPurge: false\n")
211
+ }
212
+ return
213
+ }
214
+ }
215
+ }
216
+
196
217
  async installDependencies(execOptions: Record<string, unknown>) {
197
218
  if (!this.packageManager) {
198
219
  await this.setPackageManager(execOptions)
@@ -203,6 +224,15 @@ export default class PackageManager {
203
224
  await this.removeLockFiles(execOptions.cwd)
204
225
  }
205
226
 
227
+ // Ensure pnpm workspace config allows non-interactive installs
228
+ if (
229
+ this.packageManager === "pnpm" &&
230
+ execOptions.cwd &&
231
+ typeof execOptions.cwd === "string"
232
+ ) {
233
+ this.ensureWorkspaceConfig(execOptions.cwd)
234
+ }
235
+
206
236
  const commands: Record<PackageManagerType, string> = {
207
237
  yarn: "yarn",
208
238
  pnpm: "pnpm install",
@@ -274,7 +304,7 @@ export default class PackageManager {
274
304
 
275
305
  const formats: Record<PackageManagerType, string> = {
276
306
  yarn: `yarn acmekit ${command}`,
277
- pnpm: `pnpm acmekit ${command}`,
307
+ pnpm: `pnpm exec acmekit ${command}`,
278
308
  npm: `npx acmekit ${command}`,
279
309
  }
280
310