-
Notifications
You must be signed in to change notification settings - Fork 0
/
genDependencieVersionMap.js
29 lines (29 loc) · 1.1 KB
/
genDependencieVersionMap.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
var fs_1 = __importDefault(require("fs"));
var prompts_1 = __importDefault(require("./prompts"));
var plugins = prompts_1.default.find(function (prompt) { return prompt.name === 'plugins'; });
var depsMap = {};
if (plugins) {
for (var _i = 0, _b = plugins.choices; _i < _b.length; _i++) {
var plugin = _b[_i];
var pluginName = plugin.value.plugin;
try {
var pkg = require("../" + pluginName.replace('@udock/', '') + "/package.json");
depsMap[pluginName] = {
dependencies: pkg.peerDependencies,
devDependencies: (_a = {},
_a[pluginName] = "^" + pkg.version,
_a)
};
}
catch (e) {
console.warn("Can not find plugin: " + pluginName);
}
}
}
fs_1.default.writeFileSync('./dependencieVersionMap.json', JSON.stringify(depsMap, null, 2));