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

Commit

Permalink
npm update: scripts/tasks, presets,..
Browse files Browse the repository at this point in the history
 - run tests sequantally from npm scripts

 - gulp - ignore error in run tasks (so the process doesn't break)

 - preset-env + spread operator
  • Loading branch information
Stropho committed Nov 1, 2017
1 parent f7825ad commit b2b962e
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 16 deletions.
13 changes: 12 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
{
"presets": [
"es2015"
[
"env", {
"targets": {
"node": "current"
}
}
]
],
"plugins": [
"transform-es2015-parameters",
"transform-es2015-destructuring",
"transform-object-rest-spread"
],
"env": {
"test": {
Expand Down
5 changes: 4 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
"es6": true
},
"parserOptions": {
"sourceType": "module"
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true
}
},
"extends": "idiomatic"
}
36 changes: 28 additions & 8 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import gulp from 'gulp';
import sourceMaps from 'gulp-sourcemaps';
import run from 'gulp-run-command'
import run from 'gulp-run-command';
import babel from 'gulp-babel';
import path from 'path';
import del from 'del';
import fs from 'fs';
import concat from 'gulp-concat';
import gulpJsdoc2md from 'gulp-jsdoc-to-markdown';

const paths = {
es6Path: './src/**/*.*',
es6: [ './src/**/*.js', '!./src/**/*.json' ],
es5: './dist',
docs: './jsdoc2md',

unitTest: './test/unit/**/*.spec.js',
integrationTest: './test/integration/**/*.spec.js',
Expand All @@ -26,7 +30,7 @@ gulp.task( 'build', [ 'clean:dist', 'copy:nonJs' ], () => {
return gulp.src( paths.es6 )
.pipe( sourceMaps.init() )
.pipe( babel( {
presets: [ 'es2015' ]
presets: [ 'env' ]
} ) )
.pipe( sourceMaps.write( '.', { sourceRoot: paths.sourceRoot } ) )
.pipe( gulp.dest( paths.es5 ) );
Expand All @@ -45,19 +49,35 @@ gulp.task( 'watch', [ 'build' ], () => {
} );

gulp.task( 'test:unit',
run(`mocha '${paths.unitTest}' --compilers js:babel-core/register --require './test/mocha.conf.js'`)
run(`mocha '${paths.unitTest}' --compilers js:babel-core/register --require './test/mocha.conf.js'`,
{ignoreErrors: true}
)
);

gulp.task( 'test:integration',
run(`mocha '${paths.integrationTest}' --compilers js:babel-core/register --require './test/mocha.conf.js'`)
run(`mocha '${paths.integrationTest}' --compilers js:babel-core/register --require './test/mocha.conf.js'`,
{ignoreErrors: true}
)
);

gulp.task( 'test', ['test:unit', 'test:integration']);


gulp.task( 'test:unit:watch', () => {
gulp.start([ 'test:unit' ]);
gulp.watch( [paths.unitTest, paths.es6], [ 'test:unit' ] );
} );

gulp.task('docs', () => {
return gulp.src(paths.es6)
.pipe(concat('README.md'))
.pipe(gulpJsdoc2md({
template: fs.readFileSync(`${paths.docs}/README.hbs`, 'utf8'),
partial: [
`${paths.docs}/contribute.hbs`,
`${paths.docs}/intro.hbs`
]
}))
.on('error', (err) => {
console.log('jsdoc2md failed:', err.message)
})
.pipe(gulp.dest('./'))
});

gulp.task( 'default', [ 'watch' ] );
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "short-key-generator",
"version": "0.0.9",
"description": "Generate sequence of keys based on specific alphabet",
"description": "Generate sequence of short keys based on specific alphabet and provide a keymap",
"keywords": [
"short",
"key",
Expand Down Expand Up @@ -34,9 +34,11 @@
"lint": "npm run lint:src && npm run lint:test",
"test:integration": "npm run lint:test && gulp test:integration",
"test:unit": "gulp test:unit",
"test": "npm run lint:test && gulp test",
"test:unit:watch": "gulp test:unit:watch",
"all": "npm run lint && gulp test && npm run coverage && npm run build"
"test": "npm run lint:test && gulp test:unit && gulp test:integration",
"test:unit:watch": "npm run test:unit && gulp test:unit:watch",
"all": "npm run lint && gulp test:unit && gulp test:integration && npm run coverage && npm run build && npm run docs",
"clean": "gulp clean:dist",
"docs": "gulp docs"
},
"dependencies": {
"bidirectional-map": "^1.0.3"
Expand All @@ -45,16 +47,20 @@
"babel-cli": "^6.26.0",
"babel-core": "^6.11.4",
"babel-istanbul": "^0.12.2",
"babel-plugin-istanbul": "^1.0.3",
"babel-preset-es2015": "^6.9.0",
"babel-plugin-transform-es2015-destructuring": "^6.23.0",
"babel-plugin-transform-es2015-parameters": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.0",
"chai": "^3.5.0",
"del": "^2.2.2",
"eslint": "^4.10.0",
"eslint-config-idiomatic": "^4.0.0",
"eslint-plugin-mocha": "^4.0.0",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-concat": "^2.6.1",
"gulp-format-md": "*",
"gulp-jsdoc-to-markdown": "^1.2.2",
"gulp-run-command": "0.0.9",
"gulp-sourcemaps": "^1.6.0",
"mocha": "*",
Expand Down

0 comments on commit b2b962e

Please sign in to comment.