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

Scope package dependencies are not linked during oc package #1178

Closed
Taiters opened this issue Feb 17, 2021 · 1 comment
Closed

Scope package dependencies are not linked during oc package #1178

Taiters opened this issue Feb 17, 2021 · 1 comment

Comments

@Taiters
Copy link

Taiters commented Feb 17, 2021

Who is the bug affecting?

Component creators when packaging components (In our case, this was observed in a CI pipeline)

What is affected by this bug?

oc cli

When does this occur?

When packaging components with --useComponentDependencies

Where on the platform does it happen?

cli

How do we replicate the issue?

In our case, our CI pipeline which packages OCs will run oc package --useComponentDirectories /path/to/project. The working directory already has a node_modules folder, so when this command runs, the project's dependencies which are not already in this folder should be added as symlinks.

To recreate:

  1. Create a component which has a scoped dependency, such as @babel/core
  2. From a different directory, which contains a node_modules folder, run oc package --useComponentDependencies <your project>
  3. Observe the node_modules directory does not contain the scoped package as a symlink

Expected behavior (i.e. solution)

Scoped dependencies should appear in the local node_modules folder.

What version of OC, Node.js and OS are you using?

Other Comments

This appears to be caused by this line: https://github.com/opencomponents/oc/blob/master/src/cli/domain/handle-dependencies/link-missing-dependencies.js#L10

Normally it would split the dependency name and version:

('foo@^1.0.0').split('@')[0] -> ['foo', '1.0.0'][0] -> foo

However, with a scoped package, we'll get an empty string (falsy):

('@scope/foo^1.0.0').split('@')[0] -> ['', 'scope/foo', '1.0.0'][0] -> ''

Happy to open a PR for this

@matteofigus
Copy link
Member

Hi, thanks for submitting an issue. A PR would be great!

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

No branches or pull requests

2 participants