create-adonisjs 3.3.0 → 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 +1 -1
- package/build/{chunk-PRL2GRZO.js → chunk-BFPU45SS.js} +44 -14
- package/build/index.js +1 -1
- package/package.json +11 -11
package/build/bin/run.js
CHANGED
|
@@ -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
|
|
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 =
|
|
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!")
|
|
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
|
-
*
|
|
189
|
-
*
|
|
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
|
|
@@ -318,7 +348,7 @@ var CreateNewApp = class extends BaseCommand {
|
|
|
318
348
|
* await this.#migrateDatabase()
|
|
319
349
|
*/
|
|
320
350
|
async #migrateDatabase() {
|
|
321
|
-
await mkdir(join(this.backendSourceDir, "tmp"));
|
|
351
|
+
await mkdir(join(this.backendSourceDir, "tmp"), { recursive: true });
|
|
322
352
|
await this.#runBashCommand(this.backendSourceDir, "node", ["ace", "migration:run"]);
|
|
323
353
|
}
|
|
324
354
|
/**
|
|
@@ -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 ||
|
|
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
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.
|
|
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": "^
|
|
47
|
+
"@release-it/conventional-changelog": "^11.0.0",
|
|
48
48
|
"@types/gradient-string": "^1.1.6",
|
|
49
|
-
"@types/node": "^25.
|
|
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.
|
|
55
|
-
"prettier": "^3.8.
|
|
56
|
-
"release-it": "
|
|
53
|
+
"eslint": "^10.2.1",
|
|
54
|
+
"prettier": "^3.8.3",
|
|
55
|
+
"release-it": "20.0.1",
|
|
57
56
|
"tsup": "^8.5.1",
|
|
58
|
-
"typescript": "^
|
|
57
|
+
"typescript": "^6.0.3"
|
|
59
58
|
},
|
|
60
59
|
"dependencies": {
|
|
61
|
-
"@adonisjs/ace": "^14.0
|
|
60
|
+
"@adonisjs/ace": "^14.1.0",
|
|
61
|
+
"@poppinss/utils": "^7.0.1",
|
|
62
62
|
"execa": "^9.6.1",
|
|
63
|
-
"giget": "^3.
|
|
63
|
+
"giget": "^3.2.0",
|
|
64
64
|
"gradient-string": "^3.0.0",
|
|
65
|
-
"which-pm-runs": "^
|
|
65
|
+
"which-pm-runs": "^2.0.0"
|
|
66
66
|
},
|
|
67
67
|
"homepage": "https://github.com/adonisjs/create-adonisjs#readme",
|
|
68
68
|
"repository": {
|