UNPKG

arvis-linker

Version:

Make Arvis extensions installable from npm

40 lines (39 loc) 1.69 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.getUserConfigs = exports.applyUserConfigs = void 0; const path_1 = require("./path"); const readJson5_1 = require("./readJson5"); /** * @description Migrate previous extenion's setting */ const applyUserConfigs = (userConfig, extensionInfo) => { const result = Object.assign({}, extensionInfo); if (extensionInfo.variables) { // Migrate previous variables if (userConfig && userConfig.variables) { for (const variable of Object.keys(userConfig.variables)) { result.variables[variable] = userConfig.variables[variable]; } } } return result; }; exports.applyUserConfigs = applyUserConfigs; const getUserConfigs = () => __awaiter(void 0, void 0, void 0, function* () { try { return yield readJson5_1.readJson5(path_1.userConfigPath); } catch (err) { return {}; } }); exports.getUserConfigs = getUserConfigs;