Closed ericelliott closed 9 years ago
I just found that the npm command doesn't install all the Cloverfield's files and dependencies, this is what I have in my global lib/node_modules
directory:
9 21:08 ..
4 2015 LICENSE
4 2015 README.md
9 21:08 package.json
Maybe this is the reason why the npm command is not creating the link inside the bin
directory.
I also read in the docs that npm packages that uses the CLI like Cloverfield doesn't have to specify the main
field in the package.json
file since this option is only for packages that must be use inside the scripts with the require
keyword.
Finally there's no files
option in the project's package.json
, this option is used to specify the files and directories that must be include in your package once is installed.
I found that when I ran:
npm install -g cloverfield
No files were downloaded, but I did get the symbolic link output like normal.
However, if I run:
npm install -g cloverfield-tools/cloverfield
Cloverfield is installed properly, and both cf and cloverfield are executable. However, I get error messages from the index.js file. I am using nvm, so I do not know if that is an issue.
We have most of things ignored before publishing to npm. Also I don't think we published to npm recently (will check it).
I am going to fix this today later.
As I expected it is simply not published to npm. I created #20 with .npmignore
and #19 to update to the most recent dependencies. After thy are in we can publish new version to the npm.
Thanks @nkbt
It's a good start, but we need to build the bin file that gets symlinked with Babel for Node support:
$ npm install -g cloverfield
> fsevents@0.3.8 install /Users/eric/.nvm/versions/node/v0.12.5/lib/node_modules/cloverfield/node_modules/babel/node_modules/chokidar/node_modules/fsevents
> node-gyp rebuild
SOLINK_MODULE(target) Release/.node
CXX(target) Release/obj.target/fse/fsevents.o
SOLINK_MODULE(target) Release/fse.node
/Users/eric/.nvm/versions/node/v0.12.5/bin/cloverfield -> /Users/eric/.nvm/versions/node/v0.12.5/lib/node_modules/cloverfield/index.js
/Users/eric/.nvm/versions/node/v0.12.5/bin/cf -> /Users/eric/.nvm/versions/node/v0.12.5/lib/node_modules/cloverfield/index.js
cloverfield@0.2.0 /Users/eric/.nvm/versions/node/v0.12.5/lib/node_modules/cloverfield
├── nomnom@1.8.1 (underscore@1.6.0, chalk@0.4.0)
├── babel@5.8.21 (slash@1.0.0, path-is-absolute@1.0.0, fs-readdir-recursive@0.1.2, path-exists@1.0.0, convert-source-map@1.1.1, commander@2.8.1, source-map@0.4.4, output-file-sync@1.1.1, glob@5.0.14, lodash@3.10.1, chokidar@1.0.5, babel-core@5.8.21)
└── npm@2.13.4
-- -- (master origin) v0.2.0
Erics-MacBook-Pro:cloverfield eric$ cf
/Users/eric/.nvm/versions/node/v0.12.5/lib/node_modules/cloverfield/index.js:4
import nomnom from 'nomnom';
^^^^^^
SyntaxError: Unexpected reserved word
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Module._extensions..js (module.js:478:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/eric/Dropbox/dev/cloverfield/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:214:7)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at Object.<anonymous> (/Users/eric/Dropbox/dev/cloverfield/node_modules/babel/lib/_babel-node.js:144:25)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
Hm, I used babel-node as interpreter here so it should work. At least it worked on the other project of mine. I'll check more. If it still won't work, will do it on the code level
babel-node is not need it anymore if we are using ESLint ^1.0.0, we could safely use the native ESLint parser since this new version has full support for ES6
@davegomez babel-node and babel-eslint are completely different things. And I am pretty sure eslint 1.0 still does not support object spread like:
const x = {
...y,
z: 123
};
+1 @nkbt Just tested eslint 1.1.0 and object spread is not supported (cf https://github.com/eslint/eslint/issues/3271).
I don't know babel-node, but should the transpilation be done in the CI part ? Thus, the published package would be ES5.
We use babel-node to avoid transpilation step before publishing. Babel-node does it in-memory.
Sincerely yours, Nikita Butenko Google Talk: nik@butenko.me Skype: nikita.butenko Mobile: +61 450 264 801
On 11 August 2015 at 18:21, ThomasCrvsr notifications@github.com wrote:
+1 @nkbt https://github.com/nkbt Just tested eslint 1.1.0 and object spread is not supported (cf eslint/eslint#3271 https://github.com/eslint/eslint/issues/3271).
I don't know babel-node, but should the transpilation be done in the CI part ? Thus, the published package would be ES5.
— Reply to this email directly or view it on GitHub https://github.com/cloverfield-tools/cloverfield/issues/18#issuecomment-129764982 .
Published as 0.3.0
This should work:
But here's what happens:
Want to fix this, @nkbt?