FreeAllMedia / stimpak

An easy-to-use system for defining, discovering, and re-using code, text, and workflow patterns
http://stimpak.io
MIT License
8 stars 1 forks source link

npm3 breaks just-in-time transpiling #13

Closed dcrockwell closed 8 years ago

dcrockwell commented 8 years ago

Steps to reproduce:

  1. use a stimpak generator that includes another stimpak generator
  2. when both generators are published to npm and installed globally
npm uninstall stimpak stimpak-generator -g
npm install stimpak stimpak-generator -g
stimpak generator

Expected:

The sub-generator would be transpiled just as the parent generator was, and everything would run normally.

What actually happens:

Due to the way npm3 uses maximally flat hierarchy to support windows boxes better, the sub-generator's babel dependencies are not installed in the sub-generator's directory, but instead in the parent generator's directory, or the global node modules directory. This causes the sub-generator to fail transpiling, resulting in:

/stimpak-generator/node_modules/stimpak-readme/generator.js:3
export default class StimpakReadme {
^^^^^^

SyntaxError: Unexpected reserved word
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Module._extensions..js (module.js:417:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/dcrockwell/Dropbox/Code/stimpak/node_modules/babel-register/lib/node.js:166:7)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (generator.js:3:1)
    at Module._compile (module.js:410:26)
dcrockwell commented 8 years ago

This is fixed with the latest dev build: https://travis-ci.org/FreeAllMedia/stimpak/builds/133763963