create-adonisjs 3.2.0 → 3.2.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.
package/build/bin/run.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  kernel
4
- } from "../chunk-T34DGSTH.js";
4
+ } from "../chunk-NTHRNZYE.js";
5
5
 
6
6
  // bin/run.ts
7
7
  kernel.handle(["create-adonisjs", ...process.argv.slice(2)]).catch(console.error);
@@ -84,28 +84,39 @@ var CreateNewApp = class extends BaseCommand {
84
84
  }
85
85
  /**
86
86
  * Adapts the downloaded starter kit for the detected package manager.
87
+ * - For non-pnpm package managers: removes pnpm-workspace.yaml
88
+ * - For non-monorepo starter kits: no further changes are needed
87
89
  * - For pnpm monorepos: removes the workspaces field from package.json
88
- * - For non-pnpm: removes pnpm-workspace.yaml if present
89
- * - Removes packageManager field when it doesn't match the detected PM
90
+ * since pnpm uses pnpm-workspace.yaml for workspace configuration
91
+ * - For monorepos: sets the packageManager field in package.json to the
92
+ * detected package manager name and version
90
93
  */
91
94
  async #adaptForPackageManager() {
92
95
  const pkgJsonPath = join(this.destination, "package.json");
93
96
  const pkgJson = await readFile(pkgJsonPath, "utf-8").then(JSON.parse);
94
97
  const pnpmWorkspacePath = join(this.destination, "pnpm-workspace.yaml");
98
+ if (this.packageManager !== "pnpm") {
99
+ try {
100
+ await unlink(pnpmWorkspacePath);
101
+ } catch {
102
+ }
103
+ }
104
+ if (!this.isMonorepo) {
105
+ return;
106
+ }
95
107
  let dirty = false;
96
108
  if (this.packageManager === "pnpm") {
97
- if (this.isMonorepo && pkgJson.workspaces) {
98
- delete pkgJson.workspaces;
99
- dirty = true;
100
- }
101
- } else if (existsSync(pnpmWorkspacePath)) {
102
- await unlink(pnpmWorkspacePath);
109
+ delete pkgJson.workspaces;
110
+ dirty = true;
103
111
  }
104
- if (pkgJson.packageManager && !pkgJson.packageManager.startsWith(this.packageManager)) {
105
- delete pkgJson.packageManager;
112
+ const detectedPackageManager = detectPackageManager();
113
+ if (detectedPackageManager) {
114
+ pkgJson.packageManager = `${detectedPackageManager.name}@${detectedPackageManager.version}`;
106
115
  dirty = true;
107
116
  }
108
- if (dirty) await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
117
+ if (dirty) {
118
+ await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
119
+ }
109
120
  }
110
121
  /**
111
122
  * Executes a bash command using execa with shared default options.
package/build/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  kernel
3
- } from "./chunk-T34DGSTH.js";
3
+ } from "./chunk-NTHRNZYE.js";
4
4
  export {
5
5
  kernel
6
6
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-adonisjs",
3
3
  "description": "Scaffold new AdonisJS applications using starter kits",
4
- "version": "3.2.0",
4
+ "version": "3.2.1",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },