Mercurial > hg > ugly-duckling
changeset 150:384b17a32c7a
Merge remote-tracking branch 'origin/master'
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Tue, 21 Mar 2017 09:18:17 +0000 |
parents | 38abcb4830f1 (current diff) d344fc3ef219 (diff) |
children | 9cf2bd2db4cd |
files | package.json |
diffstat | 3 files changed, 112 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/angular-cli.json Mon Mar 20 15:25:54 2017 +0000 +++ b/angular-cli.json Tue Mar 21 09:18:17 2017 +0000 @@ -1,4 +1,5 @@ { + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "project": { "version": "1.0.0-beta.18", "name": "ugly-duckling" @@ -46,18 +47,6 @@ }, "defaults": { "styleExt": "css", - "prefixInterfaces": false, - "inline": { - "style": false, - "template": false - }, - "spec": { - "class": false, - "component": true, - "directive": true, - "module": false, - "pipe": true, - "service": true - } + "component": {} } }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/build-prod.js Tue Mar 21 09:18:17 2017 +0000 @@ -0,0 +1,85 @@ +/** + * Created by lucas on 20/03/2017. + */ +'use strict'; +const webpack = require('webpack'); +const cli = require('@angular/cli'); +const fs = require('fs'); +webpack.optimize = Object.assign({}, webpack.optimize, { + UglifyJsPlugin: function () { this.apply = () => {}; } +}); + +const bundlePrefixes = [ + 'main', + 'polyfills', + 'scripts', + 'styles', + 'vendor', + 'inline' +]; + +const distDir = './dist'; +const tmpDir = `${distDir}/gh-pages`; + +const getGeneratedBundleNames = () => { + return new Promise((res, rej) => { + fs.readdir(distDir, (err, files) => { + if (err) { + rej(1); + } else { + res(files.filter(file => bundlePrefixes.find( + prefix => file.startsWith(prefix) + ))); + } + }) + }); +}; + +const throwIfBuildReportedError = (result) => { + return new Promise((res, rej) => { + if (typeof result === 'object' && result.exitCode != null) { + if (result.exitCode === 0) { + res(); + } else { + rej(result.exitCode); + } + } else if(typeof result === 'number') { + if (result === 0) { + res(); + } else { + rej(result); + } + } else { + res(); + } + }); +}; + +const copyToTmpDir = (bundles) => { + // TODO should really handle errors for all of this + // and it could be async but i'm too lazy & it doesn't really matter for this + if (!fs.existsSync(tmpDir)){ + fs.mkdirSync(tmpDir); + } + for (let bundle of bundles) { + const parts = bundle.split('.'); + const bundlePrefix = parts[0]; + const bundleExtension = parts[parts.length - 1]; + const contents = fs.readFileSync(`${distDir}/${bundle}`); + fs.writeFileSync( + `${tmpDir}/${bundlePrefix}.bundle.${bundleExtension}`, + contents + ); + } +}; + +cli({ + cliArgs: ['build', '--prod', '--aot', 'false', '-bh', '/ugly-duckling/'], + inputStream: process.stdin, + outputStream: process.stdout +}) +.then(throwIfBuildReportedError) +.then(getGeneratedBundleNames) +.then(copyToTmpDir) +.then(process.exit) +.catch(process.exit);
--- a/package.json Mon Mar 20 15:25:54 2017 +0000 +++ b/package.json Tue Mar 21 09:18:17 2017 +0000 @@ -12,46 +12,46 @@ }, "private": true, "dependencies": { - "@angular/common": "^2.2.1", - "@angular/compiler": "^2.2.1", - "@angular/core": "^2.2.1", - "@angular/forms": "^2.2.1", - "@angular/http": "^2.2.1", + "@angular/common": "^2.4.0", + "@angular/compiler": "^2.4.0", + "@angular/core": "^2.4.0", + "@angular/forms": "^2.4.0", + "@angular/http": "^2.4.0", "@angular/material": "^2.0.0-beta.2", - "@angular/platform-browser": "^2.2.1", - "@angular/platform-browser-dynamic": "^2.2.1", - "@angular/router": "3.2.1", + "@angular/platform-browser": "^2.4.0", + "@angular/platform-browser-dynamic": "^2.4.0", + "@angular/router": "^3.4.0", "core-js": "^2.4.1", "hammerjs": "^2.0.8", "piper": "piper-audio/piper-js", "requirejs": "^2.3.2", - "rxjs": "5.0.0-beta.12", - "ts-helpers": "^1.1.1", + "rxjs": "^5.1.0", "waves-ui": "github:cannam/waves-ui", - "zone.js": "^0.6.23" + "zone.js": "^0.7.6" }, "devDependencies": { - "@angular/cli": "^1.0.0-beta.32.3", - "@angular/compiler-cli": "^2.2.1", + "@angular/cli": "^1.0.0-rc.2", + "@angular/compiler-cli": "^2.4.0", "@types/hammerjs": "^2.0.33", "@types/jasmine": "2.5.38", - "@types/node": "^6.0.42", + "@types/node": "~6.0.60", "babel": "^5.8.29", "babel-runtime": "^5.3.0", "browserify": "^14.1.0", - "codelyzer": "~1.0.0-beta.3", - "jasmine-core": "2.5.2", - "jasmine-spec-reporter": "2.5.0", + "codelyzer": "~2.0.0", + "jasmine-core": "~2.5.2", + "jasmine-spec-reporter": "~3.2.0", "jshint": "^2.9.4", - "karma": "1.2.0", - "karma-chrome-launcher": "^2.0.0", - "karma-cli": "^1.0.1", - "karma-jasmine": "^1.0.2", - "karma-remap-istanbul": "^0.2.1", + "karma": "~1.4.1", + "karma-chrome-launcher": "~2.0.0", + "karma-cli": "~1.0.1", + "karma-coverage-istanbul-reporter": "^0.2.0", + "karma-jasmine": "~1.1.0", + "karma-jasmine-html-reporter": "^0.2.2", "node-watch": "^0.4.1", - "protractor": "4.0.9", - "ts-node": "1.2.1", - "tslint": "3.13.0", + "protractor": "~5.1.0", + "ts-node": "~2.0.0", + "tslint": "~4.5.0", "typescript": "~2.0.3", "webdriver-manager": "10.2.5" }