style: run format (#28532)

PR Close #28532
This commit is contained in:
Greg Magolan 2019-02-05 11:49:49 -08:00 committed by Matias Niemelä
parent 7a6237bc50
commit 4142db0828
2 changed files with 62 additions and 62 deletions

View File

@ -8,12 +8,12 @@
* @fileoverview Schematics for ng-new project that builds with Bazel. * @fileoverview Schematics for ng-new project that builds with Bazel.
*/ */
import { SchematicContext, apply, applyTemplates, chain, mergeWith, move, Rule, schematic, Tree, url, SchematicsException, UpdateRecorder, } from '@angular-devkit/schematics'; import {SchematicContext, apply, applyTemplates, chain, mergeWith, move, Rule, schematic, Tree, url, SchematicsException, UpdateRecorder,} from '@angular-devkit/schematics';
import { parseJsonAst, JsonAstObject, strings, JsonValue } from '@angular-devkit/core'; import {parseJsonAst, JsonAstObject, strings, JsonValue} from '@angular-devkit/core';
import { findPropertyInAstObject, insertPropertyInAstObjectInOrder } from '@schematics/angular/utility/json-utils'; import {findPropertyInAstObject, insertPropertyInAstObjectInOrder} from '@schematics/angular/utility/json-utils';
import { validateProjectName } from '@schematics/angular/utility/validation'; import {validateProjectName} from '@schematics/angular/utility/validation';
import { getWorkspacePath } from '@schematics/angular/utility/config'; import {getWorkspacePath} from '@schematics/angular/utility/config';
import { Schema } from './schema'; import {Schema} from './schema';
/** /**
* Packages that build under Bazel require additional dev dependencies. This * Packages that build under Bazel require additional dev dependencies. This
@ -40,7 +40,7 @@ function addDevDependenciesToPackageJson(options: Schema) {
} }
const angularCoreVersion = angularCoreNode.value as string; const angularCoreVersion = angularCoreNode.value as string;
const devDependencies: { [ k: string ]: string } = { const devDependencies: {[k: string]: string} = {
'@angular/bazel': angularCoreVersion, '@angular/bazel': angularCoreVersion,
// TODO(kyliau): Consider moving this to latest-versions.ts // TODO(kyliau): Consider moving this to latest-versions.ts
'@bazel/bazel': '^0.22.1', '@bazel/bazel': '^0.22.1',
@ -51,7 +51,7 @@ function addDevDependenciesToPackageJson(options: Schema) {
const recorder = host.beginUpdate(packageJson); const recorder = host.beginUpdate(packageJson);
for (const packageName of Object.keys(devDependencies)) { for (const packageName of Object.keys(devDependencies)) {
const version = devDependencies[ packageName ]; const version = devDependencies[packageName];
const indent = 4; const indent = 4;
insertPropertyInAstObjectInOrder(recorder, devDeps, packageName, version, indent); insertPropertyInAstObjectInOrder(recorder, devDeps, packageName, version, indent);
} }
@ -109,7 +109,7 @@ function replacePropertyInAstObject(
if (property === null) { if (property === null) {
throw new Error(`Property ${propertyName} does not exist in JSON object`); throw new Error(`Property ${propertyName} does not exist in JSON object`);
} }
const { start, text } = property; const {start, text} = property;
recorder.remove(start.offset, text.length); recorder.remove(start.offset, text.length);
const indentStr = '\n' + const indentStr = '\n' +
' '.repeat(indent); ' '.repeat(indent);
@ -119,7 +119,7 @@ function replacePropertyInAstObject(
function updateAngularJsonToUseBazelBuilder(options: Schema): Rule { function updateAngularJsonToUseBazelBuilder(options: Schema): Rule {
return (host: Tree, context: SchematicContext) => { return (host: Tree, context: SchematicContext) => {
const { name } = options; const {name} = options;
const workspacePath = getWorkspacePath(host); const workspacePath = getWorkspacePath(host);
if (!workspacePath) { if (!workspacePath) {
throw new Error('Could not find angular.json'); throw new Error('Could not find angular.json');
@ -169,7 +169,7 @@ function updateAngularJsonToUseBazelBuilder(options: Schema): Rule {
replacePropertyInAstObject( replacePropertyInAstObject(
recorder, architect, 'test', { recorder, architect, 'test', {
builder: '@angular/bazel:build', builder: '@angular/bazel:build',
options: { 'bazelCommand': 'test', 'targetLabel': '//src/...' }, options: {'bazelCommand': 'test', 'targetLabel': '//src/...'},
}, },
indent); indent);
@ -216,7 +216,7 @@ function backupAngularJson(): Rule {
}; };
} }
export default function (options: Schema): Rule { export default function(options: Schema): Rule {
return (host: Tree) => { return (host: Tree) => {
validateProjectName(options.name); validateProjectName(options.name);

View File

@ -8,11 +8,11 @@
* @fileoverview Schematics for ng-new project that builds with Bazel. * @fileoverview Schematics for ng-new project that builds with Bazel.
*/ */
import { Rule, Tree, chain, externalSchematic, schematic } from '@angular-devkit/schematics'; import {Rule, Tree, chain, externalSchematic, schematic} from '@angular-devkit/schematics';
import { validateProjectName } from '@schematics/angular/utility/validation'; import {validateProjectName} from '@schematics/angular/utility/validation';
import { Schema } from './schema'; import {Schema} from './schema';
export default function (options: Schema): Rule { export default function(options: Schema): Rule {
return (host: Tree) => { return (host: Tree) => {
validateProjectName(options.name); validateProjectName(options.name);