Skip to content

Commit

Permalink
Update to Angular 6 (#150)
Browse files Browse the repository at this point in the history
- refactor the whole project to be angular-cli and angular 6 compatible
- use the correct library specific prefix
- sort the dependencies alphabetically
- remove tests for node 6 and 7
- add tests for node 9 and 10
  • Loading branch information
madoar authored Sep 28, 2018
1 parent 640ffee commit fd053eb
Show file tree
Hide file tree
Showing 78 changed files with 11,549 additions and 211 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ dist: trusty
language: node_js

node_js:
- "10"
- "9"
- "8"
- "7"
- "6"

addons:
chrome: stable
Expand Down
43 changes: 43 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "",
"projects": {
"angular-archwizard": {
"root": "",
"sourceRoot": "src",
"projectType": "library",
"prefix": "aw",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "tsconfig.lib.json",
"project": "ng-package.json"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js"
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"tsconfig.lib.json",
"tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "angular-archwizard"
}
145 changes: 12 additions & 133 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,152 +1,31 @@
// Karma configuration for Unit testing

const path = require('path');
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {

const configuration = {

// base path that will be used to resolve all patterns (eg. files, exclude)
config.set({
basePath: '',

// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],

frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-webpack'),
require('karma-sourcemap-loader'),
require('karma-spec-reporter'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require("istanbul-instrumenter-loader")
],

// list of files / patterns to load in the browser
files: [
{
pattern: './karma-shim.js',
watched: false
}
require('@angular-devkit/build-angular/plugins/karma')
],

// list of files to exclude
exclude: [],

// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'./karma-shim.js': ['webpack', 'sourcemap']
},

// webpack
webpack: {
resolve: {
extensions: ['.ts', '.js']
},
module: {
rules: [
{
test: /\.ts/,
loaders: ['ts-loader', 'angular2-template-loader'],
exclude: /node_modules/
},
{
test: /\.(ts|js)$/,
loaders: ['angular-router-loader'],
exclude: /node_modules/
},
{
enforce: 'post',
test: /\.ts/,
use: [
{
loader: 'istanbul-instrumenter-loader',
options: {esModules: true}
}
],
exclude: [/\.spec.ts/, /node_modules/]
},
{
test: /\.html$/,
loader: 'raw-loader'
},
{
test: /\.less$/,
loaders: ['to-string-loader', 'css-loader', 'less-loader']
},
{
test: /\.css$/,
loaders: ['to-string-loader', 'css-loader']
},
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.(png|jpe?g|gif|svg|woff|woff2|ttf|eot|ico)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader?name=fonts/[name].[hash].[ext]?'
},
],
exprContextCritical: false
},
performance: {hints: false}
},

webpackServer: {
noInfo: true
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},

// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['spec', 'coverage-istanbul'],

coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage'),
reports: ['html', 'lcovonly'],
dir: path.join(__dirname, 'coverage'),
fixWebpackSourcePaths: true,
// Most reporters accept additional config options. You can pass these through the `report-config` option
'report-config': {

// all options available at: https://github.com/istanbuljs/istanbuljs/blob/aae256fb8b9a3d19414dcf069c592e88712c32c6/packages/istanbul-reports/lib/html/index.js#L135-L137
html: {
// outputs the report in ./coverage/html
subdir: 'html'
}

}
fixWebpackSourcePaths: true
},


// web server port
reporters: ['progress', 'kjhtml'],
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['ChromeHeadless'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true

};

config.set(configuration);
});
};
1 change: 1 addition & 0 deletions ng-package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
"dest": "./dist",
"lib": {
"entryFile": "src/index.ts"
}
Expand Down
Loading

0 comments on commit fd053eb

Please sign in to comment.