Skip to content
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

feat(publish): Publish command uses publishConfig.access in package.json #5290

Merged
merged 6 commits into from
Jan 30, 2018

Conversation

rally25rs
Copy link
Contributor

fixes #5279

Summary

For npm compatibility, yarn publish should check publishConfig.access in package.json and use it as if the --access option was passed.

If --access is also passed, then the command line parameter takes precedence.

Test plan

Added unit tests regarding "access" in __tests__/commands/publish.js

For npm compatability, `yarn publish` should check `publishConfig.access` in package.json and use it
as if the `--access` option was passed.

yarnpkg#5279
@buildsize
Copy link

buildsize bot commented Jan 29, 2018

This change will decrease the build size from 10.44 MB to 10.41 MB, a decrease of 29.77 KB (0%)

File name Previous Size New Size Change
yarn-[version].noarch.rpm 904.5 KB 901.53 KB -2.98 KB (0%)
yarn-[version].js 3.93 MB 3.92 MB -10.44 KB (0%)
yarn-legacy-[version].js 4.08 MB 4.07 MB -11.3 KB (0%)
yarn-v[version].tar.gz 909.97 KB 907.21 KB -2.76 KB (0%)
yarn_[version]all.deb 672.29 KB 670 KB -2.29 KB (0%)

@rally25rs
Copy link
Contributor Author

Test failures seem to be due to timeouts. I think this may be because the CI servers run without net access (tests pass when run locally). I probably need to mock something... will investigate/fix...

@arcanis
Copy link
Member

arcanis commented Jan 29, 2018

Yeah, I think that's why publish wasn't tested until now - but if you find a way that would be great!


test.concurrent('publish should default access to undefined', () => {
return runPublish([], {newVersion: '0.0.1'}, 'minimal', config => {
const requestCallParams = config.registries.npm.request.mock.calls[0][1];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find it more readable to use toBeCalledWith rather than reaching into the mock objects

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't sure if there was a way to do that and only specify the parameter that I care about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or rather, the 2nd parameter is an object with a bunch of properties but I'm realy only testing 1 of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems I had to nest a couple expect.objectContaining() calls, but I cleaned it up (or made it longer and more nested, depending on your point of view 😄 )

@rally25rs
Copy link
Contributor Author

rally25rs commented Jan 29, 2018

@arcanis it turns out it was prompting me for my npm password. Locally I was already logged it so it was getting skipped. I just mocked out the function so it always thinks I'm logged in, which skips the prompt and lets the tests pass.

except for appveyor which seems to just be taking forever...

@arcanis
Copy link
Member

arcanis commented Jan 30, 2018

Niiiice 👍

@arcanis arcanis merged commit aa200e4 into yarnpkg:master Jan 30, 2018
agoldis added a commit to agoldis/yarn that referenced this pull request Feb 2, 2018
…readdir_files

* upstream/master: (34 commits)
  feat(upgrade, add): Separately log added/upgraded dependencies (yarnpkg#5227)
  feat(publish): Publish command uses publishConfig.access in package.json (yarnpkg#5290)
  fix(CLI): Use process exit instead of exitCode for node < 4 (yarnpkg#5291)
  feat(cli): error on missing workspace directory (yarnpkg#5206) (yarnpkg#5222)
  feat: better error when package is not found (yarnpkg#5213)
  Allow scoped package as alias source (yarnpkg#5229)
  fix(cli): Use correct directory for upgrade-interactive (yarnpkg#5272)
  nohoist baseline implementation (yarnpkg#4979)
  1.4.1
  1.4.0
  Show current version, when new version is not supplied on "yarn publish" (yarnpkg#4947)
  fix(install): use node-gyp from homebrew npm (yarnpkg#4994)
  Fix transient symlinks overriding direct ones v2 (yarnpkg#5016)
  fix(auth): Fixes authentication conditions and logic with registries (yarnpkg#5216)
  chore(package): move devDeps to appropriate place (yarnpkg#5166)
  fix(resolution) Eliminate "missing peerDep" warning when dep exists at root level. (yarnpkg#5088)
  fix(cli): improve guessing of package names that contain a dot (yarnpkg#5102) (yarnpkg#5135)
  feat(cli): include notice with license when generating disclaimer (yarnpkg#5072) (yarnpkg#5111)
  feat(cli): group by license in licenses list (yarnpkg#5074) (yarnpkg#5110)
  feat(cli): improve error message when file resolver can't find file (yarnpkg#5134) (yarnpkg#5145)
  ...
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.

yarn publish not respecting publishConfig in package.json for scoped packages
3 participants