create-adonisjs 2.2.1 → 2.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/README.md CHANGED
@@ -112,12 +112,10 @@ npm init adonisjs -- --kit="web" --db="mysql"
112
112
 
113
113
  ### Other options
114
114
 
115
- | Option | Description |
116
- | -------------- | --------------------------------------------------------------------------------------- |
117
- | `--install` | Install dependencies. A prompt will be shown when the flag is not mentioned explicitly. |
118
- | `--git-init` | Initialize git repository. |
119
- | `--no-install` | Explicitly opt out from installing dependencies and skip the prompt |
120
- | `--verbose` | Enable verbose mode to display all logs |
115
+ | Option | Description |
116
+ | ------------ | --------------------------------------- |
117
+ | `--git-init` | Initialize git repository. |
118
+ | `--verbose` | Enable verbose mode to display all logs |
121
119
 
122
120
  ## Debugging errors
123
121
 
@@ -23,11 +23,6 @@ export declare class CreateNewApp extends BaseCommand {
23
23
  * Authentication token to download private templates
24
24
  */
25
25
  token?: string;
26
- /**
27
- * Auto install packages after creating the project. Display prompt
28
- * when flag is not mentioned.
29
- */
30
- install?: boolean;
31
26
  /**
32
27
  * Init git repository. Do not init when flag is not mentioned.
33
28
  */
@@ -34,7 +34,7 @@ const INERTIA_STARTER_KIT = 'github:adonisjs/inertia-starter-kit';
34
34
  */
35
35
  export class CreateNewApp extends BaseCommand {
36
36
  static commandName = 'create-adonisjs';
37
- static description = 'Create a new AdonisJS application using a starter kit';
37
+ static description = 'Create a new AdonisJS application';
38
38
  /**
39
39
  * Runs bash command using execa with shared defaults
40
40
  */
@@ -78,7 +78,7 @@ export class CreateNewApp extends BaseCommand {
78
78
  */
79
79
  async #promptForDestination() {
80
80
  if (!this.destination) {
81
- this.destination = await this.prompt.ask('Where should we create your new project?', {
81
+ this.destination = await this.prompt.ask('Where should we create your new project', {
82
82
  default: './my-adonisjs-app',
83
83
  });
84
84
  }
@@ -94,7 +94,7 @@ export class CreateNewApp extends BaseCommand {
94
94
  /**
95
95
  * Display prompt when "kit" flag is not used.
96
96
  */
97
- const template = await this.prompt.choice('Which starter kit would you like to use?', templates);
97
+ const template = await this.prompt.choice('Which starter kit would you like to use', templates);
98
98
  this.kit = templates.find((t) => t.name === template).source;
99
99
  }
100
100
  else {
@@ -115,8 +115,8 @@ export class CreateNewApp extends BaseCommand {
115
115
  /**
116
116
  * Display prompt when "db" flag is not used.
117
117
  */
118
- const database = await this.prompt.choice('Select the database driver you want to use', databases);
119
- this.db = databases.find((t) => t.name === database).alias;
118
+ const database = await this.prompt.choice('Which database driver you want to use', databases);
119
+ this.db = database;
120
120
  }
121
121
  }
122
122
  /**
@@ -127,8 +127,8 @@ export class CreateNewApp extends BaseCommand {
127
127
  /**
128
128
  * Display prompt when "authGuard" flag is not used.
129
129
  */
130
- const guard = await this.prompt.choice('Select the authentication guard you want to use', authGuards);
131
- this.authGuard = authGuards.find((t) => t.name === guard).alias;
130
+ const guard = await this.prompt.choice('Which authentication guard you want to use', authGuards);
131
+ this.authGuard = guard;
132
132
  }
133
133
  }
134
134
  /**
@@ -136,8 +136,8 @@ export class CreateNewApp extends BaseCommand {
136
136
  */
137
137
  async #promptForInertiaAdapter() {
138
138
  if (!this.adapter) {
139
- const adapter = await this.prompt.choice('Select the Inertia frontend adapter you want to use', adapters);
140
- this.adapter = adapters.find((t) => t.name === adapter).alias;
139
+ const adapter = await this.prompt.choice('Which frontend adapter you want to use with Inertia', adapters);
140
+ this.adapter = adapter;
141
141
  }
142
142
  }
143
143
  /**
@@ -145,18 +145,7 @@ export class CreateNewApp extends BaseCommand {
145
145
  */
146
146
  async #promptForInertiaSsr() {
147
147
  if (this.ssr === undefined) {
148
- this.ssr = await this.prompt.confirm('Do you want to setup server-side rendering with Inertia?');
149
- }
150
- }
151
- /**
152
- * Prompt to check if we should install dependencies?
153
- */
154
- async #promptForInstallingDeps() {
155
- if (this.install === undefined) {
156
- this.install = await this.prompt.confirm(`Do you want us to install dependencies using "${this.packageManager}"?`, {
157
- default: true,
158
- hint: "(If not, you'll need to configure guards and database manually)",
159
- });
148
+ this.ssr = await this.prompt.confirm('Do you want to setup server-side rendering with Inertia');
160
149
  }
161
150
  }
