create-adonisjs 1.2.2-1 → 2.1.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
@@ -1,9 +1,11 @@
1
1
  # create-adonisjs
2
+
2
3
  Scaffold a new AdonisJS application using starter kits
3
4
 
4
5
  <br />
5
6
 
6
7
  [![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]
8
+
7
9
  ## Starter kits
8
10
 
9
11
  You can use between one of the following official starter kits, or bring your own using the `--kit` flag.
@@ -39,39 +41,39 @@ This argument is optional and the command will prompt you to enter the directory
39
41
 
40
42
  > **Note** - The directory must be empty otherwise the command will fail.
41
43
 
42
- ### `--kit`
44
+ ### `--kit` (Default: Triggers prompt for selection)
43
45
 
44
46
  If you want to use your own starter kit hosted on Github, Gitlab, or Bitbucket, you can use the `--kit` flag to define the repo URL.
45
47
 
46
48
  ```sh
47
- npm init adonisjs -- -K="github:github_user/repo"
49
+ npm init adonisjs -- --kit="github:github_user/repo"
48
50
 
49
51
  # Download from GitLab
50
- npm init adonisjs -- -K="gitlab:user/repo"
52
+ npm init adonisjs -- --kit="gitlab:user/repo"
51
53
 
52
54
  # Download from BitBucket
53
- npm init adonisjs -- -K="bitbucket:user/repo"
55
+ npm init adonisjs -- --kit="bitbucket:user/repo"
54
56
  ```
55
57
 
56
58
  You can also pass specify the branch or tag name as follows:
57
59
 
58
60
  ```sh
59
61
  # Branch name
60
- npm init adonisjs -- -K="github:github_user/repo#branch-name"
62
+ npm init adonisjs -- --kit="github:github_user/repo#branch-name"
61
63
 
62
64
  # Tag name
63
- npm init adonisjs -- -K="github:github_user/repo#v1.0.0"
65
+ npm init adonisjs -- --kit="github:github_user/repo#v1.0.0"
64
66
  ```
65
67
 
66
- ### `--token`
68
+ ### `--token` (Default: undefined)
67
69
 
68
70
  If you are using a custom starter kit hosted on a private repository, then you can pass the authentication token as follows:
69
71
 
70
72
  ```sh
71
- npm init adonisjs -- -K="github:github_user/repo" -t="github_token"
73
+ npm init adonisjs -- --kit="github:github_user/repo" --token="github_token"
72
74
  ```
73
75
 
74
- ### `--pkg`
76
+ ### `--pkg` (Default: Auto detects)
75
77
 
76
78
  We are trying to detect the package manager used by your project. However, if you want to force a specific package manager, then you can pass it as follows:
77
79
 
@@ -79,14 +81,46 @@ We are trying to detect the package manager used by your project. However, if yo
79
81
  npm init adonisjs -- --pkg="yarn"
80
82
  ```
81
83
 
84
+ ### `--auth-guard` (Default: session)
85
+
86
+ Specify a custom auth guard to use when using the `api` stater kit. One of the following options are allowed
87
+
88
+ - `session` (Default)
89
+ - `access_tokens`
90
+
91
+ ```sh
92
+ npm init adonisjs -- --kit="api" --auth-guard="access_tokens"
93
+ ```
94
+
95
+ ### `--db` (Default: sqlite)
96
+
97
+ Specify the database dialect to configure with Lucid. One of the following options are allowd.
98
+
99
+ - `sqlite` (Default)
100
+ - `mysql`
101
+ - `mssql`
102
+ - `postgres`
103
+
104
+ ```sh
105
+ npm init adonisjs -- --kit="web" --db="mysql"
106
+ ```
107
+
82
108
  ### Other options
83
109
 
84
- | Option | Description |
85
- |-------------------|-----------------------------------|
86
- | `--install` | Install dependencies. |
87
- | `--git-init` | Initialize git repository. |
88
- | `--no-install` | Don't install dependencies. |
89
- | `--no-git-init` | Don't initialize git repository. |
110
+ | Option | Description |
111
+ | -------------- | --------------------------------------------------------------------------------------- |
112
+ | `--install` | Install dependencies. A prompt will be shown when the flag is not mentioned explicitly. |
113
+ | `--git-init` | Initialize git repository. |
114
+ | `--no-install` | Explicitly opt out from installing dependencies and skip the prompt |
115
+ | `--verbose` | Enable verbose mode to display all logs |
116
+
117
+ ## Debugging errors
118
+
119
+ If creating a new project fails, then you must re-run the same command with the `--verbose` flag to view all the logs.
120
+
121
+ ```sh
122
+ npm init adonisjs -- --verbose
123
+ ```
90
124
 
91
125
  ## Contributing
92
126
 
@@ -1,4 +1,7 @@
1
1
  import { BaseCommand } from '@adonisjs/ace';
2
+ /**
3
+ * Creates a new AdonisJS application and configures it
4
+ */
2
5
  export declare class CreateNewApp extends BaseCommand {
3
6
  #private;
4
7
  static commandName: string;
@@ -21,21 +24,31 @@ export declare class CreateNewApp extends BaseCommand {
21
24
  */
22
25
  token?: string;
23
26
  /**
24
- * Skip packages installation
27
+ * Auto install packages after creating the project. Display prompt
28
+ * when flag is not mentioned.
25
29
  */
26
30
  install?: boolean;
27
31
  /**
28
- * Skip git initialization
32
+ * Init git repository. Do not init when flag is not mentioned.
29
33
  */
30
34
  gitInit?: boolean;
31
35
  /**
32
- * Package manager to use
36
+ * Package manager to use. Detect package manager when flag is not
37
+ * mentioned.
33
38
  */
34
39
  packageManager: string;
35
40
  /**
36
- * Execute the `run` method and catch errors
41
+ * Database dialect for Lucid. Defaults to "sqlite"
37
42
  */
38
- exec(): Promise<void>;
43
+ db?: string;
44
+ /**
45
+ * Auth guard for auth package. Defaults to "session"
46
+ */
47
+ authGuard?: string;
48
+ /**
49
+ * Execute tasks in verbose mode. Defaults to false.
50
+ */
51
+ verbose?: boolean;
39
52
  /**
40
53
  * Main method
41
54
  */
@@ -12,205 +12,317 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
12
12
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
13
13
  return c > 3 && r && Object.defineProperty(target, key, r), r;
14
14
  };
15
- import { execa } from 'execa';
16
15
  import { cwd } from 'node:process';
17
16
  import { existsSync } from 'node:fs';
18
17
  import gradient from 'gradient-string';
19
18
  import { downloadTemplate } from 'giget';
19
+ import { execa } from 'execa';
20
20
  import detectPackageManager from 'which-pm-runs';
21
- import { isAbsolute, join, relative } from 'node:path';
21
+ import { installPackage } from '@antfu/install-pkg';
22
22
  import { BaseCommand, args, flags } from '@adonisjs/ace';
23
+ import { basename, isAbsolute, join, relative } from 'node:path';
23
24
  import { copyFile, readFile, unlink, writeFile } from 'node:fs/promises';
24
25
  import { templates } from '../src/templates.js';
26
+ /**
27
+ * Creates a new AdonisJS application and configures it
28
+ */
25
29
  export class CreateNewApp extends BaseCommand {
26
30
  static commandName = 'create-adonisjs';
27
31
  static description = 'Create a new AdonisJS application using a starter kit';
28
32
  /**
29
- * Whether or not dependencies were installed
33
+ * Runs bash command using execa with shared defaults
30
34
  */
31
- #shouldInstallDependencies;
35
+ async #runBashCommand(file, cliArgs, options) {
36
+ await execa(file, cliArgs, {
37
+ cwd: this.destination,
38
+ preferLocal: true,
39
+ windowsHide: false,
40
+ buffer: false,
41
+ stdio: this.verbose === true ? 'inherit' : 'ignore',
42
+ ...options,
43
+ });
44
+ }
32
45
  /**
33
- * Print the title
46
+ * Prints AdonisJS as ASCII art
34
47
  */
35
- #printTitle() {
36
- const title = Buffer.from('CiAgICBfX18gICAgICAgX18gICAgICAgICAgICBfICAgICAgICAgIF8gICAgIAogICAvICAgfCBfX19fLyAvX19fICBfX19fICAoXylfX19fICAgIChfKV9fX18KICAvIC98IHwvIF9fICAvIF9fIFwvIF9fIFwvIC8gX19fLyAgIC8gLyBfX18vCiAvIF9fXyAvIC9fLyAvIC9fLyAvIC8gLyAvIChfXyAgKSAgIC8gKF9fICApIAovXy8gIHxfXF9fLF8vXF9fX18vXy8gL18vXy9fX19fKF8pXy8gL19fX18vICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvX19fLyAgICAgICAg==', 'base64').toString();
48
+ #printBannerArt() {
49
+ const title = Buffer.from('ICAgICBfICAgICAgIF8gICAgICAgICAgICAgXyAgICAgICAgIF8gX19fXyAgCiAgICAvIFwgICBfX3wgfCBfX18gIF8gX18gKF8pX19fICAgIHwgLyBfX198IAogICAvIF8gXCAvIF9gIHwvIF8gXHwgJ18gXHwgLyBfX3xfICB8IFxfX18gXCAKICAvIF9fXyBcIChffCB8IChfKSB8IHwgfCB8IFxfXyBcIHxffCB8X19fKSB8CiAvXy8gICBcX1xfXyxffFxfX18vfF98IHxffF98X19fL1xfX18vfF9fX18vIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA=', 'base64').toString();
37
50
  this.logger.log('');
38
- this.logger.log(`${gradient.mind(title)}`);
51
+ this.logger.log(`${gradient.mind.multiline(title)}`);
39
52
  this.logger.log('');
40
53
  }
54
+ /**
55
+ * Print the success message
56
+ */
57
+ #printSuccessMessage() {
58
+ this.logger.log('');
59
+ this.ui
60
+ .instructions()
61
+ .heading('Your AdonisJS project has been created successfully!')
62
+ .add(this.colors.cyan('cd ' + relative(cwd(), this.destination)))
63
+ .add(this.colors.cyan(`${this.packageManager} run dev`))
64
+ .add(this.colors.cyan('Open http://localhost:3333'))
65
+ .add('')
66
+ .add(`Have any questions?`)
67
+ .add(`Join our Discord server - ${this.colors.yellow('https://discord.gg/vDcEjq6')}`)
68
+ .render();
69
+ }
41
70
  /**
42
71
  * Prompt for the destination directory
43
72
  */
44
- async #setDestination() {
73
+ async #promptForDestination() {
45
74
  if (!this.destination) {
46
- this.destination = await this.prompt.ask('Where should we create the project?', {
47
- default: `./` + relative(cwd(), './my-adonisjs-app'),
48
- result(dir) {
49
- return isAbsolute(dir) ? dir : join(cwd(), dir);
50
- },
75
+ this.destination = await this.prompt.ask('Where should we create your new project?', {
76
+ default: './my-adonisjs-app',
51
77
  });
52
78
  }
79
+ this.destination = isAbsolute(this.destination)
80
+ ? this.destination
81
+ : join(cwd(), this.destination);
53
82
  }
54
83
  /**
55
- * Prompt and download the selected template
84
+ * Prompt to configure a starter kit
56
85
  */
57
- async #downloadTemplate() {
86
+ async #promptForStarterKit() {
58
87
  if (!this.kit) {
59
- const template = await this.prompt.choice('Select the template you want to use', templates);
88
+ /**
89
+ * Display prompt when "kit" flag is not used.
90
+ */
91
+ const template = await this.prompt.choice('Which starter kit would you like to use?', templates);
60
92
  this.kit = templates.find((t) => t.name === template).source;
61
93
  }
62
- const spinner = this.logger.await(`Downloading ${this.kit} template`).start();
63
- try {
64
- await downloadTemplate(this.kit, { dir: this.destination, auth: this.token });
65
- spinner.update('Template downloaded successfully').stop();
66
- }
67
- catch (error) {
68
- spinner.update('Failed to download template').stop();
69
- throw error;
94
+ else {
95
+ /**
96
+ * Allowing users to mention aliases via the CLI flag.
97
+ */
98
+ const matchingTemplatingFromAlias = templates.find((t) => t.alias === this.kit);
99
+ if (matchingTemplatingFromAlias) {
100
+ this.kit = matchingTemplatingFromAlias.source;
101
+ }
70
102
  }
71
103
  }
72
104
  /**
73
- * Install dependencies with the detected package manager
105
+ * Prompt to check if we should install dependencies?
74
106
  */
75
- async #installDependencies() {
76
- if (this.install === false) {
77
- return;
78
- }
79
- this.#shouldInstallDependencies =
80
- this.install ||
81
- (await this.prompt.confirm('Do you want to install dependencies?', {
82
- hint: this.packageManager + ' will be used',
83
- default: true,
84
- }));
85
- if (!this.#shouldInstallDependencies) {
86
- return;
87
- }
88
- const spinner = this.logger
89
- .await(`Installing dependencies using ${this.packageManager}`)
90
- .start();
91
- try {
92
- await execa(this.packageManager, ['install'], { cwd: this.destination });
93
- spinner.update('Dependencies installed successfully').stop();
94
- }
95
- catch (error) {
96
- spinner.stop();
97
- this.error = `Failed to install dependencies :\n${error.stderr}`;
98
- throw error;
99
- }
100
- }
101
- /**
102
- * Init git repository inside the destination directory
103
- */
104
- async #initGitRepo() {
105
- if (this.gitInit === false) {
106
- return;
107
- }
108
- const shouldInit = this.gitInit ||
109
- (await this.prompt.confirm('Do you want to initialize a git repository?', {
107
+ async #promptForInstallingDeps() {
108
+ if (this.install === undefined) {
109
+ this.install = await this.prompt.confirm(`Do you want us to install dependencies using "${this.packageManager}"?`, {
110
110
  default: true,
111
- }));
112
- if (!shouldInit) {
113
- return;
114
- }
115
- try {
116
- await execa('git', ['init'], { cwd: this.destination });
117
- this.logger.success('Git repository initialized successfully');
118
- }
119
- catch (error) {
120
- this.error = `Failed to initialize git repository :\n${error.stderr}`;
121
- throw error;
111
+ });
122
112
  }
123
113
  }
124
114
  /**
125
- * Replace the package.json name with the destination directory name
115
+ * Replace the package.json name with the destination directory name.
116
+ * Errors are ignored.
126
117
  */
127
118
  async #replacePackageJsonName() {
128
119
  const pkgJsonPath = join(this.destination, 'package.json');
129
120
  const pkgJson = await readFile(pkgJsonPath, 'utf-8').then(JSON.parse);
130
- pkgJson.name = relative(cwd(), this.destination);
121
+ pkgJson.name = basename(this.destination);
131
122
  await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
132
123
  }
124
+ /**
125
+ * Optionally removes readme file. Errors are ignored
126
+ */
127
+ async #removeReadmeFile() {
128
+ await unlink(join(this.destination, 'README.md'));
129
+ }
130
+ /**
131
+ * Optionally remove existing lock file. Errors are ignored
132
+ */
133
+ async #removeLockFile() {
134
+ await Promise.allSettled([
135
+ unlink(join(this.destination, 'package-lock.json')),
136
+ unlink(join(this.destination, 'yarn.lock')),
137
+ unlink(join(this.destination, 'pnpm-lock.yaml')),
138
+ ]);
139
+ }
133
140
  /**
134
141
  * If starter template has an `.env.example` file, then copy it to `.env`
135
142
  */
136
143
  async #copyEnvExampleFile() {
144
+ const envPath = join(this.destination, '.env');
137
145
  const envExamplePath = join(this.destination, '.env.example');
138
- const hasEnvExample = existsSync(envExamplePath);
139
- if (!hasEnvExample) {
140
- return;
146
+ if (existsSync(envExamplePath)) {
147
+ await copyFile(envExamplePath, envPath);
141
148
  }
142
- const envPath = join(this.destination, '.env');
143
- await copyFile(envExamplePath, envPath);
144
149
  }
145
150
  /**
146
- * Generate a fresh app key
151
+ * Generate a fresh app key. Errors are ignored
147
152
  */
148
153
  async #generateFreshAppKey() {
149
- if (!this.#shouldInstallDependencies) {
154
+ if (this.install === false) {
150
155
  return;
151
156
  }
152
- try {
153
- await execa('node', ['ace', 'generate:key'], { cwd: this.destination });
154
- }
155
- catch (error) {
156
- this.logger.warning('Failed to generate app key : ' + error.stderr);
157
- }
157
+ await this.#runBashCommand('node', ['ace', 'generate:key']);
158
158
  }
159
159
  /**
160
- * Optionally removes readme file
160
+ * Configures the Lucid package
161
161
  */
162
- async #removeReadmeFile() {
163
- try {
164
- await unlink(join(this.destination, 'README.md'));
162
+ async #configureLucid() {
163
+ this.db = this.db || 'sqlite';
164
+ const argv = ['ace', 'configure', '@adonisjs/lucid', '--db', this.db, '--install'];
165
+ if (this.verbose) {
166
+ argv.push('--verbose');
165
167
  }
166
- catch { }
168
+ await this.#runBashCommand('node', argv);
167
169
  }
168
170
  /**
169
- * Print the success message
171
+ * Configures the session package
170
172
  */
171
- #printSuccessMessage() {
172
- this.logger.log('');
173
- this.ui
174
- .instructions()
175
- .heading('Your AdonisJS project has been created successfully!')
176
- .add(this.colors.cyan('cd ' + relative(cwd(), this.destination)))
177
- .add(this.colors.cyan(`${this.packageManager} run dev`))
178
- .add(this.colors.cyan('Open http://localhost:3333'))
179
- .add('')
180
- .add(`Have any questions?`)
181
- .add(`Join our Discord server - ${this.colors.yellow('https://discord.gg/vDcEjq6')}`)
182
- .render();
173
+ async #configureSession() {
174
+ await installPackage(['@adonisjs/session@latest'], {
175
+ cwd: this.destination,
176
+ packageManager: this.packageManager,
177
+ silent: !this.verbose,
178
+ });
179
+ const argv = ['ace', 'configure', '@adonisjs/session'];
180
+ if (this.verbose) {
181
+ argv.push('--verbose');
182
+ }
183
+ await this.#runBashCommand('node', argv);
183
184
  }
184
185
  /**
185
- * Execute the `run` method and catch errors
186
+ * Configures the Auth package
186
187
  */
187
- async exec() {
188
- this.hydrate();
189
- try {
190
- await this.run();
188
+ async #configureAuth() {
189
+ this.authGuard = this.authGuard || 'session';
190
+ /**
191
+ * Install the session package when using api starter kit with session
192
+ * guard. This needs to be done, since the api starter kit does
193
+ * not install the session package by default.
194
+ */
195
+ if (this.authGuard === 'session' && this.kit === 'github:adonisjs/api-starter-kit') {
196
+ await this.#configureSession();
191
197
  }
192
- catch (error) {
193
- this.logger.fatal(this.error || error.message);
194
- this.exitCode = 1;
198
+ /**
199
+ * Next configure the auth package
200
+ */
201
+ const argv = ['ace', 'configure', '@adonisjs/auth', '--guard', this.authGuard];
202
+ if (this.verbose) {
203
+ argv.push('--verbose');
195
204
  }
205
+ await this.#runBashCommand('node', argv);
196
206
  }
197
207
  /**
198
208
  * Main method
199
209
  */
200
210
  async run() {
201
- if (!this.packageManager) {
202
- this.packageManager = detectPackageManager()?.name || 'npm';
211
+ this.packageManager = this.packageManager || detectPackageManager()?.name || 'npm';
212
+ /**
213
+ * Print ASCII art
214
+ */
215
+ this.#printBannerArt();
216
+ /**
217
+ * Display prompts
218
+ */
219
+ await this.#promptForDestination();
220
+ await this.#promptForStarterKit();
221
+ await this.#promptForInstallingDeps();
222
+ /**
223
+ * Create tasks instance for displaying
224
+ * actions as tasks
225
+ */
226
+ const tasks = this.ui.tasks({ verbose: this.verbose === true });
227
+ /**
228
+ * Configure lucid when using web or api starter kits
229
+ * and installing dependencies
230
+ */
231
+ const configureLucid = (this.kit === 'github:adonisjs/web-starter-kit' ||
232
+ this.kit === 'github:adonisjs/api-starter-kit') &&
233
+ this.install !== false;
234
+ /**
235
+ * Configure auth when using web or api starter kits
236
+ * and installing dependencies
237
+ */
238
+ const configureAuth = (this.kit === 'github:adonisjs/web-starter-kit' ||
239
+ this.kit === 'github:adonisjs/api-starter-kit') &&
240
+ this.install !== false;
241
+ tasks
242
+ .add('Download starter kit', async (task) => {
243
+ task.update(`Downloading "${this.kit}"`);
244
+ await downloadTemplate(this.kit, { dir: this.destination, auth: this.token });
245
+ await this.#removeLockFile();
246
+ return `Downloaded "${this.kit}"`;
247
+ })
248
+ .addIf(this.gitInit === true, 'Initialize git repository', async () => {
249
+ await this.#runBashCommand('git', ['init']);
250
+ return 'Initialized git repository';
251
+ })
252
+ .addIf(this.install !== false, 'Install packages', async (task) => {
253
+ const spinner = this.logger.await('installing dependencies', {
254
+ silent: this.verbose,
255
+ });
256
+ spinner.tap((line) => task.update(line));
257
+ spinner.start();
258
+ try {
259
+ await this.#runBashCommand(this.packageManager, ['install']);
260
+ return `Packages installed using "${this.packageManager}"`;
261
+ }
262
+ finally {
263
+ spinner.stop();
264
+ }
265
+ })
266
+ .add('Prepare application', async () => {
267
+ try {
268
+ await this.#replacePackageJsonName();
269
+ await this.#removeReadmeFile();
270
+ await this.#copyEnvExampleFile();
271
+ await this.#generateFreshAppKey();
272
+ return 'Application ready';
273
+ }
274
+ catch (error) {
275
+ if (this.verbose) {
276
+ this.logger.fatal(error);
277
+ }
278
+ return 'Unable to prepare application';
279
+ }
280
+ })
281
+ .addIf(configureLucid, 'Configure Lucid', async (task) => {
282
+ const spinner = this.logger.await('configuring @adonisjs/lucid', {
283
+ silent: this.verbose,
284
+ });
285
+ spinner.tap((line) => task.update(line));
286
+ spinner.start();
287
+ try {
288
+ await this.#configureLucid();
289
+ spinner.stop();
290
+ return `Lucid configured to use "${this.db}" database`;
291
+ }
292
+ catch (error) {
293
+ spinner.stop();
294
+ if (this.verbose) {
295
+ this.logger.fatal(error);
296
+ }
297
+ return `Unable to configure "@adonisjs/lucid"`;
298
+ }
299
+ })
300
+ .addIf(configureAuth, 'Configure Auth', async (task) => {
301
+ const spinner = this.logger.await('configuring @adonisjs/auth', {
302
+ silent: this.verbose,
303
+ });
304
+ spinner.tap((line) => task.update(line));
305
+ spinner.start();
306
+ try {
307
+ await this.#configureAuth();
308
+ spinner.stop();
309
+ return `Auth configured to use "${this.authGuard}" guard`;
310
+ }
311
+ catch (error) {
312
+ spinner.stop();
313
+ if (this.verbose) {
314
+ this.logger.fatal(error);
315
+ }
316
+ return `Unable to configure "@adonisjs/auth"`;
317
+ }
318
+ });
319
+ await tasks.run();
320
+ if (tasks.getState() === 'succeeded') {
321
+ this.#printSuccessMessage();
322
+ }
323
+ else {
324
+ this.exitCode = 1;
203
325
  }
204
- this.#printTitle();
205
- await this.#setDestination();
206
- await this.#downloadTemplate();
207
- await this.#installDependencies();
208
- await this.#initGitRepo();
209
- await this.#replacePackageJsonName();
210
- await this.#copyEnvExampleFile();
211
- await this.#generateFreshAppKey();
212
- await this.#removeReadmeFile();
213
- this.#printSuccessMessage();
214
326
  }
215
327
  }
216
328
  __decorate([
@@ -218,7 +330,7 @@ __decorate([
218
330
  ], CreateNewApp.prototype, "destination", void 0);
219
331
  __decorate([
220
332
  flags.string({
221
- description: 'Define path to a custom git repository',
333
+ description: 'Define path to a custom git repository to download the starter kit',
222
334
  alias: 'K',
223
335
  })
224
336
  ], CreateNewApp.prototype, "kit", void 0);
@@ -229,11 +341,37 @@ __decorate([
229
341
  })
230
342
  ], CreateNewApp.prototype, "token", void 0);
231
343
  __decorate([
232
- flags.boolean({ description: 'Packages installation' })
344
+ flags.boolean({
345
+ description: 'Install packages after creating the project',
346
+ showNegatedVariantInHelp: true,
347
+ })
233
348
  ], CreateNewApp.prototype, "install", void 0);
234
349
  __decorate([
235
- flags.boolean({ description: 'Git initialization' })
350
+ flags.boolean({
351
+ description: 'Init Git repository using the "git init" command',
352
+ })
236
353
  ], CreateNewApp.prototype, "gitInit", void 0);
237
354
  __decorate([
238
- flags.string({ description: 'Explicitly define the package manager to npm', flagName: 'pkg' })
355
+ flags.string({
356
+ description: 'Define the package manager to install dependencies',
357
+ flagName: 'pkg',
358
+ })
239
359
  ], CreateNewApp.prototype, "packageManager", void 0);
360
+ __decorate([
361
+ flags.string({
362
+ description: 'Define the database dialect to use with Lucid',
363
+ default: 'sqlite',
364
+ })
365
+ ], CreateNewApp.prototype, "db", void 0);
366
+ __decorate([
367
+ flags.string({
368
+ description: 'Define the authentication guard for the Auth package',
369
+ default: 'session',
370
+ })
371
+ ], CreateNewApp.prototype, "authGuard", void 0);
372
+ __decorate([
373
+ flags.boolean({
374
+ description: 'Execute tasks in verbose mode',
375
+ alias: 'v',
376
+ })
377
+ ], CreateNewApp.prototype, "verbose", void 0);
@@ -3,6 +3,7 @@
3
3
  */
4
4
  export declare const templates: {
5
5
  name: string;
6
+ alias: string;
6
7
  hint: string;
7
8
  source: string;
8
9
  }[];
@@ -12,17 +12,20 @@
12
12
  export const templates = [
13
13
  {
14
14
  name: 'Slim Starter Kit',
15
+ alias: 'slim',
15
16
  hint: 'A lean AdonisJS application with just the framework core',
16
17
  source: 'github:adonisjs/slim-starter-kit',
17
18
  },
18
19
  {
19
20
  name: 'Web Starter Kit',
21
+ alias: 'web',
20
22
  hint: 'Everything you need to build a server render app',
21
23
  source: 'github:adonisjs/web-starter-kit',
22
24
  },
23
- // {
24
- // name: 'API Starter Kit',
25
- // hint: 'AdonisJS app tailored for creating JSON APIs',
26
- // source: 'github:adonisjs/api-starter-kit',
27
- // },
25
+ {
26
+ name: 'API Starter Kit',
27
+ alias: 'api',
28
+ hint: 'AdonisJS app tailored for creating JSON APIs',
29
+ source: 'github:adonisjs/api-starter-kit',
30
+ },
28
31
  ];
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": "1.2.2-1",
4
+ "version": "2.1.0",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
7
7
  "files": [
@@ -35,29 +35,30 @@
35
35
  "prepublishOnly": "npm run build"
36
36
  },
37
37
  "devDependencies": {
38
- "@adonisjs/eslint-config": "^1.1.8",
39
- "@adonisjs/prettier-config": "^1.1.8",
40
- "@adonisjs/tsconfig": "^1.1.8",
41
- "@japa/assert": "^2.0.0-1",
42
- "@japa/file-system": "^2.0.0-1",
43
- "@japa/runner": "^3.0.0-5",
44
- "@swc/core": "1.3.82",
45
- "@types/gradient-string": "^1.1.2",
46
- "@types/node": "^20.4.1",
47
- "@types/which-pm-runs": "^1.0.0",
48
- "c8": "^8.0.0",
38
+ "@adonisjs/eslint-config": "^1.2.1",
39
+ "@adonisjs/prettier-config": "^1.2.1",
40
+ "@adonisjs/tsconfig": "^1.2.1",
41
+ "@japa/assert": "^2.1.0",
42
+ "@japa/file-system": "^2.2.0",
43
+ "@japa/runner": "^3.1.1",
44
+ "@swc/core": "^1.3.104",
45
+ "@types/gradient-string": "^1.1.5",
46
+ "@types/node": "^20.11.5",
47
+ "@types/which-pm-runs": "^1.0.2",
48
+ "c8": "^9.1.0",
49
49
  "copyfiles": "^2.4.1",
50
50
  "del-cli": "^5.0.0",
51
- "eslint": "^8.45.0",
52
- "np": "^8.0.4",
53
- "prettier": "^3.0.0",
54
- "ts-node": "^10.9.1",
55
- "typescript": "^5.1.6"
51
+ "eslint": "^8.56.0",
52
+ "np": "^9.2.0",
53
+ "prettier": "^3.2.4",
54
+ "ts-node": "^10.9.2",
55
+ "typescript": "^5.3.3"
56
56
  },
57
57
  "dependencies": {
58
- "@adonisjs/ace": "12.3.1-8",
58
+ "@adonisjs/ace": "^13.0.0",
59
+ "@antfu/install-pkg": "^0.3.1",
59
60
  "execa": "^8.0.1",
60
- "giget": "^1.1.2",
61
+ "giget": "^1.2.1",
61
62
  "gradient-string": "^2.0.2",
62
63
  "which-pm-runs": "^1.1.0"
63
64
  },