Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add build-es and build-lib gulp tasks #140

Merged
merged 2 commits into from
Mar 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ bundled
typings
.typingsrc
dist
lib
es

type_definitions/inversify/*.js

Expand Down
61 changes: 41 additions & 20 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,20 @@ gulp.task("lint", function() {
//******************************************************************************
//* SOURCE
//******************************************************************************
gulp.task("build-bundle-src", function() {

var mainTsFilePath = "src/inversify.ts";
var outputFolder = "dist/";
var outputFileName = "inversify.js";
var pkg = require("./package.json");

var banner = ["/**",
var banner = ["/**",
" * <%= pkg.name %> v.<%= pkg.version %> - <%= pkg.description %>",
" * Copyright (c) 2015 <%= pkg.author %>",
" * <%= pkg.license %> inversify.io/LICENSE",
" * <%= pkg.homepage %>",
" */",
""].join("\n");
var pkg = require("./package.json");

gulp.task("build-bundle-src", function() {

var mainTsFilePath = "src/inversify.ts";
var outputFolder = "dist/";
var outputFileName = "inversify.js";

var bundler = browserify({
debug: true,
Expand All @@ -80,15 +80,6 @@ gulp.task("build-bundle-compress-src", function() {
var mainTsFilePath = "src/inversify.ts";
var outputFolder = "dist/";
var outputFileName = "inversify.min.js";
var pkg = require("./package.json");

var banner = ["/**",
" * <%= pkg.name %> v.<%= pkg.version %> - <%= pkg.description %>",
" * Copyright (c) 2015 <%= pkg.author %>",
" * <%= pkg.license %> inversify.io/LICENSE",
" * <%= pkg.homepage %>",
" */",
""].join("\n");

var bundler = browserify({
debug: true,
Expand All @@ -108,6 +99,36 @@ gulp.task("build-bundle-compress-src", function() {
.pipe(gulp.dest(outputFolder));
});

var tsLibProject = tsc.createProject("tsconfig.json", { module : "commonjs" });

gulp.task("build-lib", function() {
return gulp.src([
"src/**/*.ts"
])
.pipe(tsc(tsLibProject ))
.on("error", function (err) {
process.exit(1);
})
.js
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest("lib/"));
});

var tsEsProject = tsc.createProject("tsconfig.json", { module : "es2015" });

gulp.task("build-es", function() {
return gulp.src([
"src/**/*.ts"
])
.pipe(tsc(tsEsProject))
.on("error", function (err) {
process.exit(1);
})
.js
.pipe(header(banner, { pkg : pkg } ))
.pipe(gulp.dest("es/"));
});

//******************************************************************************
//* TESTS
//******************************************************************************
Expand Down Expand Up @@ -181,9 +202,9 @@ gulp.task("build-type-definitions", function() {
gulp.task("build", function(cb) {
runSequence(
"lint",
"build-bundle-src", // for nodejs
"build-bundle-compress-src", // for browsers
"build-src", // tests
"build-bundle-src", // for nodejs
"build-bundle-compress-src", // for browsers
["build-src", "build-es", "build-lib"], // tests + build es and lib
"build-test",
"build-type-definitions", cb);
});
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "inversify",
"version": "2.0.0-alpha.6",
"description": "A lightweight IoC container written in TypeScript.",
"main": "dist/inversify.js",
"main": "lib/inversify.js",
"jsnext:main": "es/inversify.js",
"directories": {
"test": "test"
},
Expand Down