intermediate-component-sa 1.0.4 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +1 -20
  3. package/build-dev.bat +2 -0
  4. package/build-prod-aot.bat +2 -0
  5. package/build-prod-rollup-aot.bat +2 -0
  6. package/build-prod.bat +2 -0
  7. package/config.ts +4 -0
  8. package/gulpfile.ts +172 -0
  9. package/index.js +10 -1
  10. package/karma.conf.js +124 -0
  11. package/package.json +340 -15
  12. package/postgrator-test.json +9 -0
  13. package/postgrator.json +9 -0
  14. package/src/app.server.ts +4 -0
  15. package/src/client/app/app.component.ts +37 -0
  16. package/src/client/app/app.html +6 -0
  17. package/src/client/app/app.module.ts +36 -0
  18. package/src/client/app/app.routing.ts +7 -0
  19. package/src/client/app/hot_loader_main.ts +14 -0
  20. package/src/client/app/main-aot.ts +8 -0
  21. package/src/client/app/main.ts +8 -0
  22. package/src/client/app/rxjs-operators.ts +15 -0
  23. package/src/client/index.html +90 -0
  24. package/src/client/tsconfig.json +44 -0
  25. package/src/server/config/app.config.ts +57 -0
  26. package/src/server/config/jwt.config.ts +4 -0
  27. package/src/server/config/logger.config.ts +161 -0
  28. package/src/server/config/mssql.config.ts +30 -0
  29. package/src/server/config/redis.config.ts +10 -0
  30. package/src/server/config/server.config.ts +20 -0
  31. package/src/server/config/templates.config.ts +41 -0
  32. package/src/server/crypt.ts +37 -0
  33. package/src/server/customRequest.ts +609 -0
  34. package/src/server/index.ts +231 -0
  35. package/src/server/interfaces/cleaner.interface.ts +3 -0
  36. package/src/server/interfaces/supervisor.interface.ts +3 -0
  37. package/src/server/routes-centralized.ts +36 -0
  38. package/src/server/routes.ts +6 -0
  39. package/src/server/services/index.ts +10 -0
  40. package/src/server/services/routes.service.ts +11 -0
  41. package/src/server/shared/file-manager.ts +1007 -0
  42. package/src/server/shared/http.shared.ts +49 -0
  43. package/src/server/shared/promises.shared.ts +13 -0
  44. package/src/server/shared/security.shared.ts +90 -0
  45. package/src/server/ssl/star_inconcertcc_com.key +28 -0
  46. package/src/server/ssl/star_inconcertcc_com.pem +62 -0
  47. package/src/server/tsconfig.json +38 -0
  48. package/tools/build.js.prod.ts +40 -0
  49. package/tools/config/project.config.ts +718 -0
  50. package/tools/config.ts +4 -0
  51. package/tools/database/SchemaZen.exe +0 -0
  52. package/tools/database/generate-all-data-scripts.bat +32 -0
  53. package/tools/database/generate-database-scripts.bat +36 -0
  54. package/tools/debug.ts +17 -0
  55. package/tools/env/base.ts +8 -0
  56. package/tools/env/dev.ts +9 -0
  57. package/tools/env/env-config.interface.ts +1 -0
  58. package/tools/env/prod.ts +10 -0
  59. package/tools/manual_typings/project/sample.package.d.ts +3 -0
  60. package/tools/manual_typings/seed/angular2-hot-loader.d.ts +9 -0
  61. package/tools/manual_typings/seed/autoprefixer.d.ts +13 -0
  62. package/tools/manual_typings/seed/colorguard.d.ts +15 -0
  63. package/tools/manual_typings/seed/connect-livereload.d.ts +5 -0
  64. package/tools/manual_typings/seed/cssnano.d.ts +18 -0
  65. package/tools/manual_typings/seed/doiuse.d.ts +16 -0
  66. package/tools/manual_typings/seed/express-history-api-fallback.d.ts +18 -0
  67. package/tools/manual_typings/seed/istream.d.ts +10 -0
  68. package/tools/manual_typings/seed/karma.d.ts +12 -0
  69. package/tools/manual_typings/seed/merge-stream.d.ts +8 -0
  70. package/tools/manual_typings/seed/open.d.ts +8 -0
  71. package/tools/manual_typings/seed/postcss-reporter.d.ts +20 -0
  72. package/tools/manual_typings/seed/slash.d.ts +5 -0
  73. package/tools/manual_typings/seed/stylelint.d.ts +16 -0
  74. package/tools/manual_typings/seed/systemjs-builder.d.ts +10 -0
  75. package/tools/manual_typings/seed/tildify.d.ts +5 -0
  76. package/tools/manual_typings/seed/tiny-lr.d.ts +10 -0
  77. package/tools/manual_typings/seed/walk.d.ts +10 -0
  78. package/tools/scripts/install.speech-analytic.sh +35 -0
  79. package/tools/tasks/build.app.server.ts +57 -0
  80. package/tools/tasks/build.assets.dev.ts +19 -0
  81. package/tools/tasks/build.assets.prod.ts +31 -0
  82. package/tools/tasks/build.bundles.app.aot.ts +31 -0
  83. package/tools/tasks/build.bundles.app.rollup.aot.ts +101 -0
  84. package/tools/tasks/build.bundles.app.ts +31 -0
  85. package/tools/tasks/build.bundles.ts +45 -0
  86. package/tools/tasks/build.database.scripts.runner.ts +137 -0
  87. package/tools/tasks/build.database.scripts.ts +27 -0
  88. package/tools/tasks/build.flags.ts +9 -0
  89. package/tools/tasks/build.fonts.ts +9 -0
  90. package/tools/tasks/build.html_css.ts +126 -0
  91. package/tools/tasks/build.index.dev.ts +68 -0
  92. package/tools/tasks/build.index.prod.ts +64 -0
  93. package/tools/tasks/build.js.dev.ts +66 -0
  94. package/tools/tasks/build.js.prod.aot.ts +44 -0
  95. package/tools/tasks/build.js.prod.rollup.aot.ts +50 -0
  96. package/tools/tasks/build.js.prod.ts +40 -0
  97. package/tools/tasks/build.packages.prod.ts +19 -0
  98. package/tools/tasks/build.server.dev.ts +59 -0
  99. package/tools/tasks/build.server.prod.ts +31 -0
  100. package/tools/tasks/build.server.statics.ts +24 -0
  101. package/tools/tasks/build.skins.ts +51 -0
  102. package/tools/tasks/build.sme.prod.aot.ts +6 -0
  103. package/tools/tasks/build.sme.prod.rollup.aot.ts +6 -0
  104. package/tools/tasks/build.sme.prod.ts +6 -0
  105. package/tools/tasks/build.tar.prod.ts +17 -0
  106. package/tools/tasks/build.test.database.scripts.ts +52 -0
  107. package/tools/tasks/clean.dev.ts +7 -0
  108. package/tools/tasks/clean.prod.ts +7 -0
  109. package/tools/tasks/compile.ahead.prod.ts +65 -0
  110. package/tools/tasks/copy.client.js.prod.rollup.aot.ts +33 -0
  111. package/tools/tasks/copy.client.js.prod.ts +18 -0
  112. package/tools/tasks/copy.server.assets.ts +38 -0
  113. package/tools/tasks/copy.server.js.prod.ts +16 -0
  114. package/tools/tasks/css-lint.ts +58 -0
  115. package/tools/tasks/e2e.ts +32 -0
  116. package/tools/tasks/karma.run.ts +18 -0
  117. package/tools/tasks/karma.watch.ts +9 -0
  118. package/tools/tasks/minify.server.statics.ts +52 -0
  119. package/tools/tasks/server.prod.ts +6 -0
  120. package/tools/tasks/server.start.ts +6 -0
  121. package/tools/tasks/test.database.ts +6 -0
  122. package/tools/tasks/transpile.bundles.rollup.aot.ts +43 -0
  123. package/tools/tasks/tslint.ts +64 -0
  124. package/tools/tasks/watch.file.changes.dev.ts +37 -0
  125. package/tools/tasks/watch.key.press.dev.ts +116 -0
  126. package/tools/tasks/webdriver.ts +6 -0
  127. package/tools/utils/project/sample_util.ts +18 -0
  128. package/tools/utils/project.utils.ts +4 -0
  129. package/tools/utils/seed/build_optimizer.ts +26 -0
  130. package/tools/utils/seed/clean.ts +35 -0
  131. package/tools/utils/seed/code_change_tools.ts +38 -0
  132. package/tools/utils/seed/karma.start.ts +10 -0
  133. package/tools/utils/seed/server.ts +43 -0
  134. package/tools/utils/seed/sme.ts +51 -0
  135. package/tools/utils/seed/tasks_tools.ts +70 -0
  136. package/tools/utils/seed/template_locals.ts +64 -0
  137. package/tools/utils/seed/tsproject.ts +25 -0
  138. package/tools/utils/seed.utils.ts +11 -0
  139. package/tools/utils.ts +5 -0
  140. package/tsconfig.json +33 -0
  141. package/tslint.json +120 -0
  142. package/utils.ts +5 -0
