create-adonisjs 3.2.0 → 3.3.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.
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-PRL2GRZO.js";
5
5
 
6
6
  // bin/run.ts
7
7
  kernel.handle(["create-adonisjs", ...process.argv.slice(2)]).catch(console.error);
@@ -28,26 +28,32 @@ var templates = [
28
28
  {
29
29
  name: "Hypermedia app",
30
30
  alias: "hypermedia",
31
- hint: "A fullstack application using server-side templates",
31
+ hint: "A full-stack app using server-side templates",
32
32
  source: "github:adonisjs/starter-kits/hypermedia"
33
33
  },
34
34
  {
35
35
  name: "React app (using Inertia)",
36
36
  alias: "react",
37
- hint: "A fullstack React application with E2E type-safety",
37
+ hint: "A full-stack React app with end-to-end type safety",
38
38
  source: "github:adonisjs/starter-kits/inertia-react"
39
39
  },
40
40
  {
41
41
  name: "Vue app (using Inertia)",
42
42
  alias: "vue",
43
- hint: "A fullstack Vue application with E2E type-safety",
43
+ hint: "A full-stack Vue app with end-to-end type safety",
44
44
  source: "github:adonisjs/starter-kits/inertia-vue"
45
45
  },
46
46
  {
47
- name: "API (monorepo)",
47
+ name: "API",
48
48
  alias: "api",
49
- hint: "Type-safe REST API with dual authentication",
49
+ hint: "A type-safe REST API with session and access token auth",
50
50
  source: "github:adonisjs/starter-kits/api"
51
+ },
52
+ {
53
+ name: "API (monorepo)",
54
+ alias: "api-monorepo",
55
+ hint: "A monorepo setup with a type-safe REST API",
56
+ source: "github:adonisjs/starter-kits/api-monorepo"
51
57
  }
52
58
  ];
53
59
 
@@ -83,29 +89,47 @@ var CreateNewApp = class extends BaseCommand {
83
89
  }
84
90
  }
85
91
  /**
86
- * Adapts the downloaded starter kit for the detected package manager.
92
+ * Adapts the downloaded starter kit for the selected package manager.
93
+ * - For non-pnpm package managers: removes pnpm-workspace.yaml
94
+ * - For non-yarn package managers: removes .yarnrc.yml
95
+ * - For non-monorepo starter kits: no further changes are needed
87
96
  * - 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
97
+ * since pnpm uses pnpm-workspace.yaml for workspace configuration
98
+ * - For monorepos: sets the packageManager field in package.json to the
99
+ * selected package manager, using detected version when available
90
100
  */
91
101
  async #adaptForPackageManager() {
92
102
  const pkgJsonPath = join(this.destination, "package.json");
93
103
  const pkgJson = await readFile(pkgJsonPath, "utf-8").then(JSON.parse);
94
104
  const pnpmWorkspacePath = join(this.destination, "pnpm-workspace.yaml");
95
- let dirty = false;
96
- if (this.packageManager === "pnpm") {
97
- if (this.isMonorepo && pkgJson.workspaces) {
98
- delete pkgJson.workspaces;
99
- dirty = true;
105
+ const yarnFilePath = join(this.destination, ".yarnrc.yml");
106
+ if (this.packageManager !== "pnpm") {
107
+ try {
108
+ await unlink(pnpmWorkspacePath);
109
+ } catch {
100
110
  }
101
- } else if (existsSync(pnpmWorkspacePath)) {
102
- await unlink(pnpmWorkspacePath);
103
111
  }
104
- if (pkgJson.packageManager && !pkgJson.packageManager.startsWith(this.packageManager)) {
105
- delete pkgJson.packageManager;
112
+ if (this.packageManager !== "yarn") {
113
+ try {
114
+ await unlink(yarnFilePath);
115
+ } catch {
116
+ }
117
+ }
118
+ if (!this.isMonorepo) {
119
+ return;
120
+ }
121
+ let dirty = false;
122
+ if (this.packageManager === "pnpm") {
123
+ delete pkgJson.workspaces;
106
124
  dirty = true;
107
125
  }
108
- if (dirty) await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
126
+ const detectedPackageManager = detectPackageManager();
127
+ const detectedVersion = detectedPackageManager?.name === this.packageManager ? detectedPackageManager.version : void 0;
128
+ pkgJson.packageManager = detectedVersion ? `${this.packageManager}@${detectedVersion}` : this.packageManager;
129
+ dirty = true;
130
+ if (dirty) {
131
+ await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
132
+ }
109
133
  }
110
134
  /**
111
135
  * 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-PRL2GRZO.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.3.0",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },