Skip to content

Commit

Permalink
chore(build): add manual build verifier for Angular 5.0 (angular#1294)
Browse files Browse the repository at this point in the history
* chore(deps): upgrade typescript

* chore(build): add manual build verifier for Angular 5.0
  • Loading branch information
davideast authored Oct 25, 2017
1 parent 4a21857 commit c33c3c3
Show file tree
Hide file tree
Showing 21 changed files with 5,414 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/ng-build/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cd ng5 && ng build --prod
45 changes: 45 additions & 0 deletions test/ng-build/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
const fs = require('fs');
const { spawn, spawnSync } = require('child_process');
const ng5Pkg = require('./ng5/package.json');
const pkg = require('../../package.json');
const shell = require('shelljs');

const PACKAGED_VERSION = `angularfire2-${pkg.version}.tgz`;

function packageAngularFire() {
console.log(`------------ PACKAGING VERSION ${PACKAGED_VERSION} ------------`);
const res = spawnSync('sh', ['pack.sh']);
console.log(`------------ FINISHED PACKAGING VERSION ${PACKAGED_VERSION} ------------`);
console.log(`------------ INSTALLING VERSION ${PACKAGED_VERSION} ------------`);
if (shell.exec(`cd ng5 && npm i firebase ../${PACKAGED_VERSION}`).code !== 0) {
shell.echo('Error');
shell.exit(1);
}
console.log(`------------ FINISHED INSTALLING VERSION ${PACKAGED_VERSION} ------------`);
buildVersion5();
}

function buildVersion5() {
console.log(`------------ BUILDING VERSION ${ng5Pkg.dependencies['@angular/core']} ------------`);
const cmd = spawn('sh', ['build.sh']);
cmd.stdout.on('data', (data) => {
console.log(data.toString('utf8'));
});
cmd.stderr.on('data', (data) => {
console.log(data.toString('utf8'));
});
cmd.on('close', () => {
try {
const dir = fs.readdirSync(__dirname + '/ng5/dist');
console.log(dir);
console.log(`------------ SUCCESS VERSION ${ng5Pkg.dependencies['@angular/core']} ------------`);
} catch (e) {
console.log(`------------ FAIL VERSION ${ng5Pkg.dependencies['@angular/core']} ------------`);
console.log(e);
throw new Error('ng build failed');
}
});
}

packageAngularFire();
//buildVersion5();
84 changes: 84 additions & 0 deletions test/ng-build/ng5/.angular-cli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "ng5"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"class": {
"spec": false
},
"component": {
"inlineStyle": true
,
"inlineTemplate": true
,
"spec": false
},
"directive": {
"spec": false
},
"guard": {
"spec": false
},
"module": {
"spec": false
},
"pipe": {
"spec": false
},
"service": {
"spec": false
}
}
}
42 changes: 42 additions & 0 deletions test/ng-build/ng5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# dependencies
/node_modules

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
34 changes: 34 additions & 0 deletions test/ng-build/ng5/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "ng5",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "5.0.0-rc.3",
"@angular/common": "5.0.0-rc.3",
"@angular/compiler": "5.0.0-rc.3",
"@angular/core": "5.0.0-rc.3",
"@angular/forms": "5.0.0-rc.3",
"@angular/http": "5.0.0-rc.3",
"@angular/platform-browser": "5.0.0-rc.3",
"@angular/platform-browser-dynamic": "5.0.0-rc.3",
"@angular/router": "5.0.0-rc.3",
"core-js": "^2.4.1",
"rxjs": "^5.5.0",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.4.9",
"@angular/compiler-cli": "5.0.0-rc.3",
"@angular/language-service": "5.0.0-rc.3",
"typescript": "~2.4.2"
}
}
39 changes: 39 additions & 0 deletions test/ng-build/ng5/src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { Component } from '@angular/core';
import { FirebaseApp } from 'angularfire2';
import { AngularFireDatabase } from 'angularfire2/database';
import { AngularFireAuth } from 'angularfire2/auth';
import { AngularFirestore } from 'angularfire2/firestore';

