Skip to content

Commit 3af9dda

Browse files
committed
chore: kickoff
1 parent 7399541 commit 3af9dda

16 files changed

+105
-193
lines changed

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"trailingComma": "none",
3+
"printWidth": 100,
4+
"singleQuote": true
5+
}

README.md

+8-25
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,10 @@
1-
# AngularjsToAngular
1+
# AngularJS migration to Angular
2+
Source code for NG-BAIRES **AngularJS migration to Angular** presentation Demo App.
23

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.7.
4+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.0.8.
45

5-
## Development server
6-
7-
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
8-
9-
## Code scaffolding
10-
11-
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
12-
13-
## Build
14-
15-
Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `--prod` flag for a production build.
16-
17-
## Running unit tests
18-
19-
Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).
20-
21-
## Running end-to-end tests
22-
23-
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24-
25-
## Further help
26-
27-
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
6+
## Step 0: Kick-Off
7+
1. Create a new project using Angular CLI.
8+
```bash
9+
$ ng new angularjs-to-angular
10+
```

angular.json

+8-25
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,8 @@
1818
"main": "src/main.ts",
1919
"polyfills": "src/polyfills.ts",
2020
"tsConfig": "src/tsconfig.app.json",
21-
"assets": [
22-
"src/favicon.ico",
23-
"src/assets"
24-
],
25-
"styles": [
26-
"src/styles.css"
27-
],
21+
"assets": ["src/favicon.ico", "src/assets"],
22+
"styles": ["src/styles.css"],
2823
"scripts": []
2924
},
3025
"configurations": {
@@ -71,26 +66,16 @@
7166
"polyfills": "src/polyfills.ts",
7267
"tsConfig": "src/tsconfig.spec.json",
7368
"karmaConfig": "src/karma.conf.js",
74-
"styles": [
75-
"src/styles.css"
76-
],
69+
"styles": ["src/styles.css"],
7770
"scripts": [],
78-
"assets": [
79-
"src/favicon.ico",
80-
"src/assets"
81-
]
71+
"assets": ["src/favicon.ico", "src/assets"]
8272
}
8373
},
8474
"lint": {
8575
"builder": "@angular-devkit/build-angular:tslint",
8676
"options": {
87-
"tsConfig": [
88-
"src/tsconfig.app.json",
89-
"src/tsconfig.spec.json"
90-
],
91-
"exclude": [
92-
"**/node_modules/**"
93-
]
77+
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
78+
"exclude": ["**/node_modules/**"]
9479
}
9580
}
9681
}
@@ -115,13 +100,11 @@
115100
"builder": "@angular-devkit/build-angular:tslint",
116101
"options": {
117102
"tsConfig": "e2e/tsconfig.e2e.json",
118-
"exclude": [
119-
"**/node_modules/**"
120-
]
103+
"exclude": ["**/node_modules/**"]
121104
}
122105
}
123106
}
124107
}
125108
},
126109
"defaultProject": "angularjs-to-angular"
127-
}
110+
}

package-lock.json

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@
2525
"zone.js": "^0.8.26"
2626
},
2727
"devDependencies": {
28-
"@angular/compiler-cli": "^6.0.3",
2928
"@angular-devkit/build-angular": "~0.6.6",
30-
"typescript": "~2.7.2",
3129
"@angular/cli": "~6.0.7",
30+
"@angular/compiler-cli": "^6.0.3",
3231
"@angular/language-service": "^6.0.3",
3332
"@types/jasmine": "~2.8.6",
3433
"@types/jasminewd2": "~2.0.3",
@@ -43,6 +42,7 @@
4342
"karma-jasmine-html-reporter": "^0.2.2",
4443
"protractor": "~5.3.0",
4544
"ts-node": "~5.0.1",
46-
"tslint": "~5.9.1"
45+
"tslint": "~5.9.1",
46+
"typescript": "~2.7.2"
4747
}
4848
}

src/app/app.component.spec.ts

+34-23
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
11
import { TestBed, async } from '@angular/core/testing';
22
import { AppComponent } from './app.component';
33
describe('AppComponent', () => {
4-
beforeEach(async(() => {
5-
TestBed.configureTestingModule({
6-
declarations: [
7-
AppComponent
8-
],
9-
}).compileComponents();
10-
}));
11-
it('should create the app', async(() => {
12-
const fixture = TestBed.createComponent(AppComponent);
13-
const app = fixture.debugElement.componentInstance;
14-
expect(app).toBeTruthy();
15-
}));
16-
it(`should have as title 'app'`, async(() => {
17-
const fixture = TestBed.createComponent(AppComponent);
18-
const app = fixture.debugElement.componentInstance;
19-
expect(app.title).toEqual('app');
20-
}));
21-
it('should render title in a h1 tag', async(() => {
22-
const fixture = TestBed.createComponent(AppComponent);
23-
fixture.detectChanges();
24-
const compiled = fixture.debugElement.nativeElement;
25-
expect(compiled.querySelector('h1').textContent).toContain('Welcome to angularjs-to-angular!');
26-
}));
4+
beforeEach(
5+
async(() => {
6+
TestBed.configureTestingModule({
7+
declarations: [AppComponent]
8+
}).compileComponents();
9+
})
10+
);
11+
it(
12+
'should create the app',
13+
async(() => {
14+
const fixture = TestBed.createComponent(AppComponent);
15+
const app = fixture.debugElement.componentInstance;
16+
expect(app).toBeTruthy();
17+
})
18+
);
19+
it(
20+
`should have as title 'app'`,
21+
async(() => {
22+
const fixture = TestBed.createComponent(AppComponent);
23+
const app = fixture.debugElement.componentInstance;
24+
expect(app.title).toEqual('app');
25+
})
26+
);
27+
it(
28+
'should render title in a h1 tag',
29+
async(() => {
30+
const fixture = TestBed.createComponent(AppComponent);
31+
fixture.detectChanges();
32+
const compiled = fixture.debugElement.nativeElement;
33+
expect(compiled.querySelector('h1').textContent).toContain(
34+
'Welcome to angularjs-to-angular!'
35+
);
36+
})
37+
);
2738
});

