-
-
Save sasxa/85486bb62dc5dca3e48f6f385ef93135 to your computer and use it in GitHub Desktop.
Rebuilding ngCLI build process with Gulp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** THIS FILE SHOULD BE IN gulpfile.ts FOLDER */ | |
| var fs = require('fs'); | |
| var path = require('path'); | |
| var url = require('url'); | |
| /* | |
| |-------------------------------------------------------------------------- | |
| | Browser-sync config file | |
| |-------------------------------------------------------------------------- | |
| | | |
| | For up-to-date information about the options: | |
| | http://www.browsersync.io/docs/options/ | |
| | | |
| | There are more options than you see here, these are just the ones that are | |
| | set internally. See the website for more info. | |
| | | |
| | | |
| */ | |
| const build_folder = path.resolve(__dirname, '..', 'build'); | |
| const root_folder = path.resolve(__dirname, '..'); | |
| module.exports = { | |
| "ui": { | |
| "port": 3001, | |
| "weinre": { | |
| "port": 8080 | |
| } | |
| }, | |
| "files": path.join(build_folder, '**', '*.*'), | |
| "watchOptions": {}, | |
| "server": [build_folder, root_folder], | |
| "proxy": false, | |
| "port": 3000, | |
| "middleware": [ | |
| require('compression')(), | |
| function (req, res, next) { | |
| let name = url.parse(req.url); | |
| name = name.href.split(name.search).join(''); | |
| const isNode = /node_modules/.test(name); | |
| const file = path.join(isNode ? root_folder : build_folder, name); | |
| try { | |
| fs.accessSync(file, fs.constants.F_OK); | |
| } catch (error) { | |
| req.url = /\.js$/.test(name) ? name : "/index.html"; | |
| // if (!/\.js$/.test(name)) { | |
| // console.log(name, '===', file); | |
| // } | |
| } | |
| return next(); | |
| } | |
| ], | |
| "serveStatic": [], | |
| "ghostMode": { | |
| "clicks": true, | |
| "scroll": true, | |
| "forms": { | |
| "submit": true, | |
| "inputs": true, | |
| "toggles": true | |
| } | |
| }, | |
| "logLevel": "info", | |
| "logPrefix": "brSync", | |
| "logConnections": false, | |
| "logFileChanges": false, | |
| "logSnippet": true, | |
| "rewriteRules": [], | |
| "open": false, | |
| "browser": "default", | |
| "cors": false, | |
| "xip": false, | |
| "hostnameSuffix": false, | |
| "reloadOnRestart": true, | |
| "notify": false, | |
| "scrollProportionally": true, | |
| "scrollThrottle": 0, | |
| "scrollRestoreTechnique": "window.name", | |
| "scrollElements": [], | |
| "scrollElementMapping": [], | |
| "reloadDelay": 0, | |
| "reloadDebounce": 0, | |
| "reloadThrottle": 0, | |
| "plugins": [], | |
| "injectChanges": true, | |
| "startPath": null, | |
| "minify": true, | |
| "host": null, | |
| "localOnly": false, | |
| "codeSync": true, | |
| "timestamps": true, | |
| "clientEvents": [ | |
| "scroll", | |
| "scroll:element", | |
| "input:text", | |
| "input:toggles", | |
| "form:submit", | |
| "form:reset", | |
| "click" | |
| ], | |
| "socket": { | |
| "socketIoOptions": { | |
| "log": false | |
| }, | |
| "socketIoClientConfig": { | |
| "reconnectionAttempts": 50 | |
| }, | |
| "path": "/browser-sync/socket.io", | |
| "clientPath": "/browser-sync", | |
| "namespace": "/browser-sync", | |
| "clients": { | |
| "heartbeatTimeout": 5000 | |
| } | |
| }, | |
| "tagNames": { | |
| "less": "link", | |
| "scss": "link", | |
| "css": "link", | |
| "jpg": "img", | |
| "jpeg": "img", | |
| "png": "img", | |
| "svg": "img", | |
| "gif": "img", | |
| "js": "script" | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| c:\project>ng s | |
| ** NG Live Development Server is running on http://localhost:4200. ** | |
| 17976ms building modules | |
| 128ms sealing | |
| 1ms optimizing | |
| 0ms basic module optimization | |
| 159ms module optimization | |
| 46ms advanced module optimization | |
| 69ms basic chunk optimization | |
| 1ms chunk optimization | |
| 15ms advanced chunk optimization | |
| 0ms module and chunk tree optimization | |
| 229ms module reviving | |
| 19ms module order optimization | |
| 5ms module id optimization | |
| 12ms chunk reviving | |
| 1ms chunk order optimization | |
| 55ms chunk id optimization | |
| 112ms hashing | |
| 0ms module assets processing | |
| 293ms chunk assets processing | |
| 4ms additional chunk assets processing | |
| 0ms recording | |
| 1ms additional asset processing | |
| 4821ms chunk asset optimization | |
| 2190ms asset optimization | |
| 97ms emitting | |
| Hash: ba07edef4615054e6348 | |
| Version: webpack 2.1.0-beta.25 | |
| Time: 26259ms | |
| Asset Size Chunks Chunk Names | |
| 0.map 1.71 MB 0, 6 [emitted] | |
| 0.chunk.js 1.51 MB 0, 6 [emitted] | |
| 2.chunk.js 750 kB 2, 6 [emitted] | |
| main.bundle.js 2.42 MB 3, 6 [emitted] main | |
| scripts.bundle.js 184 kB 4, 6 [emitted] scripts | |
| styles.bundle.js 75 kB 5, 6 [emitted] styles | |
| inline.bundle.js 5.53 kB 6 [emitted] inline | |
| 1.chunk.js 903 kB 1, 6 [emitted] | |
| 1.map 979 kB 1, 6 [emitted] | |
| 2.map 840 kB 2, 6 [emitted] | |
| main.map 2.44 MB 3, 6 [emitted] main | |
| scripts.map 225 kB 4, 6 [emitted] scripts | |
| styles.map 83 kB 5, 6 [emitted] styles | |
| inline.map 5.6 kB 6 [emitted] inline | |
| index.html 553 bytes [emitted] | |
| Child html-webpack-plugin for "index.html": | |
| Asset Size Chunks Chunk Names | |
| index.html 2.82 kB 0 | |
| webpack: bundle is now VALID. | |
| webpack: bundle is now INVALID. | |
| 1226ms building modules | |
| 27ms sealing | |
| 4ms optimizing | |
| 2ms basic module optimization | |
| 239ms module optimization | |
| 102ms advanced module optimization | |
| 134ms basic chunk optimization | |
| 1ms chunk optimization | |
| 1ms advanced chunk optimization | |
| 105ms module and chunk tree optimization | |
| 359ms module reviving | |
| 11ms module order optimization | |
| 12ms module id optimization | |
| 19ms chunk reviving | |
| 4ms chunk order optimization | |
| 64ms chunk id optimization | |
| 140ms hashing | |
| 4ms module assets processing | |
| 107ms chunk assets processing | |
| 9ms additional chunk assets processing | |
| 1ms recording | |
| 4ms additional asset processing | |
| 2678ms chunk asset optimization | |
| 1008ms asset optimization | |
| 37ms emitting | |
| Hash: 3dd56f5329a67aa14369 | |
| Version: webpack 2.1.0-beta.25 | |
| Time: 10887ms | |
| Asset Size Chunks Chunk Names | |
| 0.map 1.71 MB 0, 6 | |
| 0.chunk.js 1.51 MB 0, 6 | |
| 2.chunk.js 750 kB 2, 6 | |
| main.bundle.js 2.42 MB 3, 6 [emitted] main | |
| scripts.bundle.js 184 kB 4, 6 scripts | |
| styles.bundle.js 75 kB 5, 6 styles | |
| inline.bundle.js 5.53 kB 6 inline | |
| 1.chunk.js 903 kB 1, 6 | |
| 1.map 979 kB 1, 6 | |
| 2.map 840 kB 2, 6 | |
| scripts.map 225 kB 4, 6 scripts | |
| styles.map 83 kB 5, 6 styles | |
| inline.map 5.6 kB 6 inline | |
| main.map 2.44 MB 3, 6 [emitted] main | |
| Child html-webpack-plugin for "index.html": | |
| Asset Size Chunks Chunk Names | |
| index.html 2.82 kB 0 | |
| webpack: bundle is now VALID. | |
| webpack: bundle is now INVALID. | |
| 772ms building modules | |
| 18ms sealing | |
| 3ms optimizing | |
| 1ms basic module optimization | |
| 183ms module optimization | |
| 54ms advanced module optimization | |
| 82ms basic chunk optimization | |
| 1ms chunk optimization | |
| 1ms advanced chunk optimization | |
| 91ms module and chunk tree optimization | |
| 226ms module reviving | |
| 5ms module order optimization | |
| 6ms module id optimization | |
| 17ms chunk reviving | |
| 1ms chunk order optimization | |
| 53ms chunk id optimization | |
| 119ms hashing | |
| 3ms module assets processing | |
| 1ms chunk assets processing | |
| 6ms additional chunk assets processing | |
| 3ms recording | |
| 0ms additional asset processing | |
| 2ms chunk asset optimization | |
| 1104ms asset optimization | |
| 9ms emitting | |
| Hash: 3dd56f5329a67aa14369 | |
| Version: webpack 2.1.0-beta.25 | |
| Time: 6893ms | |
| Asset Size Chunks Chunk Names | |
| 0.map 1.71 MB 0, 6 | |
| 0.chunk.js 1.51 MB 0, 6 | |
| 2.chunk.js 750 kB 2, 6 | |
| main.bundle.js 2.42 MB 3, 6 main | |
| scripts.bundle.js 184 kB 4, 6 scripts | |
| styles.bundle.js 75 kB 5, 6 styles | |
| inline.bundle.js 5.53 kB 6 inline | |
| 1.chunk.js 903 kB 1, 6 | |
| 1.map 979 kB 1, 6 | |
| 2.map 840 kB 2, 6 | |
| main.map 2.44 MB 3, 6 main | |
| scripts.map 225 kB 4, 6 scripts | |
| styles.map 83 kB 5, 6 styles | |
| inline.map 5.6 kB 6 inline | |
| Child html-webpack-plugin for "index.html": | |
| Asset Size Chunks Chunk Names | |
| index.html 2.82 kB 0 | |
| webpack: bundle is now VALID. | |
| webpack: bundle is now INVALID. | |
| 618ms building modules | |
| 15ms sealing | |
| 1ms optimizing | |
| 2ms basic module optimization | |
| 146ms module optimization | |
| 86ms advanced module optimization | |
| 109ms basic chunk optimization | |
| 1ms chunk optimization | |
| 1ms advanced chunk optimization | |
| 96ms module and chunk tree optimization | |
| 230ms module reviving | |
| 7ms module order optimization | |
| 5ms module id optimization | |
| 17ms chunk reviving | |
| 2ms chunk order optimization | |
| 47ms chunk id optimization | |
| 117ms hashing | |
| 3ms module assets processing | |
| 1ms chunk assets processing | |
| 5ms additional chunk assets processing | |
| 1ms recording | |
| 3ms additional asset processing | |
| 2ms chunk asset optimization | |
| 1035ms asset optimization | |
| 4ms emitting | |
| Hash: 3dd56f5329a67aa14369 | |
| Version: webpack 2.1.0-beta.25 | |
| Time: 5964ms | |
| Asset Size Chunks Chunk Names | |
| 0.map 1.71 MB 0, 6 | |
| 0.chunk.js 1.51 MB 0, 6 | |
| 2.chunk.js 750 kB 2, 6 | |
| main.bundle.js 2.42 MB 3, 6 main | |
| scripts.bundle.js 184 kB 4, 6 scripts | |
| styles.bundle.js 75 kB 5, 6 styles | |
| inline.bundle.js 5.53 kB 6 inline | |
| 1.chunk.js 903 kB 1, 6 | |
| 1.map 979 kB 1, 6 | |
| 2.map 840 kB 2, 6 | |
| main.map 2.44 MB 3, 6 main | |
| scripts.map 225 kB 4, 6 scripts | |
| styles.map 83 kB 5, 6 styles | |
| inline.map 5.6 kB 6 inline | |
| Child html-webpack-plugin for "index.html": | |
| Asset Size Chunks Chunk Names | |
| index.html 2.82 kB 0 | |
| webpack: bundle is now VALID. | |
| webpack: bundle is now INVALID. | |
| 1452ms building modules | |
| 107ms sealing | |
| 144ms optimizing | |
| 1ms basic module optimization | |
| 114ms module optimization | |
| 39ms advanced module optimization | |
| 47ms basic chunk optimization | |
| 1ms chunk optimization | |
| 2ms advanced chunk optimization | |
| 42ms module and chunk tree optimization | |
| 255ms module reviving | |
| 6ms module order optimization | |
| 5ms module id optimization | |
| 18ms chunk reviving | |
| 2ms chunk order optimization | |
| 48ms chunk id optimization | |
| 121ms hashing | |
| 4ms module assets processing | |
| 35ms chunk assets processing | |
| 8ms additional chunk assets processing | |
| 2ms recording | |
| 1ms additional asset processing | |
| 872ms chunk asset optimization | |
| 1070ms asset optimization | |
| 18ms emitting | |
| Hash: 7ffe2aeb3aeea6e73bef | |
| Version: webpack 2.1.0-beta.25 | |
| Time: 9595ms | |
| Asset Size Chunks Chunk Names | |
| 0.map 1.71 MB 0, 6 | |
| 0.chunk.js 1.51 MB 0, 6 | |
| 2.chunk.js 750 kB 2, 6 | |
| main.bundle.js 2.42 MB 3, 6 main | |
| scripts.bundle.js 184 kB 4, 6 scripts | |
| styles.bundle.js 75 kB 5, 6 styles | |
| inline.bundle.js 5.53 kB 6 inline | |
| 1.chunk.js 903 kB 1, 6 [emitted] | |
| 2.map 840 kB 2, 6 | |
| main.map 2.44 MB 3, 6 main | |
| scripts.map 225 kB 4, 6 scripts | |
| styles.map 83 kB 5, 6 styles | |
| inline.map 5.6 kB 6 inline | |
| 1.map 978 kB 1, 6 [emitted] | |
| Child html-webpack-plugin for "index.html": | |
| Asset Size Chunks Chunk Names | |
| index.html 2.82 kB 0 | |
| webpack: bundle is now VALID. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| c:\project>gulp | |
| [00:47:08] Requiring external module ts-node/register | |
| [00:47:11] Using gulpfile c:\project\gulpfile.ts | |
| [00:47:11] Starting 'default'... | |
| [00:47:11] Starting 'log'... | |
| [00:47:11] __dirname: c:\project\gulpfile.ts | |
| [00:47:11] tsconfig: { | |
| "baseUrl": "c:/project/src", | |
| "emitDecoratorMetadata": true, | |
| "experimentalDecorators": true, | |
| "isolatedModules": true, | |
| "lib": [ | |
| "lib.es2015.d.ts", | |
| "lib.dom.d.ts", | |
| "lib.es2017.d.ts" | |
| ], | |
| "module": 4, | |
| "moduleResolution": 2, | |
| "target": 1, | |
| "sourceMap": false, | |
| "suppressOutputPathCheck": true, | |
| "newLine": 1, | |
| "declaration": false, | |
| "inlineSourceMap": true | |
| } | |
| [00:47:11] Finished 'log' after 7.09 ms | |
| [00:47:11] Starting 'clean'... | |
| [00:47:11] Finished 'clean' after 54 ms | |
| [00:47:11] Starting 'assets'... | |
| [00:47:11] Starting 'publik'... | |
| [00:47:11] Starting 'styl'... | |
| [00:47:11] Starting 'js'... | |
| [00:47:11] Starting 'ts'... | |
| [00:47:12] assets 0 items | |
| [00:47:12] Finished 'assets' after 431 ms | |
| [00:47:12] public public\favicon.ico | |
| [00:47:13] public public\index.html | |
| [00:47:13] public 2 items | |
| [00:47:13] JavaScript systemjs.config.js | |
| [00:47:13] JavaScript 1 item | |
| [00:47:13] Finished 'publik' after 1.54 s | |
| [00:47:13] Finished 'js' after 1.65 s | |
| [00:47:14] Finished 'styl' after 2.44 s | |
| [00:47:15] all files 465.2 kB | |
| [00:47:15] Finished 'ts' after 3.97 s | |
| [00:47:15] Starting 'serve'... | |
| [00:47:15] Starting 'watch'... | |
| [brSync] Access URLs: | |
| -------------------------------------- | |
| Local: http://localhost:3000 | |
| External: http://192.168.1.100:3000 | |
| -------------------------------------- | |
| UI: http://localhost:3001 | |
| UI External: http://192.168.1.100:3001 | |
| -------------------------------------- | |
| [brSync] Serving files from: c:\project\build | |
| [brSync] Serving files from: c:\project | |
| [brSync] Watching files... | |
| [00:47:18] Finished 'serve' after 2.14 s | |
| [00:48:42] Starting 'ts'... | |
| [00:48:43] all files 16.27 kB | |
| [00:48:43] Finished 'ts' after 194 ms | |
| [00:49:33] Starting 'ts'... | |
| [00:49:33] Starting 'styl'... | |
| [00:49:33] Finished 'styl' after 171 ms | |
| [00:49:33] Finished 'ts' after 200 ms | |
| [00:50:17] Starting 'ts'... | |
| [00:50:17] Finished 'ts' after 57 ms | |
| [00:51:52] Starting 'ts'... | |
| [00:51:52] Starting 'styl'... | |
| [00:51:52] Finished 'styl' after 274 ms | |
| [00:51:52] all files 15.83 kB | |
| [00:51:52] Finished 'ts' after 308 ms |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>project</title> | |
| <base href="/"> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <link rel="icon" type="image/x-icon" href="favicon.ico"> | |
| <link rel="stylesheet" href="styles.css"> | |
| </head> | |
| <body> | |
| <app-root>Comming soon...</app-root> | |
| <!-- 1. Load libraries --> | |
| <script src="node_modules/core-js/client/shim.min.js"></script> | |
| <script src="node_modules/zone.js/dist/zone.js"></script> | |
| <script src="node_modules/reflect-metadata/Reflect.js"></script> | |
| <script src="node_modules/systemjs/dist/system.src.js"></script> | |
| <!-- 2. Configure SystemJS --> | |
| <script src="systemjs.config.js"></script> | |
| <!-- 3. Load App --> | |
| <script> | |
| System.import('main.js') | |
| // System.import('app.bundle.js') | |
| .catch(function(err){ console.error(err); }); | |
| </script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** THIS FILE SHOULD BE IN gulpfile.ts FOLDER */ | |
| /** RENAME THIS FILE TO index.ts! I named it index.JS just so Gist does syntax highlighting... */ | |
| const __ = require('gulp-load-plugins')(); | |
| const del = require('del'); | |
| const gulp = require('gulp'); | |
| const path = require('path'); | |
| const bs = require('browser-sync').create(); | |
| const bsConfig = require('./bs-config.js'); | |
| const autoprefixer = require('autoprefixer'); | |
| const csso = require('csso'); | |
| const htmlmin = require('html-minifier').minify; | |
| const postcss = require('postcss'); | |
| const stylus = require('stylus'); | |
| const PATH = { | |
| root: path.join(__dirname, '..'), | |
| src: path.join(__dirname, '..', 'src'), | |
| dest: path.join(__dirname, '..', 'build'), | |
| lib: 'c:/.library', | |
| tsconfig: path.join(__dirname, 'tsconfig.json'), | |
| polyfills: [ | |
| 'node_modules/core-js/client/shim.min.js', | |
| 'node_modules/zone.js/dist/zone.js', | |
| 'node_modules/reflect-metadata/Reflect.js', | |
| 'node_modules/systemjs/dist/system.src.js', | |
| ], | |
| sysconfig: path.join(__dirname, 'systemjs.config.js'), | |
| }; | |
| const OPTIONS = { | |
| stylus: { | |
| include: [ | |
| path.resolve(PATH.root, 'src'), | |
| path.resolve(PATH.root, 'src', 'styles'), | |
| path.resolve(PATH.lib, 'styl')] | |
| }, | |
| minify: { | |
| minimize: true, | |
| removeAttributeQuotes: false, | |
| caseSensitive: true, | |
| customAttrSurround: [ | |
| [/#/, /(?:)/], | |
| [/\*/, /(?:)/], | |
| [/\[?\(?/, /(?:)/] | |
| ], | |
| customAttrAssign: [/\)?\]?=/], | |
| collapseWhitespace: true, | |
| removeComments: true, | |
| }, | |
| tsconfig: require(PATH.tsconfig), | |
| }; | |
| const inlineNg2Options = { | |
| base: '/src/app', | |
| useRelativePaths: true, | |
| /** | |
| * Processor function call signature and type return | |
| * | |
| * @Param{String} file path | |
| * @Param{String} file extension (type) | |
| * @Param{String} file content | |
| * @Param{Function} callback function (err, result) => void | |
| * @Return{void} | |
| */ | |
| styleProcessor: (p, e, f, c) => { | |
| f = f.replace(/@import\s+'(?:\.\.\/)+/gmi, '@import \''); | |
| let css = stylus(f) | |
| .set('filename', p) | |
| .set('paths', OPTIONS.stylus.include) | |
| .render(); | |
| css = postcss([autoprefixer]).process(css).css; | |
| css = csso.minify(css).css; | |
| c(null, css); | |
| }, | |
| templateProcessor: (p, e, f, c) => { | |
| let html = htmlmin(f, OPTIONS.minify); | |
| c(null, html); | |
| }, | |
| }; | |
| export const clean = function clean(done) { | |
| del(['dist', 'build'], { force: true }) | |
| .catch(error => console.log(error)) | |
| .then(paths => done()); | |
| }; | |
| export const clear = clean; | |
| export const dummy = function dummy(done) { | |
| console.log(); | |
| done(); | |
| }; | |
| export const styl = function styl(done) { | |
| const files = [path.resolve(PATH.src, '**', '*.styl'), `!${path.join('src', 'app', '**', '*.*')}`]; | |
| console.log(files); | |
| return gulp.src(files, { | |
| since: gulp.lastRun('styl') | |
| }) | |
| .pipe(__.plumber()) | |
| .pipe(__.debug({ title: 'Styl' })) | |
| .pipe(__.sourcemaps.init()) | |
| .pipe(__.stylus(OPTIONS.stylus)) | |
| .pipe(__.autoprefixer()) | |
| .pipe(__.concat(path.resolve(PATH.dest, 'styles.css'))) | |
| .pipe(__.sourcemaps.write()) | |
| .pipe(gulp.dest(PATH.dest)); | |
| }; | |
| const tsProject = __.typescript.createProject(require(PATH.tsconfig).compilerOptions); | |
| export const typescript = function ts(done) { | |
| // https://github.com/isaacs/node-glob#glob | |
| const files = [path.resolve(PATH.src, '**', '*.ts'), '!**.(spec|e2e).**']; | |
| return gulp.src(files, { | |
| since: gulp.lastRun('ts'), | |
| base: 'src' | |
| }) | |
| .pipe(__.plumber()) | |
| .pipe(__.sourcemaps.init()) | |
| .pipe(__.inlineNg2Template(inlineNg2Options)) | |
| .pipe(tsProject()) | |
| // .pipe(__.debug({ title: 'TypeScript' })) | |
| .pipe(__.sourcemaps.write()) | |
| .pipe(__.size()) | |
| .pipe(gulp.dest(PATH.dest)); | |
| }; | |
| export const ts = typescript; | |
| export const javascript = function js(done) { | |
| const files = [path.resolve(PATH.src, '**', '*.js'), PATH.sysconfig]; | |
| return gulp.src(files, { | |
| since: gulp.lastRun('js') | |
| }) | |
| .pipe(__.plumber()) | |
| .pipe(__.rename({ dirname: '' })) | |
| .pipe(__.debug({ title: 'JavaScript' })) | |
| .pipe(gulp.dest(PATH.dest)); | |
| }; | |
| export const js = javascript; | |
| export const polyfills = function polyfills(done) { | |
| const files = [...PATH.polyfills, PATH.sysconfig]; | |
| return gulp.src(files, { | |
| since: gulp.lastRun('polyfills'), | |
| }) | |
| .pipe(__.plumber()) | |
| .pipe(__.rename({ dirname: '' })) | |
| .pipe(__.debug({ title: 'polyfills' })) | |
| .pipe(gulp.dest(PATH.dest)); | |
| }; | |
| export const publik = function publik(done) { | |
| return gulp.src(path.resolve(PATH.root, 'public', '**', '*.*'), { | |
| since: gulp.lastRun('publik'), | |
| base: 'public' | |
| }) | |
| .pipe(__.plumber()) | |
| .pipe(__.rename({ dirname: '' })) | |
| .pipe(__.debug({ title: 'public' })) | |
| .pipe(gulp.dest(PATH.dest)) | |
| .on('close', x => console.log('close', x)); | |
| }; | |
| export const assets = function assets(done) { | |
| return gulp.src(path.resolve(PATH.src, 'assets', '**', '*.*'), { | |
| since: gulp.lastRun('assets'), | |
| base: 'src', | |
| read: false | |
| }) | |
| .pipe(__.plumber()) | |
| .pipe(__.debug({ title: 'assets' })) | |
| .pipe(gulp.dest(PATH.dest)); | |
| }; | |
| export let log = function log(done) { | |
| const colors = __.util.colors; | |
| const log = __.util.log; | |
| log(colors.cyan('__dirname: '), path.resolve(__dirname)); | |
| log(colors.cyan('tsconfig: '), colors.yellow(JSON.stringify(tsProject.options, null, 2))); | |
| done(); | |
| }; | |
| export const serve = function serve(done) { | |
| bs.init(bsConfig, done); | |
| }; | |
| export const watch = function watch(done) { | |
| gulp.watch([path.resolve(PATH.src, '**', '*.js'), PATH.sysconfig], javascript); | |
| gulp.watch([ | |
| path.resolve(PATH.src, '*.ts'), | |
| path.resolve(PATH.src, 'app', '**', '*.*'), | |
| PATH.tsconfig | |
| ], typescript); | |
| gulp.watch(path.resolve(PATH.root, 'public', '**', '*.*'), publik); | |
| gulp.watch(path.resolve(PATH.root, 'assets', '**', '*.*'), assets); | |
| gulp.watch(path.resolve(PATH.src, '**', '*.styl'), styl); | |
| }; | |
| export const scripts = gulp.parallel(javascript, typescript); | |
| export const statik = gulp.parallel(assets, publik); | |
| export const styles = gulp.parallel(styl); | |
| export const build = gulp.series(log, clean, gulp.parallel(statik, styles, scripts)); | |
| export default gulp.series(build, gulp.parallel(serve, watch)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "project", | |
| "version": "0.0.0", | |
| "license": "MIT", | |
| "angular-cli": {}, | |
| "scripts": { | |
| "start": "ng serve", | |
| "i18n": "ng-xi18n", | |
| "lint": "tslint \"src/**/*.ts\"", | |
| "test": "ng test", | |
| "pree2e": "webdriver-manager update", | |
| "e2e": "protractor" | |
| }, | |
| "private": true, | |
| "dependencies": { | |
| "@angular/common": "~2.1.2", | |
| "@angular/compiler": "~2.1.2", | |
| "@angular/compiler-cli": "~2.1.2", | |
| "@angular/core": "~2.1.2", | |
| "@angular/forms": "~2.1.2", | |
| "@angular/http": "~2.1.2", | |
| "@angular/platform-browser": "~2.1.2", | |
| "@angular/platform-browser-dynamic": "~2.1.2", | |
| "@angular/platform-server": "~2.1.2", | |
| "@angular/router": "~3.1.2", | |
| "@ngrx/core": "~1.2.0", | |
| "@ngrx/effects": "~2.0.0", | |
| "@ngrx/store": "~2.2.1", | |
| "angularfire2": "^2.0.0-beta.5", | |
| "core-js": "~2.4.1", | |
| "firebase": "~3.5.2", | |
| "rxjs": "~5.0.0-rc.1", | |
| "zone.js": "~0.6.26" | |
| }, | |
| "devDependencies": { | |
| "@ngrx/store-devtools": "~3.2.1", | |
| "@types/jasmine": "~2.5.36", | |
| "angular-cli": "1.0.0-beta.19-3", | |
| "browser-sync": "^2.17.5", | |
| "codelyzer": "~1.0.0-beta.3", | |
| "compression": "~1.6.2", | |
| "gulp": "git+https://github.com/gulpjs/gulp.git#4.0", | |
| "gulp-autoprefixer": "^3.1.1", | |
| "gulp-concat": "^2.6.0", | |
| "gulp-csso": "^2.0.0", | |
| "gulp-debug": "^2.1.2", | |
| "gulp-htmlmin": "^3.0.0", | |
| "gulp-inline-ng2-template": "^3.0.2", | |
| "gulp-load-plugins": "^1.3.0", | |
| "gulp-plumber": "^1.1.0", | |
| "gulp-rename": "^1.2.2", | |
| "gulp-size": "^2.1.0", | |
| "gulp-sourcemaps": "^2.2.0", | |
| "gulp-stylus": "^2.5.0", | |
| "gulp-typescript": "^3.1.2", | |
| "gulp-util": "^3.0.7", | |
| "jasmine-core": "~2.5.2", | |
| "jasmine-spec-reporter": "~2.7.0", | |
| "karma": "~1.3.0", | |
| "karma-chrome-launcher": "~2.0.0", | |
| "karma-cli": "~1.0.1", | |
| "karma-jasmine": "~1.0.2", | |
| "karma-remap-istanbul": "~0.2.1", | |
| "protractor": "~4.0.10", | |
| "systemjs": "^0.19.40", | |
| "ts-helpers": "~1.1.2", | |
| "ts-node": "~1.6.1", | |
| "tslint": "~3.15.1", | |
| "typescript": "^2.0.6", | |
| "webdriver-manager": "~10.2.6" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** THIS FILE SHOULD BE IN gulpfile.ts FOLDER */ | |
| /** | |
| * System configuration for Angular samples | |
| * Adjust as necessary for your application needs. | |
| */ | |
| (function (global) { | |
| System.config({ | |
| defaultJSExtensions: true, | |
| paths: { | |
| // paths serve as alias | |
| 'npm:': 'node_modules/', | |
| 'firebase': 'node_modules/firebase/', | |
| }, | |
| // map tells the System loader where to look for things | |
| map: { | |
| // our app is within the app folder | |
| app: 'app', | |
| // angular bundles | |
| '@angular/core': 'npm:@angular/core/bundles/core.umd.js', | |
| '@angular/common': 'npm:@angular/common/bundles/common.umd.js', | |
| '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js', | |
| '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js', | |
| '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js', | |
| '@angular/http': 'npm:@angular/http/bundles/http.umd.js', | |
| '@angular/router': 'npm:@angular/router/bundles/router.umd.js', | |
| '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js', | |
| // other libraries | |
| 'rxjs': 'npm:rxjs', | |
| '@ngrx': 'npm:@ngrx', | |
| 'angularfire2': 'npm:angularfire2/bundles/angularFire2.umd.js', | |
| 'angular-in-memory-web-api': 'npm:angular-in-memory-web-api', | |
| }, | |
| // packages tells the System loader how to load when no filename and/or no extension | |
| packages: { | |
| app: { | |
| main: './index.js', | |
| defaultExtension: 'js', | |
| map: { | |
| './routes': './routes/index.js', | |
| './core': './core/index.js', | |
| './core/auth': './core/auth/index.js', | |
| './core/firebase': './core/firebase/index.js', | |
| './core/notification': './core/notification/index.js', | |
| './core/ui': './core/ui/index.js', | |
| /* Lot more mappings here... meh... ;(( */ | |
| } | |
| }, | |
| environments: { | |
| defaultExtension: 'js' | |
| }, | |
| rxjs: { | |
| defaultExtension: 'js' | |
| }, | |
| angularfire2: { | |
| main: 'angularfire2.js', | |
| defaultExtension: 'js' | |
| }, | |
| firebase: { | |
| main: 'firebase-browser.js', | |
| defaultExtension: 'js' | |
| }, | |
| 'angular-in-memory-web-api': { | |
| main: './index.js', | |
| defaultExtension: 'js' | |
| } | |
| }, | |
| packageConfigPaths: [ | |
| 'node_modules/@angular/*/package.json', | |
| 'node_modules/@ngrx/*/package.json', | |
| ], | |
| }); | |
| })(this); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "compilerOptions": { | |
| "baseUrl": "./src", | |
| "emitDecoratorMetadata": true, | |
| "experimentalDecorators": true, | |
| "isolatedModules": true, | |
| "lib": [ "es6", "dom", "es2017" ], | |
| "module": "system", | |
| "moduleResolution": "node", | |
| "sourceMap": true, | |
| "target": "es5" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment