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

Allow scoped package as alias source #5229

Merged

Conversation

GoodForOneFare
Copy link
Contributor

Summary
Yarn already supports aliasing a scoped package with an unscoped package:

yarn add @goodforonefare/left-pad@npm:left-pad@1.2.0

This PR adds support for aliasing any package with a scoped package:

yarn add left-pad@npm:@goodforonefare/left-pad@1.2.0

Note: the only documentation I can find for this feature is a tweet from Sebastian McKenzie.

Test plan

  • cd to a yarn-managed repo
  • Add a scoped alias for left-pad:
    • yarn add left-pad@npm:@goodforonefare/left-pad
  • Verify that left-pad calls append my username to inputs:
$ node -e "console.log(require('left-pad')('test', 20))"`
GoodForOneFare                test

**Summary**
Yarn already supports aliasing a scoped package with an unscoped package:
```bash
yarn add @goodforonefare/left-pad@npm:left-pad@1.2.0
```

This PR adds support for aliasing any package with a scoped package:
```bash
yarn add left-pad@npm:@goodforonefare/left-pad@1.2.0
```

Note: the only documentation I can find for this feature [is a tweet from Sebastian McKenzie](https://twitter.com/sebmck/status/873958247304232961?lang=en).

**Test plan**
* `cd` to a yarn-managed repo
* Add a scoped alias for `left-pad`:
  * `yarn add left-pad@npm:@goodforonefare/left-pad`
* Verify that `left-pad` calls append my username to inputs:
```
$ node -e "console.log(require('left-pad')('test', 20))"`
GoodForOneFare                test
```
@GoodForOneFare GoodForOneFare force-pushed the allow-scoped-package-as-alias branch from 15c1e44 to 288c024 Compare January 16, 2018 05:53
@buildsize
Copy link

buildsize bot commented Jan 16, 2018

This change will decrease the build size from 10.41 MB to 10.41 MB, a decrease of 857 bytes (0%)

File name Previous Size New Size Change
yarn-[version].noarch.rpm 901.44 KB 901.44 KB 5 bytes (0%)
yarn-[version].js 3.92 MB 3.92 MB 2 bytes (0%)
yarn-legacy-[version].js 4.07 MB 4.07 MB 2 bytes (0%)
yarn-v[version].tar.gz 907.14 KB 906.4 KB -760 bytes (0%)
yarn_[version]all.deb 670.14 KB 670.03 KB -106 bytes (0%)

@arcanis arcanis merged commit 328fd59 into yarnpkg:master Jan 29, 2018
@arcanis
Copy link
Member

arcanis commented Jan 29, 2018

lgtm

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.

2 participants