src/app/app.module.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@ import { NgModule } from '@angular/core';
44
import { AppComponent } from './app.component';
55

66
@NgModule({
7-
declarations: [
8-
AppComponent
9-
],
10-
imports: [
11-
BrowserModule
12-
],
7+
declarations: [AppComponent],
8+
imports: [BrowserModule],
139
providers: [],
1410
bootstrap: [AppComponent]
1511
})
16-
export class AppModule { }
12+
export class AppModule {}

src/karma.conf.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Karma configuration file, see link for more information
22
// https://karma-runner.github.io/1.0/config/configuration-file.html
33

4-
module.exports = function (config) {
4+
module.exports = function(config) {
55
config.set({
66
basePath: '',
77
frameworks: ['jasmine', '@angular-devkit/build-angular'],
@@ -28,4 +28,4 @@ module.exports = function (config) {
2828
browsers: ['Chrome'],
2929
singleRun: false
3030
});
31-
};
31+
};

src/main.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ if (environment.production) {
88
enableProdMode();
99
}
1010

11-
platformBrowserDynamic().bootstrapModule(AppModule)
11+
platformBrowserDynamic()
12+
.bootstrapModule(AppModule)
1213
.catch(err => console.log(err));

src/polyfills.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,10 @@
4040
/** IE10 and IE11 requires the following for the Reflect API. */
4141
// import 'core-js/es6/reflect';
4242

43-
4443
/** Evergreen browsers require these. **/
4544
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
4645
import 'core-js/es7/reflect';
4746

48-
4947
/**
5048
* Web Animations `@angular/platform-browser/animations`
5149
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
@@ -58,11 +56,11 @@ import 'core-js/es7/reflect';
5856
* user can disable parts of macroTask/DomEvents patch by setting following flags
5957
*/
6058

61-
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
62-
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
63-
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
59+
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
60+
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
61+
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
6462

65-
/*
63+
/*
6664
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
6765
* with the following flag, it will bypass `zone.js` patch for IE/Edge
6866
*/
@@ -71,9 +69,7 @@ import 'core-js/es7/reflect';
7169
/***************************************************************************************************
7270
* Zone JS is required by default for Angular itself.
7371
*/
74-
import 'zone.js/dist/zone'; // Included with Angular CLI.
75-
76-
72+
import 'zone.js/dist/zone'; // Included with Angular CLI.
7773

7874
/***************************************************************************************************
7975
* APPLICATION IMPORTS

src/test.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@ import {
1010
declare const require: any;
1111

1212
// First, initialize the Angular testing environment.
13-
getTestBed().initTestEnvironment(
14-
BrowserDynamicTestingModule,
15-
platformBrowserDynamicTesting()
16-
);
13+
getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting());
1714
// Then we find all the tests.
1815
const context = require.context('./', true, /\.spec\.ts$/);
1916
// And load the modules.

src/tsconfig.app.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@
55
"module": "es2015",
66
"types": []
77
},
8-
"exclude": [
9-
"src/test.ts",
10-
"**/*.spec.ts"
11-
]
8+
"exclude": ["src/test.ts", "**/*.spec.ts"]
129
}

src/tsconfig.spec.json

+3-12
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,8 @@
33
"compilerOptions": {
44
"outDir": "../out-tsc/spec",
55
"module": "commonjs",
6-
"types": [
7-
"jasmine",
8-
"node"
9-
]
6+
"types": ["jasmine", "node"]
107
},
11-
"files": [
12-
"test.ts",
13-
"polyfills.ts"
14-
],
15-
"include": [
16-
"**/*.spec.ts",
17-
"**/*.d.ts"
18-
]
8+
"files": ["test.ts", "polyfills.ts"],
9+
"include": ["**/*.spec.ts", "**/*.d.ts"]
1910
}

src/tslint.json

+5-15
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,7 @@
11
{
2-
"extends": "../tslint.json",
3-
"rules": {
4-
"directive-selector": [
5-
true,
6-
"attribute",
7-
"app",
8-
"camelCase"
9-
],
10-
"component-selector": [
11-
true,
12-
"element",
13-
"app",
14-
"kebab-case"
15-
]
16-
}
2+
"extends": "../tslint.json",
3+
"rules": {
4+
"directive-selector": [true, "attribute", "app", "camelCase"],
5+
"component-selector": [true, "element", "app", "kebab-case"]
6+
}
177
}

tsconfig.json

+2-7
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@
99
"emitDecoratorMetadata": true,
1010
"experimentalDecorators": true,
1111
"target": "es5",
12-
"typeRoots": [
13-
"node_modules/@types"
14-
],
15-
"lib": [
16-
"es2017",
17-
"dom"
18-
]
12+
"typeRoots": ["node_modules/@types"],
13+
"lib": ["es2017", "dom"]
1914
}
2015
}

0 commit comments

Comments
 (0)