After reading that .npmignore uses the same format as .gitignore, I
tried this, and it worked nicely. The whitelist strategy probably works
better for traceur, considering how many non-package files we have
everywhere.
The minimal distro package is surprisingly small, considering the repo
used to be 25 MB (mostly thanks to closure-library, though). I might
have left out something important, though.
#--cut--
cat > .npmignore <<"END"
*
!src/runtime/runtime.js
!src/node/*.js
!bin/traceur.js
!traceur
!Makefile
END
ln -s ~+ ../pkg-dir ## ~+ === abs path of cwd
mkdir ../npm-dir
cd ../npm-dir
npm install --local ../pkg-dir
## or you can just do a global install and skip the alias tricks
alias traceur=node_modules/traceur/traceur
cat > t.js <<"END"
var s = `${'hello'} world ${[for (x of [1,2,3]) x*10]}`;
console.log(s, s.startsWith('h'), s.endsWith('0'));
END
## interpret, compile + link traceur, compile + link runtime.
traceur t.js
traceur --out t.out.js -- t.js
{ printf "require('traceur');\n"
cat t.out.js
} > t.linked1.js
node t.linked1.js
## This works too, now that runtime.js modifies the global object.
## There should be some way to make this work with just
## "require('traceur/runtime')", right?
{ printf "require('traceur/src/runtime/runtime');\n"
cat t.out.js
} > t.linked2.js
node t.linked2.js
unalias traceur
#--cut--
https://codereview.appspot.com/7531049/diff/1/.npmignore
File .npmignore (right):
https://codereview.appspot.com/7531049/diff/1/.npmignore#newcode2
.npmignore:2: demo
It might be nice to include demo/repl.html and demo/repl.js, even though
they're both still a little rough around the edges.
https://codereview.appspot.com/7531049/