Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Commit

Permalink
fix: depend on Angular 2.0.0 (#3)
Browse files Browse the repository at this point in the history
* build(npm): update deps

* build(gulp): update tasks

* build(webpack): update config

* refactor: update .gitignore

* refactor: update .npmignore

* style(core): lint
  • Loading branch information
Burak Tasci authored and Burak Tasci committed Sep 4, 2017
1 parent 1848f78 commit 6e6ce77
Show file tree
Hide file tree
Showing 19 changed files with 1,454 additions and 1,407 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.js
*.d.ts
*.metadata.json
/.idea
/bundles
!/config/*.js
/coverage
Expand Down
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.ts
!*.d.ts
/.github
/.idea
/config
/coverage
/node_modules
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ To resolve this issue, it is **highly recommended** to use [ng-router-loader]. H
- [License](#license)

## Prerequisites
Verify that you are running at least `@angular v2.4.0` and `@angular/router v3.4.0`. Older versions containing outdated dependencies, might produce errors.
This package depends on `@angular v2.0.0` but it's highly recommended that you are running at least **`@angular v2.4.0`** and **`@angular/router v3.4.0`**. Older versions contain outdated dependencies, might produce errors.

You should also upgrade to a minimum version of `TypeScript 2.1.x`.
Also, please ensure that you are using **`Typescript v2.1.6`** or higher.

#### WARNING

The pull request [#14327](https://github.com/angular/angular/pull/14327) on **`@angular v2.4.8`** and **`@angular v4.0.0-rc.1`** introduced a severe error [#14588](https://github.com/angular/angular/issues/14588) which causes the app to fall into an infinite loop before bootstrapping.

In order to avoid issues, avoid using these versions of **Angular**.

## Getting started
### Installation
Expand Down
276 changes: 138 additions & 138 deletions config/gulp-tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,49 @@
/**
* Gulp helpers & dependencies
*/
var gulp = require('gulp'),
$ = require('gulp-load-plugins')({
pattern: [
'gulp-*',
'rimraf',
'webpack'
]
}),
$$ = require('./helpers');
const gulp = require('gulp'),
$ = require('gulp-load-plugins')({
pattern: [
'gulp-*',
'rimraf',
'webpack'
]
}),
$$ = require('./helpers');

/**
* Define tasks
*/
var tasks = {};
const tasks = {};

/**
* Clean file(s)
*/
var clean = {
'temp': function (done) {
$.rimraf('./temp', done);
},
'bundles': function (done) {
$.rimraf('./bundles', done);
},
'index.js': function (done) {
$.rimraf('./index.js', done);
},
'index.d.ts': function (done) {
$.rimraf('./index.d.ts', done);
},
'index.metadata.json': function (done) {
$.rimraf('./index.metadata.json', done);
},
'src/*.js': function (done) {
$.rimraf('./src/**/*.js', done);
},
'src/*.d.ts': function (done) {
$.rimraf('./src/**/*.d.ts', done);
},
'src/*.metadata.json': function (done) {
$.rimraf('./src/**/*.metadata.json', done);
}
const clean = {
'temp': function (done) {
$.rimraf('./temp', done);
},
'bundles': function (done) {
$.rimraf('./bundles', done);
},
'index.js': function (done) {
$.rimraf('./index.js', done);
},
'index.d.ts': function (done) {
$.rimraf('./index.d.ts', done);
},
'index.metadata.json': function (done) {
$.rimraf('./index.metadata.json', done);
},
'src/*.js': function (done) {
$.rimraf('./src/**/*.js', done);
},
'src/*.d.ts': function (done) {
$.rimraf('./src/**/*.d.ts', done);
},
'src/*.metadata.json': function (done) {
$.rimraf('./src/**/*.metadata.json', done);
}
};

clean.temp.displayName = 'clean:./temp/**';
Expand All @@ -60,34 +60,34 @@ clean['src/*.metadata.json'].displayName = 'clean:./src/*.js';
/**
* AoT compilation
*/
var ts = {
compile: function(done) {
const options = {
continueOnError: false,
pipeStdout: false,
customTemplatingThing: 'test'
};
const reportOptions = {
err: true,
stderr: true,
stdout: true
};

return gulp.src('./tsconfig.json')
.pipe($.exec('ngc -p "./tsconfig.json"', options))
.pipe($.exec.reporter(reportOptions))
.on('end', done);
},
lint: function(done) {
return gulp.src([
'./index.ts',
'./src/**/*.ts',
'!./src/**/*.d.ts'
])
.pipe($.tslint({ formatter: 'verbose' }))
.pipe($.tslint.report({ emitError: false }))
.on('end', done);
}
const ts = {
compile: function (done) {
const options = {
continueOnError: false,
pipeStdout: false,
customTemplatingThing: 'test'
};
const reportOptions = {
err: true,
stderr: true,
stdout: true
};

return gulp.src('./tsconfig.json')
.pipe($.exec('"./node_modules/.bin/ngc" -p "./tsconfig.json"', options))
.pipe($.exec.reporter(reportOptions))
.on('end', done);
},
lint: function (done) {
return gulp.src([
'./index.ts',
'./src/**/*.ts',
'!./src/**/*.d.ts'
])
.pipe($.tslint({formatter: 'verbose'}))
.pipe($.tslint.report({emitError: false}))
.on('end', done);
}
};

ts.compile.displayName = 'compile:ngc';
Expand All @@ -96,68 +96,68 @@ ts.lint.displayName = 'tslint';
/**
* Bundle
*/
var bundle = {
webpack: function (done) {
const chalk = require('chalk'),
conf = require('./webpack.prod.js');

$.webpack(conf)
.run(function (err, stats) {
if (err) {
console.log(chalk.red(`Error: ${err}`));
done();
} else {
const statsJson = stats.toJson(),
warnings = statsJson.warnings,
errors = statsJson.errors;

Object.keys(warnings)
.forEach(function (key) {
console.log(chalk.gray(`Warning: ${warnings[key]}\n`));
});

if (warnings.length > 0)
console.log(chalk.gray(` (${warnings.length}) warning(s) total.\n`));

Object.keys(errors)
.forEach(function (key) {
console.log(chalk.red(`Error: ${errors[key]}\n`));
});

if (errors.length > 0)
console.log(chalk.red(` (${errors.length}) error(s) total.\n`));

Object.keys(stats.compilation.assets)
.forEach(function (key) {
console.log(`Webpack: output ${chalk.green(key)}`);
});

console.log(`Webpack: ${chalk.blue(`finished`)}`);

done();
}
const bundle = {
webpack: function (done) {
const chalk = require('chalk'),
conf = require('./webpack.prod.js');

$.webpack(conf)
.run(function (err, stats) {
if (err) {
console.log(chalk.red(`Error: ${err}`));
done();
} else {
const statsJson = stats.toJson(),
warnings = statsJson.warnings,
errors = statsJson.errors;

Object.keys(warnings)
.forEach(function (key) {
console.log(chalk.gray(`Warning: ${warnings[key]}\n`));
});
}

if (warnings.length > 0)
console.log(chalk.gray(` (${warnings.length}) warning(s) total.\n`));

Object.keys(errors)
.forEach(function (key) {
console.log(chalk.red(`Error: ${errors[key]}\n`));
});

if (errors.length > 0)
console.log(chalk.red(` (${errors.length}) error(s) total.\n`));

Object.keys(stats.compilation.assets)
.forEach(function (key) {
console.log(`Webpack: output ${chalk.green(key)}`);
});

console.log(`Webpack: ${chalk.blue(`finished`)}`);

done();
}
});
}
};

bundle.webpack.displayName = 'bundle:webpack';

/**
* Tests
*/
var tests = {
run: function(done) {
const server = require('karma').Server;

new server({
configFile: $$.root('./karma.conf.js'),
singleRun: true
},
function() {
done();
process.exit(0);
}).start();
}
const tests = {
run: function (done) {
const server = require('karma').Server;

new server({
configFile: $$.root('./karma.conf.js'),
singleRun: true
},
function () {
done();
process.exit(0);
}).start();
}
};

tests.run.displayName = 'tests:run';
Expand All @@ -174,39 +174,39 @@ tasks.tests = tests;
* Task: __CLEAN__
*/
gulp.task('__CLEAN__',
gulp.parallel(
clean.temp,
clean.bundles,
clean['index.js'],
clean['index.d.ts'],
clean['index.metadata.json'],
clean['src/*.js'],
clean['src/*.d.ts'],
clean['src/*.metadata.json']
));
gulp.parallel(
clean.temp,
clean.bundles,
clean['index.js'],
clean['index.d.ts'],
clean['index.metadata.json'],
clean['src/*.js'],
clean['src/*.d.ts'],
clean['src/*.metadata.json']
));

/**
* Task: make
*/
gulp.task('make',
gulp.series(
'__CLEAN__',
tasks.ts.compile,
tasks.bundle.webpack
));
gulp.series(
'__CLEAN__',
tasks.ts.compile,
tasks.bundle.webpack
));

/**
* Task: _TEST_
*/
gulp.task('_TEST_',
gulp.series(
tasks.tests.run
));
gulp.series(
tasks.tests.run
));

/**
* Task: review:ts
*/
gulp.task('review:ts',
gulp.series(
tasks.ts.lint
));
gulp.series(
tasks.ts.lint
));
10 changes: 5 additions & 5 deletions config/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ $.path = require('path');
/**
* Helper methods
*/
function root(args) {
const ROOT = $.path.resolve(__dirname, '..');
args = Array.prototype.slice.call(arguments, 0);
const root = function (args) {
const ROOT = $.path.resolve(__dirname, '..');
args = Array.prototype.slice.call(arguments, 0);

return $.path.join.apply($.path, [ROOT].concat(args));
}
return $.path.join.apply($.path, [ROOT].concat(args));
};

/**
* Exports
Expand Down
Loading

0 comments on commit 6e6ce77

Please sign in to comment.