Skip to content

chore: change " => ' in .ts files #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HomeComponent } from './home/home.component';
import { BarcelonaModule } from './barcelona/barcelona.module';<% } %>

// Uncomment and add to NgModule imports if you need to use two-way binding
// import { NativeScriptFormsModule } from "nativescript-angular/forms";
// import { NativeScriptFormsModule } from 'nativescript-angular/forms';

// Uncomment and add to NgModule imports if you need to use the HTTP wrapper
// import { NativeScriptHttpClientModule } from 'nativescript-angular/http-client';
Expand Down
4 changes: 2 additions & 2 deletions src/add-ns/_sample-files/barcelona/barcelona.common.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Routes } from '@angular/router';

import { PlayersComponent } from "./players/players.component";
import { PlayerDetailComponent } from "./player-detail/player-detail.component";
import { PlayersComponent } from './players/players.component';
import { PlayerDetailComponent } from './player-detail/player-detail.component';
import { PlayerService } from './player.service';

export const componentDeclarations: any[] = [
Expand Down
4 changes: 2 additions & 2 deletions src/add-web/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,8 +329,8 @@ function mergeDependenciesJSON(nsPackageJson: any, webPackageJson: any) {

/**
* renames main.ts to main.tns.ts
* and updates: import { AppModule } from "./app.module";
* to: import { AppModule } from "./app.module.tns";
* and updates: import { AppModule } from './app.module';
* to: import { AppModule } from './app.module.tns';
*/
// const updateMain = (tree: Tree) => {
// const importPath = projectSettings.entryModuleImportPath;
Expand Down
6 changes: 3 additions & 3 deletions src/angular-json/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ describe('Angular JSON Config Schematic', () => {
path.join(__dirname, '../collection.json'),
);

const projName = "leproj"
const projName = 'leproj';
const defaultOptions: angularJsonOptions = {
name: projName,
};
const configPath = `/angular.json`;


describe("with default options (name only)", () => {
describe('with default options (name only)', () => {
let tree: UnitTestTree;
beforeAll(() => {
tree = schematicRunner.runSchematic('angular-json', defaultOptions);
Expand Down Expand Up @@ -48,7 +48,7 @@ describe('Angular JSON Config Schematic', () => {
});

it('should create files inside path when specified', () => {
const path = "/path/to/my/app";
const path = '/path/to/my/app';
const appJsonPath = `${path}/angular.json`;
const options = { ...defaultOptions, path };

Expand Down
36 changes: 18 additions & 18 deletions src/angular-project-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,40 +13,40 @@ export interface AngularProjectSettings {
/** ng Npm Version */
ngSemVer: SemVer;

/** default: "" */
/** default: '' */
root: string;

/** default: "src" */
/** default: 'src' */
sourceRoot: string;

/** default: "main"*/
/** default: 'main'*/
mainName: string;
/** default: "src/main.ts"*/
/** default: 'src/main.ts'*/
mainPath: string;
/** default: "app" */
/** default: 'app' */
prefix: string;
/** default: "src/tsconfig.json" */
/** default: 'src/tsconfig.json' */
tsConfig: string;

/** default: "AppModule"*/
/** default: 'AppModule'*/
entryModuleClassName: string;
/** default: "App"*/
/** default: 'App'*/
entryModuleName: string;
/** default: "src/app/app.module.ts"*/
/** default: 'src/app/app.module.ts'*/
entryModulePath: string;
/** default: "./app/app.module"*/
/** default: './app/app.module'*/
entryModuleImportPath: string;

/** default: "AppComponent" */
/** default: 'AppComponent' */
entryComponentClassName: string;
/** default: "App" */
/** default: 'App' */
entryComponentName: string;
/** default: "src/app/app.component.ts" */
/** default: 'src/app/app.component.ts' */
entryComponentPath: string;
/** default: "./app.component" */
/** default: './app.component' */
entryComponentImportPath: string;

/** default: "app-root"*/
/** default: 'app-root'*/
indexAppRootTag: string;
}

Expand Down Expand Up @@ -173,7 +173,7 @@ export function getProjectObject(tree: Tree, projectName: string) {

// Step 2 - get entryModule and entryModulePath => open ${sourceRoot}/${main}.ts
// - get entryModule from .bootstrapModule(__value__)
// - get entryModulePath from import { ${entryModule} } from "__value__" -- might need to remove ./
// - get entryModulePath from import { ${entryModule} } from '__value__' -- might need to remove ./
function getEntryModuleMetadata(tree: Tree, mainPath: string): ClassMetadata {
const source = getSourceFile(tree, mainPath);

Expand All @@ -197,7 +197,7 @@ function getEntryModuleMetadata(tree: Tree, mainPath: string): ClassMetadata {

// Step 3 - get appComponent and appComponentPath => open ${appRoot}/${entryModulePath}
// - get appComponent from bootstrap: [ __value__ ]
// - get appComponentPath from import { ${appComponent} } from "__value__"
// - get appComponentPath from import { ${appComponent} } from '__value__'
function getEntryComponentMetadata(tree: Tree, entryModulePath: string): ClassMetadata {
const source = getSourceFile(tree, entryModulePath);

Expand Down Expand Up @@ -227,7 +227,7 @@ function getEntryComponentMetadata(tree: Tree, entryModulePath: string): ClassMe
};
}

// Step 4 - get indexAppRootTag => open ${appRoot}/${appComponentPath} - get from selector: "__value__"
// Step 4 - get indexAppRootTag => open ${appRoot}/${appComponentPath} - get from selector: '__value__'
function getAppRootTag(tree: Tree, entryComponentPath: string): string {
const source = getSourceFile(tree, entryComponentPath);

Expand Down
3 changes: 1 addition & 2 deletions src/ast-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ function normalizeNodeToRemove<T extends ts.Node>(node: T, source: ts.Node)
const start = nodeStart - source.getFullStart();
const symbolBefore = content.substring(start - 1, start);

if (symbolBefore === ",") {
if (symbolBefore === ',') {
return new RemoveContent(nodeStart - 1, nodeEnd);
} else {
return new RemoveContent(nodeStart, nodeEnd + 1);
Expand Down Expand Up @@ -614,7 +614,6 @@ export function findImportPath(source: ts.Node, name) {
return moduleSpecifier.text;
}


export const updateNodeText = (tree: Tree, node: ts.Node, newText: string) => {
const recorder = tree.beginUpdate(node.getSourceFile().fileName);
recorder.remove(node.getStart(), node.getText().length);
Expand Down
10 changes: 5 additions & 5 deletions src/generate/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getNsConfig, getPackageJson } from "../utils";
import { Tree, SchematicsException } from "@angular-devkit/schematics";
import { extname } from "path";
import { getNsConfig, getPackageJson } from '../utils';
import { Tree, SchematicsException } from '@angular-devkit/schematics';
import { extname } from 'path';
import { Schema as ComponentOptions } from './component/schema';
import { Schema as ModuleOptions } from './module/schema';

Expand Down Expand Up @@ -83,8 +83,8 @@ export const getExtensions = (tree: Tree, options: Options): Extensions => {
}

return {
ns: parseExtension(ns || ""),
web: parseExtension(web || "")
ns: parseExtension(ns || ''),
web: parseExtension(web || '')
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/ng-new/application/_files/__sourcedir__/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AppComponent } from './app.component';
import { HomeComponent } from './home/home.component';

// Uncomment and add to NgModule imports if you need to use two-way binding
// import { NativeScriptFormsModule } from "nativescript-angular/forms";
// import { NativeScriptFormsModule } from 'nativescript-angular/forms';

// Uncomment and add to NgModule imports if you need to use the HTTP wrapper
// import { NativeScriptHttpClientModule } from 'nativescript-angular/http-client';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HomeComponent } from './home/home.component';
import { BarcelonaModule } from './barcelona/barcelona.module';<% } %>

// Uncomment and add to NgModule imports if you need to use two-way binding
// import { NativeScriptFormsModule } from "nativescript-angular/forms";
// import { NativeScriptFormsModule } from 'nativescript-angular/forms';

// Uncomment and add to NgModule imports if you need to use the HTTP wrapper
// import { NativeScriptHttpClientModule } from 'nativescript-angular/http-client';
Expand Down
4 changes: 2 additions & 2 deletions src/ng-new/shared/_sample-files/barcelona/barcelona.common.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Routes } from '@angular/router';

import { PlayersComponent } from "./players/players.component";
import { PlayerDetailComponent } from "./player-detail/player-detail.component";
import { PlayersComponent } from './players/players.component';
import { PlayerDetailComponent } from './player-detail/player-detail.component';
import { PlayerService } from './player.service';

export const componentDeclarations: any[] = [
Expand Down
4 changes: 2 additions & 2 deletions src/node-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Tree, SchematicsException } from "@angular-devkit/schematics";
import { getPackageJson, safeGet } from "./utils";
import { Tree, SchematicsException } from '@angular-devkit/schematics';
import { getPackageJson, safeGet } from './utils';

export class SemVer {
constructor(
Expand Down
18 changes: 9 additions & 9 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,17 @@ export const renameFilesForce = (paths: FromTo[]) =>
});

export function createEmptyNsOnlyProject(projectName: string, extension: string = ''): UnitTestTree {
let appTree = schematicRunner.runSchematic("angular-json", { name: projectName, sourceRoot: "src" });
let appTree = schematicRunner.runSchematic('angular-json', { name: projectName, sourceRoot: 'src' });

appTree = createAppModule(<any>appTree, `/src/app/app.module${extension}.ts`);

appTree.create('/package.json', JSON.stringify({
nativescript: { id: "proj" },
nativescript: { id: 'proj' },
dependencies: {
"@angular/core": "^6.1.0"
'@angular/core': '^6.1.0'
},
devDependencies: {
"@angular/cli": "^6.1.0"
'@angular/cli': '^6.1.0'
},
}));

Expand All @@ -176,11 +176,11 @@ export function createEmptySharedProject(projectName: string, webExtension: stri
appTree = createAppModule(<any>appTree, `/src/app/app.module${webExtension}.ts`);

appTree.create('/nsconfig.json', JSON.stringify({
"appResourcesPath": "App_Resources",
"appPath": "src",
"nsext": ".tns",
"webext": "",
"shared": true
'appResourcesPath': 'App_Resources',
'appPath': 'src',
'nsext': '.tns',
'webext': '',
'shared': true
}));

return appTree;
Expand Down