Skip to content
Open
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
60 changes: 0 additions & 60 deletions .angular-cli.json

This file was deleted.

132 changes: 132 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"ngx-analytics": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"polyfills": "src/polyfills.ts",
"assets": [
"src/assets",
"src/favicon.ico"
],
"styles": [
"src/styles.scss"
],
"scripts": []
},
"configurations": {
"production": {
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "ngx-analytics:build"
},
"configurations": {
"production": {
"browserTarget": "ngx-analytics:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "ngx-analytics:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"karmaConfig": "./karma.conf.js",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"scripts": [],
"styles": [
"src/styles.scss"
],
"assets": [
"src/assets",
"src/favicon.ico"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"ngx-analytics-e2e": {
"root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
"e2e": {
"builder": "@angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "./protractor.conf.js",
"devServerTarget": "ngx-analytics:serve"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"e2e/tsconfig.e2e.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "ngx-analytics",
"schematics": {
"@schematics/angular:component": {
"prefix": "app",
"styleext": "scss"
},
"@schematics/angular:directive": {
"prefix": "app"
}
}
}
12 changes: 12 additions & 0 deletions browserslist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# You can see what browsers were selected by your queries by running:
# npx browserslist

> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
25 changes: 10 additions & 15 deletions build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import { spawn } from 'child_process';
import * as copyfiles from 'copy';
import { copy } from 'fs-extra';
import { rollup } from 'rollup';
import { rollup, RollupLogProps, RollupWarning } from 'rollup';
import * as filesize from 'rollup-plugin-filesize';
import * as sourcemaps from 'rollup-plugin-sourcemaps';
import { Observable } from 'rxjs';
import { bindCallback, forkJoin, Observable } from 'rxjs';

const copyAll: ((s: string, s1: string) => any) = Observable.bindCallback(
const copyAll: ((s: string, s1: string) => any) = bindCallback(
copyfiles,
);

Expand Down Expand Up @@ -41,7 +41,6 @@ const MODULE_NAMES = {

const GLOBALS = {
'tslib': 'tslib',

'@angular/core': 'ng.core',
'@angular/common': 'ng.common',
'@angular/forms': 'ng.forms',
Expand All @@ -50,22 +49,17 @@ const GLOBALS = {
'@angular/platform-browser': 'ng.platformBrowser',
'@angular/platform-server': 'ng.platformServer',
'@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',

'@uirouter/core': '@uirouter/core',

'rxjs/Observable': 'Rx',
'rxjs/Subject': 'Rx',
'rxjs/Observer': 'Rx',
'rxjs/Subscription': 'Rx',
'rxjs/ReplaySubject': 'Rx',
'rxjs/BehaviorSubject': 'Rx',

'rxjs/operators/filter': 'Rx.operators',
'rxjs/operators/map': 'Rx.operators',

'rxjs/observable/merge': 'Rx.Observable',
'rxjs/observable/of': 'Rx.Observable',

'ngx-analytics': MODULE_NAMES['core'],
};

Expand All @@ -90,7 +84,7 @@ const TSC_ARGS = (type: string, name: string, config= 'build') => {
* Create an Observable of a spawned child process.
*/
function spawnObservable(command: string, args: string[]) {
return Observable.create(observer => {
return new Observable(observer => {
const cmd = spawn(command, args);
observer.next(''); // hack to kick things off, not every command will have a stdout
cmd.stdout.on('data', (data) => { observer.next(data.toString()); });
Expand All @@ -108,15 +102,16 @@ function generateBundle(input, file, name, format): Promise<any> {
input,
external: Object.keys(GLOBALS),
onwarn(warning) {
if (warning.code === 'THIS_IS_UNDEFINED') {
if (typeof warning !== 'string' && warning.code === 'THIS_IS_UNDEFINED') {
return;
}
if (warning.code === 'UNUSED_EXTERNAL_IMPORT') {
if (typeof warning !== 'string' && warning.code === 'UNUSED_EXTERNAL_IMPORT') {
return;
}
console.log(warning.message);
if (typeof warning !== 'string') {
console.log(warning.message);
}
},
file,
plugins,
}).then(bundle => {
return bundle.write({
Expand Down Expand Up @@ -154,7 +149,7 @@ function createEs(name: string, target: string) {
function buildModule(name: string, type: string) {
const es2015$ = spawnObservable(NGC, TSC_ARGS(type, name));
const esm$ = spawnObservable(NGC, TSC_ARGS(type, name, 'esm'));
return Observable.forkJoin(es2015$, esm$);
return forkJoin(es2015$, esm$);
}

async function buildModulesProviders() {
Expand Down
14 changes: 6 additions & 8 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,23 @@
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular/cli/plugins/karma'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false, // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: 'coverage/',
reports: ['text-summary', 'json', 'html'],
fixWebpackSourcePaths: true,
},
angularCli: {
environment: 'dev',
dir: require('path').join(__dirname, 'coverage'), reports: ['text-summary', 'json', 'html'],
fixWebpackSourcePaths: true
},

reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
Expand All @@ -35,6 +33,6 @@ module.exports = function(config) {
base: `${process.env['TRAVIS'] ? 'ChromeHeadless' : 'Chrome'}`,
flags: ['--no-sandbox']
}
},
}
});
};
Loading