Skip to content

Commit

Permalink
gulp and babel
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilkp committed Mar 14, 2018
1 parent d0c8c50 commit 65d1428
Show file tree
Hide file tree
Showing 12 changed files with 11,421 additions and 3,527 deletions.
19 changes: 19 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"presets": [
["@babel/preset-env", {
"targets": {
"browsers": ["last 2 versions", "safari >= 7", "ie >= 10"]
}
}]
],
"plugins": [
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-pipeline-operator",
"@babel/plugin-proposal-nullish-coalescing-operator",
"@babel/plugin-transform-async-to-generator",
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-optional-catch-binding",
"@babel/plugin-proposal-async-generator-functions",
"@babel/plugin-transform-exponentiation-operator"
]
}
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module.exports = {
parser: 'babel-eslint',
rules: {
'prefer-const': ['error', { destructuring: 'all' }],
'semi-spacing': ['error', { 'before': false, 'after': true }],
'space-infix-ops': ['error'],
'keyword-spacing': ['error'],
'comma-dangle': ['error', 'always-multiline'],
'indent': ['error', 2, {
FunctionDeclaration: { parameters: 'first' },
FunctionExpression: { parameters: 'first' },
SwitchCase: 1,
MemberExpression: 'off',
}],
},
};
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.detectIndentation": false,
"editor.insertSpaces": true,
"editor.tabSize": 2
}
579 changes: 579 additions & 0 deletions dist/angular-vs-repeat.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/angular-vs-repeat.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import gulp from 'gulp';
import babel from 'gulp-babel';
import uglify from 'gulp-uglify';
import rename from 'gulp-rename';
import clean from 'gulp-clean';
import { Server } from 'karma';

gulp.task('clean', () =>
gulp.src('dist', { read: false })
.pipe(clean())
);

gulp.task('babel', ['clean'], () =>
gulp.src('src/angular-vs-repeat.js')
.pipe(babel())
.pipe(gulp.dest('dist'))
);

gulp.task('min', ['babel'], () =>
gulp.src('dist/angular-vs-repeat.js')
.pipe(uglify())
.pipe(rename('angular-vs-repeat.min.js'))
.pipe(gulp.dest('dist'))
);

gulp.task('karma', ['build'], (done) => {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true,
}, done).start();
});

gulp.task('karma-travis', ['build'], (done) => {
new Server({
configFile: __dirname + '/karma.conf.js',
singleRun: true,
browsers: [
'Firefox',
],
}, done).start();
});

gulp.task('build', ['clean', 'babel', 'min']);
gulp.task('test', ['build', 'karma']);
gulp.task('travis', ['build', 'karma-travis']);
6 changes: 3 additions & 3 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
module.exports = function(config) {
config.set({
frameworks: ['mocha'],
frameworks: ['mocha', 'chai'],

// list of files / patterns to load in the browser
files: [
'node_modules/expect.js/index.js',
'lib/angular.js',
'src/angular-vs-repeat.min.js',
'dist/angular-vs-repeat.min.js',
'lib/angular-mocks.js',
'test/spec.js',
],
Expand Down Expand Up @@ -62,6 +61,7 @@ module.exports = function(config) {

plugins: [
'karma-mocha',
'karma-chai',
'karma-chrome-launcher',
'karma-firefox-launcher'
]
Expand Down
Loading

0 comments on commit 65d1428

Please sign in to comment.