question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add an option to publish a .tgz previously packed with `npm pack`

See original GitHub issue

Hello,

I use VSTS to build and publish a NPM package. I have a CI build which restores packages, executes the build scripts, runs npm pack and upload the .tgz file as an artifact. Then, I have a release definition which is responsible for deploying the package in VSTS Package Management, MyGet, or nmpjs public registry depending on the stability.

The npm pack command creates a .tgz file with the package name and the version, so it is not possible to predict the final file name. However, the arguments input of the NPM task does not support minimatch patterns. Plus, the working folder input is not necessary anymore in this mode (and should be let empty, or the task would fail with the error “TypeError: Cannot read property ‘trim’ of null”).

I think it would be great if we could choose either to publish a folder (and let the working folder input as is) or to publish a tarball (and add an input that supports minimatch for this purpose).

As a temporary fix, I currently extract the tarball and then call the NPM publish task with the working folder set.

Thank you!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:13
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
asiffermanncommented, Aug 28, 2017

Hi,

The key part of my scenario is that I have two different pipelines: a build definition which creates the package (with the npm pack command), and a release definition which deploys the same package to different registries.

Build definition

Create the package

build1

Copy it in the build artifacts

build2

Release definition

Pipeline

image

I cannot use the preconfigured publish command

image

I cannot use the custom command

The minimatch pattern is not resolved, and I cannot select the external npm registry.

image

My temporary fix

So, at the moment, I can only extract the package and then publish it. Yes, it IS odd! 😅 That’s why I opened this issue to ask if you could add an option to the preconfigured publish command

image image

Hope it’s clearer now! Thanks!

2reactions
infin8xcommented, Apr 1, 2019

Closing this as WF. In the upcoming quarter, we’ll be moving away from the full-featured Artifacts-related tasks and recommending calling npm directly, which will give you the flexibility to call whatever command you wish, even if you’re working against an authenticated feed. See the design here for more details.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add an option to publish a .tgz previously packed with npm ...
Hello,. I use VSTS to build and publish a NPM package. I have a CI build which restores packages, executes the build scripts,...
Read more >
npm-publish
Description. Publishes a package to the registry so that it can be installed by name. By default npm will publish to the public...
Read more >
How to Work with NPM Packages Locally Using .tgz Files
Run your build command from the directory of your application that gets published as an NPM package. · Run npm pack from the...
Read more >
How to publish packages to npm (the way the industry ...
The way the industry publishes (and updates) packages. · Run tests (if there are any) · Update version in package.json according to Semver...
Read more >
Testing npm packages before publishing | by Carl Vitullo
tgz file exactly the way it would if you were going to publish the package to npm. It pulls the name and version...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found