Skip to content

Commit

Permalink
fix(generators): install dependencies for app.nativescript (#107)
Browse files Browse the repository at this point in the history
close #106
  • Loading branch information
dungahk authored and NathanWalker committed Mar 18, 2019
1 parent 1b0618f commit d59d94a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/app.nativescript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
schematic,
noop,
} from '@angular-devkit/schematics';
import { stringUtils, prerun, getNpmScope, getPrefix, addRootDeps, updatePackageScripts, updateAngularProjects, updateNxProjects, applyAppNamingConvention, getGroupByName, getAppName, missingArgument, getJsonFromFile, setDependency, updateJsonFile } from '../utils';
import { stringUtils, prerun, getNpmScope, getPrefix, addRootDeps, updatePackageScripts, updateAngularProjects, updateNxProjects, applyAppNamingConvention, getGroupByName, getAppName, missingArgument, addInstall, getJsonFromFile, setDependency, updateJsonFile } from '../utils';
import { Schema as ApplicationOptions } from './schema';

export default function (options: ApplicationOptions) {
Expand Down Expand Up @@ -43,6 +43,7 @@ export default function (options: ApplicationOptions) {
})(tree, context),
// add root package dependencies
(tree: Tree) => addRootDeps(tree, {nativescript: true}),
addInstall,
addNsCli(options.addCliDependency),
// add start/clean scripts
(tree: Tree) => {
Expand Down
9 changes: 2 additions & 7 deletions src/app.nest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
noop,
externalSchematic
} from "@angular-devkit/schematics";
import { NodePackageInstallTask } from "@angular-devkit/schematics/tasks";
import {
stringUtils,
getNpmScope,
Expand All @@ -29,7 +28,8 @@ import {
applyAppNamingConvention,
getAppName,
updateJsonInTree,
missingArgument
missingArgument,
addInstall
} from "../utils";

export default function (options: ApplicationOptions) {
Expand Down Expand Up @@ -101,11 +101,6 @@ export default function (options: ApplicationOptions) {
]);
}

function addInstall(host: Tree, context: SchematicContext) {
context.addTask(new NodePackageInstallTask());
return host;
}

function addAppFiles(
options: ApplicationOptions,
appPath: string,
Expand Down
6 changes: 6 additions & 0 deletions src/utils/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { toFileName } from "./name-utils";
const util = require('util');
const xml2js = require('xml2js');
import * as stripJsonComments from 'strip-json-comments';
import { NodePackageInstallTask } from "@angular-devkit/schematics/tasks";

export const supportedPlatforms = [
"web",
Expand Down Expand Up @@ -1315,3 +1316,8 @@ export const toComponentClassName = (name: string) =>
`${classify(name)}Component`;

export const toNgModuleClassName = (name: string) => `${classify(name)}Module`;

export function addInstall(host: Tree, context: SchematicContext) {
context.addTask(new NodePackageInstallTask());
return host;
}

0 comments on commit d59d94a

Please sign in to comment.