@@ -0,0 +1,4 @@
1
+ import { ProjectConfig } from './config/project.config';
2
+
3
+ const config: ProjectConfig = new ProjectConfig();
4
+ export = config;
Binary file
@@ -0,0 +1,32 @@
1
+ @ECHO OFF
2
+
3
+ REM Datos de acceso al SQL de desarrollo
4
+ SET DATABASE_HOST=192.168.2.199
5
+ SET DATABASE_NAME=Testing_Billing
6
+ SET DATABASE_USER=usraccmw
7
+ SET DATABASE_PASSWORD=inc2001
8
+ SET DATABASE_TIMEOUT=600
9
+
10
+
11
+ REM Armo el connection string
12
+ SET DATABASE_CONNECTION_STRING="Server=%DATABASE_HOST%;Database=%DATABASE_NAME%;User Id=%DATABASE_USER%;Password=%DATABASE_PASSWORD%;Connection Timeout=%DATABASE_TIMEOUT%;Timeout=%DATABASE_TIMEOUT%;"
13
+
14
+ REM Datos del repositorio local
15
+ SET TARGET_DIR=..\..\dist\tmp_database\mssql
16
+
17
+ REM Limpio los scripts actuales
18
+ RMDIR %TARGET_DIR%\data /S /Q
19
+ RMDIR %TARGET_DIR%\functions /S /Q
20
+ RMDIR %TARGET_DIR%\procedures /S /Q
21
+ RMDIR %TARGET_DIR%\tables /S /Q
22
+ RMDIR %TARGET_DIR%\users /S /Q
23
+
24
+ REM Ejecuto generador de scripts
25
+ SchemaZen.exe script^
26
+ --connectionString %DATABASE_CONNECTION_STRING%^
27
+ --scriptDir %TARGET_DIR%^
28
+ --overwrite=true^
29
+ --verbose=true^
30
+ --dataTablesPattern=(.*)
31
+
32
+ PAUSE
@@ -0,0 +1,36 @@
1
+ @ECHO OFF
2
+
3
+ REM Datos de acceso al SQL de desarrollo
4
+ SET DATABASE_HOST=192.168.2.199
5
+ SET DATABASE_NAME=Testing_Billing
6
+ SET DATABASE_USER=usraccmw
7
+ SET DATABASE_PASSWORD=inc2001
8
+ SET DATABASE_TIMEOUT=600
9
+
10
+ REM Armo el connection string
11
+ SET DATABASE_CONNECTION_STRING="Server=%DATABASE_HOST%;Database=%DATABASE_NAME%;User Id=%DATABASE_USER%;Password=%DATABASE_PASSWORD%;Connection Timeout=%DATABASE_TIMEOUT%;Timeout=%DATABASE_TIMEOUT%;"
12
+
13
+ REM Datos del repositorio local
14
+ SET TARGET_DIR=..\..\src\database\mssql
15
+
16
+ REM Tablas para las que quiero incluir los scripts de data
17
+ SET DATA_TABLES=Task
18
+
19
+ REM Limpio los scripts actuales
20
+ RMDIR %TARGET_DIR%\data /S /Q
21
+ RMDIR %TARGET_DIR%\functions /S /Q
22
+ RMDIR %TARGET_DIR%\procedures /S /Q
23
+ RMDIR %TARGET_DIR%\tables /S /Q
24
+ RMDIR %TARGET_DIR%\users /S /Q
25
+
26
+ REM Ejecuto generador de scripts
27
+ SchemaZen.exe script^
28
+ --connectionString %DATABASE_CONNECTION_STRING%^
29
+ --scriptDir %TARGET_DIR%^
30
+ --overwrite=true^
31
+ --verbose=true^
32
+ --dataTables=%DATA_TABLES%
33
+
34
+ PAUSE
35
+
36
+ REM Para exportar data de todas las tablas --> --dataTablesPattern=(.*)
package/tools/debug.ts ADDED
@@ -0,0 +1,17 @@
1
+ import * as gulp from 'gulp';
2
+ import { argv } from 'yargs';
3
+
4
+ require('../gulpfile');
5
+
6
+ const TASK = argv['task'];
7
+
8
+ if (!TASK) {
9
+ throw new Error('You must specify a task name.');
10
+ }
11
+
12
+ console.log('**********************');
13
+ console.log('* angular2-seed tools ');
14
+ console.log('* debugging task:', TASK);
15
+ console.log('**********************');
16
+
17
+ gulp.start(TASK);
@@ -0,0 +1,8 @@
1
+ import { EnvConfig } from './env-config.interface';
2
+ import { DEV_API_BASE_URL } from '../config';
3
+
4
+ const BaseConfig: EnvConfig = {
5
+ API: DEV_API_BASE_URL
6
+ };
7
+
8
+ export = BaseConfig;
@@ -0,0 +1,9 @@
1
+ import { EnvConfig } from './env-config.interface';
2
+ import { DEV_API_BASE_URL } from '../config';
3
+
4
+ const DevConfig: EnvConfig = {
5
+ ENV: 'DEV',
6
+ API: DEV_API_BASE_URL
7
+ };
8
+
9
+ export = DevConfig;
@@ -0,0 +1 @@
1
+ export { EnvConfig } from '../../src/client/shared/config/env.config';
@@ -0,0 +1,10 @@
1
+ import { EnvConfig } from './env-config.interface';
2
+ import { PROD_API_BASE_URL } from '../config';
3
+
4
+ const ProdConfig: EnvConfig = {
5
+ ENV: 'PROD',
6
+ API: PROD_API_BASE_URL
7
+ };
8
+
9
+ export = ProdConfig;
10
+
@@ -0,0 +1,3 @@
1
+ // declare module "moment/moment" {
2
+ // export = moment;
3
+ // }
@@ -0,0 +1,9 @@
1
+ declare module 'angular2-hot-loader' {
2
+ export interface Options {
3
+ port?: number;
4
+ path?: string;
5
+ processPath?: Function;
6
+ }
7
+ export function listen(localConfig?: Options): void;
8
+ export function onChange(files: string[]): void;
9
+ }
@@ -0,0 +1,13 @@
1
+ declare module 'autoprefixer' {
2
+
3
+ interface IOptions {
4
+ browsers: string[];
5
+ }
6
+
7
+ interface IAutoprefixer {
8
+ (opts?: IOptions): NodeJS.ReadWriteStream;
9
+ }
10
+
11
+ const autoprefixer: IAutoprefixer;
12
+ export = autoprefixer;
13
+ }
@@ -0,0 +1,15 @@
1
+ declare module 'colorguard' {
2
+
3
+ interface IOptions {
4
+ ignore?: string[];
5
+ threshold?: number;
6
+ whitelist?: [string, string][];
7
+ }
8
+
9
+ interface IColorguard {
10
+ (opts?: IOptions): NodeJS.ReadWriteStream;
11
+ }
12
+
13
+ const colorguard: IColorguard;
14
+ export = colorguard;
15
+ }
@@ -0,0 +1,5 @@
1
+ declare module 'connect-livereload' {
2
+ function connectLivereload(options?: any): any;
3
+ module connectLivereload {}
4
+ export = connectLivereload;
5
+ }
@@ -0,0 +1,18 @@
1
+ declare module 'cssnano' {
2
+
3
+ interface IOptions {
4
+ discardComments?: {
5
+ removeAll: boolean;
6
+ };
7
+ discardUnused?: boolean;
8
+ zindex?: boolean;
9
+ reduceIdents?: boolean;
10
+ }
11
+
12
+ interface ICssnano {
13
+ (opts?: IOptions): NodeJS.ReadWriteStream;
14
+ }
15
+
16
+ const cssnano: ICssnano;
17
+ export = cssnano;
18
+ }
@@ -0,0 +1,16 @@
1
+ declare module 'doiuse' {
2
+
3
+ interface IOptions {
4
+ browsers?: string[];
5
+ ignore?: string[];
6
+ ignoreFiles?: string[];
7
+ onFeatureUsage?: Function;
8
+ }
9
+
10
+ interface IDoiuse {
11
+ (opts?: IOptions): NodeJS.ReadWriteStream;
12
+ }
13
+
14
+ const doiuse: IDoiuse;
15
+ export = doiuse;
16
+ }
@@ -0,0 +1,18 @@
1
+ declare module 'express-history-api-fallback' {
2
+
3
+ import { RequestHandler } from 'express';
4
+
5
+ interface IOptions {
6
+ maxAge?: number;
7
+ root?: string;
8
+ lastModified?: number;
9
+ headers?: { [key: string]: string; };
10
+ dotfiles?: boolean;
11
+ }
12
+
13
+ function fallback(index: string, options?: IOptions): RequestHandler;
14
+
15
+ module fallback {}
16
+
17
+ export = fallback;
18
+ }
@@ -0,0 +1,10 @@
1
+ declare module 'isstream' {
2
+ function istream(stream: any): boolean;
3
+ interface Istream {
4
+ isReadable(stream: any): boolean;
5
+ isWritable(stream: any): boolean;
6
+ isDuplex(stream: any): boolean;
7
+ }
8
+ module istream {}
9
+ export = istream;
10
+ }
@@ -0,0 +1,12 @@
1
+ // Use this minimalistic definition file as bluebird dependency
2
+ // generate a lot of errors.
3
+
4
+ declare module 'karma' {
5
+ var karma: IKarma;
6
+ export = karma;
7
+ interface IKarma {
8
+ server: {
9
+ start(options: any, callback: Function): void
10
+ };
11
+ }
12
+ }
@@ -0,0 +1,8 @@
1
+ declare module 'merge-stream' {
2
+ function mergeStream(...streams: NodeJS.ReadWriteStream[]): MergeStream;
3
+ interface MergeStream extends NodeJS.ReadWriteStream {
4
+ add(stream: NodeJS.ReadWriteStream): MergeStream;
5
+ }
6
+ module mergeStream {}
7
+ export = mergeStream;
8
+ }
@@ -0,0 +1,8 @@
1
+ // https://github.com/borisyankov/DefinitelyTyped/tree/master/open
2
+ // Does not support ES2015 import (import * as open from 'open').
3
+
4
+ declare module 'open' {
5
+ function open(target: string, app?: string): void;
6
+ module open {}
7
+ export = open;
8
+ }
@@ -0,0 +1,20 @@
1
+ declare module 'postcss-reporter' {
2
+
3
+ interface IOptions {
4
+ clearMessages?: boolean;
5
+ formatter?: Function;
6
+ plugins?: string[];
7
+ throwError?: boolean;
8
+ sortByPosition?: boolean;
9
+ positionless?: string;
10
+ noIcon?: boolean;
11
+ noPlugin?: boolean;
12
+ }
13
+
14
+ interface IPostcssReporter {
15
+ (opts?: IOptions): NodeJS.ReadWriteStream;
16
+ }
17
+
18
+ const postcssReporter: IPostcssReporter;
19
+ export = postcssReporter;
20
+ }
@@ -0,0 +1,5 @@
1
+ declare module 'slash' {
2
+ function slash(path: string): string;
3
+ module slash {}
4
+ export = slash;
5
+ }
@@ -0,0 +1,16 @@
1
+ declare module 'stylelint' {
2
+
3
+ interface IOptions {
4
+ config?: Object;
5
+ configFile?: string;
6
+ configBasedir?: string;
7
+ configOverrides?: Object;
8
+ }
9
+
10
+ interface IStylelint {
11
+ (opts?: IOptions): NodeJS.ReadWriteStream;
12
+ }
13
+
14
+ const stylelint: IStylelint;
15
+ export = stylelint;
16
+ }
@@ -0,0 +1,10 @@
1
+ declare module 'systemjs-builder' {
2
+ class Builder {
3
+ constructor(configObject?: any, baseUrl?: string, configPath?: string);
4
+ bundle(source: string, target: string, options?: any): Promise<any>;
5
+ buildStatic(source: string, target: string, options?: any): Promise<any>;
6
+ }
7
+
8
+ module Builder {}
9
+ export = Builder;
10
+ }
@@ -0,0 +1,5 @@
1
+ declare module 'tildify' {
2
+ function tildify(path: string): string;
3
+ module tildify {}
4
+ export = tildify;
5
+ }
@@ -0,0 +1,10 @@
1
+ declare module 'tiny-lr' {
2
+ function tinylr(): ITinylr;
3
+ module tinylr {}
4
+ export = tinylr;
5
+
6
+ interface ITinylr {
7
+ changed(options: any): void;
8
+ listen(port: number): void;
9
+ }
10
+ }
@@ -0,0 +1,10 @@
1
+ declare module 'walk' {
2
+ interface Walker {
3
+ on(eventName: string, cb: Function): any;
4
+ }
5
+ interface Walk {
6
+ walk(path: string, options: any): Walker;
7
+ }
8
+ const walk: Walk;
9
+ export = walk;
10
+ }
@@ -0,0 +1,35 @@
1
+ #!/bin/bash
2
+
3
+ ###################################
4
+ # Descomprimo e instalo servicio #
5
+ ###################################
6
+
7
+ # Obtengo directorio de trabajo
8
+ wwwdir=/var/www
9
+
10
+ # Obtengo nombre del archivo a descomprimir
11
+ tarfile=`ls -t $wwwdir/*.tar.gz | grep -v backup | head -1`
12
+
13
+ # Me paro en directorio base
14
+ cd $wwwdir
15
+
16
+ # Hago backup de la carpeta actual
17
+ # tar zcvf $appName-backup.tar.gz $appName
18
+
19
+ # Descomprimo el paquete
20
+ if [ $appName != "speech-analytic" ]; then
21
+ mv $appName speech-analytic
22
+ fi
23
+ tar zxvf $tarfile
24
+ if [ $appName != "speech-analytic" ]; then
25
+ mv speech-analytic $appName
26
+ fi
27
+ cd $appName
28
+
29
+ #########################
30
+ # Reinicio el servicio #
31
+ #########################
32
+
33
+ # Reinicio la aplicacion
34
+ cd ..
35
+ pm2 restart $appName
@@ -0,0 +1,57 @@
1
+ import * as gulp from 'gulp';
2
+ import * as gulpLoadPlugins from 'gulp-load-plugins';
3
+ import * as merge from 'merge-stream';
4
+ import * as log from 'fancy-log';
5
+ import { Chalk } from 'chalk';
6
+ import { join, resolve } from 'path';
7
+
8
+ import { APP_SERVER_SRC, APP_SERVER_DEST, TOOLS_DIR, TEMPLATE_CONFIG } from '../config';
9
+ import { makeTsProject, TemplateLocalsBuilder } from '../utils';
10
+
11
+ // Obtengo plugins de gulp
12
+ const chalk: Chalk = require('chalk');
13
+ const plugins = <any>gulpLoadPlugins();
14
+
15
+ // Flag de primera ejecución
16
+ let firstTime: boolean = true;
17
+
18
+ // Ejecuta transpile del app.server
19
+ export = () => {
20
+ // Proyecto de compilación TS
21
+ let tsProject: any;
22
+ // Archivos de typings locales
23
+ let typings = gulp.src([
24
+ TOOLS_DIR + '/manual_typings/**/*.d.ts'
25
+ ]);
26
+ // Archivos a compilar
27
+ let projectFiles = gulp.src([
28
+ join(APP_SERVER_SRC, '../app.server.ts'),
29
+ ], {base : 'src'});
30
+
31
+ // Solo uso los typings en la primer compilación
32
+ if (firstTime) {
33
+ // La primera vez ejecuto build usando los typings manuales
34
+ tsProject = makeTsProject({}, APP_SERVER_SRC);
35
+ projectFiles = merge(typings, projectFiles);
36
+ } else {
37
+ // Las siguientes los hago typeless para acelerar
38
+ tsProject = makeTsProject({ /* isolatedModules: true */ }, APP_SERVER_SRC);
39
+ projectFiles = projectFiles.pipe(plugins.cached());
40
+ log('Fastbuild ' + chalk.cyan('Ejecutando compilación typeless.'));
41
+ }
42
+
43
+ // Actualizo flag
44
+ firstTime = false;
45
+
46
+ // Inicializo proyecto
47
+ let result: any = projectFiles
48
+ .pipe(plugins.plumber())
49
+ .pipe(plugins.sourcemaps.init())
50
+ .pipe(tsProject());
51
+
52
+ // Ejecuto la compilación y copio el resultado en carpeta destino
53
+ return result.js
54
+ .pipe(plugins.sourcemaps.write({ includeContent: false, sourceRoot: resolve('./src') }))
55
+ .pipe(plugins.template(new TemplateLocalsBuilder().withStringifiedSystemConfigDev().build(), TEMPLATE_CONFIG))
56
+ .pipe(gulp.dest(resolve(APP_SERVER_DEST, '..')));
57
+ };
@@ -0,0 +1,19 @@
1
+ import * as gulp from 'gulp';
2
+ import { join } from 'path';
3
+
4
+ import { APP_CLIENT_DEST, APP_CLIENT_SRC, TEMP_FILES } from '../config';
5
+
6
+ /**
7
+ * Executes the build process, copying the assets located in `src/client` over to the appropriate
8
+ * `dist/dev` directory.
9
+ */
10
+ export = () => {
11
+ let paths: string[] = [
12
+ join(APP_CLIENT_SRC, '**'),
13
+ '!' + join(APP_CLIENT_SRC, '**', '*.ts'),
14
+ '!' + join(APP_CLIENT_SRC, '**', '*.scss')
15
+ ].concat(TEMP_FILES.map((p) => { return '!' + p; }));
16
+
17
+ return gulp.src(paths)
18
+ .pipe(gulp.dest(APP_CLIENT_DEST));
19
+ };
@@ -0,0 +1,31 @@
1
+ import * as gulp from 'gulp';
2
+ import { join } from 'path';
3
+
4
+ import { APP_CLIENT_DEST, APP_CLIENT_SRC, ASSETS_SRC, TEMP_FILES } from '../config';
5
+
6
+ // TODO There should be more elegant to prevent empty directories from copying
7
+ let es: any = require('event-stream');
8
+ var onlyDirs = function (es: any) {
9
+ return es.map(function (file: any, cb: any) {
10
+ if (file.stat.isFile()) {
11
+ return cb(null, file);
12
+ } else {
13
+ return cb();
14
+ }
15
+ });
16
+ };
17
+
18
+ /**
19
+ * Executes the build process, copying the assets located in `src/client` over to the appropriate
20
+ * `dist/prod` directory.
21
+ */
22
+ export = () => {
23
+ return gulp.src([
24
+ join(APP_CLIENT_SRC, '**'),
25
+ '!' + join(APP_CLIENT_SRC, '**', '*.ts'),
26
+ '!' + join(APP_CLIENT_SRC, '**', '*.html'),
27
+ '!' + join(APP_CLIENT_SRC, '**', '*.scss')
28
+ ].concat(TEMP_FILES.map((p) => { return '!' + p; })),{base:APP_CLIENT_SRC})
29
+ .pipe(onlyDirs(es))
30
+ .pipe(gulp.dest(APP_CLIENT_DEST));
31
+ };
@@ -0,0 +1,31 @@
1
+ import { join } from 'path';
2
+ import * as Builder from 'systemjs-builder';
3
+
4
+ import {
5
+ BOOTSTRAP_MODULE_AOT,
6
+ JS_PROD_APP_BUNDLE,
7
+ JS_DEST,
8
+ SYSTEM_JS_CONFIG_PROD,
9
+ TMP_CLIENT_DIR,
10
+ PRESERVE_SOURCE_MAPS,
11
+ } from '../config';
12
+
13
+ const BUNDLER_OPTIONS = {
14
+ format: 'cjs',
15
+ minify: true,
16
+ mangle: false,
17
+ sourceMaps: PRESERVE_SOURCE_MAPS,
18
+ };
19
+
20
+ /**
21
+ * Executes the build process, bundling the JavaScript files using the SystemJS builder.
22
+ */
23
+ export = (done: any) => {
24
+ let builder = new Builder(SYSTEM_JS_CONFIG_PROD);
25
+ builder
26
+ .buildStatic(join(TMP_CLIENT_DIR, BOOTSTRAP_MODULE_AOT),
27
+ join(JS_DEST, JS_PROD_APP_BUNDLE),
28
+ BUNDLER_OPTIONS)
29
+ .then(() => done())
30
+ .catch((err: any) => done(err));
31
+ };
@@ -0,0 +1,101 @@
1
+ import { parallel } from 'async';
2
+ import { writeFile } from 'fs';
3
+ import { join } from 'path';
4
+
5
+ import { TMP_CLIENT_DIR, BOOTSTRAP_MODULE_AOT, ROLLUP_INCLUDE_DIR, ROLLUP_INCLUDES, ROLLUP_NAMED_EXPORTS, PRESERVE_SOURCE_MAPS } from '../config';
6
+
7
+ const rollup = require('rollup');
8
+ const globals = require('rollup-plugin-node-globals');
9
+ const builtins = require('rollup-plugin-node-builtins');
10
+ const json = require('rollup-plugin-json');
11
+ const includePaths = require('rollup-plugin-includepaths');
12
+ const nodeResolve = require('rollup-plugin-node-resolve');
13
+ const commonjs = require('rollup-plugin-commonjs');
14
+
15
+ const config = {
16
+ input: join(TMP_CLIENT_DIR, BOOTSTRAP_MODULE_AOT),
17
+ treeshake: true,
18
+ output: {
19
+ sourcemap: false,
20
+ name: 'main',
21
+ },
22
+ onwarn: function(warning) {
23
+ // Evito los warning que se generan por el codigo compilado
24
+ if ((warning.code === 'THIS_IS_UNDEFINED') ||
25
+ (warning.code === 'CIRCULAR_DEPENDENCY' && !warning.importer.indexOf('node_modules\\moment\\'))
26
+ ) return;
27
+ // Cualquier otro mensaje lo logueo
28
+ console.warn(warning.message);
29
+ },
30
+ plugins: [
31
+ globals(),
32
+ builtins(),
33
+ json({
34
+ include: 'node_modules/**',
35
+ exclude: [],
36
+ preferConst: true,
37
+ indent: ' '
38
+ }),
39
+ includePaths({
40
+ include: ROLLUP_INCLUDES,
41
+ paths: [join(TMP_CLIENT_DIR, 'app')],
42
+ external: [],
43
+ extensions: ['.js', '.json', '.html', '.ts']
44
+ }),
45
+ nodeResolve({
46
+ jsnext: true,
47
+ main: true,
48
+ module: false,
49
+ browser: true,
50
+ preferBuiltins: true,
51
+ modulesOnly: false,
52
+ }),
53
+ commonjs({
54
+ include: ROLLUP_INCLUDE_DIR,
55
+ namedExports: ROLLUP_NAMED_EXPORTS,
56
+ }),
57
+ ]
58
+ };
59
+
60
+ export = (done: any) => {
61
+ rollup
62
+ .rollup(config)
63
+ .then((bundle: any) => bundle.generate({
64
+ format: 'iife',
65
+ sourcemap: PRESERVE_SOURCE_MAPS,
66
+ })
67
+ )
68
+ .then((result: any) => {
69
+ const path = join(TMP_CLIENT_DIR, 'bundle.js');
70
+
71
+ parallel(getTasks(path, result), (error: any, results: boolean[]) => {
72
+ if (error && results.indexOf(false) === -1) {
73
+ console.error(error);
74
+ process.exit(0);
75
+ }
76
+ done();
77
+ });
78
+ })
79
+ .catch((error: any) => {
80
+ console.error(error);
81
+ process.exit(0);
82
+ });
83
+ };
84
+
85
+ function getTasks(path: string, result: any): any[] {
86
+ const tasks = [
87
+ (callback: any) => {
88
+ return writeFile(
89
+ path,
90
+ result.code + (PRESERVE_SOURCE_MAPS ? '\n//# sourceMappingURL=bundle.js.map' : ''),
91
+ (error: any) => callback(null, !error)
92
+ );
93
+ }
94
+ ];
95
+ if (PRESERVE_SOURCE_MAPS) {
96
+ tasks.push((callback: any) =>
97
+ writeFile(path + '.map', result.map.toString(), (error: any) => callback(null, !error))
98
+ );
99
+ }
100
+ return tasks;
101
+ }