UNPKG

678 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 touch(file) {
6 if (!await fs.pathExists(file)) {
7 await fs.outputJSON(file, {});
8 }
9 else {
10 await fs.utimes(file, new Date(), new Date());
11 }
12}
13async function run(name, file) {
14 await touch(file);
15 const { body } = await http_call_1.default.get(`https://registry.npmjs.org/${name.replace('/', '%2f')}`, { timeout: 5000 });
16 await fs.outputJSON(file, body['dist-tags']);
17 process.exit(0);
18}
19run(process.argv[2], process.argv[3])
20 .catch(require('@oclif/errors/handle'));