import { Rule , SchematicContext , Tree } from "@angular-devkit/schematics" ; import { NodePackageInstallTask } from "@angular-devkit/schematics/tasks" ; import { Schema } from "./schema" ; import { execSync } from "child_process" ; import { addPackageToPackageJsonFactory } from "../utils/package" ; export function installDependencies ( options ) { return ( host , context ) => { const deps = [ { name : "@commitlint/cli" , version : "^12.0.1" , } , { name : "@commitlint/config-conventional" , version : "^12.0.1" , } , { name : "all-contributors-cli" , version : "^6.20.0" , } , { name : "lint-staged" , version : "^10.5.4" , } , { name : "prettier" , version : "^2.2.1" , } , { name : "husky" , version : "^5.1.2" , } , { name : "cross-env" , version : "^7.0.3" , } , { name : "@types/jasmine" , version : "~3.6.0" , } , { name : "commitizen" , version : "^4.2.4" , } , ] ; if ( ! options . skipLib ) { if ( ! options . skipSpectator ) { execSync ( "npm install --silent --save-dev @ngneat/spectator" , { windowsHide : true , } ) ; deps . push ( { name : "@ngneat/spectator" , version : "^8.0.2" } ) ; } if ( ! options . skipAngularCliGhPages ) { execSync ( "npm install --silent --save-dev angular-cli-ghpages" , { windowsHide : true , } ) ; deps . push ( { name : "angular-cli-ghpages" , version : "^1.0.0-rc.1" } ) ; } } const addPackageToPackageJson = addPackageToPackageJsonFactory ( host , "devDependencies" ) ; deps . forEach ( ( dep ) => { addPackageToPackageJson ( dep . name , dep . version ) ; } ) ; context . addTask ( new NodePackageInstallTask ( ) ) ; context . logger . log ( "info" , "⌛ Adding packages..." ) ; return host ; } ; }