gulp tasks
This commit is contained in:
parent
ed77bcd75b
commit
f2bbeb4afb
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,3 +12,4 @@ coverage/
|
||||
.env
|
||||
dist
|
||||
*.tgz
|
||||
!gulpfile.js
|
||||
|
76
gulpfile.js
Normal file
76
gulpfile.js
Normal file
@ -0,0 +1,76 @@
|
||||
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 ./test/**/*.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())
|
||||
.pipe(istanbul.writeReports())
|
||||
|
||||
});
|
||||
|
||||
gulp.task('test-coverage', ['test'], 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;
|
||||
})
|
2310
package-lock.json
generated
2310
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
33
package.json
33
package.json
@ -4,25 +4,11 @@
|
||||
"description": "Generates models for TypeORM from existing databases.",
|
||||
"bin": "bin/typeorm-model-generator",
|
||||
"scripts": {
|
||||
"tsc:w": "tsc -w",
|
||||
"tsc": "tsc",
|
||||
"typings-install": "typings install",
|
||||
"setup": "npm install && npm run typings-install",
|
||||
"prestart": "tsc",
|
||||
"setup": "npm install && typings install",
|
||||
"start": " node ./dist/src/index.js",
|
||||
"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 "
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{ts,json,md}": [
|
||||
"prettier --write",
|
||||
"git add"
|
||||
]
|
||||
"test": "gulp test-coverage",
|
||||
"compile": "gulp compile",
|
||||
"precommit": "gulp pre-commit"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -35,6 +21,7 @@
|
||||
},
|
||||
"homepage": "https://github.com/Kononnable/typeorm-model-generator#readme",
|
||||
"dependencies": {
|
||||
"change-case": "^3.0.1",
|
||||
"handlebars": "^4.0.11",
|
||||
"mssql": "^4.0.4",
|
||||
"mysql": "^2.15.0",
|
||||
@ -42,7 +29,6 @@
|
||||
"pg": "^7.4.0",
|
||||
"reflect-metadata": "^0.1.10",
|
||||
"typeorm": "^0.2.0-alpha.13",
|
||||
"change-case": "^3.0.1",
|
||||
"typescript": "^2.6.1",
|
||||
"yargs": "^11.0.0",
|
||||
"yn": "^2.0.0"
|
||||
@ -66,10 +52,17 @@
|
||||
"codecov": "^3.0.0",
|
||||
"dotenv": "^5.0.0",
|
||||
"fs-extra": "^5.0.0",
|
||||
"gulp": "^3.9.1",
|
||||
"gulp-clean": "^0.4.0",
|
||||
"gulp-istanbul": "^1.1.3",
|
||||
"gulp-mocha": "^3.0.1",
|
||||
"gulp-shell": "^0.6.5",
|
||||
"gulp-sourcemaps": "^2.6.4",
|
||||
"gulp-typescript": "^4.0.1",
|
||||
"husky": "^0.14.3",
|
||||
"istanbul": "^0.4.5",
|
||||
"lint-staged": "^7.0.0",
|
||||
"mocha": "^5.0.0",
|
||||
"mocha": "^3.0.1",
|
||||
"prettier": "^1.10.2",
|
||||
"remap-istanbul": "^0.11.0",
|
||||
"sinon": "^4.1.2",
|
||||
|
Loading…
Reference in New Issue
Block a user