intermediate-component-sa 1.0.6 → 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 +4 -2
  10. package/karma.conf.js +124 -0
  11. package/package.json +326 -5
  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,718 @@
1
+ import { join, normalize } from 'path';
2
+ import { argv } from 'yargs';
3
+
4
+ // Modos de ejecucion
5
+ export const ENVIRONMENTS: Environments = {
6
+ DEVELOPMENT: 'dev',
7
+ PRODUCTION: 'prod'
8
+ };
9
+
10
+ // Configuración del proyecto.
11
+ export class ProjectConfig {
12
+
13
+ // Obtengo el ambiente (dev, prod, test).
14
+ ENV = getEnvironment();
15
+
16
+ // Datos generales de la aplicación obtenidos del packages.json.
17
+ APP_TITLE = appDescription();
18
+ APP_NAME = appName();
19
+ APP_VERSION = appVersion();
20
+
21
+ // Directorio base del proyecto
22
+ PROJECT_ROOT = join(__dirname, '../..');
23
+
24
+ // Puerto en que esucha la aplicación cliente (solo para dev).
25
+ //APP_CLIENT_PORT = 5100;
26
+ APP_CLIENT_PORT = 4210;
27
+
28
+ // Puerto en que esucha la aplicacion servidor
29
+ DEV_APP_SERVER_PORT = 9002;
30
+ PROD_APP_SERVER_PORT = 9000;
31
+ APP_SERVER_PORT = this.ENV === ENVIRONMENTS.DEVELOPMENT ? this.DEV_APP_SERVER_PORT : this.PROD_APP_SERVER_PORT;
32
+
33
+ // Ruta base de la URL de la aplicación.
34
+ APP_BASE = argv['base'] || '/';
35
+
36
+ // Ruta base de la URL de los archivos de cliente.
37
+ APP_CLIENT_BASE = '/client/';
38
+
39
+ // URL base para el api desde el cliente.
40
+ PROD_API_BASE_URL = '';
41
+ DEV_API_BASE_URL = 'http://localhost:' + this.DEV_APP_SERVER_PORT;
42
+
43
+ // Cantidad de ejecuciones en que se haran builds con typings (0 = siempre usar typings).
44
+ TYPED_COMPILE_INTERVAL = 0;
45
+
46
+ // Directorio del componete app para el bootstrap de angular.
47
+ BOOTSTRAP_DIR = 'app';
48
+
49
+ // Carpeta de la aplicación cliente.
50
+ APP_CLIENT = 'client';
51
+
52
+ // Carpeta de la aplicación servidor.
53
+ APP_SERVER = argv['server'] || 'server';
54
+
55
+ // Carpeta de la base de datos.
56
+ APP_DATABASE = argv['database'] || 'database';
57
+
58
+ // Nombre del archivo principal de la aplicación de angular.
59
+ BOOTSTRAP_MAIN = 'main';
60
+
61
+ // Nombre del archivo principal de la aplicación de angular (AOT).
62
+ BOOTSTRAP_MAIN_AOT = 'main-aot';
63
+
64
+ // Archivo principal de angular con el que se bootstrapea la aplicación de angular.
65
+ BOOTSTRAP_MODULE = this.BOOTSTRAP_DIR + '/' + this.BOOTSTRAP_MAIN;
66
+
67
+ // Archivo principal de angular con el que se bootstrapea la aplicación de angular (AOT).
68
+ BOOTSTRAP_MODULE_AOT = this.BOOTSTRAP_DIR + '/' + this.BOOTSTRAP_MAIN_AOT;
69
+
70
+ /// Carpeta de los fuentes de la aplicación cliente.
71
+ APP_CLIENT_SRC = `src/${this.APP_CLIENT}`;
72
+
73
+ // Carpeta de los fuentes de la aplicación servidor.
74
+ APP_SERVER_SRC = `src/${this.APP_SERVER}`;
75
+
76
+ // Carpeta de los fuentes de base de datos.
77
+ APP_DATABASE_SRC = `src/${this.APP_DATABASE}`;
78
+
79
+ // Carpeta de los fuentes de assets en la aplicación cliente.
80
+ ASSETS_SRC = `${this.APP_CLIENT_SRC}/assets`;
81
+
82
+ // Carpeta de los fuentes de SASS en la aplicación cliente.
83
+ CSS_SRC = `${this.ASSETS_SRC}/scss`;
84
+
85
+ // Path de los source de fonts.
86
+ FONTS_SRC = [
87
+ 'node_modules/font-awesome/fonts/**',
88
+ 'node_modules/material-design-icons/iconfont/**'
89
+ ];
90
+
91
+ // Path de los source de banderas.
92
+ FLAGS_SRC = [
93
+ 'node_modules/flag-icon-css/flags/**'
94
+ ];
95
+
96
+ // Carpeta de tools.
97
+ TOOLS_DIR = 'tools';
98
+
99
+ // Directorios para build.
100
+ DIST_DIR = 'dist';
101
+ DIST_DEV_DIR = `${this.DIST_DIR}/dev`;
102
+ DIST_PROD_DIR = `${this.DIST_DIR}/prod`;
103
+
104
+ // Directorio destino de la aplicación cliente en modo dev.
105
+ DEV_CLIENT_DEST = `${this.DIST_DEV_DIR}/${this.APP_CLIENT}`;
106
+
107
+ // Directorio destino de la aplicación cliente en modo prod.
108
+ PROD_CLIENT_DEST = `${this.DIST_PROD_DIR}/${this.APP_CLIENT}`;
109
+
110
+ // Directorio destino de la aplicación servidor en modo dev.
111
+ DEV_SERVER_DEST = `${this.DIST_DEV_DIR}/${this.APP_SERVER}`;
112
+
113
+ // Directorio destino de la aplicación servidor en modo prod.
114
+ PROD_SERVER_DEST = `${this.DIST_PROD_DIR}/${this.APP_SERVER}`;
115
+
116
+ // Directorio temporal de la aplicación cliente en modo dev.
117
+ TMP_CLIENT_DIR = `${this.DIST_DIR}/tmp_${this.APP_CLIENT}`;
118
+
119
+ // Directorio temporal de la aplicación servidor en modo dev.
120
+ TMP_SERVER_DIR = `${this.DIST_DIR}/tmp_${this.APP_SERVER}`;
121
+
122
+ // Directorio destino de la aplicación cliente.
123
+ APP_CLIENT_DEST = this.ENV === ENVIRONMENTS.DEVELOPMENT ? this.DEV_CLIENT_DEST : this.PROD_CLIENT_DEST;
124
+
125
+ // Directorio destino de la aplicación servidor.
126
+ APP_SERVER_DEST = this.ENV === ENVIRONMENTS.DEVELOPMENT ? this.DEV_SERVER_DEST : this.PROD_SERVER_DEST;
127
+
128
+ // Carpeta assets en destino.
129
+ ASSETS_DEST = `${this.APP_CLIENT_DEST}/assets`;
130
+
131
+ // Ruta de la carpeta de archivos estáticos del servidor.
132
+ SERVER_STATIC_DEST = `${this.APP_SERVER_DEST}/static`;
133
+
134
+ // Path de los source y destino de skins.
135
+ SKINS_SRC = join(this.ASSETS_SRC, 'skins');
136
+ SKINS_DEST = join(this.ASSETS_DEST, 'skins');
137
+
138
+ // Ruta destino de los archivos css.
139
+ CSS_DEST = `${this.APP_CLIENT_DEST}/css`;
140
+
141
+ // Ruta destino de los archivos css.
142
+ JS_DEST = `${this.APP_CLIENT_DEST}/js`;
143
+
144
+ // Nombre del archivo para incluir lo shims.
145
+ JS_PROD_SHIMS_BUNDLE = 'shims.js';
146
+
147
+ // Nombre de archivo para el bundle de la aplicación cliente en modo producción.
148
+ JS_PROD_APP_BUNDLE = 'app.js';
149
+
150
+ // Nombre del archivo para el bundle de estilos de la aplicación cliente.
151
+ CSS_PROD_BUNDLE = 'main.css';
152
+
153
+ // Ruta base para los estilos de los skins.
154
+ SKIN_CSS_BASE_URL = this.ENV === ENVIRONMENTS.DEVELOPMENT ? this.SKINS_DEST.replace(/\\/g, '/') : 'client/css';
155
+
156
+ // Ruta base para archivo de estilos principal
157
+ MAIN_CSS_BASE_URL = this.ENV === ENVIRONMENTS.DEVELOPMENT ? this.CSS_DEST.replace(/\\/g, '/') : 'client/css';
158
+
159
+ // Lista de reglas para el codelizer.
160
+ CODELYZER_RULES = customRules();
161
+
162
+ // Extension a usar en los archivos js estaticos del servidor.
163
+ STATIC_JS_EXTENSION = this.ENV === ENVIRONMENTS.DEVELOPMENT ? 'js' : 'min.js';
164
+
165
+ // Extension a usar en los archivos css estaticos del servidor.
166
+ STATIC_CSS_EXTENSION = this.ENV === ENVIRONMENTS.DEVELOPMENT ? 'css' : 'min.css';
167
+
168
+ // Flag para defomor si usar SASS.
169
+ ENABLE_SCSS = true;
170
+
171
+ // Flag para preservar los sourcemaps al compilar prod (se usa para el SME).
172
+ PRESERVE_SOURCE_MAPS = argv['preserve-source-maps'] || false;
173
+
174
+ // Directorio de salida para el resultado del source-map-explorer.
175
+ SME_DIR = `${this.DIST_DIR}/sme`;
176
+
177
+ // Lista de directorios a incluir para el rollup.
178
+ ROLLUP_INCLUDE_DIR: string[] = [
179
+ 'node_modules/**',
180
+ 'node_modules/atoa/**',
181
+ 'node_modules/contra/**',
182
+ 'node_modules/ticky/**',
183
+ 'node_modules/ng2-file-upload/**',
184
+ 'node_modules/ngx-clipboard/**',
185
+ 'node_modules/ngx-window-token/**',
186
+ // 'node_modules/xlsx/**',
187
+ ];
188
+
189
+ // Mapeos de librerías que el rollup no puede encontrar.
190
+ ROLLUP_INCLUDES: any = {
191
+ 'contra/emitter': 'node_modules/contra/emitter.js',
192
+ 'moment-timezone': 'node_modules/moment-timezone/index.js',
193
+ 'ngx-clipboard/src/index': 'node_modules/ngx-clipboard/esm2015/ngx-clipboard.js',
194
+ 'ngx-clipboard/src/clipboard.service': 'node_modules/ngx-clipboard/esm2015/ngx-clipboard.js',
195
+ 'ngx-clipboard/src/clipboard.directive': 'node_modules/ngx-clipboard/esm2015/ngx-clipboard.js',
196
+ 'ngx-window-token/src/index': 'node_modules/ngx-window-token/esm2015/ngx-window-token.js'
197
+ };
198
+
199
+ // Named exports para el rollup.
200
+ ROLLUP_NAMED_EXPORTS: any = {
201
+ 'node_modules/contra/emitter.js': ['contra/emitter'],
202
+ 'node_modules/ng2-file-upload/index.js': ['FileUploader'],
203
+ 'node_modules/ngx-clipboard/esm2015/ngx-clipboard.js': ['ClipboardService'],
204
+ 'node_modules/ngx-window-token/esm2015/ngx-window-token.js': ['WINDOW', '_window', 'NgxWindowTokenModule']
205
+ };
206
+
207
+ // Las opciones para pasarle al verificador de sintaxis de los SCSS.
208
+ SASS_LINT_OPTIONS = {
209
+ options: {
210
+ formatter: 'stylish',
211
+ 'merge-default-rules': true
212
+ },
213
+ rules: {
214
+ // Deshabilito algunas reglas
215
+ 'force-element-nesting': 0,
216
+ 'force-pseudo-nesting': 0,
217
+ 'nesting-depth': [1,
218
+ {
219
+ 'max-depth': 10
220
+ }
221
+ ],
222
+ 'no-color-literals': 0,
223
+ 'no-duplicate-properties': [1,
224
+ {
225
+ 'exclude': ['height', 'width', 'cursor', 'background-image']
226
+ }
227
+ ],
228
+ 'no-important': 0,
229
+ 'no-qualifying-elements': 0,
230
+ 'no-transition-all': 0,
231
+ 'no-vendor-prefixes': 0,
232
+ 'property-sort-order': 0
233
+ }
234
+ };
235
+
236
+ // Lista de librerías a inyectar en el index.html.
237
+ NPM_DEPENDENCIES: InjectableDependency[] = [
238
+ { src: 'zone.js/dist/zone.js', inject: 'libs' },
239
+ { src: 'core-js/client/shim.min.js', inject: 'shims' },
240
+ { src: 'systemjs/dist/system.src.js', inject: 'shims', env: ENVIRONMENTS.DEVELOPMENT },
241
+ { src: 'tslib/tslib.js', inject: 'libs', env: ENVIRONMENTS.DEVELOPMENT },
242
+ { src: 'rxjs/bundles/Rx.min.js', inject: 'libs', env: ENVIRONMENTS.DEVELOPMENT },
243
+ // Librerías adicionales.
244
+ { src: 'flag-icon-css/css/flag-icon.css', inject: true },
245
+ { src: 'awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css', inject: true },
246
+ { src: 'jquery/dist/jquery.min.js', inject: 'libs' },
247
+ { src: 'jquery-slimscroll/jquery.slimscroll.min.js', inject: 'libs' },
248
+ { src: 'tether/dist/js/tether.min.js', inject: 'libs' },
249
+ { src: 'bootstrap/dist/js/bootstrap.min.js', inject: 'libs' },
250
+ { src: 'hammerjs/hammer.min.js', inject: 'libs' },
251
+ { src: 'moment/min/moment.min.js', inject: 'libs' },
252
+ { src: 'validator/validator.js', inject: 'libs' },
253
+ { src: 'd3/build/d3.js', inject: 'libs' },
254
+ { src: 'jspdf/dist/jspdf.min.js', inject: 'libs' },
255
+ { src: 'jspdf-autotable/dist/jspdf.plugin.autotable.min.js', inject: 'libs' },
256
+ { src: 'raphael/raphael.js', inject: 'libs' },
257
+ { src: 'justgage/justgage.js', inject: 'libs' },
258
+ { src: 'highcharts/highcharts.js', inject: 'libs' },
259
+ { src: 'highcharts/modules/drilldown.js', inject: 'libs' },
260
+ { src: 'ion-rangeslider/js/ion.rangeSlider.min.js', inject: 'libs' },
261
+ { src: 'ion-rangeslider/css/normalize.css', inject: true },
262
+ { src: 'ion-rangeslider/css/ion.rangeSlider.css', inject: true },
263
+ { src: 'ion-rangeslider/css/ion.rangeSlider.skinHTML5.css', inject: true },
264
+ { src: 'ion-rangeslider/css/ion.rangeSlider.skinHTML5.css', inject: true },
265
+
266
+ // Librerías definidas como archivos estáticos.
267
+ // { src: join(this.PROJECT_ROOT, this.APP_SERVER_SRC, 'static/dhtmlx/codebase/fonts/font_roboto', 'roboto.css'), inject: true },
268
+ // { src: join(this.PROJECT_ROOT, this.APP_SERVER_SRC, 'static/dhtmlx/codebase', 'dhtmlxtree.css'), inject: true },
269
+ // { src: join(this.PROJECT_ROOT, this.APP_SERVER_SRC, 'static/dhtmlx/codebase', 'dhtmlxtree.js'), inject: true },
270
+ // { src: join(this.PROJECT_ROOT, this.APP_SERVER_SRC, 'static/js/audio-dashboard-highcharts-column.js'), inject: true },
271
+ // { src: join(this.PROJECT_ROOT, this.APP_SERVER_SRC, 'static/js/cloud.js'), inject: true },
272
+ // { src: join(this.PROJECT_ROOT, this.APP_SERVER_SRC, 'static/js/highcharts-bar-drilldown.js'), inject: true },
273
+ // { src: join(this.PROJECT_ROOT, this.APP_SERVER_SRC, 'static/js/search-dashboard-highcharts.js'), inject: true },
274
+ // { src: join(this.PROJECT_ROOT, this.APP_SERVER_SRC, 'static/js/study.js'), inject: true },
275
+ // { src: join(this.PROJECT_ROOT, this.APP_SERVER_SRC, 'static/js', 'tree.js'), inject: true },
276
+ // { src: join(this.PROJECT_ROOT, this.APP_SERVER_SRC, 'static/libs', 'd3-tip.js'), inject: 'libs' }
277
+ ];
278
+
279
+ // Orígenes de assets.
280
+ APP_ASSETS: InjectableDependency[] = [
281
+ { src: `${this.CSS_SRC}/main.${this.getInjectableStyleExtension()}`, inject: true, vendor: false }
282
+ ];
283
+
284
+ // Lista de archivos temporales a ignorar por el watcher y builder.
285
+ TEMP_FILES: string[] = [
286
+ '**/*___jb_tmp___',
287
+ '**/*~',
288
+ ];
289
+
290
+ // Devuelve array de dependencias a inyectar.
291
+ get DEPENDENCIES(): InjectableDependency[] {
292
+ return normalizeDependencies(this.NPM_DEPENDENCIES.filter(filterDependency.bind(null, this.ENV)))
293
+ .concat(this.APP_ASSETS.filter(filterDependency.bind(null, this.ENV)));
294
+ }
295
+
296
+ // Configuración de SystemJS para modo dev.
297
+ SYSTEM_JS_CONFIG_DEV: any = {
298
+ transpiler: 'plugin-babel',
299
+ packageConfigPaths: [
300
+ `/node_modules/*/package.json`,
301
+ `/node_modules/**/package.json`,
302
+ `/node_modules/@angular/*/package.json`,
303
+ `/node_modules/@types/*/package.json`,
304
+ `/node_modules/@ng-bootstrap/*/package.json`
305
+ ],
306
+ paths: {
307
+ [this.BOOTSTRAP_MODULE]: `${this.APP_BASE}${this.BOOTSTRAP_MODULE}`,
308
+ '@angular/animations': 'node_modules/@angular/animations/bundles/animations.umd.js',
309
+ '@angular/platform-browser/animations': 'node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
310
+ '@angular/common': 'node_modules/@angular/common/bundles/common.umd.js',
311
+ '@angular/compiler': 'node_modules/@angular/compiler/bundles/compiler.umd.js',
312
+ '@angular/core': 'node_modules/@angular/core/bundles/core.umd.js',
313
+ '@angular/forms': 'node_modules/@angular/forms/bundles/forms.umd.js',
314
+ '@angular/http': 'node_modules/@angular/http/bundles/http.umd.js',
315
+ '@angular/platform-browser': 'node_modules/@angular/platform-browser/bundles/platform-browser.umd.js',
316
+ '@angular/platform-browser-dynamic': 'node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
317
+ '@angular/router': 'node_modules/@angular/router/bundles/router.umd.js',
318
+ '@angular/animations/browser': 'node_modules/@angular/animations/bundles/animations-browser.umd.js',
319
+
320
+ '@angular/common/testing': 'node_modules/@angular/common/bundles/common-testing.umd.js',
321
+ '@angular/compiler/testing': 'node_modules/@angular/compiler/bundles/compiler-testing.umd.js',
322
+ '@angular/core/testing': 'node_modules/@angular/core/bundles/core-testing.umd.js',
323
+ '@angular/http/testing': 'node_modules/@angular/http/bundles/http-testing.umd.js',
324
+ '@angular/platform-browser/testing':
325
+ 'node_modules/@angular/platform-browser/bundles/platform-browser-testing.umd.js',
326
+ '@angular/platform-browser-dynamic/testing':
327
+ 'node_modules/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js',
328
+ '@angular/router/testing': 'node_modules/@angular/router/bundles/router-testing.umd.js',
329
+
330
+ 'app/': `${this.APP_BASE}app/`,
331
+ 'assets/': `${this.APP_BASE}assets/`,
332
+ // For test config.
333
+ 'dist/dev/': '/base/dist/dev/',
334
+ '': 'node_modules/',
335
+
336
+ // Plugin de Babel para hacer el transpile de ES6.
337
+ 'plugin-babel': `${this.APP_BASE}node_modules/systemjs-plugin-babel/plugin-babel.js`,
338
+ 'systemjs-babel-build': `${this.APP_BASE}node_modules/systemjs-plugin-babel/systemjs-babel-browser.js`,
339
+
340
+ // Paths a módulos que requieren configuracion especifica (aca solo se precisan los del lado cliente).
341
+ '@angular/cdk': `${this.APP_BASE}node_modules/@angular/cdk/bundles/cdk.umd.js`,
342
+ '@angular/material': `${this.APP_BASE}node_modules/@angular/material/bundles/material.umd.js`,
343
+ 'angular2-jwt': `${this.APP_BASE}node_modules/angular2-jwt/angular2-jwt.js`,
344
+ 'angular2-notifications': `${this.APP_BASE}node_modules/angular2-notifications/dist/index.js`,
345
+ 'angular-4-data-table': `${this.APP_BASE}node_modules/angular-4-data-table/dist/index.js`,
346
+ 'd3': `${this.APP_BASE}node_modules/d3/build/d3.js`,
347
+ 'd3-axis': `${this.APP_BASE}node_modules/d3-axis/dist/d3-axis.min.js`,
348
+ 'd3-array': `${this.APP_BASE}node_modules/d3-array/dist/d3-array.min.js`,
349
+ 'd3-brush': `${this.APP_BASE}node_modules/d3-brush/dist/d3-brush.min.js`,
350
+ 'd3-chord': `${this.APP_BASE}node_modules/d3-chord/dist/d3-chord.min.js`,
351
+ 'd3-color': `${this.APP_BASE}node_modules/d3-color/dist/d3-color.min.js`,
352
+ 'd3-collection': `${this.APP_BASE}node_modules/d3-collection/dist/d3-collection.min.js`,
353
+ 'd3-dispatch': `${this.APP_BASE}node_modules/d3-dispatch/dist/d3-dispatch.min.js`,
354
+ 'd3-format': `${this.APP_BASE}node_modules/d3-format/dist/d3-format.min.js`,
355
+ 'd3-interpolate': `${this.APP_BASE}node_modules/d3-interpolate/dist/d3-interpolate.min.js`,
356
+ 'd3-path': `${this.APP_BASE}node_modules/d3-path/dist/d3-path.min.js`,
357
+ 'd3-scale': `${this.APP_BASE}node_modules/d3-scale/dist/d3-scale.min.js`,
358
+ 'd3-shape': `${this.APP_BASE}node_modules/d3-shape/dist/d3-shape.min.js`,
359
+ 'd3-time': `${this.APP_BASE}node_modules/d3-time/dist/d3-time.min.js`,
360
+ 'd3-timer': `${this.APP_BASE}node_modules/d3-timer/dist/d3-timer.min.js`,
361
+ 'd3-ease': `${this.APP_BASE}node_modules/d3-ease/dist/d3-ease.min.js`,
362
+ 'd3-selection': `${this.APP_BASE}node_modules/d3-selection/dist/d3-selection.min.js`,
363
+ 'd3-time-format': `${this.APP_BASE}node_modules/d3-time-format/dist/d3-time-format.min.js`,
364
+ 'd3-transition': `${this.APP_BASE}node_modules/d3-transition/dist/d3-transition.min.js`,
365
+ 'raphael': `${this.APP_BASE}node_modules/raphael/raphael.js`,
366
+ 'justgage': `${this.APP_BASE}node_modules/justgage/justgage.js`,
367
+ 'highcharts': `${this.APP_BASE}node_modules/highcharts/highcharts.js`,
368
+ 'drilldown': `${this.APP_BASE}node_modules/highcharts/modules/drilldown.js`,
369
+ 'moment': `${this.APP_BASE}node_modules/moment/min/moment-with-locales.js`,
370
+ 'moment-timezone': `${this.APP_BASE}node_modules/moment-timezone/builds/moment-timezone-with-data.min.js`,
371
+ '@ng-bootstrap/ng-bootstrap': `${this.APP_BASE}node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js`,
372
+ 'ng2-tree': `${this.APP_BASE}node_modules/ng2-tree/bundles/ng2-tree.umd.js`,
373
+ 'ng2-file-upload': `${this.APP_BASE}node_modules/ng2-file-upload/ng2-file-upload.js`,
374
+ 'ngx-bootstrap': `${this.APP_BASE}node_modules/ngx-bootstrap/bundles/ngx-bootstrap.umd.min.js`,
375
+ 'ngx-clipboard': `${this.APP_BASE}node_modules/ngx-clipboard/dist/bundles/ngxClipboard.umd.js`,
376
+ 'ngx-window-token': `${this.APP_BASE}node_modules/ngx-window-token/dist/bundles/ngxWindowToken.umd.js`,
377
+ 'powerbi-api': `${this.APP_BASE}node_modules/powerbi-api/lib/index.js`,
378
+ 'powerbi-client': `${this.APP_BASE}node_modules/powerbi-client/dist/powerbi.min.js`,
379
+ 'screenfull': `${this.APP_BASE}node_modules/screenfull/dist/screenfull.js`,
380
+ 'socket.io-client': `${this.APP_BASE}node_modules/socket.io-client/dist/socket.io.js`,
381
+ 'validator': `${this.APP_BASE}node_modules/validator/validator.js`,
382
+ 'w3c-blob': `${this.APP_BASE}node_modules/w3c-blob/index.js`,
383
+ 'buffer': `${this.APP_BASE}node_modules/buffer/index.js`,
384
+ 'base64-js': `${this.APP_BASE}node_modules/base64-js/index.js`,
385
+ 'ieee754': `${this.APP_BASE}node_modules/ieee754/index.js`,
386
+ 'js-base64': `${this.APP_BASE}node_modules/js-base64/base64.js`,
387
+ 'xlsx': `${this.APP_BASE}node_modules/xlsx/dist/xlsx.full.min.js`,
388
+ 'shufflejs': `${this.APP_BASE}node_modules/shufflejs/dist/shuffle.js`
389
+ },
390
+ map: {
391
+ 'rxjs': `${this.APP_BASE}node_modules/rxjs`,
392
+ 'ts-md5': `${this.APP_BASE}node_modules/ts-md5`
393
+ },
394
+ meta: {
395
+ 'xlsx': {
396
+ exports: 'XLSX'
397
+ }
398
+ },
399
+ packages: {
400
+ [this.BOOTSTRAP_DIR]: {
401
+ defaultExtension: 'js'
402
+ },
403
+ '': {
404
+ defaultExtension: 'js'
405
+ }
406
+ }
407
+ };
408
+
409
+ // Configuración a usar del SystemJS (por defecto se usa el de modo dev).
410
+ SYSTEM_JS_CONFIG: any = this.SYSTEM_JS_CONFIG_DEV;
411
+
412
+ // Configuración de SystemJS para el builder (modo prod).
413
+ SYSTEM_JS_CONFIG_PROD: any = {
414
+ defaultJSExtensions: true,
415
+ transpiler: 'plugin-babel',
416
+ base: this.PROJECT_ROOT,
417
+ packageConfigPaths: [
418
+ join('node_modules', '*', 'package.json'),
419
+ join('node_modules', '@angular', '*', 'package.json'),
420
+ join('node_modules', '@types', '*', 'package.json'),
421
+ join('node_modules', '@ng-bootstrap', '*', 'package.json')
422
+ ],
423
+ paths: {
424
+ [`${this.TMP_CLIENT_DIR}/*`]: `${this.TMP_CLIENT_DIR}/*`,
425
+ [join(this.TMP_CLIENT_DIR, this.BOOTSTRAP_DIR, '*')]: `${this.TMP_CLIENT_DIR}/${this.BOOTSTRAP_DIR}/*`,
426
+ '@angular/platform-browser/animations': 'node_modules/@angular/platform-browser/bundles/platform-browser-animations.umd.js',
427
+ '@angular/animations/browser': 'node_modules/@angular/animations/bundles/animations-browser.umd.js',
428
+ 'dist/tmp/node_modules/*': 'dist/tmp/node_modules/*',
429
+ 'assets/*': `${this.ASSETS_DEST}/*`,
430
+ 'node_modules/*': 'node_modules/*',
431
+ '*': 'node_modules/*',
432
+
433
+ // Plugin de Babel para hacer el transpile de ES6.
434
+ 'plugin-babel': 'node_modules/systemjs-plugin-babel/plugin-babel.js',
435
+ 'systemjs-babel-build': 'node_modules/systemjs-plugin-babel/systemjs-babel-browser.js',
436
+
437
+ // Paths a módulos que requieren configuración específica.
438
+ '@angular/cdk': 'node_modules/@angular/cdk/bundles/cdk.umd.js',
439
+ '@angular/material': 'node_modules/@angular/material/bundles/material.umd.js',
440
+ 'angular2-jwt': 'node_modules/angular2-jwt/angular2-jwt.js',
441
+ 'angular2-notifications': 'node_modules/angular2-notifications/dist/index.js',
442
+ 'angular-4-data-table': 'node_modules/angular-4-data-table/dist/index.js',
443
+ 'd3': 'node_modules/d3/build/d3.js',
444
+ 'd3-axis': 'node_modules/d3-axis/dist/d3-axis.min.js',
445
+ 'd3-array': 'node_modules/d3-array/dist/d3-array.min.js',
446
+ 'd3-brush': 'node_modules/d3-brush/dist/d3-brush.min.js',
447
+ 'd3-chord': 'node_modules/d3-chord/dist/d3-chord.min.js',
448
+ 'd3-color': 'node_modules/d3-color/dist/d3-color.min.js',
449
+ 'd3-collection': 'node_modules/d3-collection/dist/d3-collection.min.js',
450
+ 'd3-dispatch': 'node_modules/d3-dispatch/dist/d3-dispatch.min.js',
451
+ 'd3-format': 'node_modules/d3-format/dist/d3-format.min.js',
452
+ 'd3-interpolate': 'node_modules/d3-interpolate/dist/d3-interpolate.min.js',
453
+ 'd3-path': 'node_modules/d3-path/dist/d3-path.min.js',
454
+ 'd3-scale': 'node_modules/d3-scale/dist/d3-scale.min.js',
455
+ 'd3-shape': 'node_modules/d3-shape/dist/d3-shape.min.js',
456
+ 'd3-time': 'node_modules/d3-time/dist/d3-time.min.js',
457
+ 'd3-timer': 'node_modules/d3-timer/dist/d3-timer.min.js',
458
+ 'd3-ease': 'node_modules/d3-ease/dist/d3-ease.min.js',
459
+ 'd3-selection': 'node_modules/d3-selection/dist/d3-selection.min.js',
460
+ 'd3-time-format': 'node_modules/d3-time-format/dist/d3-time-format.min.js',
461
+ 'd3-transition': 'node_modules/d3-transition/dist/d3-transition.min.js',
462
+ 'raphael': 'node_modules/raphael/raphael.js',
463
+ 'justgage': 'node_modules/justgage/justgage.js',
464
+ 'highcharts': 'node_modules/highcharts/highcharts.js',
465
+ 'drilldown': 'node_modules/highcharts/modules/drilldown.js',
466
+ 'moment': 'node_modules/moment/min/moment-with-locales.js',
467
+ 'moment-timezone': 'node_modules/moment-timezone/builds/moment-timezone-with-data.min.js',
468
+ '@ng-bootstrap/ng-bootstrap': 'node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js',
469
+ 'ng2-tree': 'node_modules/ng2-tree/bundles/ng2-tree.umd.js',
470
+ 'ng2-file-upload': 'node_modules/ng2-file-upload/ng2-file-upload.js',
471
+ 'ngx-bootstrap': 'node_modules/ngx-bootstrap/bundles/ngx-bootstrap.umd.min.js',
472
+ 'ngx-clipboard': 'node_modules/ngx-clipboard/dist/bundles/ngxClipboard.umd.js',
473
+ 'ngx-window-token': 'node_modules/ngx-window-token/dist/bundles/ngxWindowToken.umd.js',
474
+ 'powerbi-api': 'node_modules/powerbi-api/lib/index.js',
475
+ 'powerbi-client': 'node_modules/powerbi-client/dist/powerbi.min.js',
476
+ 'socket.io-client': 'node_modules/socket.io-client/dist/socket.io.js',
477
+ 'screenfull': 'node_modules/screenfull/dist/screenfull.js',
478
+ 'validator': 'node_modules/validator/validator.js',
479
+ 'w3c-blob': 'node_modules/w3c-blob/index.js',
480
+ 'buffer': 'node_modules/buffer/index.js',
481
+ 'base64-js': 'node_modules/base64-js/index.js',
482
+ 'ieee754': 'node_modules/ieee754/index.js',
483
+ 'js-base64': 'node_modules/js-base64/base64.js',
484
+ 'xlsx': 'node_modules/xlsx/dist/xlsx.full.min.js',
485
+ 'shufflejs': 'node_modules/shufflejs/dist/shuffle.js'
486
+ },
487
+ packages: {
488
+ '@angular/animations': {
489
+ main: 'bundles/animations.umd.js',
490
+ defaultExtension: 'js'
491
+ },
492
+ '@angular/common': {
493
+ main: 'bundles/common.umd.js',
494
+ defaultExtension: 'js'
495
+ },
496
+ '@angular/compiler': {
497
+ main: 'bundles/compiler.umd.js',
498
+ defaultExtension: 'js'
499
+ },
500
+ '@angular/core/testing': {
501
+ main: 'bundles/core-testing.umd.js',
502
+ defaultExtension: 'js'
503
+ },
504
+ '@angular/core': {
505
+ main: 'bundles/core.umd.js',
506
+ defaultExtension: 'js'
507
+ },
508
+ '@angular/forms': {
509
+ main: 'bundles/forms.umd.js',
510
+ defaultExtension: 'js'
511
+ },
512
+ '@angular/http': {
513
+ main: 'bundles/http.umd.js',
514
+ defaultExtension: 'js'
515
+ },
516
+ '@angular/platform-browser': {
517
+ main: 'bundles/platform-browser.umd.js',
518
+ defaultExtension: 'js'
519
+ },
520
+ '@angular/platform-browser-dynamic': {
521
+ main: 'bundles/platform-browser-dynamic.umd.js',
522
+ defaultExtension: 'js'
523
+ },
524
+ '@angular/router': {
525
+ main: 'bundles/router.umd.js',
526
+ defaultExtension: 'js'
527
+ },
528
+ '@angular/service-worker': {
529
+ main: 'bundles/service-worker.umd.js',
530
+ defaultExtension: 'js'
531
+ },
532
+ 'rxjs': {
533
+ main: 'Rx.js',
534
+ defaultExtension: 'js'
535
+ }
536
+ },
537
+ meta: {
538
+ 'xlsx': {
539
+ exports: 'XLSX'
540
+ }
541
+ }
542
+ };
543
+
544
+ // Configuración para el autoprefixer de css.
545
+ BROWSER_LIST = [
546
+ 'ie >= 10',
547
+ 'ie_mob >= 10',
548
+ 'ff >= 30',
549
+ 'chrome >= 34',
550
+ 'safari >= 7',
551
+ 'opera >= 23',
552
+ 'ios >= 7',
553
+ 'android >= 4.4',
554
+ 'bb >= 10'
555
+ ];
556
+
557
+ // Lista de colores para cologuard.
558
+ COLOR_GUARD_WHITE_LIST: [string, string][] = [
559
+ ];
560
+
561
+ // Configuración para el plugin de templates.
562
+ TEMPLATE_CONFIG = {
563
+
564
+ // Used to detect `data` property values to be HTML-escaped.
565
+ escape: /<%-([\s\S]+?)%>/g,
566
+
567
+ // Used to detect code to be evaluated.
568
+ evaluate: /<%([\s\S]+?)%>/g,
569
+
570
+ // Used to detect `data` property values to inject.
571
+ interpolate: /<%=([\s\S]+?)%>/g,
572
+
573
+ // Used to reference the data object in the template text.
574
+ variable: ''
575
+ };
576
+
577
+ // Configuración de plugins.
578
+ PLUGIN_CONFIGS: any = {
579
+ /**
580
+ * The BrowserSync configuration of the application.
581
+ * The default open behavior is to open the browser. To prevent the browser from opening use the `--b` flag when
582
+ * running `npm start` (tested with serve.dev).
583
+ * Example: `npm start -- --b`
584
+ * @type {any}
585
+ */
586
+ 'browser-sync': {
587
+ middleware: [require('connect-history-api-fallback')({ index: `${this.APP_BASE}index.html` })],
588
+ port: this.APP_CLIENT_PORT,
589
+ startPath: this.APP_BASE,
590
+ open: argv['b'] ? false : true,
591
+ injectChanges: false,
592
+ server: {
593
+ baseDir: `${this.DIST_DIR}/empty/`,
594
+ routes: {
595
+ [`${this.APP_BASE}${this.APP_CLIENT_SRC}`]: this.APP_CLIENT_SRC,
596
+ [`${this.APP_BASE}${this.APP_CLIENT_DEST}`]: this.APP_CLIENT_DEST,
597
+ [`${this.APP_BASE}${this.APP_SERVER_SRC}`]: this.APP_SERVER_SRC,
598
+ [`${this.APP_BASE}${this.APP_SERVER_DEST}`]: this.APP_SERVER_DEST,
599
+ [`${this.APP_BASE}static`]: this.SERVER_STATIC_DEST,
600
+ [`${this.APP_BASE}node_modules`]: 'node_modules',
601
+ [`${this.APP_BASE}client`]: this.APP_CLIENT_DEST,
602
+ [`${this.APP_BASE.replace(/\/$/, '')}`]: this.APP_CLIENT_DEST,
603
+ }
604
+ }
605
+ },
606
+
607
+ // Note: you can customize the location of the file.
608
+ 'environment-config': join(this.PROJECT_ROOT, this.TOOLS_DIR, 'env'),
609
+
610
+ /**
611
+ * The options to pass to gulp-sass (and then to node-sass).
612
+ * Reference: https://github.com/sass/node-sass#options
613
+ * @type {object}
614
+ */
615
+ 'gulp-sass': {
616
+ includePaths: ['./node_modules/']
617
+ },
618
+
619
+ /**
620
+ * The options to pass to gulp-concat-css.
621
+ * Reference: https://github.com/mariocasciaro/gulp-concat-css
622
+ * @type {object}
623
+ */
624
+ 'gulp-concat-css': {
625
+ targetFile: this.CSS_PROD_BUNDLE,
626
+ options: {
627
+ rebaseUrls: false
628
+ }
629
+ }
630
+ };
631
+
632
+ // Devuelve la configuracion de un plugin.
633
+ getPluginConfig(pluginKey: string): any {
634
+ if (this.PLUGIN_CONFIGS[pluginKey]) {
635
+ return this.PLUGIN_CONFIGS[pluginKey];
636
+ }
637
+ return null;
638
+ }
639
+
640
+ // Devuelve la extension a usar para estilos.
641
+ getInjectableStyleExtension() {
642
+ return this.ENV === ENVIRONMENTS.PRODUCTION && this.ENABLE_SCSS ? 'scss' : 'css';
643
+ }
644
+
645
+ // Devuelve un timestamp en base a la fecha actual
646
+ getTimeStamp = function(): string {
647
+ return Date.now().toString();
648
+ }
649
+ }
650
+
651
+ // Normaliza las dependencias.
652
+ export function normalizeDependencies(deps: InjectableDependency[]) {
653
+ deps
654
+ .filter((d: InjectableDependency) => !/\*/.test(d.src)) // Skip globs.
655
+ .forEach((d: InjectableDependency) => d.src = require.resolve(d.src));
656
+ return deps;
657
+ }
658
+
659
+ // Devuelve true si la dependencia se usa en un tipo de ambiente.
660
+ function filterDependency(env: string, d: InjectableDependency): boolean {
661
+ if (!d.env) {
662
+ d.env = Object.keys(ENVIRONMENTS).map(k => ENVIRONMENTS[k]);
663
+ }
664
+ if (!(d.env instanceof Array)) {
665
+ (<any>d).env = [d.env];
666
+ }
667
+ return d.env.indexOf(env) >= 0;
668
+ }
669
+
670
+ // Devuelve el nombre de la aplicación.
671
+ function appName(): string {
672
+ var pkg = require('../../package.json');
673
+ return pkg.name;
674
+ }
675
+
676
+ // Devuelve la version de la aplicación.
677
+ function appVersion(): number | string {
678
+ var pkg = require('../../package.json');
679
+ return pkg.version;
680
+ }
681
+
682
+ // Devuelve la descripcion de la aplicación.
683
+ function appDescription(): string {
684
+ var pkg = require('../../package.json');
685
+ return pkg.description;
686
+ }
687
+
688
+ // Devuelve la lista de reglas del tslint para codelyzer.
689
+ function customRules(): string[] {
690
+ var lintConf = require('../../tslint.json');
691
+ return lintConf.rulesDirectory;
692
+ }
693
+
694
+ // Devuelve el environment de la aplicación.
695
+ function getEnvironment() {
696
+ let base: string[] = argv['_'];
697
+ let prodKeyword = !!base.filter(o => o.indexOf(ENVIRONMENTS.PRODUCTION) >= 0).pop();
698
+ let env = (argv['env'] || '').toLowerCase();
699
+ if ((base && prodKeyword) || env === ENVIRONMENTS.PRODUCTION) {
700
+ return ENVIRONMENTS.PRODUCTION;
701
+ } else {
702
+ return ENVIRONMENTS.DEVELOPMENT;
703
+ }
704
+ }
705
+
706
+ // Interfaces.
707
+ interface InjectableDependency {
708
+ src: string;
709
+ inject: string | boolean;
710
+ vendor?: boolean;
711
+ env?: string[] | string;
712
+ }
713
+
714
+ interface Environments {
715
+ DEVELOPMENT: string;
716
+ PRODUCTION: string;
717
+ [key: string]: string;
718
+ }