Feature/generate cli #98
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Warning
This PR is still in draft. Changes to the
@strapi/generators
package are needed for this to work correctly. This PR on the strapi/strapi repo addresses these changesWhat does it do?
It adds a new command to the CLI to generate boilerplate code for your plugin.
This command will start an interactive CLI where the user can give some input that is used to generate the code. The DX is almost exactly the same as the native
strapi generate
CLI. The only thing different is the fact that you don't have to select the destination.This PR basically implements an extension of the
@strapi/generators
package. Both the file generation and most of the prompts are import from that package and re-used by calling thegenerate
API.Why is it needed?
The native
strapi generate
CLI allows for generating boilerplate code for plugins, but that only works for local plugins in thesrc/plugins
directory. For standalone plugins there is no way to generate boilerplate code.How to test it?
pnpm install
pnpm run build && npx yalc push --publish
npx @strapi/sdk-plugin init
npx yalc add @strapi/sdk-plugin
node_modules/.bin/strapi-plugin generate