create-adonisjs 3.3.1 → 3.4.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-LKYXQAE4.js";
4
+ } from "../chunk-BFPU45SS.js";
5
5
 
6
6
  // bin/run.ts
7
7
  kernel.handle(["create-adonisjs", ...process.argv.slice(2)]).catch(console.error);
@@ -13,12 +13,13 @@ var __decorateClass = (decorators, target, key, kind) => {
13
13
  import { HelpCommand, Kernel } from "@adonisjs/ace";
14
14
 
15
15
  // commands/main.ts
16
+ import { whichPMRuns } from "which-pm-runs";
16
17
  import { cwd } from "process";
17
18
  import { existsSync } from "fs";
18
19
  import gradient from "gradient-string";
19
20
  import { downloadTemplate } from "giget";
20
21
  import { execa } from "execa";
21
- import detectPackageManager from "which-pm-runs";
22
+ import { isRunningInAIAgent } from "@poppinss/utils";
22
23
  import { BaseCommand, args, flags } from "@adonisjs/ace";
23
24
  import { basename, isAbsolute, join, relative } from "path";
24
25
  import { copyFile, mkdir, readFile, unlink, writeFile } from "fs/promises";
@@ -123,7 +124,7 @@ var CreateNewApp = class extends BaseCommand {
123
124
  delete pkgJson.workspaces;
124
125
  dirty = true;
125
126
  }
126
- const detectedPackageManager = detectPackageManager();
127
+ const detectedPackageManager = whichPMRuns();
127
128
  const detectedVersion = detectedPackageManager?.name === this.packageManager ? detectedPackageManager.version : void 0;
128
129
  pkgJson.packageManager = detectedVersion ? `${this.packageManager}@${detectedVersion}` : this.packageManager;
129
130
  dirty = true;
@@ -182,21 +183,47 @@ var CreateNewApp = class extends BaseCommand {
182
183
  */
183
184
  #printSuccessMessage() {
184
185
  this.logger.log("");
185
- this.ui.instructions().heading("Your AdonisJS project has been created successfully!").add(this.colors.cyan("cd " + relative(cwd(), this.destination))).add(this.colors.cyan(`${this.packageManager} run dev`)).add(this.colors.cyan("Open http://localhost:3333")).add("").add(`Have any questions?`).add(`Join our Discord server - ${this.colors.yellow("https://discord.gg/vDcEjq6")}`).render();
186
+ let instructions = this.ui.instructions().heading("Your AdonisJS project has been created successfully!");
187
+ const destRelativePath = relative(cwd(), this.destination);
188
+ if (destRelativePath !== "") {
189
+ instructions.add(this.colors.cyan(`cd ${destRelativePath}`));
190
+ }
191
+ instructions.add(this.colors.cyan(`${this.packageManager} run dev`)).add(this.colors.cyan("Open http://localhost:3333")).add("").add(`Have any questions?`).add(`Join our Discord server - ${this.colors.yellow("https://discord.gg/vDcEjq6")}`).render();
186
192
  }
187
193
  /**
188
- * Prompts the user to specify a destination directory if one was not provided
189
- * as a command argument. Converts relative paths to absolute paths using the
190
- * current working directory.
191
- *
192
- * Sets the `destination` property to the absolute path where the project will be created.
193
- *
194
- * @example
195
- * await this.#promptForDestination()
196
- * console.log('Creating project at:', this.destination)
194
+ * Displays AI-friendly instructions and exit when running inside
195
+ * an AI agent sandbox without the required flags.
197
196
  */
197
+ #exitWithNonInteractiveError() {
198
+ const kitOptions = templates.map((t) => ` - "${t.alias}": ${t.hint}`).join("\n");
199
+ this.logger.error(
200
+ [
201
+ `Interactive prompts are not supported in non-interactive environments.`,
202
+ ``,
203
+ `To create a new AdonisJS application, you must provide the destination directory and the starter kit as command-line arguments.`,
204
+ ``,
205
+ `Ask the user which starter kit they want to use. The available options are:`,
206
+ kitOptions,
207
+ ``,
208
+ `Also ask the user which package manager they want to use. The available options are: npm, yarn, pnpm.`,
209
+ ``,
210
+ `Once you have the user's preferences, run the command with the following format:`,
211
+ ``,
212
+ ` npm init adonisjs@latest -- <destination> --kit="<kit>" --pkg="<package_manager>"`,
213
+ ``,
214
+ `For example:`,
215
+ ``,
216
+ ` npm init adonisjs@latest -- my-app --kit="react" --pkg="npm"`
217
+ ].join("\n")
218
+ );
219
+ this.exitCode = 1;
220
+ throw new Error("Non-interactive environment detected");
221
+ }
198
222
  async #promptForDestination() {
