create-adonisjs 2.2.0 → 2.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/commands/main.js +20 -24
- package/build/src/auth_guards.d.ts +4 -8
- package/build/src/auth_guards.js +12 -14
- package/build/src/databases.d.ts +4 -5
- package/build/src/databases.js +11 -20
- package/build/src/inertia_adapters.d.ts +2 -2
- package/build/src/inertia_adapters.js +11 -11
- package/build/src/templates.js +1 -1
- package/package.json +43 -36
package/build/commands/main.js
CHANGED
|
@@ -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
|
|
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
|
|
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('
|
|
119
|
-
this.db =
|
|
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('
|
|
131
|
-
this.authGuard =
|
|
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('
|
|
140
|
-
this.adapter =
|
|
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,7 +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
|
|
148
|
+
this.ssr = await this.prompt.confirm('Do you want to setup server-side rendering with Inertia');
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
@@ -153,9 +153,8 @@ export class CreateNewApp extends BaseCommand {
|
|
|
153
153
|
*/
|
|
154
154
|
async #promptForInstallingDeps() {
|
|
155
155
|
if (this.install === undefined) {
|
|
156
|
-
this.install = await this.prompt.confirm(`Do you want
|
|
156
|
+
this.install = await this.prompt.confirm(`Do you want to install dependencies using "${this.packageManager}"`, {
|
|
157
157
|
default: true,
|
|
158
|
-
hint: "(If not, you'll need to configure guards and database manually)",
|
|
159
158
|
});
|
|
160
159
|
}
|
|
161
160
|
}
|
|
@@ -208,7 +207,6 @@ export class CreateNewApp extends BaseCommand {
|
|
|
208
207
|
* Configures the Lucid package
|
|
209
208
|
*/
|
|
210
209
|
async #configureLucid() {
|
|
211
|
-
this.db = this.db || 'sqlite';
|
|
212
210
|
const argv = ['ace', 'configure', '@adonisjs/lucid', '--db', this.db, '--install'];
|
|
213
211
|
if (this.verbose) {
|
|
214
212
|
argv.push('--verbose');
|
|
@@ -234,7 +232,6 @@ export class CreateNewApp extends BaseCommand {
|
|
|
234
232
|
* Configures the Auth package
|
|
235
233
|
*/
|
|
236
234
|
async #configureAuth() {
|
|
237
|
-
this.authGuard = this.authGuard || 'session';
|
|
238
235
|
/**
|
|
239
236
|
* Install the session package when using api starter kit with session
|
|
240
237
|
* guard. This needs to be done, since the api starter kit does
|
|
@@ -256,7 +253,6 @@ export class CreateNewApp extends BaseCommand {
|
|
|
256
253
|
* Configures the Inertia package
|
|
257
254
|
*/
|
|
258
255
|
async #configureInertia() {
|
|
259
|
-
this.adapter = this.adapter || 'vue';
|
|
260
256
|
const argv = [
|
|
261
257
|
'ace',
|
|
262
258
|
'configure',
|
|
@@ -306,19 +302,19 @@ export class CreateNewApp extends BaseCommand {
|
|
|
306
302
|
* and installing dependencies
|
|
307
303
|
*/
|
|
308
304
|
const configureLucid = [WEB_STARTER_KIT, API_STARTER_KIT, INERTIA_STARTER_KIT].includes(this.kit || '') &&
|
|
309
|
-
this.db !==
|
|
305
|
+
this.db !== 'skip' &&
|
|
310
306
|
this.install !== false;
|
|
311
307
|
/**
|
|
312
308
|
* Configure auth when using our own starter kits
|
|
313
309
|
* and installing dependencies
|
|
314
310
|
*/
|
|
315
311
|
const configureAuth = [WEB_STARTER_KIT, API_STARTER_KIT, INERTIA_STARTER_KIT].includes(this.kit || '') &&
|
|
316
|
-
this.authGuard !==
|
|
312
|
+
this.authGuard !== 'skip' &&
|
|
317
313
|
this.install !== false;
|
|
318
314
|
/**
|
|
319
315
|
* Configure inertia when using our inertia starter kit
|
|
320
316
|
*/
|
|
321
|
-
const configureInertia = this.kit === INERTIA_STARTER_KIT && this.
|
|
317
|
+
const configureInertia = this.kit === INERTIA_STARTER_KIT && this.adapter !== 'skip' && this.install !== false;
|
|
322
318
|
tasks
|
|
323
319
|
.add('Download starter kit', async (task) => {
|
|
324
320
|
task.update(`Downloading "${this.kit}"`);
|
|
@@ -440,19 +436,19 @@ __decorate([
|
|
|
440
436
|
], CreateNewApp.prototype, "kit", void 0);
|
|
441
437
|
__decorate([
|
|
442
438
|
flags.string({
|
|
443
|
-
description: '
|
|
439
|
+
description: 'Auth token to download private repositories',
|
|
444
440
|
alias: 't',
|
|
445
441
|
})
|
|
446
442
|
], CreateNewApp.prototype, "token", void 0);
|
|
447
443
|
__decorate([
|
|
448
444
|
flags.boolean({
|
|
449
|
-
description: '
|
|
445
|
+
description: 'Force install or skip dependencies installation',
|
|
450
446
|
showNegatedVariantInHelp: true,
|
|
451
447
|
})
|
|
452
448
|
], CreateNewApp.prototype, "install", void 0);
|
|
453
449
|
__decorate([
|
|
454
450
|
flags.boolean({
|
|
455
|
-
description: 'Init
|
|
451
|
+
description: 'Init git repository',
|
|
456
452
|
})
|
|
457
453
|
], CreateNewApp.prototype, "gitInit", void 0);
|
|
458
454
|
__decorate([
|
|
@@ -468,17 +464,17 @@ __decorate([
|
|
|
468
464
|
], CreateNewApp.prototype, "db", void 0);
|
|
469
465
|
__decorate([
|
|
470
466
|
flags.string({
|
|
471
|
-
description: 'Define the authentication guard
|
|
467
|
+
description: 'Define the authentication guard with the Auth package',
|
|
472
468
|
})
|
|
473
469
|
], CreateNewApp.prototype, "authGuard", void 0);
|
|
474
470
|
__decorate([
|
|
475
471
|
flags.string({
|
|
476
|
-
description: 'Define the Inertia frontend adapter
|
|
472
|
+
description: 'Define the Inertia frontend adapter',
|
|
477
473
|
})
|
|
478
474
|
], CreateNewApp.prototype, "adapter", void 0);
|
|
479
475
|
__decorate([
|
|
480
476
|
flags.boolean({
|
|
481
|
-
description: '
|
|
477
|
+
description: 'Enable SSR for Inertia',
|
|
482
478
|
})
|
|
483
479
|
], CreateNewApp.prototype, "ssr", void 0);
|
|
484
480
|
__decorate([
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* List of
|
|
2
|
+
* List of known authentication guards
|
|
3
3
|
*/
|
|
4
|
-
export declare const authGuards:
|
|
4
|
+
export declare const authGuards: {
|
|
5
5
|
name: string;
|
|
6
|
-
|
|
6
|
+
message: string;
|
|
7
7
|
hint: string;
|
|
8
|
-
}
|
|
9
|
-
name: string;
|
|
10
|
-
alias: undefined;
|
|
11
|
-
hint: string;
|
|
12
|
-
})[];
|
|
8
|
+
}[];
|
package/build/src/auth_guards.js
CHANGED
|
@@ -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
|
|
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: '
|
|
15
|
-
|
|
16
|
-
hint: '
|
|
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
|
];
|
package/build/src/databases.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* List of
|
|
2
|
+
* List of known databases that can be used with Lucid
|
|
3
3
|
*/
|
|
4
4
|
export declare const databases: ({
|
|
5
|
-
name:
|
|
6
|
-
|
|
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
|
})[];
|
package/build/src/databases.js
CHANGED
|
@@ -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
|
|
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: '
|
|
15
|
-
|
|
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
|
];
|
|
@@ -11,24 +11,24 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export const adapters = [
|
|
13
13
|
{
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
message: 'Vue 3',
|
|
15
|
+
name: 'vue',
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
message: 'React',
|
|
19
|
+
name: 'react',
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
message: 'Svelte',
|
|
23
|
+
name: 'svelte',
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
message: 'Solid.js',
|
|
27
|
+
name: 'solid',
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
name: '
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
name: 'skip',
|
|
31
|
+
message: 'Skip',
|
|
32
|
+
hint: 'I want to configure Interia manually',
|
|
33
33
|
},
|
|
34
34
|
];
|
package/build/src/templates.js
CHANGED
|
@@ -31,7 +31,7 @@ export const templates = [
|
|
|
31
31
|
{
|
|
32
32
|
name: 'Inertia Starter Kit',
|
|
33
33
|
alias: 'inertia',
|
|
34
|
-
hint: '
|
|
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.
|
|
4
|
+
"version": "2.3.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",
|
|
@@ -30,47 +30,42 @@
|
|
|
30
30
|
"test": "c8 npm run quick:test",
|
|
31
31
|
"prebuild": "npm run lint && npm run clean",
|
|
32
32
|
"build": "tsc",
|
|
33
|
-
"release": "
|
|
33
|
+
"release": "release-it",
|
|
34
34
|
"version": "npm run build",
|
|
35
35
|
"prepublishOnly": "npm run build"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@adonisjs/eslint-config": "^1.
|
|
39
|
-
"@adonisjs/prettier-config": "^1.
|
|
40
|
-
"@adonisjs/tsconfig": "^1.
|
|
41
|
-
"@japa/assert": "^
|
|
42
|
-
"@japa/file-system": "^2.
|
|
43
|
-
"@japa/runner": "^3.1.
|
|
44
|
-
"@swc/core": "^1.
|
|
45
|
-
"@types/gradient-string": "^1.1.
|
|
46
|
-
"@types/node": "^20.
|
|
38
|
+
"@adonisjs/eslint-config": "^1.3.0",
|
|
39
|
+
"@adonisjs/prettier-config": "^1.3.0",
|
|
40
|
+
"@adonisjs/tsconfig": "^1.3.0",
|
|
41
|
+
"@japa/assert": "^3.0.0",
|
|
42
|
+
"@japa/file-system": "^2.3.0",
|
|
43
|
+
"@japa/runner": "^3.1.4",
|
|
44
|
+
"@swc/core": "^1.6.1",
|
|
45
|
+
"@types/gradient-string": "^1.1.6",
|
|
46
|
+
"@types/node": "^20.14.5",
|
|
47
47
|
"@types/which-pm-runs": "^1.0.2",
|
|
48
|
-
"c8": "^
|
|
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
|
-
"
|
|
53
|
-
"
|
|
52
|
+
"prettier": "^3.3.2",
|
|
53
|
+
"release-it": "^17.3.0",
|
|
54
54
|
"ts-node": "^10.9.2",
|
|
55
|
-
"typescript": "^5.
|
|
55
|
+
"typescript": "^5.4.5"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@adonisjs/ace": "^13.
|
|
59
|
-
"@
|
|
60
|
-
"
|
|
61
|
-
"
|
|
58
|
+
"@adonisjs/ace": "^13.1.0",
|
|
59
|
+
"@adonisjs/presets": "^2.6.1",
|
|
60
|
+
"@antfu/install-pkg": "^0.3.3",
|
|
61
|
+
"execa": "^9.2.0",
|
|
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
|
-
"
|
|
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
|
-
"
|
|
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
|
},
|
|
@@ -87,12 +88,6 @@
|
|
|
87
88
|
"access": "public",
|
|
88
89
|
"tag": "latest"
|
|
89
90
|
},
|
|
90
|
-
"np": {
|
|
91
|
-
"message": "chore(release): %s",
|
|
92
|
-
"tag": "latest",
|
|
93
|
-
"branch": "main",
|
|
94
|
-
"anyBranch": false
|
|
95
|
-
},
|
|
96
91
|
"c8": {
|
|
97
92
|
"reporter": [
|
|
98
93
|
"text",
|
|
@@ -103,5 +98,17 @@
|
|
|
103
98
|
"tmp/**",
|
|
104
99
|
"bin/**"
|
|
105
100
|
]
|
|
101
|
+
},
|
|
102
|
+
"release-it": {
|
|
103
|
+
"git": {
|
|
104
|
+
"commitMessage": "chore(release): ${version}",
|
|
105
|
+
"tagAnnotation": "v${version}",
|
|
106
|
+
"tagName": "v${version}"
|
|
107
|
+
},
|
|
108
|
+
"github": {
|
|
109
|
+
"release": true,
|
|
110
|
+
"releaseName": "v${version}",
|
|
111
|
+
"web": true
|
|
112
|
+
}
|
|
106
113
|
}
|
|
107
114
|
}
|