UNPKG

937 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const fs = require("fs-extra");
4const http_call_1 = require("http-call");
5async function run(name, file, version, registry, authorization) {
6 const url = [
7 registry.replace(/\/+$/, ''),
8 name.replace('/', '%2f'),
9 ].join('/');
10 const headers = authorization ? { authorization } : {};
11 await fs.outputJSON(file, { current: version, headers }); // touch file with current version to prevent multiple updates
12 const { body } = await http_call_1.default.get(url, { headers, timeout: 5000 });
13 await fs.outputJSON(file, Object.assign(Object.assign({}, body['dist-tags']), { current: version, authorization }));
14 process.exit(0); // eslint-disable-line unicorn/no-process-exit, no-process-exit
15}
16run(process.argv[2], process.argv[3], process.argv[4], process.argv[5], process.argv[6])
17 .catch(require('@oclif/errors/handle'));