@yolkai/nx-workspace
Version:
17 lines (16 loc) • 646 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
const ast_utils_1 = require("../ast-utils");
/**
* Calls init _if_ the package does not already exist
*/
function addPackageWithInit(packageName) {
return (host) => {
const { dependencies, devDependencies } = ast_utils_1.readJsonInTree(host, 'package.json');
return dependencies[packageName] || devDependencies[packageName]
? schematics_1.noop()
: schematics_1.externalSchematic(packageName, 'init', {});
};
}
exports.addPackageWithInit = addPackageWithInit;