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

BUG: yarn incorrectly names packages with . in the path #5102

Closed
utdrmac opened this issue Dec 18, 2017 · 3 comments
Closed

BUG: yarn incorrectly names packages with . in the path #5102

utdrmac opened this issue Dec 18, 2017 · 3 comments
Assignees
Labels

Comments

@utdrmac
Copy link

utdrmac commented Dec 18, 2017

Do you want to request a feature or report a bug? BUG
What is the current behavior?

$ yarn add scottoffen/jquery.toaster
yarn add v1.3.2
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
└─ jquery@0.0.0
✨  Done in 2.22s.

If the current behavior is a bug, please provide the steps to reproduce.
See above.

$ ls -la node_modules/jquery/
total 88
drwxr-xr-x    9 drmac  staff    306 Dec 17 19:36 .
drwxr-xr-x  190 drmac  staff   6460 Dec 17 19:36 ..
-rw-r--r--    1 drmac  staff      1 May 12  2017 .gitignore
-rw-r--r--    1 drmac  staff    582 May 12  2017 LICENSE
-rw-r--r--    1 drmac  staff  11389 May 12  2017 README.md
-rw-r--r--    1 drmac  staff    541 May 12  2017 bower.json
-rw-r--r--    1 drmac  staff   5012 May 12  2017 index.html
-rw-r--r--    1 drmac  staff   4740 May 12  2017 jquery.toaster.js
-rw-r--r--    1 drmac  staff   1147 May 12  2017 toaster.jquery.json

What is the expected behavior?
The expected behavior is that yarn ignore the '.' when naming packages. This is clearly not jquery, but a jquery plugin that is poorly named.

Even attempting shell escape yarn add scottoffen/jquery\.toaster, produces the same result.

Please mention your node.js, yarn and operating system version.
macos
$ node --version
v9.3.0
$ yarn version
yarn version v1.3.2
info Current version: 1.0.3

@ghost ghost assigned rally25rs Dec 18, 2017
@ghost ghost added the triaged label Dec 18, 2017
@iansu
Copy link
Contributor

iansu commented Dec 20, 2017

I've been able to verify this bug but it seems to be something other than (just) the . in the name. For example, the package ipaddr.js installs just fine. It looks like this package is coming from GitHub and also has no package.json file. It's definitely still a bug but there's more going on here.

@rally25rs
Copy link
Contributor

I'd argue that you aren't installing a Node library, because there is no package.json file. This isn't a valid package so behavior is a bit ... "undefined".

I think if the package.json is missing, then Yarn tries to guess at a package name and version. It's probably blindly truncating the "extension" because account/repo.git is also a valid URI, and they can also end with .tar or .tar.gz. All of these need the stuff after the . trimmed.

If someone wants to tackle this, the logic is in src/util/guess-name.js and there are tests in __tests__/util/guess-name.js

@iansu
Copy link
Contributor

iansu commented Dec 20, 2017

I'll give it a try now that I know where to look.

agoldis added a commit to agoldis/yarn that referenced this issue 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
Projects
None yet
Development

No branches or pull requests

3 participants