diff --git a/gulpfile.js b/gulpfile.js index cd57632..1a3851d 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -13,7 +13,7 @@ var gulp = require("gulp"), //****************************************************************************** //* LINT //****************************************************************************** -gulp.task("lint", function() { +gulp.task("lint", function () { var config = { fornatter: "verbose", @@ -21,9 +21,9 @@ gulp.task("lint", function() { }; return gulp.src([ - "src/**/**.ts", - "test/**/**.test.ts" - ]) + "src/**/**.ts", + "test/**/**.test.ts" + ]) .pipe(tslint(config)) .pipe(tslint.report()); }); @@ -35,12 +35,12 @@ var tsLibProject = tsc.createProject("tsconfig.json", { module: "commonjs" }); -gulp.task("build-lib", function() { +gulp.task("build-lib", function () { return gulp.src([ - "src/**/*.ts" - ]) + "src/**/*.ts" + ]) .pipe(tsLibProject()) - .on("error", function(err) { + .on("error", function (err) { process.exit(1); }) .js.pipe(gulp.dest("lib/")); @@ -50,12 +50,12 @@ var tsEsProject = tsc.createProject("tsconfig.json", { module: "es2015" }); -gulp.task("build-es", function() { +gulp.task("build-es", function () { return gulp.src([ - "src/**/*.ts" - ]) + "src/**/*.ts" + ]) .pipe(tsEsProject()) - .on("error", function(err) { + .on("error", function (err) { process.exit(1); }) .js.pipe(gulp.dest("es/")); @@ -66,12 +66,12 @@ var tsDtsProject = tsc.createProject("tsconfig.json", { nolResolve: false }); -gulp.task("build-dts", function() { +gulp.task("build-dts", function () { return gulp.src([ - "src/**/*.ts" - ]) + "src/**/*.ts" + ]) .pipe(tsDtsProject()) - .on("error", function(err) { + .on("error", function (err) { process.exit(1); }) .dts.pipe(gulp.dest("dts")); @@ -83,12 +83,12 @@ gulp.task("build-dts", function() { //****************************************************************************** var tstProject = tsc.createProject("tsconfig.json"); -gulp.task("build-src", function() { +gulp.task("build-src", function () { return gulp.src([ - "src/**/*.ts" - ]) + "src/**/*.ts" + ]) .pipe(tstProject()) - .on("error", function(err) { + .on("error", function (err) { process.exit(1); }) .js.pipe(gulp.dest("src/")); @@ -96,29 +96,29 @@ gulp.task("build-src", function() { var tsTestProject = tsc.createProject("tsconfig.json"); -gulp.task("build-test", function() { +gulp.task("build-test", function () { return gulp.src([ - "test/**/*.ts" - ]) + "test/**/*.ts" + ]) .pipe(tsTestProject()) - .on("error", function(err) { + .on("error", function (err) { process.exit(1); }) .js.pipe(gulp.dest("test/")); }); -gulp.task("mocha", function() { +gulp.task("mocha", function () { return gulp.src([ - "node_modules/reflect-metadata/Reflect.js", - "test/**/*.test.js" - ]) + "node_modules/reflect-metadata/Reflect.js", + "test/**/*.test.js" + ]) .pipe(mocha({ ui: "bdd" })) .pipe(istanbul.writeReports()); }); -gulp.task("istanbul:hook", function() { +gulp.task("istanbul:hook", function () { return gulp.src(["src/**/*.js"]) // Covering files .pipe(istanbul()) @@ -126,22 +126,29 @@ gulp.task("istanbul:hook", function() { .pipe(istanbul.hookRequire()); }); -gulp.task("test", function(cb) { - runSequence("istanbul:hook", "mocha", cb); -}); - -gulp.task("build", function(cb) { - runSequence( - "lint", ["build-src", "build-test", "build-es", "build-lib", "build-dts"], - cb); -}); +gulp.task("test", gulp.series( + "istanbul:hook", + "mocha", +)); + +gulp.task("build", + gulp.series( + "lint", + gulp.parallel( + "build-src" + , "build-test" + , "build-es" + , "build-lib" + , "build-dts" + ), + + ) +); //****************************************************************************** //* DEFAULT //****************************************************************************** -gulp.task("default", function(cb) { - runSequence( - "build", - "test", - cb); -}); +gulp.task("default", gulp.series( + "build", + "test", +)); diff --git a/package.json b/package.json index bc873c0..7569e3e 100644 --- a/package.json +++ b/package.json @@ -9,29 +9,32 @@ "test": "test" }, "dependencies": { - "inversify": "4.14.0" + "inversify": "5.0.1" }, "devDependencies": { - "chai": "4.1.2", - "@types/chai": "4.1.4", - "@types/mocha": "5.2.6", - "gulp": "3.9.1", + "@types/chai": "4.2.0", + "@types/mocha": "5.2.7", + "chai": "4.2.0", + "gulp": "4.0.2", "gulp-istanbul": "1.1.3", - "gulp-mocha": "6.0.0", - "gulp-tslint": "8.1.2", + "gulp-mocha": "7.0.1", + "gulp-tslint": "8.1.4", "gulp-typescript": "5.0.1", "inversify-inject-decorators": "3.1.0", - "mocha": "6.1.3", - "publish-please": "5.4.3", + "mocha": "6.2.0", + "publish-please": "5.5.1", "reflect-metadata": "0.1.13", "run-sequence": "2.2.1", - "tslint": "5.9.0", - "typescript": "2.6.2" + "tslint": "5.19.0", + "typescript": "3.5.3", + "updates": "^8.5.3" }, "scripts": { "test": "gulp", "publish-please": "publish-please", - "prepublish": "publish-please guard" + "prepublish": "publish-please guard", + "update": "updates --update --minor && npm install", + "postupdate": "git diff-files --quiet package-lock.json || npm test" }, "repository": { "type": "git", @@ -48,4 +51,4 @@ "url": "https://github.com/inversify/inversify-vanillajs-helpers/issues" }, "homepage": "https://github.com/inversify/inversify-vanillajs-helpers#readme" -} \ No newline at end of file +} diff --git a/test/annotate.test.ts b/test/annotate.test.ts index 0328d2b..4131452 100644 --- a/test/annotate.test.ts +++ b/test/annotate.test.ts @@ -248,7 +248,7 @@ describe("Annotate Helper", () => { [ { tagged: { key: "throwable", value: false }, type: "Weapon" }, { tagged: { key: "throwable", value: true }, type: "Weapon" } - ] + ] as any ); container.bind("Weapon").to(Katana).whenTargetTagged("throwable", false); container.bind("Weapon").to(Shuriken).whenTargetTagged("throwable", true); diff --git a/test/constraints.test.ts b/test/constraints.test.ts index d39cf2a..1d9999b 100644 --- a/test/constraints.test.ts +++ b/test/constraints.test.ts @@ -125,7 +125,7 @@ describe("Register helper constraints", () => { [ { tagged: { key: "throwable", value: false }, type: TYPE.Weapon }, { tagged: { key: "throwable", value: true }, type: TYPE.Weapon } - ] + ] as any )(Ninja); let ninja = container.get(TYPE.Warrior); @@ -318,7 +318,8 @@ describe("Register helper constraints", () => { register("Warrior", [ { tagged: { key: "throwable", value: false }, type: "Weapon" }, { tagged: { key: "throwable", value: true }, type: "Weapon" } - ])(Ninja); + ] as any + )(Ninja); let ninja = container.get("Warrior"); expect(ninja.katana.name).to.eql("Katana"); @@ -490,7 +491,7 @@ describe("Register helper constraints", () => { [ { tagged: { key: "throwable", value: false }, type: "Weapon" }, { tagged: { key: "throwable", value: true }, type: "Weapon" } - ] + ] as any )(Ninja); @@ -572,7 +573,7 @@ describe("Register helper constraints", () => { [ { tagged: { key: "throwable", value: false }, type: "Factory" }, { tagged: { key: "throwable", value: true }, type: "Factory" } - ] + ] as any )(Ninja); let ninja1 = container.get("Ninja"); @@ -655,7 +656,7 @@ describe("Register helper constraints", () => { [ { tagged: { key: "throwable", value: false }, type: "Factory" }, { tagged: { key: "throwable", value: true }, type: "Factory" } - ] + ] as any )(Ninja); let ninja1 = container.get("Ninja"); @@ -760,7 +761,7 @@ describe("Register helper constraints", () => { [ { tagged: { key: "throwable", value: false }, type: "Provider" }, { tagged: { key: "not-throwable", value: true }, type: "Provider" } - ] + ] as any )(Ninja); let ninja1 = container.get("Ninja"); diff --git a/test/decorators.test.ts b/test/decorators.test.ts index f6d3976..a2d9561 100644 --- a/test/decorators.test.ts +++ b/test/decorators.test.ts @@ -50,7 +50,7 @@ describe("Register helper as a decorator", () => { [ { tagged: { key: "throwable", value: false }, type: TYPE.Weapon }, { tagged: { key: "throwable", value: true }, type: TYPE.Weapon } - ] + ] as any ) class Ninja { public primaryWeapon: Weapon;