ignite
ignite copied to clipboard
Generate a component in specific path/subfolder
how can i generate a component or other with generate
in a specific folder?
My project is split into several sub folders and is not flat like the boilerplate.
I tried ignite generate component path1/path2/Name
but do not work
Thank you
I want the same thing! can this be supported?
I believe that isn't possible at the moment, but would be a great pull request 😄
Yeah, this is a great idea.
This is how we could approach it.
Here, we need to have an option to pass through the specified path (will need to add a field to GeneratorOptions
too):
https://github.com/infinitered/ignite/blob/ef5810aac792794ee9102e4e563862145d098ea0/src/tools/generators.ts#L116-L117
We would need to pass that through here:
https://github.com/infinitered/ignite/blob/ef5810aac792794ee9102e4e563862145d098ea0/src/commands/generate.ts#L78-L81
And of course we need to be able to pass that through. That would happen somewhere around here:
https://github.com/infinitered/ignite/blob/ef5810aac792794ee9102e4e563862145d098ea0/src/commands/generate.ts#L58-L74
Various ideas:
npx ignite-cli generate component MyButton --folder=app/buttons
You'd pull this from parameters.options.folder
(or maybe dest
or path
?)
We could also just use the third parameter.
npx ignite-cli generate component MyButton app/buttons
This would be parameters.third
.
Thoughts?
Another good option would be to support frontmatter to our template files. We already have a PR in-flight for this.
https://github.com/infinitered/ignite/pull/1630
This is how we could approach it.
Here, we need to have an option to pass through the specified path (will need to add a field to
GeneratorOptions
too):https://github.com/infinitered/ignite/blob/ef5810aac792794ee9102e4e563862145d098ea0/src/tools/generators.ts#L116-L117
We would need to pass that through here:
https://github.com/infinitered/ignite/blob/ef5810aac792794ee9102e4e563862145d098ea0/src/commands/generate.ts#L78-L81
And of course we need to be able to pass that through. That would happen somewhere around here:
https://github.com/infinitered/ignite/blob/ef5810aac792794ee9102e4e563862145d098ea0/src/commands/generate.ts#L58-L74
Various ideas:
npx ignite-cli generate component MyButton --folder=app/buttons
You'd pull this from
parameters.options.folder
(or maybedest
orpath
?)We could also just use the third parameter.
npx ignite-cli generate component MyButton app/buttons
This would be
parameters.third
.Thoughts?
Wouldn't it be better to try and infer the path from one argument instead of several (for convenience)
That way before we generate the template, we check the name and resolve the component name, and the folder it should be generated in, ofcourse if there are no /
characters in the name the script will work the same way as before, I'm not sure if this solution can be integrated with what we already have now though 😅
:tada: This issue has been resolved in version 8.6.0 :tada:
The release is available on:
Your semantic-release bot :package::rocket: