MCPcopy Create free account
hub / github.com/api3dao/airnode / authNpmRegistry

Function authNpmRegistry

docker/scripts/npm.ts:67–80  ·  view source on GitHub ↗
(npmRegistryUrl: string, npmAuthToken: string)

Source from the content-addressed store, hash-verified

65};
66
67const 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}"
73registry=${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.

Callers 1

prePublishSetupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected