@nstudio/schematics
Version:
Cross-platform (xplat) tools for Nx workspaces.
30 lines • 1.56 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const schematics_1 = require("@angular-devkit/schematics");
const utils_1 = require("../../utils");
function updateRootPackage(tree, context) {
return utils_1.updateJsonInTree("package.json", json => {
json.scripts = json.scripts || {};
json.dependencies = json.dependencies || {};
json.devDependencies = json.devDependencies || {};
const appsDir = tree.getDir("apps");
const appFolders = appsDir.subdirs;
for (const dir of appFolders) {
if (dir.indexOf("nativescript-") === 0) {
const parts = dir.split("-");
parts.splice(0, 1); // remove {N}
// join the rest since app name could have a dash as well
const appName = parts.join('-');
json.scripts[`start.nativescript.${appName}.ios`] = `cd apps/${dir} && tns run ios --emulator --bundle`;
json.scripts[`start.nativescript.${appName}.android`] = `cd apps/${dir} && tns run android --emulator --bundle`;
json.scripts[`clean.nativescript.${appName}`] = `cd apps/${dir} && npx rimraf -- hooks node_modules platforms package-lock.json && npm i && npx rimraf -- package-lock.json`; // the final removal of package-lock.json fixes issue with node 10+
}
}
return json;
})(tree, context);
}
function default_1() {
return schematics_1.chain([updateRootPackage]);
}
exports.default = default_1;
//# sourceMappingURL=update-6-1-4.js.map