Open shaunwarman opened 5 years ago
Is this an example of what you were looking for: https://github.com/lirantal/create-node-lib/blob/master/bin/cli.js ?
Ah more so something that shows you can pass variables to soa generator and get access to those variables in the soa context.
Example
await sao({
applicationName,
generator,
outDir: targetPath,
npmClient: 'npm'
}).run();
saofile.js
const questions = require('./src/utils/prompts');
module.exports = {
prompts() {
const { applicationName } = this.sao.opts; // <- this isn't documented
return questions.configure(applicationName);
},
actions: [
...
],
async completed() {
this.gitInit();
await this.npmInstall();
this.showProjectTips();
}
};
So if I'm looking at v1 documentation on sao generator instance it's not immediately obvious that you can pass variables in and have access to those on this.sao.opts
.
I probably missed it. But it doesn't seem obvious how to pass in variables to sao context.
My CLI tool uses
cac
for something likeAnd need to feed this value into sao context
It seems it's available on
this.sao.opts
is this documented? If not, I'll send a PR.