UNPKG

@o3r/schematics

Version:

Schematics module of the Otter framework

25 lines 1.16 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.addVsCodeRecommendations = void 0; /** * Update VsCode recommendations for the current project * @param recommendations list of recommendations */ const addVsCodeRecommendations = (recommendations) => { const extensionFile = '/.vscode/extensions.json'; return (tree, context) => { if (tree.exists(extensionFile)) { const extensions = tree.readJson(extensionFile); extensions.recommendations = Array.from(new Set([...(extensions.recommendations || []), ...recommendations])); tree.overwrite(extensionFile, JSON.stringify(extensions, null, 2)); context.logger.debug(`Updated ${extensionFile} with recommendations: ${recommendations.join(', ')}`); } else { tree.create(extensionFile, JSON.stringify({ recommendations }, null, 2)); context.logger.debug(`Create ${extensionFile} with recommendations: ${recommendations.join(', ')}`); } return tree; }; }; exports.addVsCodeRecommendations = addVsCodeRecommendations; //# sourceMappingURL=index.js.map