create-adonisjs 1.2.2-0 → 2.0.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,12 +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
- | `--skip-install` | Skip installing dependencies. |
87
- | `--skip-git-init` | Skip initializing 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
+ ```
88
124
 
89
125
  ## Contributing
90
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
- skipInstall: boolean;
30
+ install?: boolean;
27
31
  /**
28
- * Skip git initialization
32
+ * Init git repository. Do not init when flag is not mentioned.
29
33
  */
30
- skipGitInit: boolean;
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,199 +12,306 @@ 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();
50
+ this.logger.log('');
51
+ this.logger.log(`${gradient.mind.multiline(title)}`);
37
52
  this.logger.log('');
38
- this.logger.log(`${gradient.mind(title)}`);
53
+ }
54
+ /**
55
+ * Print the success message
56
+ */
57
+ #printSuccessMessage() {
39
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();
40
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;
70
- }
71
- }
72
- /**
73
- * Install dependencies with the detected package manager
74
- */
75
- async #installDependencies() {
76
- if (this.skipInstall) {
77
- return;
78
- }
79
- this.#shouldInstallDependencies = await this.prompt.confirm('Do you want to install dependencies?', { hint: this.packageManager + ' will be used', default: true });
80
- if (!this.#shouldInstallDependencies) {
81
- return;
82
- }
83
- const spinner = this.logger
84
- .await(`Installing dependencies using ${this.packageManager}`)
85
- .start();
86
- try {
87
- await execa(this.packageManager, ['install'], { cwd: this.destination });
88
- spinner.update('Dependencies installed successfully').stop();
89
- }
90
- catch (error) {
91
- spinner.stop();
92
- this.error = `Failed to install dependencies :\n${error.stderr}`;
93
- 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
+ }
94
102
  }
95
103
  }
96
104
  /**
97
- * Init git repository inside the destination directory
105
+ * Prompt to check if we should install dependencies?
98
106
  */
99
- async #initGitRepo() {
100
- if (this.skipGitInit) {
101
- return;
102
- }
103
- const shouldInit = await this.prompt.confirm('Do you want to initialize a git repository?', {
104
- default: true,
105
- });
106
- if (!shouldInit) {
107
- return;
108
- }
109
- try {
110
- await execa('git', ['init'], { cwd: this.destination });
111
- this.logger.success('Git repository initialized successfully');
112
- }
113
- catch (error) {
114
- this.error = `Failed to initialize git repository :\n${error.stderr}`;
115
- throw error;
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
+ default: true,
111
+ });
116
112
  }
117
113
  }
118
114
  /**
119
- * 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.
120
117
  */
121
118
  async #replacePackageJsonName() {
122
119
  const pkgJsonPath = join(this.destination, 'package.json');
123
120
  const pkgJson = await readFile(pkgJsonPath, 'utf-8').then(JSON.parse);
124
- pkgJson.name = relative(cwd(), this.destination);
121
+ pkgJson.name = basename(this.destination);
125
122
  await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
126
123
  }
124
+ /**
125
+ * Optionally removes readme file. Errors are ignored
126
+ */
127
+ async #removeReadmeFile() {
128
+ await unlink(join(this.destination, 'README.md'));
129
+ }
127
130
  /**
128
131
  * If starter template has an `.env.example` file, then copy it to `.env`
129
132
  */
130
133
  async #copyEnvExampleFile() {
134
+ const envPath = join(this.destination, '.env');
131
135
  const envExamplePath = join(this.destination, '.env.example');
132
- const hasEnvExample = existsSync(envExamplePath);
133
- if (!hasEnvExample) {
134
- return;
136
+ if (existsSync(envExamplePath)) {
137
+ await copyFile(envExamplePath, envPath);
135
138
  }
136
- const envPath = join(this.destination, '.env');
137
- await copyFile(envExamplePath, envPath);
138
139
  }
139
140
  /**
140
- * Generate a fresh app key
141
+ * Generate a fresh app key. Errors are ignored
141
142
  */
142
143
  async #generateFreshAppKey() {
143
- if (!this.#shouldInstallDependencies) {
144
+ if (this.install === false) {
144
145
  return;
145
146
  }
146
- try {
147
- await execa('node', ['ace', 'generate:key'], { cwd: this.destination });
148
- }
149
- catch (error) {
150
- this.logger.warning('Failed to generate app key : ' + error.stderr);
151
- }
147
+ await this.#runBashCommand('node', ['ace', 'generate:key']);
152
148
  }
153
149
  /**
154
- * Optionally removes readme file
150
+ * Configures the Lucid package
155
151
  */
156
- async #removeReadmeFile() {
157
- try {
158
- await unlink(join(this.destination, 'README.md'));
152
+ async #configureLucid() {
153
+ this.db = this.db || 'sqlite';
154
+ const argv = ['ace', 'configure', '@adonisjs/lucid', '--db', this.db, '--install'];
155
+ if (this.verbose) {
156
+ argv.push('--verbose');
159
157
  }
160
- catch { }
158
+ await this.#runBashCommand('node', argv);
161
159
  }
162
160
  /**
163
- * Print the success message
161
+ * Configures the session package
164
162
  */
165
- #printSuccessMessage() {
166
- this.logger.log('');
167
- this.ui
168
- .instructions()
169
- .heading('Your AdonisJS project has been created successfully!')
170
- .add(this.colors.cyan('cd ' + relative(cwd(), this.destination)))
171
- .add(this.colors.cyan(`${this.packageManager} run dev`))
172
- .add(this.colors.cyan('Open http://localhost:3333'))
173
- .add('')
174
- .add(`Have any questions?`)
175
- .add(`Join our Discord server - ${this.colors.yellow('https://discord.gg/vDcEjq6')}`)
176
- .render();
163
+ async #configureSession() {
164
+ await installPackage(['@adonisjs/session@latest'], {
165
+ cwd: this.destination,
166
+ packageManager: this.packageManager,
167
+ silent: !this.verbose,
168
+ });
169
+ const argv = ['ace', 'configure', '@adonisjs/session'];
170
+ if (this.verbose) {
171
+ argv.push('--verbose');
172
+ }
173
+ await this.#runBashCommand('node', argv);
177
174
  }
178
175
  /**
179
- * Execute the `run` method and catch errors
176
+ * Configures the Auth package
180
177
  */
181
- async exec() {
182
- this.hydrate();
183
- try {
184
- await this.run();
178
+ async #configureAuth() {
179
+ this.authGuard = this.authGuard || 'session';
180
+ /**
181
+ * Install the session package when using api starter kit with session
182
+ * guard. This needs to be done, since the api starter kit does
183
+ * not install the session package by default.
184
+ */
185
+ if (this.authGuard === 'session' && this.kit === 'github:adonisjs/api-starter-kit') {
186
+ await this.#configureSession();
185
187
  }
186
- catch (error) {
187
- this.logger.fatal(this.error || error.message);
188
- this.exitCode = 1;
188
+ /**
189
+ * Next configure the auth package
190
+ */
191
+ const argv = ['ace', 'configure', '@adonisjs/auth', '--guard', this.authGuard];
192
+ if (this.verbose) {
193
+ argv.push('--verbose');
189
194
  }
195
+ await this.#runBashCommand('node', argv);
190
196
  }
191
197
  /**
192
198
  * Main method
193
199
  */
194
200
  async run() {
195
- if (!this.packageManager) {
196
- this.packageManager = detectPackageManager()?.name || 'npm';
201
+ this.packageManager = this.packageManager || detectPackageManager()?.name || 'npm';
202
+ /**
203
+ * Print ASCII art
204
+ */
205
+ this.#printBannerArt();
206
+ /**
207
+ * Display prompts
208
+ */
209
+ await this.#promptForDestination();
210
+ await this.#promptForStarterKit();
211
+ await this.#promptForInstallingDeps();
212
+ /**
213
+ * Create tasks instance for displaying
214
+ * actions as tasks
215
+ */
216
+ const tasks = this.ui.tasks({ verbose: this.verbose === true });
217
+ /**
218
+ * Configure lucid when using web or api starter kits
219
+ * and installing dependencies
220
+ */
221
+ const configureLucid = (this.kit === 'github:adonisjs/web-starter-kit' ||
222
+ this.kit === 'github:adonisjs/api-starter-kit') &&
223
+ this.install !== false;
224
+ /**
225
+ * Configure auth when using web or api starter kits
226
+ * and installing dependencies
227
+ */
228
+ const configureAuth = (this.kit === 'github:adonisjs/web-starter-kit' ||
229
+ this.kit === 'github:adonisjs/api-starter-kit') &&
230
+ this.install !== false;
231
+ tasks
232
+ .add('Download starter kit', async (task) => {
233
+ task.update(`Downloading "${this.kit}"`);
234
+ await downloadTemplate(this.kit, { dir: this.destination, auth: this.token });
235
+ return `Downloaded "${this.kit}"`;
236
+ })
237
+ .addIf(this.gitInit === true, 'Initialize git repository', async () => {
238
+ await this.#runBashCommand('git', ['init']);
239
+ return 'Initialized git repository';
240
+ })
241
+ .addIf(this.install !== false, 'Install packages', async (task) => {
242
+ const spinner = this.logger.await('installing dependencies', {
243
+ silent: this.verbose,
244
+ });
245
+ spinner.tap((line) => task.update(line));
246
+ spinner.start();
247
+ try {
248
+ await this.#runBashCommand(this.packageManager, ['install']);
249
+ return `Packages installed using "${this.packageManager}"`;
250
+ }
251
+ finally {
252
+ spinner.stop();
253
+ }
254
+ })
255
+ .add('Prepare application', async () => {
256
+ try {
257
+ await this.#replacePackageJsonName();
258
+ await this.#removeReadmeFile();
259
+ await this.#copyEnvExampleFile();
260
+ await this.#generateFreshAppKey();
261
+ return 'Application ready';
262
+ }
263
+ catch (error) {
264
+ if (this.verbose) {
265
+ this.logger.fatal(error);
266
+ }
267
+ return 'Unable to prepare application';
268
+ }
269
+ })
270
+ .addIf(configureLucid, 'Configure Lucid', async (task) => {
271
+ const spinner = this.logger.await('configuring @adonisjs/lucid', {
272
+ silent: this.verbose,
273
+ });
274
+ spinner.tap((line) => task.update(line));
275
+ spinner.start();
276
+ try {
277
+ await this.#configureLucid();
278
+ spinner.stop();
279
+ return `Lucid configured to use "${this.db}" database`;
280
+ }
281
+ catch (error) {
282
+ spinner.stop();
283
+ if (this.verbose) {
284
+ this.logger.fatal(error);
285
+ }
286
+ return `Unable to configure "@adonisjs/lucid"`;
287
+ }
288
+ })
289
+ .addIf(configureAuth, 'Configure Auth', async (task) => {
290
+ const spinner = this.logger.await('configuring @adonisjs/auth', {
291
+ silent: this.verbose,
292
+ });
293
+ spinner.tap((line) => task.update(line));
294
+ spinner.start();
295
+ try {
296
+ await this.#configureAuth();
297
+ spinner.stop();
298
+ return `Auth configured to use "${this.authGuard}" guard`;
299
+ }
300
+ catch (error) {
301
+ spinner.stop();
302
+ if (this.verbose) {
303
+ this.logger.fatal(error);
304
+ }
305
+ return `Unable to configure "@adonisjs/auth"`;
306
+ }
307
+ });
308
+ await tasks.run();
309
+ if (tasks.getState() === 'succeeded') {
310
+ this.#printSuccessMessage();
311
+ }
312
+ else {
313
+ this.exitCode = 1;
197
314
  }
198
- this.#printTitle();
199
- await this.#setDestination();
200
- await this.#downloadTemplate();
201
- await this.#installDependencies();
202
- await this.#initGitRepo();
203
- await this.#replacePackageJsonName();
204
- await this.#copyEnvExampleFile();
205
- await this.#generateFreshAppKey();
206
- await this.#removeReadmeFile();
207
- this.#printSuccessMessage();
208
315
  }
209
316
  }
210
317
  __decorate([
@@ -212,7 +319,7 @@ __decorate([
212
319
  ], CreateNewApp.prototype, "destination", void 0);
213
320
  __decorate([
214
321
  flags.string({
215
- description: 'Define path to a custom git repository',
322
+ description: 'Define path to a custom git repository to download the starter kit',
216
323
  alias: 'K',
217
324
  })
218
325
  ], CreateNewApp.prototype, "kit", void 0);
@@ -223,11 +330,37 @@ __decorate([
223
330
  })
224
331
  ], CreateNewApp.prototype, "token", void 0);
225
332
  __decorate([
226
- flags.boolean({ description: 'Skip packages installation' })
227
- ], CreateNewApp.prototype, "skipInstall", void 0);
333
+ flags.boolean({
334
+ description: 'Install packages after creating the project',
335
+ showNegatedVariantInHelp: true,
336
+ })
337
+ ], CreateNewApp.prototype, "install", void 0);
228
338
  __decorate([
229
- flags.boolean({ description: 'Skip git initialization' })
230
- ], CreateNewApp.prototype, "skipGitInit", void 0);
339
+ flags.boolean({
340
+ description: 'Init Git repository using the "git init" command',
341
+ })
342
+ ], CreateNewApp.prototype, "gitInit", void 0);
231
343
  __decorate([
232
- flags.string({ description: 'Explicitly define the package manager to npm', flagName: 'pkg' })
344
+ flags.string({
345
+ description: 'Define the package manager to install dependencies',
346
+ flagName: 'pkg',
347
+ })
233
348
  ], CreateNewApp.prototype, "packageManager", void 0);
349
+ __decorate([
350
+ flags.string({
351
+ description: 'Define the database dialect to use with Lucid',
352
+ default: 'sqlite',
353
+ })
354
+ ], CreateNewApp.prototype, "db", void 0);
355
+ __decorate([
356
+ flags.string({
357
+ description: 'Define the authentication guard for the Auth package',
358
+ default: 'session',
359
+ })
360
+ ], CreateNewApp.prototype, "authGuard", void 0);
361
+ __decorate([
362
+ flags.boolean({
363
+ description: 'Execute tasks in verbose mode',
364
+ alias: 'v',
365
+ })
366
+ ], 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-0",
4
+ "version": "2.0.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
  },