Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save DaneTheory/34ad4da825a1f833d91d3d2af4a6e18f to your computer and use it in GitHub Desktop.
Save DaneTheory/34ad4da825a1f833d91d3d2af4a6e18f to your computer and use it in GitHub Desktop.
The Package (dot) JSON: A story of love, triumph, and general witchcraft/wizardry - Extras: Custom Questionnaire
[{
"npm:current*": {
"ref": "https://docs.npmjs.com/creating-a-package-json-file#customizing-the-packagejson-questionnaire",
"description": "If you expect to create many 'package.json' files, you can customize the questions asked and fields created during the init process so all the 'package.json' files contain a standard set of information.",
"_": [
"In your home directory, create a file called '.npm-init.js'",
["To add custom questions, using a text editor, add questions with the 'prompt' function", "module.exports = prompt(\"what's your favorite flavor of ice cream, buddy?\", \"I LIKE THEM ALL\");"],
["To add custom fields, using a text editor, add desired fields to the '.npm-init.js' file", "module.exports = { \n \"customField\": \"Example custom field\", \n \"otherCustomField\": \"This example field is really cool\" \n }"],
["To learn more about creating advanced 'npm init' customizations, see the '_url1_:init-package-json:_url1_' GitHub repository.", "_url1_:https://github.com/npm/init-package-json:_url1_"]
]
}
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment