Plans for the next major version (v2.0)
egoist opened this issue · comments
- Replace
inquirer.js
withenquirer
, more lightweight and testable. - Bundle the module with
webpack
, so the install size will be < 1MB. - A new convention for writing
saofile.js
for flexibility 🤔https://gist.github.com/egoist/473170713977f6817e39a87db15701a8#file-saofile-js - Written in TypeScript
- Upgradable template
hi, thanks for sao whats about parsing args? directly witout using third party lib :D
@egoist - Do you have a rough timeline for version 2.0?
Just chiming in to say that I think the current saofile.js
format is more intuitive than the proposed format.
Personally I love Hygen's approach to prompts and copying files. Have a basic mode for just parsing all the files in template
with EJS, and then a more advanced mode for fine-tuning the actions.
But that said I think the current format is great 👍
And the scaffolded project upgrade tool would be amazing
@seaneking loading generators based on folder structure and using inline front matter instead of config file look pretty interesting 👀 maybe we should consider that too.
I don't think the inline frontmatter would be a good approach for sao, since it really breaks down once you have more than a couple of files. It's great for mini generators for new components/etc like Hygen was designed for, but not for whole projects like sao is designed for. They're complimentary tools/approaches and I use both.
For example I use sao to scaffold out client Gatsby projects, and having to write frontmatter for the 93 files in that template would be really painful.
Using folder structure for generators and the rest is really lovely though. I just think sao should use folder structure within template
to dicate output as it currently does. Maybe with override options in an optional sao.config.js
or whatever file for more advanced control
Just rewriting the aforementioned Gatsby generator (coming from Yeoman) and one change I think sao should make for v2 is taking a function for the filter
argument to add
, passing the answers hash and expecting to return an array of files to exclude. Right now the key:value object is pretty limiting.
@seaneking: passing the answers hash and expecting to return an array of files to exclude.
You can use files
to achieve this:
actions() {
return [
{
type: 'add',
files: ['*', !this.answers.ts && '!tsconfig.json'].filter(Boolean)
}
]
}
Oh nice. I didn't realise you could pass a function with the generator instance to actions
. In that case I think that should be better documented, and maybe the filter
and similar methods deprecated, because you can acheive all that more succinctly by returning a function like this.
FWIW sao errored when I tried to access this.answers
in actions, I had to pass access it from the generator instance passed in, ie:
actions({ answers }) => [ ... ]