systemjs / plugin-babel

SystemJS Babel Plugin
MIT License
82 stars 33 forks source link

chore(build): update build process #38

Closed douglasduteil closed 8 years ago

douglasduteil commented 8 years ago

Hi @guybedford

It way harder than expected to update babel (#34). I tried to run your build.sh script but it fails with :

./build.sh: 2: ./build.sh: jspm: not found
./build.sh: 3: ./build.sh: jspm: not found
./build.sh: 4: ./build.sh: jspm: not found
./build.sh: 5: ./build.sh: jspm: not found
./build.sh: 6: ./build.sh: jspm: not found
cat: jspm_packages/github/facebook/regenerator@0.8.42/runtime.js: No such file or directory

So given what you wrote I try to make a standalone build script with less environnement descendances. This PR is the state of this experiment.

However, I end up with a strange error from babel-types@6.8.1 :

err        throw new Error('Module ' + name + ' not declared as a dependency of ' + entry.name);
        ^
  Error: Module ./definitions/init not declared as a dependency of /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js
      at Object.<anonymous> (/home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js:329:25)
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js:864:4
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js:865:3
      at Object.exports.runInThisContext (vm.js:54:17)
      at Object.<anonymous> (/home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js:6:43)
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js:144:4
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js:145:3
      at Object.exports.runInThisContext (vm.js:54:17)
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-template@6.8.0/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-helpers@6.8.0/lib/helpers.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-helpers@6.8.0/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-core@6.8.0/lib/transformation/file/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-core@6.8.0/lib/api/node.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-core@6.8.0/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/systemjs-build-modular-babel-helpers.js
  Error loading /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/systemjs-build-modular-babel-helpers.js

Do you have any idea where it comes from ? Thanks





Full output:

$ ./build.sh                                         
#!/bin/bash -xv

NODE_CWD=./node_modules/.bin
+ NODE_CWD=./node_modules/.bin

JSPM_CMD=${NODE_CWD}/jspm
+ JSPM_CMD=./node_modules/.bin/jspm

JSPM_VERSION=beta
+ JSPM_VERSION=beta
REGENERATOR_VERSION=0.8.0
+ REGENERATOR_VERSION=0.8.0

#

cd build-babel
+ cd build-babel

npm install jspm@${JSPM_VERSION} --cache-min=Infinity
+ npm install jspm@beta --cache-min=Infinity
/home/x/zzz/github/douglasduteil/plugin-babel/build-babel
└── jspm@0.17.0-beta.14  extraneous

npm WARN build-babel No description
npm WARN build-babel No repository field.
npm WARN build-babel No license field.
${JSPM_CMD} install --quick --log err
+ ./node_modules/.bin/jspm install --quick --log err

cp -r jspm_packages_override jspm_packages
+ cp -r jspm_packages_override jspm_packages

${JSPM_CMD} build systemjs-babel.js ../systemjs-babel-browser.js --format amd --skip-source-maps --minify --log ok
+ ./node_modules/.bin/jspm build systemjs-babel.js ../systemjs-babel-browser.js --format amd --skip-source-maps --minify --log ok
ok   Built into ../systemjs-babel-browser.js, minified, mangled as amd.

${JSPM_CMD} build systemjs-babel.js ../systemjs-babel-node.js --format amd --node --skip-source-maps --log ok
+ ./node_modules/.bin/jspm build systemjs-babel.js ../systemjs-babel-node.js --format amd --node --skip-source-maps --log ok
ok   Built into ../systemjs-babel-node.js, unminified as amd.

${JSPM_CMD} run systemjs-build-babel-helpers.js > ../babel-helpers.js
+ ./node_modules/.bin/jspm run systemjs-build-babel-helpers.js

err        throw new Error('Module ' + name + ' not declared as a dependency of ' + entry.name);
        ^
  Error: Module ./definitions/init not declared as a dependency of /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js
      at Object.<anonymous> (/home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js:329:25)
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js:864:4
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js:865:3
      at Object.exports.runInThisContext (vm.js:54:17)
      at Object.<anonymous> (/home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js:6:43)
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js:144:4
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js:145:3
      at Object.exports.runInThisContext (vm.js:54:17)
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-template@6.8.0/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-helpers@6.8.0/lib/helpers.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-helpers@6.8.0/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-core@6.8.0/lib/transformation/file/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-core@6.8.0/lib/api/node.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-core@6.8.0/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/systemjs-build-babel-helpers.js
  Error loading /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/systemjs-build-babel-helpers.js
${JSPM_CMD} run systemjs-build-modular-babel-helpers.js
+ ./node_modules/.bin/jspm run systemjs-build-modular-babel-helpers.js

err        throw new Error('Module ' + name + ' not declared as a dependency of ' + entry.name);
        ^
  Error: Module ./definitions/init not declared as a dependency of /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js
      at Object.<anonymous> (/home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js:329:25)
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js:864:4
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js:865:3
      at Object.exports.runInThisContext (vm.js:54:17)
      at Object.<anonymous> (/home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js:6:43)
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js:144:4
      at /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js:145:3
      at Object.exports.runInThisContext (vm.js:54:17)
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-types@6.8.1/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/lib/virtual-types.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/path/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-traverse@6.8.0/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-template@6.8.0/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-helpers@6.8.0/lib/helpers.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-helpers@6.8.0/lib/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-core@6.8.0/lib/transformation/file/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-core@6.8.0/lib/api/node.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/jspm_packages/npm/babel-core@6.8.0/index.js
  Evaluating /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/systemjs-build-modular-babel-helpers.js
  Error loading /home/x/zzz/github/douglasduteil/plugin-babel/build-babel/systemjs-build-modular-babel-helpers.js

(
  echo "export default (function(module) {" ;
  cat jspm_packages/github/facebook/regenerator@${REGENERATOR_VERSION}/runtime.js
  echo "return module.exports; })({exports:{}});"
) > ../regenerator-runtime.js
+ echo 'export default (function(module) {'
+ cat jspm_packages/github/facebook/regenerator@0.8.0/runtime.js
+ echo 'return module.exports; })({exports:{}});'
cd ..
+ cd ..
guybedford commented 8 years ago

I've actually just been working on some updates to this build, and it is worth noting that the build is created with the latest jspm beta. Once I've posted out this release today, that should work here as expected I think?

douglasduteil commented 8 years ago

Yes ! Way better :)

douglasduteil commented 8 years ago

I rebased my PR. Adding a regenerator version guessing script :

npm v regenerator@^0.8.42 version | tail -n 1 | awk '{print $2}' | tr -d "'"
douglasduteil commented 8 years ago

:up:

I

douglasduteil commented 8 years ago

I coded https://github.com/systemjs/plugin-babel/pull/41 on top of thie PR. And It works perfectly :tada:

guybedford commented 8 years ago

👍

douglasduteil commented 8 years ago

:up:

I didn't commit the generated files so you can do it at will ;)

guybedford commented 8 years ago

Where would these workflows be without you @douglasduteil..