199
223
  if (!this.destination) {
224
+ if (isRunningInAIAgent()) {
225
+ this.#exitWithNonInteractiveError();
226
+ }
200
227
  this.destination = await this.prompt.ask("Where should we create your new project?", {
201
228
  default: "./adonisjs-app"
202
229
  });
@@ -217,6 +244,9 @@ var CreateNewApp = class extends BaseCommand {
217
244
  */
218
245
  async #promptForStarterKit() {
219
246
  if (!this.kit) {
247
+ if (isRunningInAIAgent()) {
248
+ this.#exitWithNonInteractiveError();
249
+ }
220
250
  const template = await this.prompt.choice(
221
251
  "Select the kind of app you want to create?",
222
252
  templates
@@ -337,7 +367,7 @@ var CreateNewApp = class extends BaseCommand {
337
367
  * await command.run()
338
368
  */
339
369
  async run() {
340
- this.packageManager = this.packageManager || detectPackageManager()?.name || "npm";
370
+ this.packageManager = this.packageManager || whichPMRuns()?.name || "npm";
341
371
  this.#printBannerArt();
342
372
  await this.#promptForDestination();
343
373
  await this.#promptForStarterKit();
package/build/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  kernel
3
- } from "./chunk-LKYXQAE4.js";
3
+ } from "./chunk-BFPU45SS.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.3.1",
4
+ "version": "3.4.0",
5
5
  "engines": {
6
6
  "node": ">=24.0.0"
7
7
  },
@@ -44,25 +44,25 @@
44
44
  "@japa/file-system": "^3.0.0",
45
45
  "@japa/runner": "^5.3.0",
46
46
  "@poppinss/ts-exec": "^1.4.4",
47
- "@release-it/conventional-changelog": "^10.0.5",
47
+ "@release-it/conventional-changelog": "^11.0.0",
48
48
  "@types/gradient-string": "^1.1.6",
49
- "@types/node": "^25.3.0",
50
- "@types/which-pm-runs": "^1.0.2",
49
+ "@types/node": "^25.6.0",
51
50
  "c8": "^11.0.0",
52
51
  "cross-env": "^10.1.0",
53
52
  "del-cli": "^7.0.0",
54
- "eslint": "^10.0.2",
55
- "prettier": "^3.8.1",
56
- "release-it": "19.2.4",
53
+ "eslint": "^10.2.1",
54
+ "prettier": "^3.8.3",
55
+ "release-it": "20.0.1",
57
56
  "tsup": "^8.5.1",
58
- "typescript": "^5.9.3"
57
+ "typescript": "^6.0.3"
59
58
  },
60
59
  "dependencies": {
61
- "@adonisjs/ace": "^14.0.1",
60
+ "@adonisjs/ace": "^14.1.0",
61
+ "@poppinss/utils": "^7.0.1",
62
62
  "execa": "^9.6.1",
63
- "giget": "^3.1.2",
63
+ "giget": "^3.2.0",
64
64
  "gradient-string": "^3.0.0",
65
- "which-pm-runs": "^1.1.0"
65
+ "which-pm-runs": "^2.0.0"
66
66
  },
67
67
  "homepage": "https://github.com/adonisjs/create-adonisjs#readme",
68
68
  "repository": {