1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const fs = require("fs-extra");
|
4 | const http_call_1 = require("http-call");
|
5 | async 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 });
|
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);
|
15 | }
|
16 | run(process.argv[2], process.argv[3], process.argv[4], process.argv[5], process.argv[6])
|
17 | .catch(require('@oclif/errors/handle'));
|