-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup NPM Token using generateNpmRc Task (#1563)
- Loading branch information
Showing
2 changed files
with
2 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
# How to publish TypeScript to npm | ||
|
||
If you want to publish npm packages, you need to simulate the `npm login` command to ensure you have the necessary credentials to `npm publish`. Add the following snippet to your `./your-project-api/build.gradle` to write the `$NPM_AUTH_TOKEN` environment variable to disk. You should specify this as a secret variable on your CI server (e.g. CircleCI or TravisCI). | ||
|
||
```diff | ||
apply plugin: 'com.palantir.conjure' | ||
|
||
+project("${project.name}-typescript") { | ||
+ publishTypeScript.doFirst { | ||
+ file('src/.npmrc') << "//registry.npmjs.org/:_authToken=${System.env.NPM_AUTH_TOKEN}" | ||
+ } | ||
+} | ||
``` | ||
If you want to publish npm packages, you need to provide the necessary credentials to `npm publish`. Documentation on how to achieve this can be found [here](https://github.com/palantir/gradle-conjure?tab=readme-ov-file#typescript). |