@Component({
selector: 'app-root',
template: `
<!--The content below is only a placeholder and can be replaced.-->
<div style="text-align:center">
<img width="300" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTAgMjUwIj4KICAgIDxwYXRoIGZpbGw9IiNERDAwMzEiIGQ9Ik0xMjUgMzBMMzEuOSA2My4ybDE0LjIgMTIzLjFMMTI1IDIzMGw3OC45LTQzLjcgMTQuMi0xMjMuMXoiIC8+CiAgICA8cGF0aCBmaWxsPSIjQzMwMDJGIiBkPSJNMTI1IDMwdjIyLjItLjFWMjMwbDc4LjktNDMuNyAxNC4yLTEyMy4xTDEyNSAzMHoiIC8+CiAgICA8cGF0aCAgZmlsbD0iI0ZGRkZGRiIgZD0iTTEyNSA1Mi4xTDY2LjggMTgyLjZoMjEuN2wxMS43LTI5LjJoNDkuNGwxMS43IDI5LjJIMTgzTDEyNSA1Mi4xem0xNyA4My4zaC0zNGwxNy00MC45IDE3IDQwLjl6IiAvPgogIDwvc3ZnPg==">
</div>
<h2>Here are some links to help you start: </h2>
<ul>
<li>
<h2><a target="_blank" rel="noopener" href="https://angular.io/tutorial">Tour of Heroes</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://github.com/angular/angular-cli/wiki">CLI Documentation</a></h2>
</li>
<li>
<h2><a target="_blank" rel="noopener" href="https://blog.angular.io/">Angular blog</a></h2>
</li>
</ul>
`,
styles: []
})
export class AppComponent {
constructor(
private readonly app: FirebaseApp,
private readonly db: AngularFireDatabase,
private readonly auth: AngularFireAuth,
private readonly afStore: AngularFirestore
) {
console.log(app, db, auth, afStore);
}
}
24 changes: 24 additions & 0 deletions test/ng-build/ng5/src/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AngularFirestoreModule } from 'angularfire2/firestore';

import { AppComponent } from './app.component';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AngularFireModule.initializeApp({}),
AngularFireAuthModule,
AngularFireDatabaseModule,
AngularFirestoreModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Empty file.
3 changes: 3 additions & 0 deletions test/ng-build/ng5/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const environment = {
production: true
};
8 changes: 8 additions & 0 deletions test/ng-build/ng5/src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// The file contents for the current environment will overwrite these during build.
// The build system defaults to the dev environment which uses `environment.ts`, but if you do
// `ng build --env=prod` then `environment.prod.ts` will be used instead.
// The list of which env maps to which file can be found in `.angular-cli.json`.

export const environment = {
production: false
};
14 changes: 14 additions & 0 deletions test/ng-build/ng5/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Ng5</title>
<base href="/">

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<app-root></app-root>
</body>
</html>
12 changes: 12 additions & 0 deletions test/ng-build/ng5/src/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

import { AppModule } from './app/app.module';
import { environment } from './environments/environment';

if (environment.production) {
enableProdMode();
}

platformBrowserDynamic().bootstrapModule(AppModule)
.catch(err => console.log(err));
76 changes: 76 additions & 0 deletions test/ng-build/ng5/src/polyfills.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* This file includes polyfills needed by Angular and is loaded before the app.
* You can add your own extra polyfills to this file.
*
* This file is divided into 2 sections:
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
* file.
*
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
*
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
*/

/***************************************************************************************************
* BROWSER POLYFILLS
*/

/** IE9, IE10 and IE11 requires all of the following polyfills. **/
// import 'core-js/es6/symbol';
// import 'core-js/es6/object';
// import 'core-js/es6/function';
// import 'core-js/es6/parse-int';
// import 'core-js/es6/parse-float';
// import 'core-js/es6/number';
// import 'core-js/es6/math';
// import 'core-js/es6/string';
// import 'core-js/es6/date';
// import 'core-js/es6/array';
// import 'core-js/es6/regexp';
// import 'core-js/es6/map';
// import 'core-js/es6/weak-map';
// import 'core-js/es6/set';

/** IE10 and IE11 requires the following for NgClass support on SVG elements */
// import 'classlist.js'; // Run `npm install --save classlist.js`.

/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';


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


/**
* Required to support Web Animations `@angular/platform-browser/animations`.
* Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation
**/
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.



/***************************************************************************************************
* Zone JS is required by Angular itself.
*/
import 'zone.js/dist/zone'; // Included with Angular CLI.



/***************************************************************************************************
* APPLICATION IMPORTS
*/

/**
* Date, currency, decimal and percent pipes.
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
*/
// import 'intl'; // Run `npm install --save intl`.
/**
* Need to import at least one locale-data with intl.
*/
// import 'intl/locale-data/jsonp/en';
1 change: 1 addition & 0 deletions test/ng-build/ng5/src/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* You can add global styles to this file, and also import other style files */
Loading

0 comments on commit c33c3c3

Please sign in to comment.