Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[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

Merged
merged 2 commits into from
Jan 15, 2019
Merged

[dist] bring module into 2019 #6

merged 2 commits into from
Jan 15, 2019

Conversation

Swaagie
Copy link
Member

@Swaagie Swaagie commented Jan 4, 2019

No description provided.

Copy link

@SuzHarrison SuzHarrison left a 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",

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/

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).

Copy link

@DullReferenceException DullReferenceException left a 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",
Copy link

@fabiomcosta fabiomcosta Jan 4, 2019

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.

Copy link
Member Author

@Swaagie Swaagie Jan 4, 2019

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.

@Swaagie
Copy link
Member Author

Swaagie commented Jan 4, 2019

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.

@DullReferenceException
Copy link

DullReferenceException commented Jan 4, 2019

The default GoDaddy setup is to have:

registry=<our private registry URL>

...in your ~/.npmrc, which is the company-wide recommendation. This causes the resolved field in the lockfile to have internal registry links, even if the installed packages come from the npm registry ultimately.

@Swaagie Swaagie merged commit 58abfca into master Jan 15, 2019
@Swaagie Swaagie deleted the deps branch January 15, 2019 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants