diff --git a/package.json b/package.json index a356222df4..6e3b401eb2 100644 --- a/package.json +++ b/package.json @@ -88,6 +88,7 @@ "gulp-strip-debug": "1.1.0", "gulp-tslint": "6.1.1", "gulp-typescript": "2.13.6", + "gulp-uglify": "2.0.0", "gulp-util": "3.0.7", "gulp-watch": "4.3.9", "html-entities": "1.2.0", @@ -122,7 +123,6 @@ "tslint": "3.15.1", "tslint-ionic-rules": "0.0.7", "typescript": "2.0.9", - "uglify-js": "2.7.5", "vinyl": "1.2.0", "webpack": "2.1.0-beta.26", "yargs": "5.0.0" diff --git a/scripts/gulp/constants.ts b/scripts/gulp/constants.ts index 861a1309c0..362feb7fad 100644 --- a/scripts/gulp/constants.ts +++ b/scripts/gulp/constants.ts @@ -36,6 +36,7 @@ export const SCRIPTS_ROOT = join(PROJECT_ROOT, SCRIPTS_NAME); export const SRC_ROOT = join(PROJECT_ROOT, SRC_NAME); export const SRC_COMPONENTS_ROOT = join(SRC_ROOT, COMPONENTS_NAME); +export const WORKERS_SRC = join(SCRIPTS_ROOT, 'workers'); // NPM diff --git a/scripts/gulp/gulpfile.ts b/scripts/gulp/gulpfile.ts index 5d6fe71295..22a2433514 100644 --- a/scripts/gulp/gulpfile.ts +++ b/scripts/gulp/gulpfile.ts @@ -12,4 +12,4 @@ import './tasks/snapshot'; import './tasks/test'; import './tasks/polyfill'; import './tasks/polyfill.source'; -//import './tasks/theme'; +import './tasks/workers'; diff --git a/scripts/gulp/tasks/e2e.dev.ts b/scripts/gulp/tasks/e2e.dev.ts index 9625048ed3..06087a5f4f 100644 --- a/scripts/gulp/tasks/e2e.dev.ts +++ b/scripts/gulp/tasks/e2e.dev.ts @@ -31,6 +31,7 @@ function e2eBuild(done: (err: any) => void) { runSequence( 'e2e.clean', 'e2e.build', + 'e2e.workers', 'e2e.polyfill', 'e2e.copyExternalDependencies', 'e2e.sass', diff --git a/scripts/gulp/tasks/release.ts b/scripts/gulp/tasks/release.ts index 60f3e984e4..514ad15ee5 100644 --- a/scripts/gulp/tasks/release.ts +++ b/scripts/gulp/tasks/release.ts @@ -1,9 +1,7 @@ import { exec, spawnSync, spawn } from 'child_process'; -import { readFileSync, writeFileSync } from 'fs'; - +import { writeFileSync } from 'fs'; import * as changelog from 'conventional-changelog'; import * as GithubApi from 'github'; -import * as glob from 'glob'; import { dest, src, task } from 'gulp'; import { rollup } from 'rollup'; import * as commonjs from 'rollup-plugin-commonjs'; @@ -108,6 +106,7 @@ task('release.copyProdVersion', () => { task('release.prepareReleasePackage', (done: (err: any) => void) => { runSequence('clean', 'release.polyfill', + 'release.workers', 'compile.release', 'release.copyTemplates', 'release.copyNpmInfo', diff --git a/scripts/gulp/tasks/workers.ts b/scripts/gulp/tasks/workers.ts new file mode 100644 index 0000000000..995afe8770 --- /dev/null +++ b/scripts/gulp/tasks/workers.ts @@ -0,0 +1,21 @@ +import { task, src, dest } from 'gulp'; +import { join } from 'path'; +import { DIST_E2E_ROOT, DIST_BUILD_ROOT, WORKERS_SRC } from '../constants'; + +const WORKER_FILES = join(WORKERS_SRC, '**', '*.js'); + + +task('release.workers', (done: Function) => { + const uglify = require('gulp-uglify'); + const workersDesc = join(DIST_BUILD_ROOT, 'workers'); + return src(WORKER_FILES) + .pipe(uglify()) + .pipe(dest(workersDesc), done); +}); + + +task('e2e.workers', (done: Function) => { + const workersDesc = join(DIST_E2E_ROOT, 'workers'); + return src(WORKER_FILES) + .pipe(dest(workersDesc), done); +});