mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
25 lines
718 B
JavaScript
25 lines
718 B
JavaScript
const path = require('path');
|
|
const fs = require('fs');
|
|
const os = require('os');
|
|
|
|
// const registryHostname = 'npm.yandex-team.ru';
|
|
const registryHostname = 'registry.npmjs.org';
|
|
const username = 'robot-divkit';
|
|
const email = 'robot-divkit@yandex-team.ru';
|
|
const token = process.env.ROBOT_NPM_TOKEN;
|
|
|
|
if (!token) {
|
|
throw new Error('No token');
|
|
}
|
|
|
|
const filename = path.join(os.homedir(), '.npmrc');
|
|
const content = [
|
|
`//${registryHostname}/:_authToken="${token}"`,
|
|
`//${registryHostname}/:always-auth=false`,
|
|
].join('\n');
|
|
|
|
// eslint-disable-next-line no-console
|
|
console.log(`Writing npm auth token for ${username} (${email}) at ${registryHostname} to ${filename}`);
|
|
|
|
fs.writeFileSync(filename, content);
|