ngx-deploy-npm
Version:
Publish your libraries to NPM with just one command
30 lines • 1.41 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = install;
const tslib_1 = require("tslib");
const devkit_1 = require("@nx/devkit");
const utils_1 = require("../../utils");
function install(tree, rawOptions) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const options = rawOptions;
const selectedLib = (0, devkit_1.getProjects)(tree).get(options.project);
if (selectedLib === undefined) {
throw new Error(`The project ${options.project} doesn't exist on your workspace`);
}
if ((yield (0, utils_1.isProjectAPublishableLib)(selectedLib)) === false) {
throw new Error(`The project ${options.project} is not a publishable library`);
}
const executorOptions = {
distFolderPath: options.distFolderPath,
access: options.access,
};
// Create targets in case that they doesn't already exists
if (!selectedLib.targets) {
selectedLib.targets = {};
}
selectedLib.targets.deploy = Object.assign({ executor: 'ngx-deploy-npm:deploy', options: executorOptions }, (selectedLib.targets.build ? { dependsOn: ['build'] } : {}));
(0, devkit_1.updateProjectConfiguration)(tree, options.project, selectedLib);
yield (0, devkit_1.formatFiles)(tree);
});
}
//# sourceMappingURL=generator.js.map
;