Skip to content

Commit

Permalink
build(build): update build and deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
trxcllnt committed Oct 2, 2017
1 parent 21bdb98 commit beb40d9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 32 deletions.
3 changes: 2 additions & 1 deletion develop.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@

These npm scripts accept argument lists of targets × modules:

* Available `targets` are `es5`, `es2015`, `esnext`, and `all` (default: `all`)
* Available `targets` are `ix`, `ts`, `es5`, `es2015`, `esnext`, and `all` (default: `all`)
* Available `modules` are `cjs`, `esm`, `umd`, and `all` (default: `all`)

Examples:

* `npm run build` -- builds all ES targets in all module formats
* `npm run build -- -t ix` -- builds the main Ix target module bundle
* `npm run build -- -t es5 -m all` -- builds the ES5 target in all module formats
* `npm run build -- -t all -m cjs` -- builds all ES targets in the CommonJS module format
* `npm run build -- --targets es5 es2015 -m all` -- builds the ES5 and ES2015 targets in all module formats
Expand Down
24 changes: 10 additions & 14 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const metadataFiles = [`LICENSE`, `readme.md`, `CHANGELOG.md`];
const packageJSONFields = [
`version`, `license`, `description`,
`author`, `homepage`, `repository`,
`bugs`, `keywords`, `peerDependencies`
`bugs`, `keywords`, `dependencies`
];

const argv = require(`command-line-args`)([
Expand Down Expand Up @@ -390,11 +390,9 @@ argv.module && !modules.length && modules.push(argv.module);
for (const [target, format] of combinations([`all`], [`all`])) {
const task = _task(target, format);
gulp.task(`clean:${task}`, cleanTask(target, format));
gulp.task(`bundle:${task}`, bundleTask(target, format));
gulp.task(`test:${task}`, testsTask(target, format, false));
gulp.task(`debug:${task}`, testsTask(target, format, true));
gulp.task(`build:${task}`, gulp.series(`clean:${task}`, buildTask(target, format)));
gulp.task(`package:${task}`, gulp.series(`build:${task}`, `bundle:${task}`));
gulp.task(`build:${task}`, gulp.series(`clean:${task}`, buildTask(target, format), bundleTask(target, format)));
}

// The UMD bundles build temporary es5/6/next targets via TS,
Expand Down Expand Up @@ -423,7 +421,8 @@ gulp.task(`build:ix`,
`build:${_task(`es2015`, `esm`)}`,
`build:${_task(`es2015`, `umd`)}`,
),
buildTask(`ix`)
buildTask(`ix`),
bundleTask(`ix`)
)
);

Expand All @@ -434,12 +433,10 @@ function gulpParallelWithConcurrency(tasks) {
}

gulp.task(`test`, (done) => gulpParallelWithConcurrency(runTasks(`test`))(done));
gulp.task(`clean`, (done) => gulpParallelWithConcurrency(runTasks(`clean`))(done));
gulp.task(`build`, (done) => gulpParallelWithConcurrency(runTasks(`build`))(done));
gulp.task(`bundle`, (done) => gulpParallelWithConcurrency(runTasks(`bundle`))(done));
gulp.task(`package`, (done) => gulpParallelWithConcurrency(runTasks(`package`))(done));
gulp.task(`test:debug`, (done) => gulpParallelWithConcurrency(runTasks(`test:debug`))(done));
gulp.task(`default`, gulp.task(`package`));
gulp.task(`clean`, (done) => gulpParallelWithConcurrency(runTasks(`clean`))(done));
gulp.task(`debug`, (done) => gulpParallelWithConcurrency(runTasks(`debug`))(done));
gulp.task(`default`, gulp.series(`build`, `test`));

function runTasks(name) {
const tasks = [];
Expand All @@ -454,14 +451,13 @@ function runTasks(name) {
return tasks.length && tasks || [(done) => done()];
}

function _taskHash(...args) { return args.join(`:`); }
function _taskHash(...args) {
return args.filter((x) => x !== void 0 && x !== ``).join(`:`);
}
function _name(target, format) { return !format ? target : `${target}-${format}`; }
function _task(target, format) { return !format ? target : `${target}:${format}`; }
function _tsconfig(target, format) { return !format ? target : `${target}.${format}`; }
function _dir(target, format) { return path.join(releasesRootDir, ...(!format ? [target] : [target, format])); }
function _snake_case(target, format) {
return !format ? `_${target}` : `_${target}_${format}`;
}

function* combinations(_targets, _modules) {

Expand Down
18 changes: 7 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@
"test": "gulp test",
"build": "gulp build",
"clean": "gulp clean",
"bundle": "gulp bundle",
"package": "gulp package",
"test:debug": "gulp test:debug",
"validate": "npm-run-all lint build test bundle",
"publish:targets": "./publish-targets.sh",
"lerna:publish": "lerna exec --bail=false npm publish",
"prepublishOnly": "echo \"Error: do 'npm run publish:targets' instead of 'npm publish'\" && exit 1",
"commitmsg": "validate-commit-msg",
"debug": "gulp debug",
"lint": "run-p lint:*",
"doc": "shx rm -rf ./doc && esdoc",
"lint": "npm-run-all -p lint:*",
"commitmsg": "validate-commit-msg",
"lint:src": "tslint --fix --type-check -p tsconfig.json -c tslint.json \"src/**/*.ts\"",
"lint:spec": "tslint --fix --type-check -p spec/tsconfig.json -c tslint.json \"spec/**/*.ts\""
"lint:spec": "tslint --fix --type-check -p spec/tsconfig.json -c tslint.json \"spec/**/*.ts\"",
"lerna:publish": "run-s --silent lint build test doc && lerna publish --conventional-commits",
"prepublishOnly": "echo \"Error: do 'npm run lerna:publish' instead of 'npm publish'\" && exit 1"
},
"author": "Matthew Podwysocki <[email protected]>",
"homepage": "https://github.com/ReactiveX/IxJS#readme",
Expand All @@ -45,7 +41,7 @@
"readme.md",
"CHANGELOG.md"
],
"peerDependencies": {
"dependencies": {
"tslib": "^1.7.1"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions tsconfig/tsconfig.es2015.cls.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Compiler configuaration to build the intermediate closure-compiler ESM UMD target.
// Not used at the moment, but ready whenever CC has full ES2015+ support.
// Compiler configuaration to build the intermediate ESM UMD target.
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
Expand Down
3 changes: 1 addition & 2 deletions tsconfig/tsconfig.es5.cls.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Compiler configuaration to build the intermediate closure-compiler ESM UMD target.
// Not used at the moment, but ready whenever CC has full ES2015+ support.
// Compiler configuaration to build the intermediate ESM UMD target.
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
Expand Down
3 changes: 1 addition & 2 deletions tsconfig/tsconfig.esnext.cls.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Compiler configuaration to build the intermediate closure-compiler ESM UMD target.
// Not used at the moment, but ready whenever CC has full ES2015+ support.
// Compiler configuaration to build the intermediate ESM UMD target.
{
"extends": "./tsconfig.base.json",
"compilerOptions": {
Expand Down

0 comments on commit beb40d9

Please sign in to comment.