162
151
  /**
@@ -199,16 +188,12 @@ export class CreateNewApp extends BaseCommand {
199
188
  * Generate a fresh app key. Errors are ignored
200
189
  */
201
190
  async #generateFreshAppKey() {
202
- if (this.install === false) {
203
- return;
204
- }
205
191
  await this.#runBashCommand('node', ['ace', 'generate:key']);
206
192
  }
207
193
  /**
208
194
  * Configures the Lucid package
209
195
  */
210
196
  async #configureLucid() {
211
- this.db = this.db || 'sqlite';
212
197
  const argv = ['ace', 'configure', '@adonisjs/lucid', '--db', this.db, '--install'];
213
198
  if (this.verbose) {
214
199
  argv.push('--verbose');
@@ -234,7 +219,6 @@ export class CreateNewApp extends BaseCommand {
234
219
  * Configures the Auth package
235
220
  */
236
221
  async #configureAuth() {
237
- this.authGuard = this.authGuard || 'session';
238
222
  /**
239
223
  * Install the session package when using api starter kit with session
240
224
  * guard. This needs to be done, since the api starter kit does
@@ -256,7 +240,6 @@ export class CreateNewApp extends BaseCommand {
256
240
  * Configures the Inertia package
257
241
  */
258
242
  async #configureInertia() {
259
- this.adapter = this.adapter || 'vue';
260
243
  const argv = [
261
244
  'ace',
262
245
  'configure',
@@ -264,7 +247,7 @@ export class CreateNewApp extends BaseCommand {
264
247
  '--adapter',
265
248
  this.adapter,
266
249
  this.ssr ? '--ssr' : '--no-ssr',
267
- this.install ? '--install' : '--no-install',
250
+ '--install',
268
251
  ];
269
252
  if (this.verbose) {
270
253
  argv.push('--verbose');
@@ -295,7 +278,6 @@ export class CreateNewApp extends BaseCommand {
295
278
  await this.#promptForInertiaAdapter();
296
279
  await this.#promptForInertiaSsr();
297
280
  }
298
- await this.#promptForInstallingDeps();
299
281
  /**
300
282
  * Create tasks instance for displaying
301
283
  * actions as tasks
@@ -306,19 +288,17 @@ export class CreateNewApp extends BaseCommand {
306
288
  * and installing dependencies
307
289
  */
308
290
  const configureLucid = [WEB_STARTER_KIT, API_STARTER_KIT, INERTIA_STARTER_KIT].includes(this.kit || '') &&
309
- this.db !== undefined &&
310
- this.install !== false;
291
+ this.db !== 'skip';
311
292
  /**
312
293
  * Configure auth when using our own starter kits
313
294
  * and installing dependencies
314
295
  */
315
296
  const configureAuth = [WEB_STARTER_KIT, API_STARTER_KIT, INERTIA_STARTER_KIT].includes(this.kit || '') &&
316
- this.authGuard !== undefined &&
317
- this.install !== false;
297
+ this.authGuard !== 'skip';
318
298
  /**
319
299
  * Configure inertia when using our inertia starter kit
320
300
  */
321
- const configureInertia = this.kit === INERTIA_STARTER_KIT && this.db !== undefined && this.install !== false;
301
+ const configureInertia = this.kit === INERTIA_STARTER_KIT && this.adapter !== 'skip';
322
302
  tasks
323
303
  .add('Download starter kit', async (task) => {
324
304
  task.update(`Downloading "${this.kit}"`);
@@ -334,7 +314,7 @@ export class CreateNewApp extends BaseCommand {
334
314
  await this.#runBashCommand('git', ['init']);
335
315
  return 'Initialized git repository';
336
316
  })
337
- .addIf(this.install !== false, 'Install packages', async (task) => {
317
+ .add('Install packages', async (task) => {
338
318
  const spinner = this.logger.await('installing dependencies', {
339
319
  silent: this.verbose,
340
320
  });
@@ -440,19 +420,13 @@ __decorate([
440
420
  ], CreateNewApp.prototype, "kit", void 0);
441
421
  __decorate([
442
422
  flags.string({
443
- description: 'Pass the authentication token to download private repositories',
423
+ description: 'Auth token to download private repositories',
444
424
  alias: 't',
445
425
  })
446
426
  ], CreateNewApp.prototype, "token", void 0);
447
427
  __decorate([
448
428
  flags.boolean({
449
- description: 'Install packages after creating the project',
450
- showNegatedVariantInHelp: true,
451
- })
452
- ], CreateNewApp.prototype, "install", void 0);
453
- __decorate([
454
- flags.boolean({
455
- description: 'Init Git repository using the "git init" command',
429
+ description: 'Init git repository',
456
430
  })
457
431
  ], CreateNewApp.prototype, "gitInit", void 0);
458
432
  __decorate([
@@ -468,17 +442,17 @@ __decorate([
468
442
  ], CreateNewApp.prototype, "db", void 0);
469
443
  __decorate([
470
444
  flags.string({
471
- description: 'Define the authentication guard for the Auth package',
445
+ description: 'Define the authentication guard with the Auth package',
472
446
  })
473
447
  ], CreateNewApp.prototype, "authGuard", void 0);
474
448
  __decorate([
475
449
  flags.string({
476
- description: 'Define the Inertia frontend adapter ( if using Inertia starter kit )',
450
+ description: 'Define the Inertia frontend adapter',
477
451
  })
478
452
  ], CreateNewApp.prototype, "adapter", void 0);
479
453
  __decorate([
480
454
  flags.boolean({
481
- description: 'Define if SSR is needed ( if using Inertia starter kit )',
455
+ description: 'Enable SSR for Inertia',
482
456
  })
483
457
  ], CreateNewApp.prototype, "ssr", void 0);
484
458
  __decorate([
@@ -1,12 +1,8 @@
1
1
  /**
2
- * List of first party authentication guards
2
+ * List of known authentication guards
3
3
  */
4
- export declare const authGuards: ({
4
+ export declare const authGuards: {
5
5
  name: string;
6
- alias: string;
6
+ message: string;
7
7
  hint: string;
8
- } | {
9
- name: string;
10
- alias: undefined;
11
- hint: string;
12
- })[];
8
+ }[];
@@ -6,23 +6,21 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ import { GUARDS } from '@adonisjs/presets/auth';
9
10
  /**
10
- * List of first party authentication guards
11
+ * List of known authentication guards
11
12
  */
12
13
  export const authGuards = [
14
+ ...Object.keys(GUARDS).map((guard) => {
15
+ return {
16
+ name: guard,
17
+ hint: GUARDS[guard].description,
18
+ message: GUARDS[guard].name,
19
+ };
20
+ }),
13
21
  {
14
- name: 'Session',
15
- alias: 'session',
16
- hint: 'Authenticate users using cookies and session.',
17
- },
18
- {
19
- name: 'Access Token',
20
- alias: 'access_tokens',
21
- hint: 'Authenticate clients using tokens.',
22
- },
23
- {
24
- name: 'Skip',
25
- alias: undefined,
26
- hint: 'I want to configures guards by myself.',
22
+ name: 'skip',
23
+ message: 'Skip',
24
+ hint: 'I want to configure the Auth package manually',
27
25
  },
28
26
  ];
@@ -1,12 +1,11 @@
1
1
  /**
2
- * List of first party databases (lucid)
2
+ * List of known databases that can be used with Lucid
3
3
  */
4
4
  export declare const databases: ({
5
- name: string;
6
- alias: string;
7
- hint?: undefined;
5
+ name: "sqlite" | "mysql" | "libsql" | "postgres" | "mssql";
6
+ message: string;
8
7
  } | {
9
8
  name: string;
9
+ message: string;
10
10
  hint: string;
11
- alias: undefined;
12
11
  })[];
@@ -6,29 +6,20 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ import { DIALECTS } from '@adonisjs/presets/lucid';
9
10
  /**
10
- * List of first party databases (lucid)
11
+ * List of known databases that can be used with Lucid
11
12
  */
12
13
  export const databases = [
14
+ ...Object.keys(DIALECTS).map((dialect) => {
15
+ return {
16
+ name: dialect,
17
+ message: DIALECTS[dialect].name,
18
+ };
19
+ }),
13
20
  {
14
- name: 'SQLite',
15
- alias: 'sqlite',
16
- },
17
- {
18
- name: 'MySQL / MariaDB',
19
- alias: 'mysql',
20
- },
21
- {
22
- name: 'PostgreSQL',
23
- alias: 'postgres',
24
- },
25
- {
26
- name: 'Microsoft SQL Server',
27
- alias: 'mssql',
28
- },
29
- {
30
- name: 'Skip',
31
- hint: 'I want to configures the Lucid package by myself.',
32
- alias: undefined,
21
+ name: 'skip',
22
+ message: 'Skip',
23
+ hint: 'I want to configure Lucid manually',
33
24
  },
34
25
  ];
@@ -2,11 +2,11 @@
2
2
  * List of adapters for configuring Inertia
3
3
  */
4
4
  export declare const adapters: ({
5
+ message: string;
5
6
  name: string;
6
- alias: string;
7
7
  hint?: undefined;
8
8
  } | {
9
9
  name: string;
10
+ message: string;
10
11
  hint: string;
11
- alias: undefined;
12
12
  })[];
@@ -11,24 +11,24 @@
11
11
  */
12
12
  export const adapters = [
13
13
  {
14
- name: 'Vue 3',
15
- alias: 'vue',
14
+ message: 'Vue 3',
15
+ name: 'vue',
16
16
  },
17
17
  {
18
- name: 'React',
19
- alias: 'react',
18
+ message: 'React',
19
+ name: 'react',
20
20
  },
21
21
  {
22
- name: 'Svelte',
23
- alias: 'svelte',
22
+ message: 'Svelte',
23
+ name: 'svelte',
24
24
  },
25
25
  {
26
- name: 'Solid.js',
27
- alias: 'solid',
26
+ message: 'Solid.js',
27
+ name: 'solid',
28
28
  },
29
29
  {
30
- name: 'Skip',
31
- hint: 'I want to configure Inertia by myself.',
32
- alias: undefined,
30
+ name: 'skip',
31
+ message: 'Skip',
32
+ hint: 'I want to configure Interia manually',
33
33
  },
34
34
  ];
@@ -31,7 +31,7 @@ export const templates = [
31
31
  {
32
32
  name: 'Inertia Starter Kit',
33
33
  alias: 'inertia',
34
- hint: 'AdonisJS app with Inertia.JS and your favorite frontend framework',
34
+ hint: 'Inertia app with a frontend framework of your choice',
35
35
  source: 'github:adonisjs/inertia-starter-kit',
36
36
  },
37
37
  ];
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "create-adonisjs",
3
3
  "description": "Scaffold new AdonisJS applications using starter kits",
4
- "version": "2.2.1",
4
+ "version": "2.4.0",
5
+ "engines": {
6
+ "node": ">=18.16.0"
7
+ },
5
8
  "main": "build/index.js",
6
9
  "type": "module",
7
10
  "files": [
@@ -17,9 +20,6 @@
17
20
  "exports": {
18
21
  ".": "./build/index.js"
19
22
  },
20
- "engines": {
21
- "node": ">=18.16.0"
22
- },
23
23
  "scripts": {
24
24
  "clean": "del-cli build",
25
25
  "typecheck": "tsc --noEmit",
@@ -41,36 +41,31 @@
41
41
  "@japa/assert": "^3.0.0",
42
42
  "@japa/file-system": "^2.3.0",
43
43
  "@japa/runner": "^3.1.4",
44
- "@swc/core": "^1.4.16",
44
+ "@swc/core": "^1.6.1",
45
45
  "@types/gradient-string": "^1.1.6",
46
- "@types/node": "^20.12.7",
46
+ "@types/node": "^20.14.5",
47
47
  "@types/which-pm-runs": "^1.0.2",
48
- "c8": "^9.1.0",
48
+ "c8": "^10.1.2",
49
49
  "copyfiles": "^2.4.1",
50
50
  "del-cli": "^5.0.0",
51
51
  "eslint": "^8.56.0",
52
- "prettier": "^3.2.5",
53
- "release-it": "^17.2.0",
52
+ "prettier": "^3.3.2",
53
+ "release-it": "^17.3.0",
54
54
  "ts-node": "^10.9.2",
55
55
  "typescript": "^5.4.5"
56
56
  },
57
57
  "dependencies": {
58
- "@adonisjs/ace": "^13.0.0",
59
- "@antfu/install-pkg": "^0.3.2",
60
- "execa": "^8.0.1",
58
+ "@adonisjs/ace": "^13.1.0",
59
+ "@adonisjs/presets": "^2.6.1",
60
+ "@antfu/install-pkg": "^0.3.3",
61
+ "execa": "^9.2.0",
61
62
  "giget": "^1.2.3",
62
63
  "gradient-string": "^2.0.2",
63
64
  "which-pm-runs": "^1.1.0"
64
65
  },
65
66
  "author": "julien-r44,virk",
66
67
  "license": "MIT",
67
- "keywords": [
68
- "adonisjs",
69
- "create-adonisjs-app"
70
- ],
71
- "directories": {
72
- "test": "tests"
73
- },
68
+ "homepage": "https://github.com/adonisjs/create-adonisjs#readme",
74
69
  "repository": {
75
70
  "type": "git",
76
71
  "url": "git+https://github.com/adonisjs/create-adonisjs.git"
@@ -78,7 +73,13 @@
78
73
  "bugs": {
79
74
  "url": "https://github.com/adonisjs/create-adonisjs/issues"
80
75
  },
81
- "homepage": "https://github.com/adonisjs/create-adonisjs#readme",
76
+ "keywords": [
77
+ "adonisjs",
78
+ "create-adonisjs-app"
79
+ ],
80
+ "directories": {
81
+ "test": "tests"
82
+ },
82
83
  "eslintConfig": {
83
84
  "extends": "@adonisjs/eslint-config/package"
84
85
  },
@@ -104,11 +105,6 @@
104
105
  "tagAnnotation": "v${version}",
105
106
  "tagName": "v${version}"
106
107
  },
107
- "hooks": {
108
- "before:init": [
109
- "npm test"
110
- ]
111
- },
112
108
  "github": {
113
109
  "release": true,
114
110
  "releaseName": "v${version}",