FormidableLabs / builder-init

A project generator for builder archetypes.
MIT License
12 stars 2 forks source link

Doc Bug: `require` is not supported in init.js #32

Closed coopy closed 8 years ago

coopy commented 8 years ago

I'm trying to use the "File Name Parsing" feature of builder-init:

This works (https://github.com/plotly/dash-components-archetype/tree/template-file-name-prompt):

Result:

~/dev/plotly/test$ builder-init "`pwd`/../dash-components-archetype"
dash-components-archetype-0.1.3.tgz
[builder-init] Preparing templates for: dash-components-archetype
? Please name your component suite. foo-prompted
? Enter a description Dash UI component suite
? GitHub organization or user name
? License organization (e.g., you or your company)
? Destination directory to write foo-prompted

[builder-init] Wrote files:
 - foo-prompted/.babelrc
 - foo-prompted/.builderrc
 - foo-prompted/LICENSE.txt
 - foo-prompted/README.md
 - foo-prompted/package.json
 - foo-prompted/.eslintrc
 - foo-prompted/.gitignore
 - foo-prompted/.npmignore
 - foo-prompted/foo-prompted.txt
 - foo-prompted/src/index.js
 - foo-prompted/src/components/ExampleComponent.react.js

[builder-init] New dash-components-archetype project is ready at: foo-prompted

This does not work (https://github.com/plotly/dash-components-archetype/tree/template-file-name-derived):

Result:

EDITED: I copy-pasted the wrong error here before.

~/dev/plotly/test$ builder-init "`pwd`/../dash-components-archetype"
dash-components-archetype-0.1.3.tgz
[builder-init] Preparing templates for: dash-components-archetype
? Destination directory to write yeah-man
Error: Unknown token: 'capitalCamelCasePackageName' for path: /var/folders/dr/4nn6l7t17cvdjcmx6tdtvgrr0000gp/T/builder-init116530-32509-elt0x8/extracted/init/{{capitalCamelCasePackageName}}.txt

Note: When using the derived field, the first prompt is "? Destination directory to write", not "? Please name your component suite."

Repro:

git clone git@github.com:plotly/dash-components-archetype.git
cd dash-components-archetype
git checkout template-file-name-derived
npm install

cd ..
npm install -g builder-init
builder-init "`pwd`/../dash-components-archetype"
# now enter a valid package name like "foo-component-suite"
ryan-roemer commented 8 years ago

Diagnosis: require's of modules in init.js is not supported. Crafting better error messages and documentation.

ryan-roemer commented 8 years ago

Will potentially support init.js dependencies as a distinct feature in the future: https://github.com/FormidableLabs/builder-init/issues/33