Deploy to NPM has no local_dir available

I’m having trouble deploying to NPM (
As much as I want to use it, I just cannot specify a dist directory! This is a big issue for me since I have multiple deploy provider running.
the npm publish command is actually more helpful.

If someone has a solution, that’d be very helpful! or a fix on the deploy provider?

This is the code for the npm provider: Hope it will help you understand what is happening.
You didn’t give any error details, the build log in particular, so can’t say anything else.

Thanks for the reply but I don’t see how it can help.
I have a deploy step with 3 different providers(gh-pages, github release, npm release), each deploy a different artifact or set of files.
The issue with before_script is that it applies to all 3 of them. (Right?)

Logs of my last attempt:

The 3rd deploy is deploying everything to npm, but I wanted to deploy just the dist/material-file-input folder


According to , it runs npm publish in the project root, passing only API key and tag if specified. All that happens next is hence up to the utility.

According to , you can specify files to deploy with the “files” parameter or, as per, exclude files with a .gitignore or .npmignore. It looks like with this, the tree will still be rooted at the project root – i.e. if you specify e.g. “dist/material-file-input/*” it will create the directories dist/material-file-input and their content under them. If you rather need the deployed tree to be rooted at dist/material-file-input, you need to move project.json (and other appropriate metafiles if any) there and use the script provider:

        - cd dist/material-file-input
        - NPM_API_KEY=<api_key> npm publish <etc>

There are a couple of viable options.

  1. Split your build into stages; the test stage that runs the tests, and the deploy stage with three different jobs, each running different deployments. One of them (one for npm) can naturally execute cd … in before_deploy step.
  2. Write a PR that adds the local_dir option to the npm provider. This seems straightforward.

(Note that the script provider does not accept multiple commands.)

1 Like

I created PR #1023 for this. If this is merged, when it will be released on Travis CI?