@adonisjs/core 6.1.5-18 → 6.1.5-19
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/commands.json +1 -1
- package/build/commands/configure.d.ts +0 -18
- package/build/commands/configure.js +21 -85
- package/build/commands/inspect_rcfile.js +17 -1
- package/build/commands/make/command.d.ts +1 -1
- package/build/commands/make/command.js +5 -2
- package/build/commands/make/controller.d.ts +1 -1
- package/build/commands/make/controller.js +5 -3
- package/build/commands/make/event.d.ts +1 -1
- package/build/commands/make/event.js +5 -3
- package/build/commands/make/exception.d.ts +1 -1
- package/build/commands/make/exception.js +5 -3
- package/build/commands/make/listener.d.ts +1 -1
- package/build/commands/make/listener.js +8 -5
- package/build/commands/make/middleware.d.ts +1 -1
- package/build/commands/make/middleware.js +5 -3
- package/build/commands/make/preload.d.ts +2 -2
- package/build/commands/make/preload.js +8 -6
- package/build/commands/make/provider.d.ts +1 -1
- package/build/commands/make/provider.js +8 -6
- package/build/commands/make/service.d.ts +1 -1
- package/build/commands/make/service.js +5 -3
- package/build/commands/make/test.d.ts +1 -1
- package/build/commands/make/test.js +5 -3
- package/build/commands/make/validator.d.ts +1 -1
- package/build/commands/make/validator.js +5 -3
- package/build/commands/make/view.d.ts +1 -1
- package/build/commands/make/view.js +5 -3
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/modules/ace/codemods.d.ts +54 -0
- package/build/modules/ace/codemods.js +133 -0
- package/build/modules/ace/commands.d.ts +6 -84
- package/build/modules/ace/commands.js +8 -37
- package/package.json +2 -2
- package/build/commands/make/_base.d.ts +0 -36
- package/build/commands/make/_base.js +0 -27
- /package/build/stubs/{index.d.ts → main.d.ts} +0 -0
- /package/build/stubs/{index.js → main.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"commands":[{"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":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and restart the HTTP server on file change"},{"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":"Select the package manager you want to use to install production dependencies"},{"name":"assets","flagName":"assets","required":false,"type":"boolean","description":"Build frontend assets","showNegatedVariantInHelp":true,"default":true},{"name":"assetsArgs","flagName":"assets-args","required":false,"type":"array","description":"Define CLI arguments to pass to the assets bundler"}],"args":[],"options":{},"filePath":"build.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/build.js"},{"commandName":"configure","description":"Configure a package post installation","help":"","namespace":null,"aliases":[],"flags":[{"name":"verbose","flagName":"verbose","required":false,"type":"boolean","description":"Display logs in verbose mode"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Package name","type":"string"}],"options":{},"filePath":"configure.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/eject.js"},{"commandName":"generate:key","description":"Generate a 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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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":{"allowUnknownFlags":true},"filePath":"make/command.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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":"Convert controller class and file name to its singular form","alias":"r"},{"name":"resource","flagName":"resource","required":false,"type":"boolean","description":"Generate controller with resource actions","alias":"r"},{"name":"api","flagName":"api","required":false,"type":"boolean","description":"Generate controller with api resource actions","alias":"a"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"The name of the controller","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/controller.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/make/event.js"},{"commandName":"make:exception","description":"Create a new ace 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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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 listener","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/listener.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/make/listener.js"},{"commandName":"make:middleware","description":"Create a new middleware class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the middleware","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/middleware.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/make/middleware.js"},{"commandName":"make:preload","description":"Create a new preload file inside the start directory","help":"","namespace":"make","aliases":[],"flags":[{"name":"environments","flagName":"environments","required":false,"type":"array","description":"Define the preload file's environment. Accepted values are \"web,console,test,repl\""}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the preload file","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/preload.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/make/preload.js"},{"commandName":"make:provider","description":"Create a new service provider class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the provider","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/provider.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the test file","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/test.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/make/test.js"},{"commandName":"make:validator","description":"Create a new VineJS validator","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the validator","type":"string"}],"options":{"allowUnknownFlags":true},"filePath":"make/validator.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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":{"allowUnknownFlags":true},"filePath":"make/view.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","```","","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":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and restart the HTTP server on file change"},{"name":"poll","flagName":"poll","required":false,"type":"boolean","description":"Use polling to detect filesystem changes"},{"name":"clear","flagName":"clear","required":false,"type":"boolean","description":"Clear the terminal for new logs after file change","showNegatedVariantInHelp":true,"default":true},{"name":"assets","flagName":"assets","required":false,"type":"boolean","description":"Start assets bundler dev server","showNegatedVariantInHelp":true,"default":true},{"name":"assetsArgs","flagName":"assets-args","required":false,"type":"array","description":"Define CLI arguments to pass to the assets bundler"}],"args":[],"options":{"staysAlive":true},"filePath":"serve.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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},{"name":"assets","flagName":"assets","required":false,"type":"boolean","description":"Start assets bundler dev server.","showNegatedVariantInHelp":true,"default":true},{"name":"assetsArgs","flagName":"assets-args","required":false,"type":"array","description":"Define CLI arguments to pass to the assets bundler"}],"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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/test.js"}],"version":1}
|
|
1
|
+
{"commands":[{"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":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and restart the HTTP server on file change"},{"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":"Select the package manager you want to use to install production dependencies"},{"name":"assets","flagName":"assets","required":false,"type":"boolean","description":"Build frontend assets","showNegatedVariantInHelp":true,"default":true},{"name":"assetsArgs","flagName":"assets-args","required":false,"type":"array","description":"Define CLI arguments to pass to the assets bundler"}],"args":[],"options":{},"filePath":"build.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/build.js"},{"commandName":"configure","description":"Configure a package post installation","help":"","namespace":null,"aliases":[],"flags":[{"name":"verbose","flagName":"verbose","required":false,"type":"boolean","description":"Display logs in verbose mode"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Package name","type":"string"}],"options":{},"filePath":"configure.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/eject.js"},{"commandName":"generate:key","description":"Generate a 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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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":"Convert controller class and file name to its singular form","alias":"r"},{"name":"resource","flagName":"resource","required":false,"type":"boolean","description":"Generate controller with resource actions","alias":"r"},{"name":"api","flagName":"api","required":false,"type":"boolean","description":"Generate controller with api resource actions","alias":"a"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"The name of the controller","type":"string"}],"options":{},"filePath":"make/controller.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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":{},"filePath":"make/event.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/make/event.js"},{"commandName":"make:exception","description":"Create a new ace exception class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the exception","type":"string"}],"options":{},"filePath":"make/exception.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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 listener","type":"string"}],"options":{},"filePath":"make/listener.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/make/listener.js"},{"commandName":"make:middleware","description":"Create a new middleware class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the middleware","type":"string"}],"options":{},"filePath":"make/middleware.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/make/middleware.js"},{"commandName":"make:preload","description":"Create a new preload file inside the start directory","help":"","namespace":"make","aliases":[],"flags":[{"name":"environments","flagName":"environments","required":false,"type":"array","description":"Define the preload file's environment. Accepted values are \"web,console,test,repl\""}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the preload file","type":"string"}],"options":{},"filePath":"make/preload.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/make/preload.js"},{"commandName":"make:provider","description":"Create a new service provider class","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the provider","type":"string"}],"options":{},"filePath":"make/provider.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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":{},"filePath":"make/service.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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"}],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the test file","type":"string"}],"options":{},"filePath":"make/test.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/make/test.js"},{"commandName":"make:validator","description":"Create a new VineJS validator","help":"","namespace":"make","aliases":[],"flags":[],"args":[{"name":"name","argumentName":"name","required":true,"description":"Name of the validator","type":"string"}],"options":{},"filePath":"make/validator.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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","```","","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":"watch","flagName":"watch","required":false,"type":"boolean","description":"Watch filesystem and restart the HTTP server on file change"},{"name":"poll","flagName":"poll","required":false,"type":"boolean","description":"Use polling to detect filesystem changes"},{"name":"clear","flagName":"clear","required":false,"type":"boolean","description":"Clear the terminal for new logs after file change","showNegatedVariantInHelp":true,"default":true},{"name":"assets","flagName":"assets","required":false,"type":"boolean","description":"Start assets bundler dev server","showNegatedVariantInHelp":true,"default":true},{"name":"assetsArgs","flagName":"assets-args","required":false,"type":"array","description":"Define CLI arguments to pass to the assets bundler"}],"args":[],"options":{"staysAlive":true},"filePath":"serve.js","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/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},{"name":"assets","flagName":"assets","required":false,"type":"boolean","description":"Start assets bundler dev server.","showNegatedVariantInHelp":true,"default":true},{"name":"assetsArgs","flagName":"assets-args","required":false,"type":"array","description":"Define CLI arguments to pass to the assets bundler"}],"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","absoluteFilePath":"/Users/virk/code/adonisjs/core/core/build/commands/test.js"}],"version":1}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { AddMiddlewareEntry, EnvValidationDefinition } from '@adonisjs/assembler/types';
|
|
2
|
-
import type { CodeTransformer } from '@adonisjs/assembler/code_transformer';
|
|
3
1
|
import { BaseCommand } from '../modules/ace/main.js';
|
|
4
2
|
/**
|
|
5
3
|
* The configure command is used to configure packages after installation
|
|
@@ -19,22 +17,6 @@ export default class Configure extends BaseCommand {
|
|
|
19
17
|
* Publish a stub file to the user project
|
|
20
18
|
*/
|
|
21
19
|
publishStub(stubPath: string, stubData?: Record<string, any>): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Define one or more environment variables
|
|
24
|
-
*/
|
|
25
|
-
defineEnvVariables(environmentVariables: Record<string, number | string | boolean>): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Define validations for the environment variables
|
|
28
|
-
*/
|
|
29
|
-
defineEnvValidations(validations: EnvValidationDefinition): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* Define validations for the environment variables
|
|
32
|
-
*/
|
|
33
|
-
registerMiddleware(stack: 'server' | 'router' | 'named', middleware: AddMiddlewareEntry[]): Promise<void>;
|
|
34
|
-
/**
|
|
35
|
-
* Update rcFile
|
|
36
|
-
*/
|
|
37
|
-
updateRcFile(...params: Parameters<CodeTransformer['updateRcFile']>): Promise<void>;
|
|
38
20
|
/**
|
|
39
21
|
* Install packages using the correct package manager
|
|
40
22
|
* You can specify version of each package by setting it in the
|
|
@@ -13,7 +13,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
13
13
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
14
14
|
};
|
|
15
15
|
import { slash } from '@poppinss/utils';
|
|
16
|
-
import { EnvEditor } from '@adonisjs/env/editor';
|
|
17
16
|
import { installPackage, detectPackageManager } from '@antfu/install-pkg';
|
|
18
17
|
import { args, BaseCommand, flags } from '../modules/ace/main.js';
|
|
19
18
|
/**
|
|
@@ -22,15 +21,6 @@ import { args, BaseCommand, flags } from '../modules/ace/main.js';
|
|
|
22
21
|
export default class Configure extends BaseCommand {
|
|
23
22
|
static commandName = 'configure';
|
|
24
23
|
static description = 'Configure a package post installation';
|
|
25
|
-
/**
|
|
26
|
-
* Flag to know if assembler is installed as a
|
|
27
|
-
* peer dependency or not.
|
|
28
|
-
*/
|
|
29
|
-
#isAssemblerInstalled;
|
|
30
|
-
/**
|
|
31
|
-
* Reference to lazily imported assembler code transformer
|
|
32
|
-
*/
|
|
33
|
-
#codeTransformer;
|
|
34
24
|
/**
|
|
35
25
|
* Returns the package main exports
|
|
36
26
|
*/
|
|
@@ -56,13 +46,22 @@ export default class Configure extends BaseCommand {
|
|
|
56
46
|
}
|
|
57
47
|
}
|
|
58
48
|
/**
|
|
59
|
-
*
|
|
49
|
+
* Registers VineJS provider
|
|
60
50
|
*/
|
|
61
|
-
async #
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
51
|
+
async #configureVineJS() {
|
|
52
|
+
const codemods = await this.createCodemods();
|
|
53
|
+
await codemods.updateRcFile((rcFile) => {
|
|
54
|
+
rcFile.addProvider('@adonisjs/core/providers/vinejs_provider');
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Registers Edge provider
|
|
59
|
+
*/
|
|
60
|
+
async #configureEdge() {
|
|
61
|
+
const codemods = await this.createCodemods();
|
|
62
|
+
await codemods.updateRcFile((rcFile) => {
|
|
63
|
+
rcFile.addProvider('@adonisjs/core/providers/edge_provider');
|
|
64
|
+
});
|
|
66
65
|
}
|
|
67
66
|
/**
|
|
68
67
|
* Publish a stub file to the user project
|
|
@@ -82,75 +81,6 @@ export default class Configure extends BaseCommand {
|
|
|
82
81
|
}
|
|
83
82
|
this.logger.action(`create ${entityFileName}`).succeeded();
|
|
84
83
|
}
|
|
85
|
-
/**
|
|
86
|
-
* Define one or more environment variables
|
|
87
|
-
*/
|
|
88
|
-
async defineEnvVariables(environmentVariables) {
|
|
89
|
-
const editor = new EnvEditor(this.app.appRoot);
|
|
90
|
-
await editor.load();
|
|
91
|
-
Object.keys(environmentVariables).forEach((key) => {
|
|
92
|
-
const value = environmentVariables[key];
|
|
93
|
-
editor.add(key, value);
|
|
94
|
-
});
|
|
95
|
-
await editor.save();
|
|
96
|
-
this.logger.action('update .env file').succeeded();
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Define validations for the environment variables
|
|
100
|
-
*/
|
|
101
|
-
async defineEnvValidations(validations) {
|
|
102
|
-
await this.#installAssembler();
|
|
103
|
-
if (!this.#codeTransformer) {
|
|
104
|
-
this.logger.warning('Cannot update "start/env.ts" file. Install "@adonisjs/assembler" to modify source files');
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const transformer = new this.#codeTransformer.CodeTransformer(this.app.appRoot);
|
|
108
|
-
const action = this.logger.action('update start/env.ts file');
|
|
109
|
-
try {
|
|
110
|
-
await transformer.defineEnvValidations(validations);
|
|
111
|
-
action.succeeded();
|
|
112
|
-
}
|
|
113
|
-
catch (error) {
|
|
114
|
-
action.failed(error.message);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Define validations for the environment variables
|
|
119
|
-
*/
|
|
120
|
-
async registerMiddleware(stack, middleware) {
|
|
121
|
-
await this.#installAssembler();
|
|
122
|
-
if (!this.#codeTransformer) {
|
|
123
|
-
this.logger.warning('Cannot update "start/kernel.ts" file. Install "@adonisjs/assembler" to modify source files');
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const transformer = new this.#codeTransformer.CodeTransformer(this.app.appRoot);
|
|
127
|
-
const action = this.logger.action('update start/kernel.ts file');
|
|
128
|
-
try {
|
|
129
|
-
await transformer.addMiddlewareToStack(stack, middleware);
|
|
130
|
-
action.succeeded();
|
|
131
|
-
}
|
|
132
|
-
catch (error) {
|
|
133
|
-
action.failed(error.message);
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Update rcFile
|
|
138
|
-
*/
|
|
139
|
-
async updateRcFile(...params) {
|
|
140
|
-
await this.#installAssembler();
|
|
141
|
-
if (!this.#codeTransformer) {
|
|
142
|
-
this.logger.warning('Cannot update "adonisrc.ts" file. Install "@adonisjs/assembler" to modify source files');
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const action = this.logger.action('update adonisrc.ts file');
|
|
146
|
-
try {
|
|
147
|
-
await new this.#codeTransformer.CodeTransformer(this.app.appRoot).updateRcFile(...params);
|
|
148
|
-
action.succeeded();
|
|
149
|
-
}
|
|
150
|
-
catch (error) {
|
|
151
|
-
action.failed(error.message);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
84
|
/**
|
|
155
85
|
* Install packages using the correct package manager
|
|
156
86
|
* You can specify version of each package by setting it in the
|
|
@@ -216,6 +146,12 @@ export default class Configure extends BaseCommand {
|
|
|
216
146
|
* Run method is invoked by ace automatically
|
|
217
147
|
*/
|
|
218
148
|
async run() {
|
|
149
|
+
if (this.name === 'vinejs') {
|
|
150
|
+
return this.#configureVineJS();
|
|
151
|
+
}
|
|
152
|
+
if (this.name === 'edge') {
|
|
153
|
+
return this.#configureEdge();
|
|
154
|
+
}
|
|
219
155
|
const packageExports = await this.#getPackageSource(this.name);
|
|
220
156
|
/**
|
|
221
157
|
* Warn, there are not instructions to run
|
|
@@ -15,6 +15,22 @@ export default class InspectRCFile extends BaseCommand {
|
|
|
15
15
|
static commandName = 'inspect:rcfile';
|
|
16
16
|
static description = 'Inspect the RC file with its default values';
|
|
17
17
|
async run() {
|
|
18
|
-
|
|
18
|
+
const rcContents = lodash.omit(this.app.rcFile, ['raw']);
|
|
19
|
+
rcContents.providers = rcContents.providers?.map((provider) => {
|
|
20
|
+
return {
|
|
21
|
+
...provider,
|
|
22
|
+
file: provider.file.toString(),
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
rcContents.preloads = rcContents.preloads?.map((preload) => {
|
|
26
|
+
return {
|
|
27
|
+
...preload,
|
|
28
|
+
file: preload.file.toString(),
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
rcContents.commands = rcContents.commands?.map((command) => {
|
|
32
|
+
return command.toString();
|
|
33
|
+
});
|
|
34
|
+
this.logger.log(JSON.stringify(rcContents, null, 2));
|
|
19
35
|
}
|
|
20
36
|
}
|
|
@@ -12,8 +12,9 @@ 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
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
16
|
import { args } from '../../modules/ace/main.js';
|
|
17
|
+
import { BaseCommand } from '../../modules/ace/main.js';
|
|
17
18
|
/**
|
|
18
19
|
* Make a new ace command
|
|
19
20
|
*/
|
|
@@ -25,7 +26,9 @@ export default class MakeCommand extends BaseCommand {
|
|
|
25
26
|
*/
|
|
26
27
|
stubPath = 'make/command/main.stub';
|
|
27
28
|
async run() {
|
|
28
|
-
await this.
|
|
29
|
+
const codemods = await this.createCodemods();
|
|
30
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
31
|
+
flags: this.parsed.flags,
|
|
29
32
|
entity: this.app.generators.createEntity(this.name),
|
|
30
33
|
});
|
|
31
34
|
}
|
|
@@ -12,8 +12,8 @@ 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 BaseCommand from '
|
|
16
|
-
import {
|
|
15
|
+
import { args, flags, BaseCommand } from '../../modules/ace/main.js';
|
|
16
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
17
17
|
/**
|
|
18
18
|
* The make controller command to create an HTTP controller
|
|
19
19
|
*/
|
|
@@ -48,7 +48,9 @@ export default class MakeController extends BaseCommand {
|
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
async run() {
|
|
51
|
-
await this.
|
|
51
|
+
const codemods = await this.createCodemods();
|
|
52
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
53
|
+
flags: this.parsed.flags,
|
|
52
54
|
entity: this.app.generators.createEntity(this.name),
|
|
53
55
|
});
|
|
54
56
|
}
|
|
@@ -12,8 +12,8 @@ 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
|
|
16
|
-
import { args } from '../../modules/ace/main.js';
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
17
17
|
/**
|
|
18
18
|
* The make event command to create a class based event
|
|
19
19
|
*/
|
|
@@ -25,7 +25,9 @@ export default class MakeEvent extends BaseCommand {
|
|
|
25
25
|
*/
|
|
26
26
|
stubPath = 'make/event/main.stub';
|
|
27
27
|
async run() {
|
|
28
|
-
await this.
|
|
28
|
+
const codemods = await this.createCodemods();
|
|
29
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
30
|
+
flags: this.parsed.flags,
|
|
29
31
|
entity: this.app.generators.createEntity(this.name),
|
|
30
32
|
});
|
|
31
33
|
}
|
|
@@ -12,8 +12,8 @@ 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
|
|
16
|
-
import { args } from '../../modules/ace/main.js';
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
17
17
|
/**
|
|
18
18
|
* Make a new exception class
|
|
19
19
|
*/
|
|
@@ -25,7 +25,9 @@ export default class MakeException extends BaseCommand {
|
|
|
25
25
|
*/
|
|
26
26
|
stubPath = 'make/exception/main.stub';
|
|
27
27
|
async run() {
|
|
28
|
-
await this.
|
|
28
|
+
const codemods = await this.createCodemods();
|
|
29
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
30
|
+
flags: this.parsed.flags,
|
|
29
31
|
entity: this.app.generators.createEntity(this.name),
|
|
30
32
|
});
|
|
31
33
|
}
|
|
@@ -12,8 +12,8 @@ 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
|
|
16
|
-
import { args, flags } from '../../modules/ace/main.js';
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, flags, BaseCommand } from '../../modules/ace/main.js';
|
|
17
17
|
/**
|
|
18
18
|
* The make listener command to create a class based event
|
|
19
19
|
* listener
|
|
@@ -31,6 +31,7 @@ export default class MakeListener extends BaseCommand {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
async run() {
|
|
34
|
+
const codemods = await this.createCodemods();
|
|
34
35
|
if (this.event) {
|
|
35
36
|
const { exitCode } = await this.kernel.exec('make:event', [this.event]);
|
|
36
37
|
/**
|
|
@@ -38,14 +39,16 @@ export default class MakeListener extends BaseCommand {
|
|
|
38
39
|
*/
|
|
39
40
|
if (exitCode === 0) {
|
|
40
41
|
const eventEntity = this.app.generators.createEntity(this.event);
|
|
41
|
-
await
|
|
42
|
-
entity: this.app.generators.createEntity(this.name),
|
|
42
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
43
43
|
event: eventEntity,
|
|
44
|
+
flags: this.parsed.flags,
|
|
45
|
+
entity: this.app.generators.createEntity(this.name),
|
|
44
46
|
});
|
|
45
47
|
}
|
|
46
48
|
return;
|
|
47
49
|
}
|
|
48
|
-
await
|
|
50
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
51
|
+
flags: this.parsed.flags,
|
|
49
52
|
entity: this.app.generators.createEntity(this.name),
|
|
50
53
|
});
|
|
51
54
|
}
|
|
@@ -12,8 +12,8 @@ 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
|
|
16
|
-
import { args } from '../../modules/ace/main.js';
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
17
17
|
/**
|
|
18
18
|
* The make middleware command to create a new middleware
|
|
19
19
|
* class.
|
|
@@ -26,7 +26,9 @@ export default class MakeMiddleware extends BaseCommand {
|
|
|
26
26
|
*/
|
|
27
27
|
stubPath = 'make/middleware/main.stub';
|
|
28
28
|
async run() {
|
|
29
|
-
await this.
|
|
29
|
+
const codemods = await this.createCodemods();
|
|
30
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
31
|
+
flags: this.parsed.flags,
|
|
30
32
|
entity: this.app.generators.createEntity(this.name),
|
|
31
33
|
});
|
|
32
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import BaseCommand from '
|
|
2
|
-
declare const ALLOWED_ENVIRONMENTS: ("
|
|
1
|
+
import { BaseCommand } from '../../modules/ace/main.js';
|
|
2
|
+
declare const ALLOWED_ENVIRONMENTS: ("web" | "console" | "test" | "repl")[];
|
|
3
3
|
type AllowedAppEnvironments = typeof ALLOWED_ENVIRONMENTS;
|
|
4
4
|
/**
|
|
5
5
|
* Make a new preload file
|
|
@@ -12,9 +12,8 @@ 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
|
|
16
|
-
import { args, flags } from '../../modules/ace/main.js';
|
|
17
|
-
import { RcFileEditor } from '@adonisjs/application/rc_file_editor';
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, flags, BaseCommand } from '../../modules/ace/main.js';
|
|
18
17
|
const ALLOWED_ENVIRONMENTS = ['web', 'console', 'test', 'repl'];
|
|
19
18
|
/**
|
|
20
19
|
* Make a new preload file
|
|
@@ -75,7 +74,9 @@ export default class MakePreload extends BaseCommand {
|
|
|
75
74
|
if (!environments) {
|
|
76
75
|
environments = await this.#promptForEnvironments();
|
|
77
76
|
}
|
|
78
|
-
const
|
|
77
|
+
const codemods = await this.createCodemods();
|
|
78
|
+
const output = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
79
|
+
flags: this.parsed.flags,
|
|
79
80
|
entity: this.app.generators.createEntity(this.name),
|
|
80
81
|
});
|
|
81
82
|
/**
|
|
@@ -83,8 +84,9 @@ export default class MakePreload extends BaseCommand {
|
|
|
83
84
|
* the relative path, since we cannot be sure about aliases to exist.
|
|
84
85
|
*/
|
|
85
86
|
const preloadImportPath = `./${output.relativeFileName.replace(/(\.js|\.ts)$/, '')}.js`;
|
|
86
|
-
|
|
87
|
-
|
|
87
|
+
await codemods.updateRcFile((rcFile) => {
|
|
88
|
+
rcFile.addPreloadFile(preloadImportPath, environments);
|
|
89
|
+
});
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
__decorate([
|
|
@@ -12,9 +12,8 @@ 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
|
|
16
|
-
import { args } from '../../modules/ace/main.js';
|
|
17
|
-
import { RcFileEditor } from '@adonisjs/application/rc_file_editor';
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
18
17
|
/**
|
|
19
18
|
* Make a new provider class
|
|
20
19
|
*/
|
|
@@ -26,7 +25,9 @@ export default class MakeProvider extends BaseCommand {
|
|
|
26
25
|
*/
|
|
27
26
|
stubPath = 'make/provider/main.stub';
|
|
28
27
|
async run() {
|
|
29
|
-
const
|
|
28
|
+
const codemods = await this.createCodemods();
|
|
29
|
+
const output = await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
30
|
+
flags: this.parsed.flags,
|
|
30
31
|
entity: this.app.generators.createEntity(this.name),
|
|
31
32
|
});
|
|
32
33
|
/**
|
|
@@ -34,8 +35,9 @@ export default class MakeProvider extends BaseCommand {
|
|
|
34
35
|
* the relative path, since we cannot be sure about aliases to exist.
|
|
35
36
|
*/
|
|
36
37
|
const providerImportPath = `./${output.relativeFileName.replace(/(\.js|\.ts)$/, '')}.js`;
|
|
37
|
-
|
|
38
|
-
|
|
38
|
+
await codemods.updateRcFile((rcFile) => {
|
|
39
|
+
rcFile.addProvider(providerImportPath);
|
|
40
|
+
});
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
__decorate([
|
|
@@ -12,8 +12,8 @@ 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
|
|
16
|
-
import { args } from '../../modules/ace/main.js';
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
17
17
|
/**
|
|
18
18
|
* Make a new service class
|
|
19
19
|
*/
|
|
@@ -25,7 +25,9 @@ export default class MakeService extends BaseCommand {
|
|
|
25
25
|
*/
|
|
26
26
|
stubPath = 'make/service/main.stub';
|
|
27
27
|
async run() {
|
|
28
|
-
await this.
|
|
28
|
+
const codemods = await this.createCodemods();
|
|
29
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
30
|
+
flags: this.parsed.flags,
|
|
29
31
|
entity: this.app.generators.createEntity(this.name),
|
|
30
32
|
});
|
|
31
33
|
}
|
|
@@ -12,8 +12,8 @@ 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
|
|
16
|
-
import { args, flags } from '../../modules/ace/main.js';
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, flags, BaseCommand } from '../../modules/ace/main.js';
|
|
17
17
|
/**
|
|
18
18
|
* Make a new test file
|
|
19
19
|
*/
|
|
@@ -87,7 +87,9 @@ export default class MakeTest extends BaseCommand {
|
|
|
87
87
|
/**
|
|
88
88
|
* Generate entity
|
|
89
89
|
*/
|
|
90
|
-
await this.
|
|
90
|
+
const codemods = await this.createCodemods();
|
|
91
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
92
|
+
flags: this.parsed.flags,
|
|
91
93
|
entity: this.app.generators.createEntity(this.name),
|
|
92
94
|
suite: {
|
|
93
95
|
directory: await this.#getSuiteDirectory(suite.directories),
|
|
@@ -12,8 +12,8 @@ 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
|
|
16
|
-
import { args } from '../../modules/ace/main.js';
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
17
17
|
/**
|
|
18
18
|
* Make a new VineJS validator
|
|
19
19
|
*/
|
|
@@ -25,7 +25,9 @@ export default class MakeValidator extends BaseCommand {
|
|
|
25
25
|
*/
|
|
26
26
|
stubPath = 'make/validator/main.stub';
|
|
27
27
|
async run() {
|
|
28
|
-
await this.
|
|
28
|
+
const codemods = await this.createCodemods();
|
|
29
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
30
|
+
flags: this.parsed.flags,
|
|
29
31
|
entity: this.app.generators.createEntity(this.name),
|
|
30
32
|
});
|
|
31
33
|
}
|
|
@@ -12,8 +12,8 @@ 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
|
|
16
|
-
import { args } from '../../modules/ace/main.js';
|
|
15
|
+
import { stubsRoot } from '../../stubs/main.js';
|
|
16
|
+
import { args, BaseCommand } from '../../modules/ace/main.js';
|
|
17
17
|
/**
|
|
18
18
|
* Make a new EdgeJS template file
|
|
19
19
|
*/
|
|
@@ -25,7 +25,9 @@ export default class MakeView extends BaseCommand {
|
|
|
25
25
|
*/
|
|
26
26
|
stubPath = 'make/view/main.stub';
|
|
27
27
|
async run() {
|
|
28
|
-
await this.
|
|
28
|
+
const codemods = await this.createCodemods();
|
|
29
|
+
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
30
|
+
flags: this.parsed.flags,
|
|
29
31
|
entity: this.app.generators.createEntity(this.name),
|
|
30
32
|
});
|
|
31
33
|
}
|
package/build/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="@types/node" resolution-mode="require"/>
|
|
2
|
-
export { stubsRoot } from './stubs/
|
|
2
|
+
export { stubsRoot } from './stubs/main.js';
|
|
3
3
|
export { inject } from './modules/container.js';
|
|
4
4
|
export { Ignitor } from './src/ignitor/main.js';
|
|
5
5
|
export declare const errors: {
|
package/build/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { errors as envErrors } from '@adonisjs/env';
|
|
|
11
11
|
import { errors as appErrors } from '@adonisjs/application';
|
|
12
12
|
import { errors as encryptionErrors } from '@adonisjs/encryption';
|
|
13
13
|
import { errors as httpServerErrors } from '@adonisjs/http-server';
|
|
14
|
-
export { stubsRoot } from './stubs/
|
|
14
|
+
export { stubsRoot } from './stubs/main.js';
|
|
15
15
|
export { inject } from './modules/container.js';
|
|
16
16
|
export { Ignitor } from './src/ignitor/main.js';
|
|
17
17
|
export const errors = {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Logger } from '@poppinss/cliui';
|
|
2
|
+
import type { CodeTransformer } from '@adonisjs/assembler/code_transformer';
|
|
3
|
+
import type { AddMiddlewareEntry, EnvValidationDefinition } from '@adonisjs/assembler/types';
|
|
4
|
+
import type { Application } from '../app.js';
|
|
5
|
+
/**
|
|
6
|
+
* Codemods to modify AdonisJS source files. The codemod APIs relies on
|
|
7
|
+
* "@adonisjs/assembler" package and it must be installed as a dependency
|
|
8
|
+
* inside user application.
|
|
9
|
+
*/
|
|
10
|
+
export declare class Codemods {
|
|
11
|
+
#private;
|
|
12
|
+
constructor(app: Application<any>, cliLogger: Logger);
|
|
13
|
+
/**
|
|
14
|
+
* Define one or more environment variables
|
|
15
|
+
*/
|
|
16
|
+
defineEnvVariables(environmentVariables: Record<string, number | string | boolean>): Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* Define validations for the environment variables
|
|
19
|
+
*/
|
|
20
|
+
defineEnvValidations(validations: EnvValidationDefinition): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Define validations for the environment variables
|
|
23
|
+
*/
|
|
24
|
+
registerMiddleware(stack: 'server' | 'router' | 'named', middleware: AddMiddlewareEntry[]): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Update RCFile
|
|
27
|
+
*/
|
|
28
|
+
updateRcFile(...params: Parameters<CodeTransformer['updateRcFile']>): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Generats the stub
|
|
31
|
+
*/
|
|
32
|
+
makeUsingStub(stubsRoot: string, stubPath: string, stubState: Record<string, any>): Promise<{
|
|
33
|
+
relativeFileName: string;
|
|
34
|
+
contents: any;
|
|
35
|
+
destination: any;
|
|
36
|
+
attributes: any;
|
|
37
|
+
status: "created";
|
|
38
|
+
skipReason: null;
|
|
39
|
+
} | {
|
|
40
|
+
relativeFileName: string;
|
|
41
|
+
contents: any;
|
|
42
|
+
destination: any;
|
|
43
|
+
attributes: any;
|
|
44
|
+
status: "force_created";
|
|
45
|
+
skipReason: null;
|
|
46
|
+
} | {
|
|
47
|
+
relativeFileName: string;
|
|
48
|
+
contents: any;
|
|
49
|
+
destination: any;
|
|
50
|
+
attributes: any;
|
|
51
|
+
status: "skipped";
|
|
52
|
+
skipReason: string;
|
|
53
|
+
}>;
|
|
54
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @adonisjs/core
|
|
3
|
+
*
|
|
4
|
+
* (c) AdonisJS
|
|
5
|
+
*
|
|
6
|
+
* For the full copyright and license information, please view the LICENSE
|
|
7
|
+
* file that was distributed with this source code.
|
|
8
|
+
*/
|
|
9
|
+
import { slash } from '@poppinss/utils';
|
|
10
|
+
import { EnvEditor } from '@adonisjs/env/editor';
|
|
11
|
+
/**
|
|
12
|
+
* Codemods to modify AdonisJS source files. The codemod APIs relies on
|
|
13
|
+
* "@adonisjs/assembler" package and it must be installed as a dependency
|
|
14
|
+
* inside user application.
|
|
15
|
+
*/
|
|
16
|
+
export class Codemods {
|
|
17
|
+
/**
|
|
18
|
+
* Flag to know if assembler is installed as a
|
|
19
|
+
* peer dependency or not.
|
|
20
|
+
*/
|
|
21
|
+
#isAssemblerInstalled;
|
|
22
|
+
/**
|
|
23
|
+
* Reference to lazily imported assembler code transformer
|
|
24
|
+
*/
|
|
25
|
+
#codeTransformer;
|
|
26
|
+
/**
|
|
27
|
+
* Reference to AdonisJS application
|
|
28
|
+
*/
|
|
29
|
+
#app;
|
|
30
|
+
/**
|
|
31
|
+
* Reference to CLI logger to write logs
|
|
32
|
+
*/
|
|
33
|
+
#cliLogger;
|
|
34
|
+
constructor(app, cliLogger) {
|
|
35
|
+
this.#app = app;
|
|
36
|
+
this.#cliLogger = cliLogger;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Lazily imports assembler
|
|
40
|
+
*/
|
|
41
|
+
async #importAssembler() {
|
|
42
|
+
if (this.#isAssemblerInstalled === undefined) {
|
|
43
|
+
this.#codeTransformer = await import('@adonisjs/assembler/code_transformer');
|
|
44
|
+
this.#isAssemblerInstalled = !!this.#codeTransformer;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Define one or more environment variables
|
|
49
|
+
*/
|
|
50
|
+
async defineEnvVariables(environmentVariables) {
|
|
51
|
+
const editor = new EnvEditor(this.#app.appRoot);
|
|
52
|
+
await editor.load();
|
|
53
|
+
Object.keys(environmentVariables).forEach((key) => {
|
|
54
|
+
const value = environmentVariables[key];
|
|
55
|
+
editor.add(key, value);
|
|
56
|
+
});
|
|
57
|
+
await editor.save();
|
|
58
|
+
this.#cliLogger.action('update .env file').succeeded();
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Define validations for the environment variables
|
|
62
|
+
*/
|
|
63
|
+
async defineEnvValidations(validations) {
|
|
64
|
+
await this.#importAssembler();
|
|
65
|
+
if (!this.#codeTransformer) {
|
|
66
|
+
this.#cliLogger.warning('Cannot update "start/env.ts" file. Install "@adonisjs/assembler" to modify source files');
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const transformer = new this.#codeTransformer.CodeTransformer(this.#app.appRoot);
|
|
70
|
+
const action = this.#cliLogger.action('update start/env.ts file');
|
|
71
|
+
try {
|
|
72
|
+
await transformer.defineEnvValidations(validations);
|
|
73
|
+
action.succeeded();
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
action.failed(error.message);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Define validations for the environment variables
|
|
81
|
+
*/
|
|
82
|
+
async registerMiddleware(stack, middleware) {
|
|
83
|
+
await this.#importAssembler();
|
|
84
|
+
if (!this.#codeTransformer) {
|
|
85
|
+
this.#cliLogger.warning('Cannot update "start/kernel.ts" file. Install "@adonisjs/assembler" to modify source files');
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
const transformer = new this.#codeTransformer.CodeTransformer(this.#app.appRoot);
|
|
89
|
+
const action = this.#cliLogger.action('update start/kernel.ts file');
|
|
90
|
+
try {
|
|
91
|
+
await transformer.addMiddlewareToStack(stack, middleware);
|
|
92
|
+
action.succeeded();
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
action.failed(error.message);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Update RCFile
|
|
100
|
+
*/
|
|
101
|
+
async updateRcFile(...params) {
|
|
102
|
+
await this.#importAssembler();
|
|
103
|
+
if (!this.#codeTransformer) {
|
|
104
|
+
this.#cliLogger.warning('Cannot update "adonisrc.ts" file. Install "@adonisjs/assembler" to modify source files');
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const transformer = new this.#codeTransformer.CodeTransformer(this.#app.appRoot);
|
|
108
|
+
const action = this.#cliLogger.action('update adonisrc.ts file');
|
|
109
|
+
try {
|
|
110
|
+
await transformer.updateRcFile(...params);
|
|
111
|
+
action.succeeded();
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
action.failed(error.message);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Generats the stub
|
|
119
|
+
*/
|
|
120
|
+
async makeUsingStub(stubsRoot, stubPath, stubState) {
|
|
121
|
+
const stubs = await this.#app.stubs.create();
|
|
122
|
+
const stub = await stubs.build(stubPath, { source: stubsRoot });
|
|
123
|
+
const output = await stub.generate(stubState);
|
|
124
|
+
const entityFileName = slash(this.#app.relativePath(output.destination));
|
|
125
|
+
const result = { ...output, relativeFileName: entityFileName };
|
|
126
|
+
if (output.status === 'skipped') {
|
|
127
|
+
this.#cliLogger.action(`create ${entityFileName}`).skipped(output.skipReason);
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
this.#cliLogger.action(`create ${entityFileName}`).succeeded();
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -2,39 +2,6 @@ import { BaseCommand as AceBaseCommand, ListCommand as AceListCommand } from '@a
|
|
|
2
2
|
import { Kernel } from './kernel.js';
|
|
3
3
|
import type { ApplicationService } from '../../src/types.js';
|
|
4
4
|
import type { CommandOptions, ParsedOutput, UIPrimitives } from '../../types/ace.js';
|
|
5
|
-
/**
|
|
6
|
-
* Wrapper around the stub generation logic.
|
|
7
|
-
* Allow commands to easily generate files from given stubs
|
|
8
|
-
*/
|
|
9
|
-
declare class StubGenerator {
|
|
10
|
-
#private;
|
|
11
|
-
constructor(command: BaseCommand, flags: Record<string, any>);
|
|
12
|
-
/**
|
|
13
|
-
* Generats the stub
|
|
14
|
-
*/
|
|
15
|
-
generate(stubsRoot: string, stubPath: string, stubState: Record<string, any>): Promise<{
|
|
16
|
-
relativeFileName: string;
|
|
17
|
-
contents: any;
|
|
18
|
-
destination: any;
|
|
19
|
-
attributes: any;
|
|
20
|
-
status: "created";
|
|
21
|
-
skipReason: null;
|
|
22
|
-
} | {
|
|
23
|
-
relativeFileName: string;
|
|
24
|
-
contents: any;
|
|
25
|
-
destination: any;
|
|
26
|
-
attributes: any;
|
|
27
|
-
status: "force_created";
|
|
28
|
-
skipReason: null;
|
|
29
|
-
} | {
|
|
30
|
-
relativeFileName: string;
|
|
31
|
-
contents: any;
|
|
32
|
-
destination: any;
|
|
33
|
-
attributes: any;
|
|
34
|
-
status: "skipped";
|
|
35
|
-
skipReason: string;
|
|
36
|
-
}>;
|
|
37
|
-
}
|
|
38
5
|
/**
|
|
39
6
|
* The base command to create custom ace commands. The AdonisJS base commands
|
|
40
7
|
* receives the application instance
|
|
@@ -42,11 +9,14 @@ declare class StubGenerator {
|
|
|
42
9
|
export declare class BaseCommand extends AceBaseCommand {
|
|
43
10
|
app: ApplicationService;
|
|
44
11
|
kernel: Kernel;
|
|
45
|
-
stubGenerator: StubGenerator;
|
|
46
12
|
static options: CommandOptions;
|
|
47
13
|
get staysAlive(): boolean | undefined;
|
|
48
14
|
get startApp(): boolean | undefined;
|
|
49
15
|
constructor(app: ApplicationService, kernel: Kernel, parsed: ParsedOutput, ui: UIPrimitives, prompt: Kernel['prompt']);
|
|
16
|
+
/**
|
|
17
|
+
* Creates the codemods module to modify source files
|
|
18
|
+
*/
|
|
19
|
+
createCodemods(): Promise<import("./codemods.js").Codemods>;
|
|
50
20
|
/**
|
|
51
21
|
* The prepare template method is used to prepare the
|
|
52
22
|
* state for the command. This is the first method
|
|
@@ -68,31 +38,6 @@ export declare class BaseCommand extends AceBaseCommand {
|
|
|
68
38
|
* reporting to the kernel layer.
|
|
69
39
|
*/
|
|
70
40
|
completed?(..._: any[]): any;
|
|
71
|
-
/**
|
|
72
|
-
* Make a new file using the given stub
|
|
73
|
-
*/
|
|
74
|
-
makeUsingStub(stubPath: string, stubState: Record<string, any>, stubsRoot: string): Promise<{
|
|
75
|
-
relativeFileName: string;
|
|
76
|
-
contents: any;
|
|
77
|
-
destination: any;
|
|
78
|
-
attributes: any;
|
|
79
|
-
status: "created";
|
|
80
|
-
skipReason: null;
|
|
81
|
-
} | {
|
|
82
|
-
relativeFileName: string;
|
|
83
|
-
contents: any;
|
|
84
|
-
destination: any;
|
|
85
|
-
attributes: any;
|
|
86
|
-
status: "force_created";
|
|
87
|
-
skipReason: null;
|
|
88
|
-
} | {
|
|
89
|
-
relativeFileName: string;
|
|
90
|
-
contents: any;
|
|
91
|
-
destination: any;
|
|
92
|
-
attributes: any;
|
|
93
|
-
status: "skipped";
|
|
94
|
-
skipReason: string;
|
|
95
|
-
}>;
|
|
96
41
|
/**
|
|
97
42
|
* Executes the command
|
|
98
43
|
*/
|
|
@@ -111,36 +56,14 @@ export declare class BaseCommand extends AceBaseCommand {
|
|
|
111
56
|
export declare class ListCommand extends AceListCommand implements BaseCommand {
|
|
112
57
|
app: ApplicationService;
|
|
113
58
|
kernel: Kernel;
|
|
114
|
-
stubGenerator: StubGenerator;
|
|
115
59
|
static options: CommandOptions;
|
|
116
60
|
get staysAlive(): boolean | undefined;
|
|
117
61
|
get startApp(): boolean | undefined;
|
|
118
62
|
constructor(app: ApplicationService, kernel: Kernel, parsed: ParsedOutput, ui: UIPrimitives, prompt: Kernel['prompt']);
|
|
119
63
|
/**
|
|
120
|
-
*
|
|
64
|
+
* Creates the codemods module to modify source files
|
|
121
65
|
*/
|
|
122
|
-
|
|
123
|
-
relativeFileName: string;
|
|
124
|
-
contents: any;
|
|
125
|
-
destination: any;
|
|
126
|
-
attributes: any;
|
|
127
|
-
status: "created";
|
|
128
|
-
skipReason: null;
|
|
129
|
-
} | {
|
|
130
|
-
relativeFileName: string;
|
|
131
|
-
contents: any;
|
|
132
|
-
destination: any;
|
|
133
|
-
attributes: any;
|
|
134
|
-
status: "force_created";
|
|
135
|
-
skipReason: null;
|
|
136
|
-
} | {
|
|
137
|
-
relativeFileName: string;
|
|
138
|
-
contents: any;
|
|
139
|
-
destination: any;
|
|
140
|
-
attributes: any;
|
|
141
|
-
status: "skipped";
|
|
142
|
-
skipReason: string;
|
|
143
|
-
}>;
|
|
66
|
+
createCodemods(): Promise<import("./codemods.js").Codemods>;
|
|
144
67
|
/**
|
|
145
68
|
* Terminate the app. A command should prefer calling this method
|
|
146
69
|
* over the "app.terminate", because this method only triggers
|
|
@@ -149,4 +72,3 @@ export declare class ListCommand extends AceListCommand implements BaseCommand {
|
|
|
149
72
|
*/
|
|
150
73
|
terminate(): Promise<void>;
|
|
151
74
|
}
|
|
152
|
-
export {};
|
|
@@ -6,36 +6,7 @@
|
|
|
6
6
|
* For the full copyright and license information, please view the LICENSE
|
|
7
7
|
* file that was distributed with this source code.
|
|
8
8
|
*/
|
|
9
|
-
import { slash } from '@poppinss/utils';
|
|
10
9
|
import { BaseCommand as AceBaseCommand, ListCommand as AceListCommand } from '@adonisjs/ace';
|
|
11
|
-
/**
|
|
12
|
-
* Wrapper around the stub generation logic.
|
|
13
|
-
* Allow commands to easily generate files from given stubs
|
|
14
|
-
*/
|
|
15
|
-
class StubGenerator {
|
|
16
|
-
#command;
|
|
17
|
-
#flags;
|
|
18
|
-
constructor(command, flags) {
|
|
19
|
-
this.#command = command;
|
|
20
|
-
this.#flags = flags;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Generats the stub
|
|
24
|
-
*/
|
|
25
|
-
async generate(stubsRoot, stubPath, stubState) {
|
|
26
|
-
const stubs = await this.#command.app.stubs.create();
|
|
27
|
-
const stub = await stubs.build(stubPath, { source: stubsRoot });
|
|
28
|
-
const output = await stub.generate(Object.assign({ flags: this.#flags }, stubState));
|
|
29
|
-
const entityFileName = slash(this.#command.app.relativePath(output.destination));
|
|
30
|
-
const result = { ...output, relativeFileName: entityFileName };
|
|
31
|
-
if (output.status === 'skipped') {
|
|
32
|
-
this.#command.logger.action(`create ${entityFileName}`).skipped(output.skipReason);
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
this.#command.logger.action(`create ${entityFileName}`).succeeded();
|
|
36
|
-
return result;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
10
|
/**
|
|
40
11
|
* The base command to create custom ace commands. The AdonisJS base commands
|
|
41
12
|
* receives the application instance
|
|
@@ -43,7 +14,6 @@ class StubGenerator {
|
|
|
43
14
|
export class BaseCommand extends AceBaseCommand {
|
|
44
15
|
app;
|
|
45
16
|
kernel;
|
|
46
|
-
stubGenerator = new StubGenerator(this, this.parsed?.flags || {});
|
|
47
17
|
static options = {};
|
|
48
18
|
get staysAlive() {
|
|
49
19
|
return this.constructor.options.staysAlive;
|
|
@@ -57,10 +27,11 @@ export class BaseCommand extends AceBaseCommand {
|
|
|
57
27
|
this.kernel = kernel;
|
|
58
28
|
}
|
|
59
29
|
/**
|
|
60
|
-
*
|
|
30
|
+
* Creates the codemods module to modify source files
|
|
61
31
|
*/
|
|
62
|
-
async
|
|
63
|
-
|
|
32
|
+
async createCodemods() {
|
|
33
|
+
const { Codemods } = await import('./codemods.js');
|
|
34
|
+
return new Codemods(this.app, this.logger);
|
|
64
35
|
}
|
|
65
36
|
/**
|
|
66
37
|
* Executes the command
|
|
@@ -114,7 +85,6 @@ export class BaseCommand extends AceBaseCommand {
|
|
|
114
85
|
export class ListCommand extends AceListCommand {
|
|
115
86
|
app;
|
|
116
87
|
kernel;
|
|
117
|
-
stubGenerator = new StubGenerator(this, this.parsed?.flags || {});
|
|
118
88
|
static options = {};
|
|
119
89
|
get staysAlive() {
|
|
120
90
|
return this.constructor.options.staysAlive;
|
|
@@ -128,10 +98,11 @@ export class ListCommand extends AceListCommand {
|
|
|
128
98
|
this.kernel = kernel;
|
|
129
99
|
}
|
|
130
100
|
/**
|
|
131
|
-
*
|
|
101
|
+
* Creates the codemods module to modify source files
|
|
132
102
|
*/
|
|
133
|
-
async
|
|
134
|
-
|
|
103
|
+
async createCodemods() {
|
|
104
|
+
const { Codemods } = await import('./codemods.js');
|
|
105
|
+
return new Codemods(this.app, this.logger);
|
|
135
106
|
}
|
|
136
107
|
/**
|
|
137
108
|
* Terminate the app. A command should prefer calling this method
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/core",
|
|
3
3
|
"description": "Core of AdonisJS",
|
|
4
|
-
"version": "6.1.5-
|
|
4
|
+
"version": "6.1.5-19",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.16.0"
|
|
7
7
|
},
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
},
|
|
113
113
|
"dependencies": {
|
|
114
114
|
"@adonisjs/ace": "^12.3.1-10",
|
|
115
|
-
"@adonisjs/application": "^7.1.2-
|
|
115
|
+
"@adonisjs/application": "^7.1.2-12",
|
|
116
116
|
"@adonisjs/bodyparser": "^9.3.2-7",
|
|
117
117
|
"@adonisjs/config": "^4.2.1-3",
|
|
118
118
|
"@adonisjs/encryption": "^5.1.2-2",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { BaseCommand } from '../../modules/ace/main.js';
|
|
2
|
-
import type { CommandOptions } from '../../types/ace.js';
|
|
3
|
-
/**
|
|
4
|
-
* Base command for make commands
|
|
5
|
-
*/
|
|
6
|
-
export default abstract class extends BaseCommand {
|
|
7
|
-
/**
|
|
8
|
-
* Allowing unknown flags to enable custom workflows
|
|
9
|
-
*/
|
|
10
|
-
static options: CommandOptions;
|
|
11
|
-
/**
|
|
12
|
-
* Generates the resource from stub
|
|
13
|
-
*/
|
|
14
|
-
protected generate(stubPath: string, stubState: Record<string, any>): Promise<{
|
|
15
|
-
relativeFileName: string;
|
|
16
|
-
contents: any;
|
|
17
|
-
destination: any;
|
|
18
|
-
attributes: any;
|
|
19
|
-
status: "created";
|
|
20
|
-
skipReason: null;
|
|
21
|
-
} | {
|
|
22
|
-
relativeFileName: string;
|
|
23
|
-
contents: any;
|
|
24
|
-
destination: any;
|
|
25
|
-
attributes: any;
|
|
26
|
-
status: "force_created";
|
|
27
|
-
skipReason: null;
|
|
28
|
-
} | {
|
|
29
|
-
relativeFileName: string;
|
|
30
|
-
contents: any;
|
|
31
|
-
destination: any;
|
|
32
|
-
attributes: any;
|
|
33
|
-
status: "skipped";
|
|
34
|
-
skipReason: string;
|
|
35
|
-
}>;
|
|
36
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @adonisjs/core
|
|
3
|
-
*
|
|
4
|
-
* (c) AdonisJS
|
|
5
|
-
*
|
|
6
|
-
* For the full copyright and license information, please view the LICENSE
|
|
7
|
-
* file that was distributed with this source code.
|
|
8
|
-
*/
|
|
9
|
-
import { stubsRoot } from '../../stubs/index.js';
|
|
10
|
-
import { BaseCommand } from '../../modules/ace/main.js';
|
|
11
|
-
/**
|
|
12
|
-
* Base command for make commands
|
|
13
|
-
*/
|
|
14
|
-
export default class default_1 extends BaseCommand {
|
|
15
|
-
/**
|
|
16
|
-
* Allowing unknown flags to enable custom workflows
|
|
17
|
-
*/
|
|
18
|
-
static options = {
|
|
19
|
-
allowUnknownFlags: true,
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Generates the resource from stub
|
|
23
|
-
*/
|
|
24
|
-
async generate(stubPath, stubState) {
|
|
25
|
-
return this.makeUsingStub(stubPath, stubState, stubsRoot);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
File without changes
|
|
File without changes
|