diff --git a/CHANGELOG.MD b/CHANGELOG.MD index a3dbfa6..2b81045 100644 --- a/CHANGELOG.MD +++ b/CHANGELOG.MD @@ -1,3 +1,6 @@ +* 0.2.0 + * BREAKING CHANGE: scripts-javascript-dist now uses core/boot.js as entry point (vs core/core.bootstrap.js in earlier versions) (fixes # + * this new default behavior can be customized by specifying the `distEntryPoint` option (see README or UPGRADE guide) * 0.1.1 * added unit testing support with karma & jasmine * removed gulp-tsd dependency diff --git a/README.md b/README.md index 0f35651..2968123 100644 --- a/README.md +++ b/README.md @@ -495,7 +495,7 @@ module.exports = function (config) { // doc: https://www.npmjs.com/package/karma-jspm // reference config: https://github.com/gunnarlium/babel-jspm-karma-jasmine-istanbul jspm: { - // Path to your SystemJS/JSPM configuration file + // Path to your SystemJS/JSPM configuration file config: "jspm.conf.js", // Where to find jspm packages @@ -513,7 +513,7 @@ module.exports = function (config) { ".tmp/**/!(*.spec).js" // make sure that all files are available ], - // SystemJS configuration specifically for tests, added after your config file. + // SystemJS configuration specifically for tests, added after your config file. // Good for adding test libraries and mock modules paths: {} } @@ -523,8 +523,8 @@ module.exports = function (config) { Dev dependencies to add for the above Karma configuration: ``` - "jasmine": "2.4.x", - "karma-jasmine": "0.3.x", + "jasmine": "2.4.x", + "karma-jasmine": "0.3.x", ``` ### Minimal (application-specific) required file contents @@ -646,6 +646,25 @@ The command will give you a description of each task. The most important to star You can run the `gulp -T` command get an visual idea of the links between the different tasks. +## Options +The build can be customized by passing options. +Defining options is done as in the following example gulpfile.babel.js: + +``` +"use strict"; + +import gulp from "gulp"; + +import modernWebDevBuild from "modern-web-dev-build"; + +let options = {}; + +options.distEntryPoint = "core/core.bootstrap"; +``` + +Available options: +* distEntryPoint: must be a relative path from .tmp/ to the file to use as entry point for creating the production JS bundle. The extension does not need to be specified (JSPM is used to load the file) + ## Build dependencies * gulp: build system (https://www.npmjs.com/package/gulp) * babel: ES2015 to ES5 transpiler; used for the gulp build diff --git a/UPGRADE.MD b/UPGRADE.MD index ecccf17..5420447 100644 --- a/UPGRADE.MD +++ b/UPGRADE.MD @@ -1,5 +1,26 @@ # Upgrade guide +## From 0.1.1 to 0.2.0 +#61 breaks compatibility with existing projects. + +In order to fix this, you need to rename app/core/core.bootstrap.ts to core/boot.ts (and rename the template accordingly) and ensure that you adapt app/index.html as well. + +If you're not willing to rename as proposed above, then you can define the `distEntryPoint` option. + +Here's an example gulpfile.babel.js: + +``` +"use strict"; + +import gulp from "gulp"; + +import modernWebDevBuild from "modern-web-dev-build"; + +let options = {}; + +options.distEntryPoint = "core/core.bootstrap"; +``` + ## From 0.1.0 to 0.1.1 To upgrade you can simply increment the dependency version in your project. To benefit from the unit testing support, you should add a karma.conf.js file to your project. Check the readme for details about its contents (though you can configure Karma as you wish/need). diff --git a/package.json b/package.json index b997a38..a4eefa7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "modern-web-dev-build", "description": "Modern Web Development Build.", - "version": "0.1.1", + "version": "0.2.0", "author": { "name": "Sebastien Dubois", "email": "seb@dsebastien.net", diff --git a/src/gulp/config.js b/src/gulp/config.js index 93c721d..5d8093f 100644 --- a/src/gulp/config.js +++ b/src/gulp/config.js @@ -77,7 +77,7 @@ let javascript = { src: [ folders.app + globs.scripts.javascript ], - srcDist: folders.temp + "/core/core.bootstrap.js", + srcDist: folders.temp + "/core/boot.js", dest: folders.temp, destDist: folders.dist + folders.scripts + "/" + finalJsBundleName, finalJsBundlePath: folders.scripts + "/" + finalJsBundleName diff --git a/src/gulp/tasks/scripts-javascript-dist.js b/src/gulp/tasks/scripts-javascript-dist.js index 9024fac..eb70148 100644 --- a/src/gulp/tasks/scripts-javascript-dist.js +++ b/src/gulp/tasks/scripts-javascript-dist.js @@ -6,15 +6,26 @@ import config from "../config"; //import size from "gulp-size"; +import path from "path"; +import gutil from "gulp-util"; + class ScriptsJavaScriptDistTaskLoader extends AbstractTaskLoader { registerTask(gulp){ super.registerTask(gulp); - + gulp.task("scripts-javascript-dist", "Package all JavaScript code for production", () =>{ // Assuming that all TS and ES2015 code has already been converted to ES5 using the System module type // Assuming that there is a single entrypoint for the application // We only need to create the final bundle + // Determine the entry point for the bundle creation (i.e., where to start from) + let distEntryPoint = config.javascript.srcDist; + + if(gulp.options.distEntryPoint){ + distEntryPoint = path.join(config.folders.temp, gulp.options.distEntryPoint); + gutil.log("Production bundle entry point customized: ", distEntryPoint); + } + // Create the bundle // Reference: https://github.com/systemjs/builder/issues/203 let jspm = require("jspm"); @@ -22,7 +33,7 @@ class ScriptsJavaScriptDistTaskLoader extends AbstractTaskLoader { jspm.setPackagePath("."); return jspm.bundleSFX( - config.javascript.srcDist, + distEntryPoint, // where to start creating the bundle from config.javascript.destDist, { sourceMaps: false, // no need for sourcemaps in prod lowResSourceMaps: false, // can speed up generation