-
Notifications
You must be signed in to change notification settings - Fork 1
Don't hardcode creator values #139
Comments
I think we should go with
Looks like we could also create a sub-module that would get run on Also makes me wonder if we should just start a child process that runs |
Would be nice if it was easy. Here are the issues I see in general with relying on
Looks like we could rely on the If we could find a way to leverage |
yeah, I mostly meant we should lean on the const npmConf = require('npm-conf');
const conf = npmConf();
const authorName = conf.get('init-author-name');
if (!authorName) {
prompts.push({ // author name prompt });
} Using something like the npm conf package. I don't think it's a terribly common thing to do, but I think it's better practice than creating our own way for defaults to work. Ideally we would support both I'm not saying we definitely should user If we run const pkg = require('package.json');
const extend = require('deep-extend');
// Get values and put them in the readme
fs.copyTpl('README.md', 'README.md', { name: pkg.name });
// We could even only prompt for package.json stuff it the file doesn't already exist
if (!fs.existsSync('package.json') {
prompts.concat(packageJsonPromts);
}
// To add new properties to the package.json
const withScripts = extend(pkg, {
scripts: {
start: "gulp stuff"
dev: "another task"
}
}); I agree that the templating version is easier to understand, but I also think it can be more complex if we have a lot of logic in those templates that decide what does and doesn't get output in which situations. |
Absolutely agree that we should use the npm conf values as defaults if they exist.
We agree here, too, but for me the solution of using npm init probably adds more complexity than it removes, not in terms of lines of code but in understanding how the generator arrives at its final results. The solution you posted is as nice as it could be, but would still require writing to an existing file in the filesystem ( |
We're currently hard-coding the following values:
authorName
authorEmail
authorUrl
githubName
We need a documented, simple way for creators outside of ODC to use this generator with custom values for these.
The text was updated successfully, but these errors were encountered: