clutchski/coffeelint

browserify is unnecessary for dependency of production

Closed this issue ยท 18 comments

please, move the browserify to devDependencies.

grep -r browserify src
# no require found

It also affect the installation time of dependents of coffeelint.

time npm install browserify
# npm install browserify  4.16s user 1.19s system 89% cpu 6.000 total

at OS 10.11 MacBook Pro (Retina, 15-inch, Mid 2014), 2.5 GHz Intel Core i7, 16 GB 1600 MHz DDR3

Because we don't commit the compiled code, if you install from git coffeelint has to compile itself to be able to run. browserify can't be a devDepndency because then it won't get installed.

The workaround I have in place is to use package.json's prepublish to yank browserify out so that it doesn't get included in npm's package.json

@swang I know this whole process is annoying, but I don't have a better process. The only alternative I know if is to just yank all of the precommit shuffling and just break installing from git

swang commented

See: npm/npm#3055

Fixing this would be nice, but breaking installs via git to fix it would probably not be an ideal solution. Breaking git installs but with instructions in the README on how to get it up and running is probably the best alternative but still not ideal.

I found that in this project npm's prepublish has just been unreliable and I have no idea why. I always npm run prepublish && npm publish {whatever...}. Doing that and pushing a new patch version would fix @59naga 's problem... until the next time it gets published and the prepublish fails :'(

a git status will also show you that package.json is modified after prepublish runs

From my experience. while omitting the ./lib from git, can npm release. using travis hooks.

swang commented

Oh I see, this is a problem with the prepublish misfiring. Really odd since I thought I had ran prepublish.

Oops, Correctly it is as follows.

after_success:
  - 'export TRAVIS_PASSED=true'
"prepublish": "node -e \"if(process.env.TRAVIS_PASSED){}else{process.exit(1)}\" && npm run compile || echo skip prepublish",
swang commented

I just published v1.13.1, and ran a local install. browserify no longer shows up.

๐Ÿ‘ awesome

swang commented

Would that do anything if we're not using travis to actually publish the npm package? The problem seems to be that prepublish only randomly decides not to run sometimes, which causes this problem.

Excuse, wait for a while because it is slow to write English.

If just move the browserify to devDependencies, it looks like there is no effect on the work in git. Is my mistake?

git clone https://github.com/59naga/coffeelint.git
cd coffeelint
npm install
tree node_modules -L 1
# node_modules
# โ”œโ”€โ”€ browserify
# โ”œโ”€โ”€ coffee-script
# โ”œโ”€โ”€ coffeeify
# โ”œโ”€โ”€ glob
# โ”œโ”€โ”€ ignore
# โ”œโ”€โ”€ optimist
# โ”œโ”€โ”€ resolve
# โ”œโ”€โ”€ strip-json-comments
# โ”œโ”€โ”€ underscore
# โ””โ”€โ”€ vows

npm install --save git://github.com/59naga/coffeelint.git

This is what I mean by install from git. If you run that you'll see that the install fails because it didn't pick up browserify.

npm install coffeelint - people complain if browserify is included
npm install git:// - install doesn't work if browserify isn't included

Changed the prepublish and install of npm-scripts.

npm uninstall browserify --global
mkdir hoge
cd hoge

npm init --yes
npm install --save git://github.com/59naga/coffeelint.git
# /
# > coffeelint@1.13.0 install /Users/59naga/Downloads/hoge/node_modules/coffeelint
# > node -e "if(require('fs').existsSync('lib/commandline.js')){}else{process.exit(1)}" && cake compile || echo skip compile

# skip compile
# coffeelint@1.13.0 node_modules/coffeelint
# โ”œโ”€โ”€ ignore@2.2.18
# โ”œโ”€โ”€ strip-json-comments@1.0.4
# โ”œโ”€โ”€ coffee-script@1.10.0
# โ”œโ”€โ”€ resolve@0.6.3
# โ”œโ”€โ”€ coffeeify@1.0.0 (through@2.3.8, convert-source-map@0.4.1)
# โ”œโ”€โ”€ optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
# โ””โ”€โ”€ glob@4.5.3 (inherits@2.0.1, inflight@1.0.4, once@1.3.2, minimatch@2.0.10)

Although, it isn't beautiful ...

ok, what about coffeeify? Also, I don't think having a globally installed browserify is an acceptable requirement for being able to install from git://.

Under our current situation, as long as we don't publish a broken version git:// and npm are interchangeable.Any replacement solution should be too

oh, I misread your command, that was npm uninstall

For now, as one of the draft.