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

Publish multiple npm workspaces packages #1149

Merged
merged 12 commits into from
Mar 12, 2024

Conversation

EyalDelarea
Copy link
Contributor

@EyalDelarea EyalDelarea commented Mar 6, 2024

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • All static analysis checks passed.
  • This pull request is on the dev branch.
  • I used gofmt for formatting the code before submitting the pull request.

When using the jf npm publish command the core didn't address the --workspaces flag which indices that there are multiple modules inside the current project.
This PR fixes the publish command to handle more than one module if exists and combine the results.

example package.json workspaces defined:

{
"workspaces": [
"second",
"third"
]
}

Before:
image

After:
image

Should fix the following issue:
jfrog/jfrog-azure-devops-extension#473

@EyalDelarea EyalDelarea added the improvement Automatically generated release notes label Mar 6, 2024
@EyalDelarea EyalDelarea changed the title Publish Multiple npm packages (workspaces) Fix publishing multiple npm workspaces packages Mar 6, 2024
@EyalDelarea EyalDelarea marked this pull request as ready for review March 6, 2024 14:00
@EyalDelarea EyalDelarea changed the title Fix publishing multiple npm workspaces packages Publish multiple npm workspaces packages Mar 6, 2024
Copy link
Contributor

@sverdlov93 sverdlov93 left a comment

Choose a reason for hiding this comment

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

Great work! lets add a test to JFrog CLI with --workspaces flag and moe then one pack

artifactory/commands/npm/publish.go Outdated Show resolved Hide resolved
output = strings.TrimSpace(output)
lines := strings.Split(output, "\n")
return strings.TrimSpace(lines[len(lines)-1]), nil
return strings.Split(output, "\n")
Copy link
Contributor

Choose a reason for hiding this comment

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

will work on windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like from the CLI test that it is working on windows 👍

artifactory/commands/npm/publish.go Outdated Show resolved Hide resolved
artifactory/commands/npm/publish.go Outdated Show resolved Hide resolved
artifactory/commands/npm/publish.go Outdated Show resolved Hide resolved
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've removed this test as the test case was irrelevant.
We checked the whole output of the CMD and tried to extract the tar.gz file name, as in practice, the npm cmd already gives us the name. and all we have to do now is to split the file names if we have more then one.
I've deleted the test here, and added a full test in CLI side to publish multiple packages.

Copy link
Contributor

👍 Frogbot scanned this pull request and found that it did not add vulnerable dependencies.


@EyalDelarea EyalDelarea merged commit 5979ebb into jfrog:dev Mar 12, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Automatically generated release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants