| 65 | }; |
| 66 | |
| 67 | const authNpmRegistry = (npmRegistryUrl: string, npmAuthToken: string) => { |
| 68 | const npmrcPath = join(homedir(), '.npmrc'); |
| 69 | const yarnrcPath = join(homedir(), '.yarnrc'); |
| 70 | // It looks like the auth token must be present in the NPM configuration (even when using Yarn) but the |
| 71 | // registry must be also in the Yarn configuration... |
| 72 | const newNpmrc = `${npmRegistryUrl.slice(npmRegistryUrl.indexOf(':') + 1)}/:_authToken="${npmAuthToken}" |
| 73 | registry=${npmRegistryUrl} |
| 74 | `; |
| 75 | const newYarn = `registry "${npmRegistryUrl}" |
| 76 | `; |
| 77 | |
| 78 | writeFileSync(npmrcPath, newNpmrc); |
| 79 | writeFileSync(yarnrcPath, newYarn); |
| 80 | }; |
| 81 | |
| 82 | // When using changelog type `@changesets/changelog-github` the GitHub token env variable needs to be set. |
| 83 | // This is annoying especially when we want to publish packages only for testing purposes. |