-
Notifications
You must be signed in to change notification settings - Fork 2
[dist] bring module into 2019 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one question - otherwise great!
package.json
Outdated
"@babel/core": "^7.0.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"@babel/register": "^7.0.0", | ||
"babelify": "^10.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need babelify?
@@ -1 +0,0 @@ | |||
registry=https://registry.npmjs.org/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be useful so we don't accidentally install things using GoDaddy's private registry (which would affect the lockfile).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a comment on why I think having .npmrc
is useful, FWIW. Also agreed that we probably don't need babelify
. Other than that, looks good to me.
"prepublish": "npm run transpile", | ||
"transpile": "mkdir -p lib && babel -o ./lib/index.js ./index.js", | ||
"test": "mocha --spec reporter --compilers js:babel-register ./test.js" | ||
"prepublishOnly": "npm run build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest:
"prepare": "npm run build",
"prepublishOnly": "npm run test",
See:
https://docs.npmjs.com/misc/scripts#prepublish-and-prepare
And
npm/npm#10074
You can make sure you're getting the right behavior for publish with a npm publish --dry-run
(you'll see it runs prepare
as well).
One advantage I've noticed with this is that ppl trying to link this package will also have it built (prepare
runs, but not prepublishOnly
when linking). There might be other things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'm well aware of the details of those different commands, but I also disagree. There is no need to transpile files again on install if those transpiled files are already bundled. It just increases install time for no actual value. If you need to run it again when running npm link
it's probably better to have a separate build:watch
running that rebuilds on each change.
I've never been a fan of prepublish
running on install in the first place. It think I've actually opened an issue about it way back when. But the npm team couldn't get rid of it for legacy reasons.
As for tests running on prepublishOnly
, in general it's probably better to have something like Travis in place to run tests on each PR/merge.
I would argue that having Godaddy's private registry in the lockfile is either bad configuration or a lockfile generated at the time it wasn't forwarding to the public registry by default (if possible). I still don't feel this is a strong argument to specify a option that is default for npm. We might not need babelify, others could still depend on it. https://github.com/babel/babelify is still in active development and anyone could be depending on this. Based on the low downloads per week I'm fine removing it. The dependency changes warrant a major release anyways. |
The default GoDaddy setup is to have:
...in your |
No description provided.