moving scripts back to package.json, fixing codecov coverage
This commit is contained in:
parent
aa16fb1206
commit
f7be977f6b
79
gulpfile.js
79
gulpfile.js
@ -1,79 +0,0 @@
|
||||
const gulp = require('gulp')
|
||||
const ts = require("gulp-typescript");
|
||||
const sourcemaps = require("gulp-sourcemaps");
|
||||
const clean = require("gulp-clean");
|
||||
const shell = require('gulp-shell');
|
||||
const istanbul = require('gulp-istanbul');
|
||||
const mocha = require('gulp-mocha');
|
||||
const remapIstanbul = require('remap-istanbul/lib/gulpRemapIstanbul');
|
||||
|
||||
gulp.task('compile', ['clean'], function () {
|
||||
var tsProject = ts.createProject('tsconfig.json');
|
||||
return tsProject.src()
|
||||
.pipe(sourcemaps.init())
|
||||
.pipe(tsProject())
|
||||
.pipe(sourcemaps.write('.'))
|
||||
.pipe(gulp.dest('dist'))
|
||||
});
|
||||
|
||||
gulp.task('clean', function () {
|
||||
return gulp.src(['dist', 'coverage', 'output'], { read: false })
|
||||
.pipe(clean());
|
||||
});
|
||||
|
||||
gulp.task('prettier', function () {
|
||||
return gulp.src('.prettierrc')
|
||||
.pipe(shell(['prettier ./src/**/*.ts --write']))
|
||||
.pipe(shell(['prettier ./src/*.ts --write']))
|
||||
});
|
||||
|
||||
gulp.task('pre-commit', ['prettier'], function () {
|
||||
return gulp.src('package.json', { read: false })
|
||||
.pipe(shell(['git update-index --again']))
|
||||
})
|
||||
|
||||
gulp.task('watch', function () {
|
||||
gulp.src('tsconfig.json')
|
||||
.pipe(shell(['tsc -w']))
|
||||
|
||||
var watcher = gulp.watch(['src/**/*.ts', 'test/**/*.ts']);
|
||||
|
||||
watcher.on('change', function (changeInfo) {
|
||||
console.log('File ' + changeInfo.path + ' was ' + changeInfo.type + '.');
|
||||
if (changeInfo.type == 'deleted') {
|
||||
let jsFilePath = changeInfo.path
|
||||
.split('.ts').join('.js')
|
||||
.split('\\').join('/')
|
||||
.split('/src/').join('/dist/src/')
|
||||
.split('/test/').join('/dist/test/');
|
||||
return gulp.src([jsFilePath, jsFilePath + '.map'], { read: false })
|
||||
.pipe(clean());
|
||||
}
|
||||
});
|
||||
})
|
||||
|
||||
gulp.task('pre-test', function () {
|
||||
return gulp.src(['dist/src/**/*.js'])
|
||||
.pipe(istanbul())
|
||||
.pipe(istanbul.hookRequire());
|
||||
});
|
||||
|
||||
gulp.task('test', ['pre-test'], function () {
|
||||
return gulp.src(['dist/test/**/*.test.js'], { read: false })
|
||||
.pipe(mocha())
|
||||
});
|
||||
|
||||
gulp.task('coveragePost', ['test'], function () {
|
||||
return gulp.src(['dist/test/**/*.test.js'], { read: false })
|
||||
.pipe(istanbul.writeReports())
|
||||
});
|
||||
|
||||
gulp.task('coverageRemap', ['coveragePost'], function () {
|
||||
var GulpStream = gulp.src('coverage/coverage-final.json')
|
||||
.pipe(remapIstanbul())
|
||||
.pipe(gulp.dest('coverage/remapped'));
|
||||
if ((process.env.CI == 'true')) {
|
||||
GulpStream = GulpStream.pipe(shell(['codecov --file=./coverage/remapped/coverage-final.json ']));
|
||||
}
|
||||
return GulpStream;
|
||||
})
|
2243
package-lock.json
generated
2243
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
17
package.json
17
package.json
@ -6,9 +6,12 @@
|
||||
"scripts": {
|
||||
"setup": "npm install && typings install",
|
||||
"start": " node ./dist/src/index.js",
|
||||
"test": "gulp coverageRemap",
|
||||
"compile": "gulp compile",
|
||||
"precommit": "gulp pre-commit"
|
||||
"compile": "npm run clean && tsc",
|
||||
"precommit": "npm run prettier && git update-index --again",
|
||||
"test": "istanbul cover ./node_modules/mocha/bin/_mocha dist/test/**/*.test.js -- -R spec",
|
||||
"posttest": "remap-istanbul -i ./coverage/coverage.json -o ./coverage/coverage-remapped.json && codecov --file=./coverage/coverage-remapped.json ",
|
||||
"clean": "rimraf dist coverage output",
|
||||
"prettier": "prettier --write ./src/*.ts ./src/**/*.ts"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -52,19 +55,13 @@
|
||||
"codecov": "^3.0.1",
|
||||
"dotenv": "^6.0.0",
|
||||
"fs-extra": "^7.0.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-clean": "^0.4.0",
|
||||
"gulp-istanbul": "^1.1.3",
|
||||
"gulp-mocha": "^6.0.0",
|
||||
"gulp-shell": "^0.6.5",
|
||||
"gulp-sourcemaps": "^2.6.4",
|
||||
"gulp-typescript": "^4.0.2",
|
||||
"husky": "^1.0.0",
|
||||
"istanbul": "^0.4.5",
|
||||
"lint-staged": "^7.2.0",
|
||||
"mocha": "^5.1.1",
|
||||
"prettier": "^1.12.1",
|
||||
"remap-istanbul": "^0.12.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"sinon": "^6.0.0",
|
||||
"sinon-chai": "^3.0.0",
|
||||
"typings": "^2.1.1"
|
||||
|
Loading…
Reference in New Issue
Block a user