@adonisjs/core 7.0.0-next.0 → 7.0.0-next.2
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/add.d.ts +32 -0
- package/build/commands/add.js +17 -0
- package/build/commands/build.d.ts +22 -0
- package/build/commands/build.js +18 -0
- package/build/commands/commands.json +1 -1
- package/build/commands/configure.d.ts +32 -9
- package/build/commands/configure.js +36 -9
- package/build/commands/eject.d.ts +27 -2
- package/build/commands/eject.js +21 -2
- package/build/commands/env/add.d.ts +39 -2
- package/build/commands/env/add.js +30 -3
- package/build/commands/generate_key.d.ts +19 -0
- package/build/commands/generate_key.js +13 -0
- package/build/commands/inspect_rcfile.d.ts +19 -1
- package/build/commands/inspect_rcfile.js +19 -1
- package/build/commands/list/routes.d.ts +31 -9
- package/build/commands/list/routes.js +26 -3
- package/build/commands/make/command.d.ts +25 -2
- package/build/commands/make/command.js +22 -2
- package/build/commands/make/controller.d.ts +33 -0
- package/build/commands/make/controller.js +18 -0
- package/build/commands/make/event.d.ts +28 -2
- package/build/commands/make/event.js +25 -2
- package/build/commands/make/exception.d.ts +28 -2
- package/build/commands/make/exception.js +25 -2
- package/build/commands/make/listener.d.ts +36 -3
- package/build/commands/make/listener.js +30 -3
- package/build/commands/make/middleware.d.ts +23 -0
- package/build/commands/make/middleware.js +17 -0
- package/build/commands/make/preload.d.ts +30 -3
- package/build/commands/make/preload.js +24 -4
- package/build/commands/make/provider.d.ts +31 -2
- package/build/commands/make/provider.js +25 -3
- package/build/commands/make/service.d.ts +19 -0
- package/build/commands/make/service.js +16 -0
- package/build/commands/make/test.d.ts +26 -3
- package/build/commands/make/test.js +34 -6
- package/build/commands/make/transformer.d.ts +43 -0
- package/build/commands/make/transformer.js +65 -0
- package/build/commands/make/validator.d.ts +34 -3
- package/build/commands/make/validator.js +28 -3
- package/build/commands/make/view.d.ts +25 -2
- package/build/commands/make/view.js +22 -2
- package/build/commands/repl.d.ts +22 -2
- package/build/commands/repl.js +22 -2
- package/build/commands/serve.d.ts +36 -0
- package/build/commands/serve.js +23 -0
- package/build/commands/test.d.ts +66 -3
- package/build/commands/test.js +35 -5
- package/build/modules/ace/codemods.js +10 -2
- package/build/modules/ace/commands.d.ts +0 -1
- package/build/modules/ace/commands.js +0 -3
- package/build/providers/app_provider.d.ts +2 -2
- package/build/providers/app_provider.js +3 -3
- package/build/providers/edge_provider.js +10 -0
- package/build/src/assembler_hooks/index_entities.d.ts +3 -17
- package/build/src/assembler_hooks/index_entities.js +26 -15
- package/build/src/helpers/string.js +6 -0
- package/build/src/helpers/types.d.ts +1 -0
- package/build/src/types.d.ts +6 -0
- package/build/src/utils.d.ts +26 -0
- package/build/src/utils.js +55 -0
- package/build/stubs/make/transformer/main.stub +18 -0
- package/build/types/common.d.ts +1 -0
- package/build/types/common.js +9 -0
- package/build/types/http.d.ts +1 -0
- package/package.json +14 -12
package/build/commands/add.d.ts
CHANGED
|
@@ -4,16 +4,48 @@ import { type SupportedPackageManager } from '@adonisjs/assembler/types';
|
|
|
4
4
|
/**
|
|
5
5
|
* The install command is used to `npm install` and `node ace configure` a new package
|
|
6
6
|
* in one go.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```
|
|
10
|
+
* ace add @adonisjs/lucid
|
|
11
|
+
* ace add @adonisjs/session --dev
|
|
12
|
+
* ace add vinejs --force
|
|
13
|
+
* ace add edge --package-manager=pnpm
|
|
14
|
+
* ```
|
|
7
15
|
*/
|
|
8
16
|
export default class Add extends BaseCommand {
|
|
9
17
|
#private;
|
|
18
|
+
/**
|
|
19
|
+
* The command name
|
|
20
|
+
*/
|
|
10
21
|
static commandName: string;
|
|
22
|
+
/**
|
|
23
|
+
* The command description
|
|
24
|
+
*/
|
|
11
25
|
static description: string;
|
|
26
|
+
/**
|
|
27
|
+
* Command options configuration
|
|
28
|
+
*/
|
|
12
29
|
static options: CommandOptions;
|
|
30
|
+
/**
|
|
31
|
+
* Package name to install and configure
|
|
32
|
+
*/
|
|
13
33
|
name: string;
|
|
34
|
+
/**
|
|
35
|
+
* Display logs in verbose mode
|
|
36
|
+
*/
|
|
14
37
|
verbose?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Define the package manager you want to use
|
|
40
|
+
*/
|
|
15
41
|
packageManager?: SupportedPackageManager;
|
|
42
|
+
/**
|
|
43
|
+
* Should we install the package as a dev dependency
|
|
44
|
+
*/
|
|
16
45
|
dev?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Forcefully overwrite existing files
|
|
48
|
+
*/
|
|
17
49
|
force?: boolean;
|
|
18
50
|
/**
|
|
19
51
|
* Run method is invoked by ace automatically
|
package/build/commands/add.js
CHANGED
|
@@ -16,10 +16,27 @@ import { args, BaseCommand, flags } from "../modules/ace/main.js";
|
|
|
16
16
|
/**
|
|
17
17
|
* The install command is used to `npm install` and `node ace configure` a new package
|
|
18
18
|
* in one go.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```
|
|
22
|
+
* ace add @adonisjs/lucid
|
|
23
|
+
* ace add @adonisjs/session --dev
|
|
24
|
+
* ace add vinejs --force
|
|
25
|
+
* ace add edge --package-manager=pnpm
|
|
26
|
+
* ```
|
|
19
27
|
*/
|
|
20
28
|
export default class Add extends BaseCommand {
|
|
29
|
+
/**
|
|
30
|
+
* The command name
|
|
31
|
+
*/
|
|
21
32
|
static commandName = 'add';
|
|
33
|
+
/**
|
|
34
|
+
* The command description
|
|
35
|
+
*/
|
|
22
36
|
static description = 'Install and configure a package';
|
|
37
|
+
/**
|
|
38
|
+
* Command options configuration
|
|
39
|
+
*/
|
|
23
40
|
static options = {
|
|
24
41
|
allowUnknownFlags: true,
|
|
25
42
|
};
|
|
@@ -2,13 +2,35 @@ import { BaseCommand } from '../modules/ace/main.ts';
|
|
|
2
2
|
/**
|
|
3
3
|
* Create the production build by compiling TypeScript source and the
|
|
4
4
|
* frontend assets
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* ace build
|
|
9
|
+
* ace build --ignore-ts-errors
|
|
10
|
+
* ace build --package-manager=pnpm
|
|
11
|
+
* ```
|
|
5
12
|
*/
|
|
6
13
|
export default class Build extends BaseCommand {
|
|
7
14
|
#private;
|
|
15
|
+
/**
|
|
16
|
+
* The command name
|
|
17
|
+
*/
|
|
8
18
|
static commandName: string;
|
|
19
|
+
/**
|
|
20
|
+
* The command description
|
|
21
|
+
*/
|
|
9
22
|
static description: string;
|
|
23
|
+
/**
|
|
24
|
+
* Help text for the command
|
|
25
|
+
*/
|
|
10
26
|
static help: string[];
|
|
27
|
+
/**
|
|
28
|
+
* Ignore TypeScript errors and continue with the build process
|
|
29
|
+
*/
|
|
11
30
|
ignoreTsErrors?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Define the package manager to copy the appropriate lock file
|
|
33
|
+
*/
|
|
12
34
|
packageManager?: 'npm' | 'pnpm' | 'yarn' | 'yarn@berry' | 'bun';
|
|
13
35
|
/**
|
|
14
36
|
* Build application
|
package/build/commands/build.js
CHANGED
|
@@ -17,10 +17,26 @@ import { importAssembler, importTypeScript } from "../src/utils.js";
|
|
|
17
17
|
/**
|
|
18
18
|
* Create the production build by compiling TypeScript source and the
|
|
19
19
|
* frontend assets
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```
|
|
23
|
+
* ace build
|
|
24
|
+
* ace build --ignore-ts-errors
|
|
25
|
+
* ace build --package-manager=pnpm
|
|
26
|
+
* ```
|
|
20
27
|
*/
|
|
21
28
|
export default class Build extends BaseCommand {
|
|
29
|
+
/**
|
|
30
|
+
* The command name
|
|
31
|
+
*/
|
|
22
32
|
static commandName = 'build';
|
|
33
|
+
/**
|
|
34
|
+
* The command description
|
|
35
|
+
*/
|
|
23
36
|
static description = 'Build application for production by compiling frontend assets and TypeScript source to JavaScript';
|
|
37
|
+
/**
|
|
38
|
+
* Help text for the command
|
|
39
|
+
*/
|
|
24
40
|
static help = [
|
|
25
41
|
'Create the production build using the following command.',
|
|
26
42
|
'```',
|
|
@@ -35,6 +51,8 @@ export default class Build extends BaseCommand {
|
|
|
35
51
|
];
|
|
36
52
|
/**
|
|
37
53
|
* Log a development dependency is missing
|
|
54
|
+
*
|
|
55
|
+
* @param dependency - The name of the missing dependency
|
|
38
56
|
*/
|
|
39
57
|
#logMissingDevelopmentDependency(dependency) {
|
|
40
58
|
this.logger.error([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"commands":[{"commandName":"add","description":"Install and configure a package","help":"","namespace":null,"aliases":[],"flags":[{"name":"verbose","flagName":"verbose","required":false,"type":"boolean","description":"Display logs in verbose mode"},{"name":"packageManager","flagName":"package-manager","required":false,"type":"string","description":"Define the package manager you want to use"},{"name":"dev","flagName":"dev","required":false,"type":"boolean","description":"Should we install the package as a dev dependency","alias":"D"},{"name":"force","flagName":"force","required":false,"type":"boolean","description":"Forcefully overwrite existing files"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Package name","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"add.js"},{"commandName":"build","description":"Build application for production by compiling frontend assets and TypeScript source to JavaScript","help":["Create the production build using the following command.","```","{{ binaryName }} build","```","","The assets bundler dev server runs automatically after detecting vite config or webpack config files","You may pass vite CLI args using the --assets-args command line flag.","```","{{ binaryName }} build --assets-args=\"--debug --base=/public\"","```"],"namespace":null,"aliases":[],"flags":[{"name":"ignoreTsErrors","flagName":"ignore-ts-errors","required":false,"type":"boolean","description":"Ignore TypeScript errors and continue with the build process"},{"name":"packageManager","flagName":"package-manager","required":false,"type":"string","description":"Define the package manager to copy the appropriate lock file"}],"args":[],"options":{},"filePath":"build.js"},{"commandName":"configure","description":"Configure a package after it has been installed","help":"","namespace":null,"aliases":[],"flags":[{"name":"verbose","flagName":"verbose","required":false,"type":"boolean","description":"Display logs in verbose mode","alias":"v"},{"name":"force","flagName":"force","required":false,"type":"boolean","description":"Forcefully overwrite existing files","alias":"f"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Package name","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"configure.js"},{"commandName":"eject","description":"Eject scaffolding stubs to your application root","help":"","namespace":null,"aliases":[],"flags":[{"name":"pkg","flagName":"pkg","required":false,"type":"string","description":"Mention package name for searching stubs","default":"@adonisjs/core"}],"args":[{"name":"stubPath","argumentName":"stub-path","required":true,"description":"Path to the stubs directory or a single stub file","type":"string"}],"options":{},"filePath":"eject.js"},{"commandName":"env:add","description":"Add a new environment variable","help":"","namespace":"env","aliases":[],"flags":[{"name":"type","flagName":"type","required":false,"type":"string","description":"Type of the variable"},{"name":"enumValues","flagName":"enum-values","required":false,"type":"array","description":"Allowed values for the enum type in a comma-separated list","default":[""]}],"args":[{"name":"name","argumentName":"name","required":false,"description":"Variable name. Will be converted to screaming snake case","type":"string"},{"name":"value","argumentName":"value","required":false,"description":"Variable value","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"env/add.js"},{"commandName":"generate:key","description":"Generate a cryptographically secure random application key","help":"","namespace":"generate","aliases":[],"flags":[{"name":"show","flagName":"show","required":false,"type":"boolean","description":"Display the key on the terminal, instead of writing it to .env file"},{"name":"force","flagName":"force","required":false,"type":"boolean","description":"Force update .env file in production environment"}],"args":[],"options":{},"filePath":"generate_key.js"},{"commandName":"inspect:rcfile","description":"Inspect the RC file with its default values","help":"","namespace":"inspect","aliases":[],"flags":[],"args":[],"options":{},"filePath":"inspect_rcfile.js"},{"commandName":"list:routes","description":"List application routes. This command will boot the application in the console environment","help":"","namespace":"list","aliases":[],"flags":[{"name":"middleware","flagName":"middleware","required":false,"type":"array","description":"View routes that includes all the mentioned middleware names. Use * to see routes that are using one or more middleware"},{"name":"ignoreMiddleware","flagName":"ignore-middleware","required":false,"type":"array","description":"View routes that does not include all the mentioned middleware names. Use * to see routes that are using zero middleware"},{"name":"json","flagName":"json","required":false,"type":"boolean","description":"Get routes list as a JSON string"},{"name":"table","flagName":"table","required":false,"type":"boolean","description":"View list of routes as a table"}],"args":[{"name":"match","argumentName":"match","required":false,"description":"Find routes matching the given keyword. Route name, pattern and controller name will be searched against the keyword","type":"string"}],"options":{"startApp":true},"filePath":"list/routes.js"},{"commandName":"make:command","description":"Create a new ace command class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the command","type":"string"}],"options":{},"filePath":"make/command.js"},{"commandName":"make:controller","description":"Create a new HTTP controller class","help":"","namespace":"make","aliases":[],"flags":[{"name":"singular","flagName":"singular","required":false,"type":"boolean","description":"Generate controller in singular form","alias":"s"},{"name":"resource","flagName":"resource","required":false,"type":"boolean","description":"Generate resourceful controller with methods to perform CRUD actions on a resource","alias":"r"},{"name":"api","flagName":"api","required":false,"type":"boolean","description":"Generate resourceful controller without the \"edit\" and the \"create\" methods","alias":"a"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"The name of the controller","type":"string"},{"name":"actions","argumentName":"actions","required":false,"description":"Create controller with custom method names","type":"spread"}],"options":{"allowUnknownFlags":true},"filePath":"make/controller.js"},{"commandName":"make:event","description":"Create a new event class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the event","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/event.js"},{"commandName":"make:exception","description":"Create a new custom exception class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the exception","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/exception.js"},{"commandName":"make:listener","description":"Create a new event listener class","help":"","namespace":"make","aliases":[],"flags":[{"name":"event","flagName":"event","required":false,"type":"string","description":"Generate an event class alongside the listener","alias":"e"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the event listener","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/listener.js"},{"commandName":"make:middleware","description":"Create a new middleware class for HTTP requests","help":"","namespace":"make","aliases":[],"flags":[{"name":"stack","flagName":"stack","required":false,"type":"string","description":"The stack in which to register the middleware","alias":"s"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the middleware","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/middleware.js"},{"commandName":"make:preload","description":"Create a new preload file inside the start directory","help":"","namespace":"make","aliases":[],"flags":[{"name":"register","flagName":"register","required":false,"type":"boolean","description":"Auto register the preload file inside the .adonisrc.ts file","showNegatedVariantInHelp":true,"alias":"r"},{"name":"environments","flagName":"environments","required":false,"type":"array","description":"Define the preload file's environment. Accepted values are \"web,console,test,repl\"","alias":"e"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the preload file","type":"string"}],"options":{},"filePath":"make/preload.js"},{"commandName":"make:provider","description":"Create a new service provider class","help":"","namespace":"make","aliases":[],"flags":[{"name":"register","flagName":"register","required":false,"type":"boolean","description":"Auto register the provider inside the .adonisrc.ts file","showNegatedVariantInHelp":true,"alias":"r"},{"name":"environments","flagName":"environments","required":false,"type":"array","description":"Define the provider environment. Accepted values are \"web,console,test,repl\"","alias":"e"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the provider","type":"string"}],"options":{},"filePath":"make/provider.js"},{"commandName":"make:service","description":"Create a new service class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the service","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/service.js"},{"commandName":"make:test","description":"Create a new Japa test file","help":"","namespace":"make","aliases":[],"flags":[{"name":"suite","flagName":"suite","required":false,"type":"string","description":"The suite for which to create the test file","alias":"s"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the test file","type":"string"}],"options":{},"filePath":"make/test.js"},{"commandName":"make:validator","description":"Create a new file to define VineJS validators","help":"","namespace":"make","aliases":[],"flags":[{"name":"resource","flagName":"resource","required":false,"type":"boolean","description":"Create a file with pre-defined validators for create and update actions"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the validator file","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/validator.js"},{"commandName":"make:view","description":"Create a new Edge.js template file","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the template","type":"string"}],"options":{},"filePath":"make/view.js"},{"commandName":"repl","description":"Start a new REPL session","help":"","namespace":null,"aliases":[],"flags":[],"args":[],"options":{"startApp":true,"staysAlive":true},"filePath":"repl.js"},{"commandName":"serve","description":"Start the development HTTP server along with the file watcher to perform restarts on file change","help":["Start the development server with file watcher using the following command.","```","{{ binaryName }} serve --watch","```","","You can also start the server with HMR support using the following command.","```","{{ binaryName }} serve --hmr","```","","The assets bundler dev server runs automatically after detecting vite config or webpack config files","You may pass vite CLI args using the --assets-args command line flag.","```","{{ binaryName }} serve --assets-args=\"--debug --base=/public\"","```"],"namespace":null,"aliases":[],"flags":[{"name":"hmr","flagName":"hmr","required":false,"type":"boolean","description":"Start the server with HMR support"},{"name":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and restart the HTTP server on file change","alias":"w"},{"name":"poll","flagName":"poll","required":false,"type":"boolean","description":"Use polling to detect filesystem changes","alias":"p"},{"name":"clear","flagName":"clear","required":false,"type":"boolean","description":"Clear the terminal for new logs after file change","showNegatedVariantInHelp":true,"default":true}],"args":[],"options":{"staysAlive":true},"filePath":"serve.js"},{"commandName":"test","description":"Run tests along with the file watcher to re-run tests on file change","help":"","namespace":null,"aliases":[],"flags":[{"name":"files","flagName":"files","required":false,"type":"array","description":"Filter tests by the filename"},{"name":"tags","flagName":"tags","required":false,"type":"array","description":"Filter tests by tags"},{"name":"groups","flagName":"groups","required":false,"type":"array","description":"Filter tests by parent group title"},{"name":"tests","flagName":"tests","required":false,"type":"array","description":"Filter tests by test title"},{"name":"reporters","flagName":"reporters","required":false,"type":"array","description":"Activate one or more test reporters"},{"name":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and re-run tests on file change"},{"name":"poll","flagName":"poll","required":false,"type":"boolean","description":"Use polling to detect filesystem changes"},{"name":"timeout","flagName":"timeout","required":false,"type":"number","description":"Define default timeout for all tests"},{"name":"retries","flagName":"retries","required":false,"type":"number","description":"Define default retries for all tests"},{"name":"failed","flagName":"failed","required":false,"type":"boolean","description":"Execute tests failed during the last run"},{"name":"clear","flagName":"clear","required":false,"type":"boolean","description":"Clear the terminal for new logs after file change","showNegatedVariantInHelp":true,"default":true}],"args":[{"name":"suites","argumentName":"suites","required":false,"description":"Mention suite names to run tests for selected suites","type":"spread"}],"options":{"allowUnknownFlags":true,"staysAlive":true},"filePath":"test.js"}],"version":1}
|
|
1
|
+
{"commands":[{"commandName":"add","description":"Install and configure a package","help":"","namespace":null,"aliases":[],"flags":[{"name":"verbose","flagName":"verbose","required":false,"type":"boolean","description":"Display logs in verbose mode"},{"name":"packageManager","flagName":"package-manager","required":false,"type":"string","description":"Define the package manager you want to use"},{"name":"dev","flagName":"dev","required":false,"type":"boolean","description":"Should we install the package as a dev dependency","alias":"D"},{"name":"force","flagName":"force","required":false,"type":"boolean","description":"Forcefully overwrite existing files"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Package name","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"add.js"},{"commandName":"build","description":"Build application for production by compiling frontend assets and TypeScript source to JavaScript","help":["Create the production build using the following command.","```","{{ binaryName }} build","```","","The assets bundler dev server runs automatically after detecting vite config or webpack config files","You may pass vite CLI args using the --assets-args command line flag.","```","{{ binaryName }} build --assets-args=\"--debug --base=/public\"","```"],"namespace":null,"aliases":[],"flags":[{"name":"ignoreTsErrors","flagName":"ignore-ts-errors","required":false,"type":"boolean","description":"Ignore TypeScript errors and continue with the build process"},{"name":"packageManager","flagName":"package-manager","required":false,"type":"string","description":"Define the package manager to copy the appropriate lock file"}],"args":[],"options":{},"filePath":"build.js"},{"commandName":"configure","description":"Configure a package after it has been installed","help":"","namespace":null,"aliases":[],"flags":[{"name":"verbose","flagName":"verbose","required":false,"type":"boolean","description":"Display logs in verbose mode","alias":"v"},{"name":"force","flagName":"force","required":false,"type":"boolean","description":"Forcefully overwrite existing files","alias":"f"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Package name","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"configure.js"},{"commandName":"eject","description":"Eject scaffolding stubs to your application root","help":"","namespace":null,"aliases":[],"flags":[{"name":"pkg","flagName":"pkg","required":false,"type":"string","description":"Mention package name for searching stubs","default":"@adonisjs/core"}],"args":[{"name":"stubPath","argumentName":"stub-path","required":true,"description":"Path to the stubs directory or a single stub file","type":"string"}],"options":{},"filePath":"eject.js"},{"commandName":"env:add","description":"Add a new environment variable","help":"","namespace":"env","aliases":[],"flags":[{"name":"type","flagName":"type","required":false,"type":"string","description":"Type of the variable"},{"name":"enumValues","flagName":"enum-values","required":false,"type":"array","description":"Allowed values for the enum type in a comma-separated list","default":[""]}],"args":[{"name":"name","argumentName":"name","required":false,"description":"Variable name. Will be converted to screaming snake case","type":"string"},{"name":"value","argumentName":"value","required":false,"description":"Variable value","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"env/add.js"},{"commandName":"generate:key","description":"Generate a cryptographically secure random application key","help":"","namespace":"generate","aliases":[],"flags":[{"name":"show","flagName":"show","required":false,"type":"boolean","description":"Display the key on the terminal, instead of writing it to .env file"},{"name":"force","flagName":"force","required":false,"type":"boolean","description":"Force update .env file in production environment"}],"args":[],"options":{},"filePath":"generate_key.js"},{"commandName":"inspect:rcfile","description":"Inspect the RC file with its default values","help":"","namespace":"inspect","aliases":[],"flags":[],"args":[],"options":{},"filePath":"inspect_rcfile.js"},{"commandName":"list:routes","description":"List application routes. This command will boot the application in the console environment","help":"","namespace":"list","aliases":[],"flags":[{"name":"middleware","flagName":"middleware","required":false,"type":"array","description":"View routes that includes all the mentioned middleware names. Use * to see routes that are using one or more middleware"},{"name":"ignoreMiddleware","flagName":"ignore-middleware","required":false,"type":"array","description":"View routes that does not include all the mentioned middleware names. Use * to see routes that are using zero middleware"},{"name":"json","flagName":"json","required":false,"type":"boolean","description":"Get routes list as a JSON string"},{"name":"table","flagName":"table","required":false,"type":"boolean","description":"View list of routes as a table"}],"args":[{"name":"match","argumentName":"match","required":false,"description":"Find routes matching the given keyword. Route name, pattern and controller name will be searched against the keyword","type":"string"}],"options":{"startApp":true},"filePath":"list/routes.js"},{"commandName":"make:command","description":"Create a new ace command class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the command","type":"string"}],"options":{},"filePath":"make/command.js"},{"commandName":"make:controller","description":"Create a new HTTP controller class","help":"","namespace":"make","aliases":[],"flags":[{"name":"singular","flagName":"singular","required":false,"type":"boolean","description":"Generate controller in singular form","alias":"s"},{"name":"resource","flagName":"resource","required":false,"type":"boolean","description":"Generate resourceful controller with methods to perform CRUD actions on a resource","alias":"r"},{"name":"api","flagName":"api","required":false,"type":"boolean","description":"Generate resourceful controller without the \"edit\" and the \"create\" methods","alias":"a"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"The name of the controller","type":"string"},{"name":"actions","argumentName":"actions","required":false,"description":"Create controller with custom method names","type":"spread"}],"options":{"allowUnknownFlags":true},"filePath":"make/controller.js"},{"commandName":"make:event","description":"Create a new event class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the event","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/event.js"},{"commandName":"make:exception","description":"Create a new custom exception class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the exception","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/exception.js"},{"commandName":"make:listener","description":"Create a new event listener class","help":"","namespace":"make","aliases":[],"flags":[{"name":"event","flagName":"event","required":false,"type":"string","description":"Generate an event class alongside the listener","alias":"e"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the event listener","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/listener.js"},{"commandName":"make:middleware","description":"Create a new middleware class for HTTP requests","help":"","namespace":"make","aliases":[],"flags":[{"name":"stack","flagName":"stack","required":false,"type":"string","description":"The stack in which to register the middleware","alias":"s"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the middleware","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/middleware.js"},{"commandName":"make:preload","description":"Create a new preload file inside the start directory","help":"","namespace":"make","aliases":[],"flags":[{"name":"register","flagName":"register","required":false,"type":"boolean","description":"Auto register the preload file inside the .adonisrc.ts file","showNegatedVariantInHelp":true,"alias":"r"},{"name":"environments","flagName":"environments","required":false,"type":"array","description":"Define the preload file's environment. Accepted values are \"web,console,test,repl\"","alias":"e"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the preload file","type":"string"}],"options":{},"filePath":"make/preload.js"},{"commandName":"make:provider","description":"Create a new service provider class","help":"","namespace":"make","aliases":[],"flags":[{"name":"register","flagName":"register","required":false,"type":"boolean","description":"Auto register the provider inside the .adonisrc.ts file","showNegatedVariantInHelp":true,"alias":"r"},{"name":"environments","flagName":"environments","required":false,"type":"array","description":"Define the provider environment. Accepted values are \"web,console,test,repl\"","alias":"e"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the provider","type":"string"}],"options":{},"filePath":"make/provider.js"},{"commandName":"make:service","description":"Create a new service class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the service","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/service.js"},{"commandName":"make:test","description":"Create a new Japa test file","help":"","namespace":"make","aliases":[],"flags":[{"name":"suite","flagName":"suite","required":false,"type":"string","description":"The suite for which to create the test file","alias":"s"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the test file","type":"string"}],"options":{},"filePath":"make/test.js"},{"commandName":"make:transformer","description":"Create a new transformer class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Entity name for which to generate the transformer","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/transformer.js"},{"commandName":"make:validator","description":"Create a new file to define VineJS validators","help":"","namespace":"make","aliases":[],"flags":[{"name":"resource","flagName":"resource","required":false,"type":"boolean","description":"Create a file with pre-defined validators for create and update actions"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the validator file","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/validator.js"},{"commandName":"make:view","description":"Create a new Edge.js template file","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the template","type":"string"}],"options":{},"filePath":"make/view.js"},{"commandName":"repl","description":"Start a new REPL session","help":"","namespace":null,"aliases":[],"flags":[],"args":[],"options":{"startApp":true,"staysAlive":true},"filePath":"repl.js"},{"commandName":"serve","description":"Start the development HTTP server along with the file watcher to perform restarts on file change","help":["Start the development server with file watcher using the following command.","```","{{ binaryName }} serve --watch","```","","You can also start the server with HMR support using the following command.","```","{{ binaryName }} serve --hmr","```","","The assets bundler dev server runs automatically after detecting vite config or webpack config files","You may pass vite CLI args using the --assets-args command line flag.","```","{{ binaryName }} serve --assets-args=\"--debug --base=/public\"","```"],"namespace":null,"aliases":[],"flags":[{"name":"hmr","flagName":"hmr","required":false,"type":"boolean","description":"Start the server with HMR support"},{"name":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and restart the HTTP server on file change","alias":"w"},{"name":"poll","flagName":"poll","required":false,"type":"boolean","description":"Use polling to detect filesystem changes","alias":"p"},{"name":"clear","flagName":"clear","required":false,"type":"boolean","description":"Clear the terminal for new logs after file change","showNegatedVariantInHelp":true,"default":true}],"args":[],"options":{"staysAlive":true},"filePath":"serve.js"},{"commandName":"test","description":"Run tests along with the file watcher to re-run tests on file change","help":"","namespace":null,"aliases":[],"flags":[{"name":"files","flagName":"files","required":false,"type":"array","description":"Filter tests by the filename"},{"name":"tags","flagName":"tags","required":false,"type":"array","description":"Filter tests by tags"},{"name":"groups","flagName":"groups","required":false,"type":"array","description":"Filter tests by parent group title"},{"name":"tests","flagName":"tests","required":false,"type":"array","description":"Filter tests by test title"},{"name":"reporters","flagName":"reporters","required":false,"type":"array","description":"Activate one or more test reporters"},{"name":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and re-run tests on file change"},{"name":"poll","flagName":"poll","required":false,"type":"boolean","description":"Use polling to detect filesystem changes"},{"name":"timeout","flagName":"timeout","required":false,"type":"number","description":"Define default timeout for all tests"},{"name":"retries","flagName":"retries","required":false,"type":"number","description":"Define default retries for all tests"},{"name":"failed","flagName":"failed","required":false,"type":"boolean","description":"Execute tests failed during the last run"},{"name":"clear","flagName":"clear","required":false,"type":"boolean","description":"Clear the terminal for new logs after file change","showNegatedVariantInHelp":true,"default":true}],"args":[{"name":"suites","argumentName":"suites","required":false,"description":"Mention suite names to run tests for selected suites","type":"spread"}],"options":{"allowUnknownFlags":true,"staysAlive":true},"filePath":"test.js"}],"version":1}
|
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
import type { CommandOptions } from '../types/ace.ts';
|
|
2
2
|
import { BaseCommand } from '../modules/ace/main.ts';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Command to configure packages after installation by running their configuration hooks.
|
|
5
|
+
* Supports built-in configurations for VineJS, Edge, and health checks, or can execute
|
|
6
|
+
* custom configure functions exported by packages.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```
|
|
10
|
+
* ace configure @adonisjs/lucid
|
|
11
|
+
* ace configure vinejs
|
|
12
|
+
* ace configure edge
|
|
13
|
+
* ace configure health_checks
|
|
14
|
+
* ace configure @adonisjs/auth --force --verbose
|
|
15
|
+
* ```
|
|
5
16
|
*/
|
|
6
17
|
export default class Configure extends BaseCommand {
|
|
7
18
|
#private;
|
|
19
|
+
/**
|
|
20
|
+
* The command name
|
|
21
|
+
*/
|
|
8
22
|
static commandName: string;
|
|
23
|
+
/**
|
|
24
|
+
* The command description
|
|
25
|
+
*/
|
|
9
26
|
static description: string;
|
|
27
|
+
/**
|
|
28
|
+
* Command options configuration.
|
|
29
|
+
* Allows unknown flags to be passed to package configure functions.
|
|
30
|
+
*/
|
|
10
31
|
static options: CommandOptions;
|
|
11
32
|
/**
|
|
12
|
-
*
|
|
33
|
+
* Expose all flags from the protected property "parsed" for access by package configure functions
|
|
13
34
|
*/
|
|
14
35
|
get parsedFlags(): {
|
|
15
36
|
[argName: string]: any;
|
|
16
37
|
};
|
|
17
38
|
/**
|
|
18
|
-
*
|
|
39
|
+
* Expose all arguments from the protected property "parsed" for access by package configure functions
|
|
19
40
|
*/
|
|
20
41
|
get parsedArgs(): (string | number)[];
|
|
21
42
|
/**
|
|
@@ -23,24 +44,26 @@ export default class Configure extends BaseCommand {
|
|
|
23
44
|
*/
|
|
24
45
|
name: string;
|
|
25
46
|
/**
|
|
26
|
-
*
|
|
47
|
+
* Enable verbose logging during package installation and configuration
|
|
27
48
|
*/
|
|
28
49
|
verbose?: boolean;
|
|
29
50
|
/**
|
|
30
|
-
* Forcefully overwrite existing files
|
|
51
|
+
* Forcefully overwrite existing files during configuration
|
|
31
52
|
*/
|
|
32
53
|
force?: boolean;
|
|
33
54
|
/**
|
|
34
|
-
* The root of the stubs
|
|
35
|
-
* the package
|
|
55
|
+
* The root directory path of the package's stubs.
|
|
56
|
+
* Set automatically when the package exports a stubsRoot property.
|
|
36
57
|
*/
|
|
37
58
|
stubsRoot: string;
|
|
38
59
|
/**
|
|
39
|
-
*
|
|
60
|
+
* Create a codemods instance configured with command options.
|
|
61
|
+
* Sets overwrite and verbose flags based on command arguments.
|
|
40
62
|
*/
|
|
41
63
|
createCodemods(): Promise<import("../modules/ace/codemods.ts").Codemods>;
|
|
42
64
|
/**
|
|
43
|
-
*
|
|
65
|
+
* Execute the configure command. Handles built-in configurations for VineJS, Edge,
|
|
66
|
+
* and health checks, or imports and executes the configure function from the specified package.
|
|
44
67
|
*/
|
|
45
68
|
run(): Promise<void>;
|
|
46
69
|
}
|
|
@@ -16,28 +16,53 @@ import { RuntimeException } from '@poppinss/utils/exception';
|
|
|
16
16
|
import { stubsRoot } from "../stubs/main.js";
|
|
17
17
|
import { args, BaseCommand, flags } from "../modules/ace/main.js";
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
19
|
+
* Command to configure packages after installation by running their configuration hooks.
|
|
20
|
+
* Supports built-in configurations for VineJS, Edge, and health checks, or can execute
|
|
21
|
+
* custom configure functions exported by packages.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```
|
|
25
|
+
* ace configure @adonisjs/lucid
|
|
26
|
+
* ace configure vinejs
|
|
27
|
+
* ace configure edge
|
|
28
|
+
* ace configure health_checks
|
|
29
|
+
* ace configure @adonisjs/auth --force --verbose
|
|
30
|
+
* ```
|
|
20
31
|
*/
|
|
21
32
|
export default class Configure extends BaseCommand {
|
|
33
|
+
/**
|
|
34
|
+
* The command name
|
|
35
|
+
*/
|
|
22
36
|
static commandName = 'configure';
|
|
37
|
+
/**
|
|
38
|
+
* The command description
|
|
39
|
+
*/
|
|
23
40
|
static description = 'Configure a package after it has been installed';
|
|
41
|
+
/**
|
|
42
|
+
* Command options configuration.
|
|
43
|
+
* Allows unknown flags to be passed to package configure functions.
|
|
44
|
+
*/
|
|
24
45
|
static options = {
|
|
25
46
|
allowUnknownFlags: true,
|
|
26
47
|
};
|
|
27
48
|
/**
|
|
28
|
-
*
|
|
49
|
+
* Expose all flags from the protected property "parsed" for access by package configure functions
|
|
29
50
|
*/
|
|
30
51
|
get parsedFlags() {
|
|
31
52
|
return this.parsed.flags;
|
|
32
53
|
}
|
|
33
54
|
/**
|
|
34
|
-
*
|
|
55
|
+
* Expose all arguments from the protected property "parsed" for access by package configure functions
|
|
35
56
|
*/
|
|
36
57
|
get parsedArgs() {
|
|
37
58
|
return this.parsed._;
|
|
38
59
|
}
|
|
39
60
|
/**
|
|
40
|
-
*
|
|
61
|
+
* Import and return the main exports of a package.
|
|
62
|
+
* Returns null if the package is not found, rethrows other errors.
|
|
63
|
+
*
|
|
64
|
+
* @param packageName - The name of the package to import
|
|
65
|
+
* @returns The package exports or null if not found
|
|
41
66
|
*/
|
|
42
67
|
async #getPackageSource(packageName) {
|
|
43
68
|
try {
|
|
@@ -53,7 +78,7 @@ export default class Configure extends BaseCommand {
|
|
|
53
78
|
}
|
|
54
79
|
}
|
|
55
80
|
/**
|
|
56
|
-
*
|
|
81
|
+
* Configure VineJS validation library by registering its provider in the RC file
|
|
57
82
|
*/
|
|
58
83
|
async #configureVineJS() {
|
|
59
84
|
const codemods = await this.createCodemods();
|
|
@@ -62,7 +87,7 @@ export default class Configure extends BaseCommand {
|
|
|
62
87
|
});
|
|
63
88
|
}
|
|
64
89
|
/**
|
|
65
|
-
*
|
|
90
|
+
* Configure Edge template engine by registering its provider and adding view meta files
|
|
66
91
|
*/
|
|
67
92
|
async #configureEdge() {
|
|
68
93
|
const codemods = await this.createCodemods();
|
|
@@ -72,7 +97,7 @@ export default class Configure extends BaseCommand {
|
|
|
72
97
|
});
|
|
73
98
|
}
|
|
74
99
|
/**
|
|
75
|
-
* Configure health checks
|
|
100
|
+
* Configure health checks feature by generating the main health file and controller
|
|
76
101
|
*/
|
|
77
102
|
async #configureHealthChecks() {
|
|
78
103
|
const codemods = await this.createCodemods();
|
|
@@ -86,7 +111,8 @@ export default class Configure extends BaseCommand {
|
|
|
86
111
|
});
|
|
87
112
|
}
|
|
88
113
|
/**
|
|
89
|
-
*
|
|
114
|
+
* Create a codemods instance configured with command options.
|
|
115
|
+
* Sets overwrite and verbose flags based on command arguments.
|
|
90
116
|
*/
|
|
91
117
|
async createCodemods() {
|
|
92
118
|
const codemods = await super.createCodemods();
|
|
@@ -95,7 +121,8 @@ export default class Configure extends BaseCommand {
|
|
|
95
121
|
return codemods;
|
|
96
122
|
}
|
|
97
123
|
/**
|
|
98
|
-
*
|
|
124
|
+
* Execute the configure command. Handles built-in configurations for VineJS, Edge,
|
|
125
|
+
* and health checks, or imports and executes the configure function from the specified package.
|
|
99
126
|
*/
|
|
100
127
|
async run() {
|
|
101
128
|
if (this.name === 'vinejs') {
|
|
@@ -1,12 +1,37 @@
|
|
|
1
1
|
import { BaseCommand } from '../modules/ace/main.ts';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* Command to eject scaffolding stubs from packages to your application root.
|
|
4
|
+
* This allows you to customize templates used by make commands and other
|
|
5
|
+
* code generation features by copying them to your local application.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```
|
|
9
|
+
* ace eject make/controller
|
|
10
|
+
* ace eject make/controller --pkg=@adonisjs/lucid
|
|
11
|
+
* ace eject stubs/
|
|
12
|
+
* ```
|
|
5
13
|
*/
|
|
6
14
|
export default class Eject extends BaseCommand {
|
|
15
|
+
/**
|
|
16
|
+
* The command name
|
|
17
|
+
*/
|
|
7
18
|
static commandName: string;
|
|
19
|
+
/**
|
|
20
|
+
* The command description
|
|
21
|
+
*/
|
|
8
22
|
static description: string;
|
|
23
|
+
/**
|
|
24
|
+
* Path to the stubs directory or a single stub file to eject
|
|
25
|
+
*/
|
|
9
26
|
stubPath: string;
|
|
27
|
+
/**
|
|
28
|
+
* Package name to search for stubs. Defaults to @adonisjs/core
|
|
29
|
+
*/
|
|
10
30
|
pkg: string;
|
|
31
|
+
/**
|
|
32
|
+
* Execute the command to eject stubs from the specified package.
|
|
33
|
+
* Copies the stubs to the application root and logs success messages
|
|
34
|
+
* for each ejected file.
|
|
35
|
+
*/
|
|
11
36
|
run(): Promise<void>;
|
|
12
37
|
}
|
package/build/commands/eject.js
CHANGED
|
@@ -15,12 +15,31 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
15
15
|
import { args, BaseCommand, flags } from "../modules/ace/main.js";
|
|
16
16
|
import stringHelpers from "../src/helpers/string.js";
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* Command to eject scaffolding stubs from packages to your application root.
|
|
19
|
+
* This allows you to customize templates used by make commands and other
|
|
20
|
+
* code generation features by copying them to your local application.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```
|
|
24
|
+
* ace eject make/controller
|
|
25
|
+
* ace eject make/controller --pkg=@adonisjs/lucid
|
|
26
|
+
* ace eject stubs/
|
|
27
|
+
* ```
|
|
20
28
|
*/
|
|
21
29
|
export default class Eject extends BaseCommand {
|
|
30
|
+
/**
|
|
31
|
+
* The command name
|
|
32
|
+
*/
|
|
22
33
|
static commandName = 'eject';
|
|
34
|
+
/**
|
|
35
|
+
* The command description
|
|
36
|
+
*/
|
|
23
37
|
static description = 'Eject scaffolding stubs to your application root';
|
|
38
|
+
/**
|
|
39
|
+
* Execute the command to eject stubs from the specified package.
|
|
40
|
+
* Copies the stubs to the application root and logs success messages
|
|
41
|
+
* for each ejected file.
|
|
42
|
+
*/
|
|
24
43
|
async run() {
|
|
25
44
|
const stubs = await this.app.stubs.create();
|
|
26
45
|
const copied = await stubs.copy(this.stubPath, {
|
|
@@ -3,18 +3,55 @@ import { BaseCommand } from '../../modules/ace/main.ts';
|
|
|
3
3
|
declare const ALLOWED_TYPES: readonly ["string", "boolean", "number", "enum"];
|
|
4
4
|
type AllowedTypes = (typeof ALLOWED_TYPES)[number];
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Command to add a new environment variable to the application.
|
|
7
|
+
* Updates .env, .env.example, and start/env.ts files with the new variable,
|
|
8
|
+
* including appropriate validation schema based on the variable type.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* ace env:add
|
|
13
|
+
* ace env:add DATABASE_URL postgres://localhost:5432/mydb
|
|
14
|
+
* ace env:add API_KEY secret --type=string
|
|
15
|
+
* ace env:add PORT 3333 --type=number
|
|
16
|
+
* ace env:add DEBUG true --type=boolean
|
|
17
|
+
* ace env:add LOG_LEVEL info --type=enum --enum-values=debug,info,warn,error
|
|
18
|
+
* ```
|
|
8
19
|
*/
|
|
9
20
|
export default class EnvAdd extends BaseCommand {
|
|
10
21
|
#private;
|
|
22
|
+
/**
|
|
23
|
+
* The command name
|
|
24
|
+
*/
|
|
11
25
|
static commandName: string;
|
|
26
|
+
/**
|
|
27
|
+
* The command description
|
|
28
|
+
*/
|
|
12
29
|
static description: string;
|
|
30
|
+
/**
|
|
31
|
+
* Command options configuration.
|
|
32
|
+
* Allows unknown flags to be passed through.
|
|
33
|
+
*/
|
|
13
34
|
static options: CommandOptions;
|
|
35
|
+
/**
|
|
36
|
+
* Environment variable name (will be converted to SCREAMING_SNAKE_CASE)
|
|
37
|
+
*/
|
|
14
38
|
name: string;
|
|
39
|
+
/**
|
|
40
|
+
* Environment variable value
|
|
41
|
+
*/
|
|
15
42
|
value: string;
|
|
43
|
+
/**
|
|
44
|
+
* Data type of the environment variable (string, boolean, number, enum)
|
|
45
|
+
*/
|
|
16
46
|
type: AllowedTypes;
|
|
47
|
+
/**
|
|
48
|
+
* Allowed values for enum type variables
|
|
49
|
+
*/
|
|
17
50
|
enumValues: string[];
|
|
51
|
+
/**
|
|
52
|
+
* Execute the command to add a new environment variable.
|
|
53
|
+
* Prompts for missing values, validates inputs, and updates all relevant files.
|
|
54
|
+
*/
|
|
18
55
|
run(): Promise<void>;
|
|
19
56
|
}
|
|
20
57
|
export {};
|
|
@@ -16,21 +16,48 @@ import stringHelpers from "../../src/helpers/string.js";
|
|
|
16
16
|
import { args, BaseCommand, flags } from "../../modules/ace/main.js";
|
|
17
17
|
const ALLOWED_TYPES = ['string', 'boolean', 'number', 'enum'];
|
|
18
18
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* Command to add a new environment variable to the application.
|
|
20
|
+
* Updates .env, .env.example, and start/env.ts files with the new variable,
|
|
21
|
+
* including appropriate validation schema based on the variable type.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```
|
|
25
|
+
* ace env:add
|
|
26
|
+
* ace env:add DATABASE_URL postgres://localhost:5432/mydb
|
|
27
|
+
* ace env:add API_KEY secret --type=string
|
|
28
|
+
* ace env:add PORT 3333 --type=number
|
|
29
|
+
* ace env:add DEBUG true --type=boolean
|
|
30
|
+
* ace env:add LOG_LEVEL info --type=enum --enum-values=debug,info,warn,error
|
|
31
|
+
* ```
|
|
21
32
|
*/
|
|
22
33
|
export default class EnvAdd extends BaseCommand {
|
|
34
|
+
/**
|
|
35
|
+
* The command name
|
|
36
|
+
*/
|
|
23
37
|
static commandName = 'env:add';
|
|
38
|
+
/**
|
|
39
|
+
* The command description
|
|
40
|
+
*/
|
|
24
41
|
static description = 'Add a new environment variable';
|
|
42
|
+
/**
|
|
43
|
+
* Command options configuration.
|
|
44
|
+
* Allows unknown flags to be passed through.
|
|
45
|
+
*/
|
|
25
46
|
static options = {
|
|
26
47
|
allowUnknownFlags: true,
|
|
27
48
|
};
|
|
28
49
|
/**
|
|
29
|
-
* Validate the type
|
|
50
|
+
* Validate that the provided type is one of the allowed types.
|
|
51
|
+
*
|
|
52
|
+
* @returns True if the type is valid, false otherwise
|
|
30
53
|
*/
|
|
31
54
|
#isTypeFlagValid() {
|
|
32
55
|
return ALLOWED_TYPES.includes(this.type);
|
|
33
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* Execute the command to add a new environment variable.
|
|
59
|
+
* Prompts for missing values, validates inputs, and updates all relevant files.
|
|
60
|
+
*/
|
|
34
61
|
async run() {
|
|
35
62
|
/**
|
|
36
63
|
* Prompt for missing name
|
|
@@ -2,11 +2,30 @@ import { BaseCommand } from '../modules/ace/main.ts';
|
|
|
2
2
|
/**
|
|
3
3
|
* The generate key command is used to generate the app key
|
|
4
4
|
* and write it inside the .env file.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```
|
|
8
|
+
* ace generate:key
|
|
9
|
+
* ace generate:key --show
|
|
10
|
+
* ace generate:key --force
|
|
11
|
+
* ```
|
|
5
12
|
*/
|
|
6
13
|
export default class GenerateKey extends BaseCommand {
|
|
14
|
+
/**
|
|
15
|
+
* The command name
|
|
16
|
+
*/
|
|
7
17
|
static commandName: string;
|
|
18
|
+
/**
|
|
19
|
+
* The command description
|
|
20
|
+
*/
|
|
8
21
|
static description: string;
|
|
22
|
+
/**
|
|
23
|
+
* Display the key on the terminal, instead of writing it to .env file
|
|
24
|
+
*/
|
|
9
25
|
show: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Force update .env file in production environment
|
|
28
|
+
*/
|
|
10
29
|
force: boolean;
|
|
11
30
|
run(): Promise<void>;
|
|
12
31
|
}
|