intermediate-component-sa 1.1.0 → 1.1.1

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 (163) hide show
  1. package/app.server.js +7 -0
  2. package/client/css/main.css +1 -0
  3. package/{src/client → client}/index.html +6 -40
  4. package/client/js/app.js +1 -0
  5. package/client/js/shims.js +17 -0
  6. package/{src/client → client}/tsconfig.json +0 -0
  7. package/package.json +75 -340
  8. package/{src/server/config/app.config.ts → server/config/app.config.js} +47 -57
  9. package/server/config/jwt.config.js +4 -0
  10. package/{src/server/config/logger.config.ts → server/config/logger.config.js} +142 -161
  11. package/server/config/mssql.config.js +32 -0
  12. package/server/config/redis.config.js +8 -0
  13. package/server/config/server.config.js +12 -0
  14. package/server/config/templates.config.js +23 -0
  15. package/server/crypt.js +29 -0
  16. package/server/customRequest.js +370 -0
  17. package/server/index.js +125 -0
  18. package/server/interfaces/cleaner.interface.js +2 -0
  19. package/server/interfaces/supervisor.interface.js +2 -0
  20. package/{src/server/routes-centralized.ts → server/routes-centralized.js} +37 -36
  21. package/server/routes.js +7 -0
  22. package/server/services/index.js +8 -0
  23. package/server/services/routes.service.js +18 -0
  24. package/server/shared/file-manager.js +616 -0
  25. package/server/shared/http.shared.js +39 -0
  26. package/server/shared/promises.shared.js +14 -0
  27. package/server/shared/security.shared.js +52 -0
  28. package/{src/server → server}/ssl/star_inconcertcc_com.key +0 -0
  29. package/{src/server → server}/ssl/star_inconcertcc_com.pem +0 -0
  30. package/CHANGELOG.md +0 -11
  31. package/README.md +0 -1
  32. package/build-dev.bat +0 -2
  33. package/build-prod-aot.bat +0 -2
  34. package/build-prod-rollup-aot.bat +0 -2
  35. package/build-prod.bat +0 -2
  36. package/config.ts +0 -4
  37. package/gulpfile.ts +0 -172
  38. package/index.js +0 -12
  39. package/karma.conf.js +0 -124
  40. package/postgrator-test.json +0 -9
  41. package/postgrator.json +0 -9
  42. package/src/app.server.ts +0 -4
  43. package/src/client/app/app.component.ts +0 -37
  44. package/src/client/app/app.html +0 -6
  45. package/src/client/app/app.module.ts +0 -36
  46. package/src/client/app/app.routing.ts +0 -7
  47. package/src/client/app/hot_loader_main.ts +0 -14
  48. package/src/client/app/main-aot.ts +0 -8
  49. package/src/client/app/main.ts +0 -8
  50. package/src/client/app/rxjs-operators.ts +0 -15
  51. package/src/server/config/jwt.config.ts +0 -4
  52. package/src/server/config/mssql.config.ts +0 -30
  53. package/src/server/config/redis.config.ts +0 -10
  54. package/src/server/config/server.config.ts +0 -20
  55. package/src/server/config/templates.config.ts +0 -41
  56. package/src/server/crypt.ts +0 -37
  57. package/src/server/customRequest.ts +0 -609
  58. package/src/server/index.ts +0 -231
  59. package/src/server/interfaces/cleaner.interface.ts +0 -3
  60. package/src/server/interfaces/supervisor.interface.ts +0 -3
  61. package/src/server/routes.ts +0 -6
  62. package/src/server/services/index.ts +0 -10
  63. package/src/server/services/routes.service.ts +0 -11
  64. package/src/server/shared/file-manager.ts +0 -1007
  65. package/src/server/shared/http.shared.ts +0 -49
  66. package/src/server/shared/promises.shared.ts +0 -13
  67. package/src/server/shared/security.shared.ts +0 -90
  68. package/src/server/tsconfig.json +0 -38
  69. package/tools/build.js.prod.ts +0 -40
  70. package/tools/config/project.config.ts +0 -718
  71. package/tools/config.ts +0 -4
  72. package/tools/database/SchemaZen.exe +0 -0
  73. package/tools/database/generate-all-data-scripts.bat +0 -32
  74. package/tools/database/generate-database-scripts.bat +0 -36
  75. package/tools/debug.ts +0 -17
  76. package/tools/env/base.ts +0 -8
  77. package/tools/env/dev.ts +0 -9
  78. package/tools/env/env-config.interface.ts +0 -1
  79. package/tools/env/prod.ts +0 -10
  80. package/tools/manual_typings/project/sample.package.d.ts +0 -3
  81. package/tools/manual_typings/seed/angular2-hot-loader.d.ts +0 -9
  82. package/tools/manual_typings/seed/autoprefixer.d.ts +0 -13
  83. package/tools/manual_typings/seed/colorguard.d.ts +0 -15
  84. package/tools/manual_typings/seed/connect-livereload.d.ts +0 -5
  85. package/tools/manual_typings/seed/cssnano.d.ts +0 -18
  86. package/tools/manual_typings/seed/doiuse.d.ts +0 -16
  87. package/tools/manual_typings/seed/express-history-api-fallback.d.ts +0 -18
  88. package/tools/manual_typings/seed/istream.d.ts +0 -10
  89. package/tools/manual_typings/seed/karma.d.ts +0 -12
  90. package/tools/manual_typings/seed/merge-stream.d.ts +0 -8
  91. package/tools/manual_typings/seed/open.d.ts +0 -8
  92. package/tools/manual_typings/seed/postcss-reporter.d.ts +0 -20
  93. package/tools/manual_typings/seed/slash.d.ts +0 -5
  94. package/tools/manual_typings/seed/stylelint.d.ts +0 -16
  95. package/tools/manual_typings/seed/systemjs-builder.d.ts +0 -10
  96. package/tools/manual_typings/seed/tildify.d.ts +0 -5
  97. package/tools/manual_typings/seed/tiny-lr.d.ts +0 -10
  98. package/tools/manual_typings/seed/walk.d.ts +0 -10
  99. package/tools/scripts/install.speech-analytic.sh +0 -35
  100. package/tools/tasks/build.app.server.ts +0 -57
  101. package/tools/tasks/build.assets.dev.ts +0 -19
  102. package/tools/tasks/build.assets.prod.ts +0 -31
  103. package/tools/tasks/build.bundles.app.aot.ts +0 -31
  104. package/tools/tasks/build.bundles.app.rollup.aot.ts +0 -101
  105. package/tools/tasks/build.bundles.app.ts +0 -31
  106. package/tools/tasks/build.bundles.ts +0 -45
  107. package/tools/tasks/build.database.scripts.runner.ts +0 -137
  108. package/tools/tasks/build.database.scripts.ts +0 -27
  109. package/tools/tasks/build.flags.ts +0 -9
  110. package/tools/tasks/build.fonts.ts +0 -9
  111. package/tools/tasks/build.html_css.ts +0 -126
  112. package/tools/tasks/build.index.dev.ts +0 -68
  113. package/tools/tasks/build.index.prod.ts +0 -64
  114. package/tools/tasks/build.js.dev.ts +0 -66
  115. package/tools/tasks/build.js.prod.aot.ts +0 -44
  116. package/tools/tasks/build.js.prod.rollup.aot.ts +0 -50
  117. package/tools/tasks/build.js.prod.ts +0 -40
  118. package/tools/tasks/build.packages.prod.ts +0 -19
  119. package/tools/tasks/build.server.dev.ts +0 -59
  120. package/tools/tasks/build.server.prod.ts +0 -31
  121. package/tools/tasks/build.server.statics.ts +0 -24
  122. package/tools/tasks/build.skins.ts +0 -51
  123. package/tools/tasks/build.sme.prod.aot.ts +0 -6
  124. package/tools/tasks/build.sme.prod.rollup.aot.ts +0 -6
  125. package/tools/tasks/build.sme.prod.ts +0 -6
  126. package/tools/tasks/build.tar.prod.ts +0 -17
  127. package/tools/tasks/build.test.database.scripts.ts +0 -52
  128. package/tools/tasks/clean.dev.ts +0 -7
  129. package/tools/tasks/clean.prod.ts +0 -7
  130. package/tools/tasks/compile.ahead.prod.ts +0 -65
  131. package/tools/tasks/copy.client.js.prod.rollup.aot.ts +0 -33
  132. package/tools/tasks/copy.client.js.prod.ts +0 -18
  133. package/tools/tasks/copy.server.assets.ts +0 -38
  134. package/tools/tasks/copy.server.js.prod.ts +0 -16
  135. package/tools/tasks/css-lint.ts +0 -58
  136. package/tools/tasks/e2e.ts +0 -32
  137. package/tools/tasks/karma.run.ts +0 -18
  138. package/tools/tasks/karma.watch.ts +0 -9
  139. package/tools/tasks/minify.server.statics.ts +0 -52
  140. package/tools/tasks/server.prod.ts +0 -6
  141. package/tools/tasks/server.start.ts +0 -6
  142. package/tools/tasks/test.database.ts +0 -6
  143. package/tools/tasks/transpile.bundles.rollup.aot.ts +0 -43
  144. package/tools/tasks/tslint.ts +0 -64
  145. package/tools/tasks/watch.file.changes.dev.ts +0 -37
  146. package/tools/tasks/watch.key.press.dev.ts +0 -116
  147. package/tools/tasks/webdriver.ts +0 -6
  148. package/tools/utils/project/sample_util.ts +0 -18
  149. package/tools/utils/project.utils.ts +0 -4
  150. package/tools/utils/seed/build_optimizer.ts +0 -26
  151. package/tools/utils/seed/clean.ts +0 -35
  152. package/tools/utils/seed/code_change_tools.ts +0 -38
  153. package/tools/utils/seed/karma.start.ts +0 -10
  154. package/tools/utils/seed/server.ts +0 -43
  155. package/tools/utils/seed/sme.ts +0 -51
  156. package/tools/utils/seed/tasks_tools.ts +0 -70
  157. package/tools/utils/seed/template_locals.ts +0 -64
  158. package/tools/utils/seed/tsproject.ts +0 -25
  159. package/tools/utils/seed.utils.ts +0 -11
  160. package/tools/utils.ts +0 -5
  161. package/tsconfig.json +0 -33
  162. package/tslint.json +0 -120
  163. package/utils.ts +0 -5
@@ -1,31 +0,0 @@
1
- import { join } from 'path';
2
- import * as Builder from 'systemjs-builder';
3
-
4
- import {
5
- BOOTSTRAP_MODULE,
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),
27
- join(JS_DEST, JS_PROD_APP_BUNDLE),
28
- BUNDLER_OPTIONS)
29
- .then(() => done())
30
- .catch((err: any) => done(err));
31
- };
@@ -1,45 +0,0 @@
1
- import * as gulp from 'gulp';
2
- import * as gulpLoadPlugins from 'gulp-load-plugins';
3
- import * as merge from 'merge-stream';
4
-
5
- import { DEPENDENCIES, JS_DEST, JS_PROD_SHIMS_BUNDLE } from '../config';
6
-
7
- const plugins = <any>gulpLoadPlugins();
8
-
9
- // Uso uglify-es para soportar ES6
10
- var uglifyEs = require('uglify-es');
11
- var composer = require('gulp-uglify/composer');
12
- var minify = composer(uglifyEs, console);
13
-
14
- /**
15
- * Executes the build process, bundling the shim files.
16
- */
17
- export = () => merge(bundleShims());
18
-
19
- /**
20
- * Returns the shim files to be injected.
21
- */
22
- function getShims() {
23
- let libs = DEPENDENCIES
24
- .filter(d => /\.js$/.test(d.src));
25
-
26
- return libs.filter(l => l.inject === 'shims')
27
- .concat(libs.filter(l => l.inject === 'libs'))
28
- .concat(libs.filter(l => l.inject === true))
29
- .map(l => l.src);
30
- }
31
-
32
- /**
33
- * Bundles the shim files.
34
- */
35
- function bundleShims() {
36
- return gulp.src(getShims())
37
- // Strip comments and sourcemaps
38
- .pipe(minify({
39
- mangle: false
40
- }))
41
- .pipe(plugins.concat(JS_PROD_SHIMS_BUNDLE))
42
- // Strip the first (global) 'use strict' added by reflect-metadata, but don't strip any others to avoid unintended scope leaks.
43
- .pipe(plugins.replace(/('|")use strict\1;var Reflect;/, 'var Reflect;'))
44
- .pipe(gulp.dest(JS_DEST));
45
- }
@@ -1,137 +0,0 @@
1
- import { APP_NAME, APP_VERSION, DIST_DIR, APP_DATABASE_SRC } from '../config';
2
- //import { MSSQL_TESTING_CONFIG_CREATE, MSSQL_TESTING_CONFIG_USAGE } from '../../src/server/config/mssql.testing.config';
3
- import { MSSQL_CONFIG } from '../../src/server/config/mssql.config';
4
- import * as log4js from 'log4js';
5
-
6
- // En el proyecto de speechanalytics no hay configuracion para testing
7
- const MSSQL_TESTING_CONFIG_CREATE: any = MSSQL_CONFIG;
8
- const MSSQL_TESTING_CONFIG_USAGE: any = MSSQL_CONFIG;
9
-
10
- let sql = require('mssql');
11
- let logger = log4js.getLogger('Sql');
12
-
13
- export function createDataBase(): (done: () => void) => void {
14
- return done => {
15
- let promises: Promise<boolean>[] = [];
16
- var queries = readProcessFile(APP_NAME + '_' + APP_VERSION + '_testing_database.sql');
17
- queries.forEach(function(query:string){
18
- if (query && query !== ' ') {
19
- promises.push(makeBulk(query, true).then());
20
- }
21
- });
22
-
23
- Promise.all(promises)
24
- .then(() => {
25
- logger.info('Data base creation finished with ' + promises.length + ' queries.');
26
- createStructure(done);
27
- }).catch(function(err) {
28
- if (err.toString().includes('Database \'InconcertTesting\' already exists. Choose a different database name')) {
29
- logger.info('Database already exist ...');
30
- done();
31
- }
32
- });
33
- };
34
- }
35
-
36
- function createStructure(callback:any) {
37
- let promises: Promise<boolean>[] = [];
38
- logger.info('Creating Testing Tables');
39
- var queries = readProcessFile(APP_NAME + '_' + APP_VERSION + '_testing_structure.sql');
40
- queries.forEach(function(query:string){
41
- if (query && query !== ' ') {
42
- promises.push(makeBulk(query, false).then());
43
- }
44
- });
45
-
46
- Promise.all(promises).then(() => {
47
- logger.info('Data base structure finished with ' + promises.length + ' queries.');
48
- createProcedures(callback);
49
- });
50
- }
51
-
52
- function createProcedures(callback:any) {
53
- let promises: Promise<boolean>[] = [];
54
- logger.info('Creating Procedures');
55
- var queries = readProcessFile(APP_NAME + '_' + APP_VERSION + '_testing_procedures.sql');
56
- queries.forEach(function(query:string){
57
- if (query && query !== ' ') {
58
- promises.push(makeBulk(query, false).then());
59
- }
60
- });
61
- Promise.all(promises).then(() => {
62
- logger.info('Data base procedures finished with ' + promises.length + ' queries.');
63
- insertData(callback);
64
- });
65
- }
66
-
67
- function insertData(callback:any) {
68
- let promises: Promise<boolean>[] = [];
69
- logger.info('Insert Testing Data');
70
- let queries: any = readProcessFile(APP_NAME + '_' + APP_VERSION + '_testing_data.sql');
71
- queries.forEach(function(query:string){
72
- if (query && query !== ' ') {
73
- promises.push(makeBulk(query, false).then());
74
- }
75
- });
76
- Promise.all(promises).then(() => {
77
- logger.info('Data insert finished with ' + promises.length + ' queries.');
78
- endDataBaseRestore(callback);
79
- });
80
- }
81
-
82
- function endDataBaseRestore(callback:any) {
83
- logger.info('Testing DataBase restore Finished');
84
- callback();
85
- }
86
-
87
- function readProcessFile(fileName:string): any {
88
- var fs = require('fs');
89
- var path = require('path');
90
- var filePath = path.join(DIST_DIR, fileName);
91
-
92
- return fs.readFileSync(filePath, 'utf-8')
93
- .replace(/InconcertOnline/g, MSSQL_TESTING_CONFIG_USAGE.database)
94
- .replace(/USE(.*?)$\n/gm,'')
95
- .replace(/SET(.*?)$\nGO/gm,'')
96
- .replace(/END;/gm,'END')
97
- .replace(/--(.*?)$/gm,'')
98
- .replace(/(\r\n|\n|\r|\t)/gm,' ')
99
- .replace(/ /gm,' ')
100
- .replace(/ /gm,' ')
101
- .split('GO');
102
- }
103
-
104
- function makeBulk(query:string, create:boolean):Promise <boolean> {
105
- let connection: any;
106
- if (create) {
107
- connection = MSSQL_TESTING_CONFIG_CREATE;
108
- } else {
109
- connection = MSSQL_TESTING_CONFIG_USAGE;
110
-
111
- }
112
- return new sql.connect(connection)
113
- .then(
114
- (result: any) => {
115
- return new sql.Request(result)
116
- .batch(query)
117
- .then((dump: any) => {
118
- result.close();
119
- return Promise.resolve(true);
120
- })
121
- .catch((err: any) => {
122
- if ( err.toString().indexOf('Choose a different database name') === 0 ) {
123
- logger.error(' Execution Error: ' +err);
124
- logger.error(query);
125
- }
126
- return Promise.reject(err);
127
- });
128
- }
129
- ).catch(
130
- (err: any) => {
131
- if ( err.toString().indexOf('Choose a different database name') === 0 ) {
132
- logger.error('Connection Error: ' + err.message);
133
- }
134
- return Promise.reject(err);
135
- }
136
- );
137
- }
@@ -1,27 +0,0 @@
1
- import * as gulp from 'gulp';
2
- import * as gulpLoadPlugins from 'gulp-load-plugins';
3
- import { resolve } from 'path';
4
-
5
- import { APP_NAME, APP_VERSION, DIST_DIR, APP_DATABASE_SRC } from '../config';
6
-
7
- const plugins = <any>gulpLoadPlugins();
8
-
9
- const scripts = [
10
- resolve(APP_DATABASE_SRC, 'mssql', 'database.sql'),
11
- resolve(APP_DATABASE_SRC, 'mssql', 'props.sql'),
12
- resolve(APP_DATABASE_SRC, 'mssql', 'schemas.sql'),
13
- resolve(APP_DATABASE_SRC, 'mssql', 'users', '**'),
14
- resolve(APP_DATABASE_SRC, 'mssql', 'tables', '**'),
15
- resolve(APP_DATABASE_SRC, 'mssql', 'functions', '**'),
16
- resolve(APP_DATABASE_SRC, 'mssql', 'procedures', '**'),
17
- resolve(APP_DATABASE_SRC, 'mssql', 'data', '**'),
18
- resolve(APP_DATABASE_SRC, 'mssql', 'initial', '**')
19
- ];
20
-
21
- export = () => {
22
- return gulp.src(scripts,{allowEmpty: true})
23
- .pipe(plugins.count('## sql files selected for bundle'))
24
- .pipe(plugins.concat(APP_NAME + '_' + APP_VERSION + '_database.sql'))
25
- .pipe(plugins.replace(/CREATE OR ALTER/g, 'CREATE'))
26
- .pipe(gulp.dest(resolve(DIST_DIR)));
27
- };
@@ -1,9 +0,0 @@
1
- import * as gulp from 'gulp';
2
- import { join } from 'path';
3
-
4
- import { FLAGS_SRC, APP_CLIENT_DEST } from '../config';
5
-
6
- export = () => {
7
- return gulp.src(FLAGS_SRC)
8
- .pipe(gulp.dest(join(APP_CLIENT_DEST, 'flags')));
9
- };
@@ -1,9 +0,0 @@
1
- import * as gulp from 'gulp';
2
- import { join } from 'path';
3
-
4
- import { FONTS_SRC, APP_CLIENT_DEST } from '../config';
5
-
6
- export = () => {
7
- return gulp.src(FONTS_SRC)
8
- .pipe(gulp.dest(join(APP_CLIENT_DEST, 'fonts')));
9
- };
@@ -1,126 +0,0 @@
1
- import * as autoprefixer from 'autoprefixer';
2
- import * as cssnano from 'cssnano';
3
- import * as gulp from 'gulp';
4
- import * as gulpLoadPlugins from 'gulp-load-plugins';
5
- import * as merge from 'merge-stream';
6
- import * as log from 'fancy-log';
7
- import { Chalk } from 'chalk';
8
- import { join } from 'path';
9
- import { noop, dummyStream } from '../utils';
10
-
11
- import {
12
- APP_CLIENT_DEST,
13
- APP_CLIENT_SRC,
14
- BROWSER_LIST,
15
- CSS_DEST,
16
- CSS_SRC,
17
- DEPENDENCIES,
18
- ENV,
19
- TMP_CLIENT_DIR,
20
- getPluginConfig,
21
- } from '../config';
22
-
23
- // Obtengo plugins de gulp
24
- const plugins = <any>gulpLoadPlugins();
25
- const cleanCss = require('gulp-clean-css');
26
- const gulpConcatCssConfig = getPluginConfig('gulp-concat-css');
27
- const chalk: Chalk = require('chalk');
28
-
29
- const processors = [
30
- autoprefixer({
31
- browsers: BROWSER_LIST
32
- })
33
- ];
34
-
35
- const reportPostCssError = (e: any) => log(chalk.red(e.message));
36
-
37
- // Obtengo lag de modo producción
38
- const isProd = ENV === 'prod';
39
-
40
- if (isProd) {
41
- processors.push(
42
- cssnano({
43
- discardComments: {removeAll: true},
44
- discardUnused: false, // unsafe, see http://goo.gl/RtrzwF
45
- zindex: false, // unsafe, see http://goo.gl/vZ4gbQ
46
- reduceIdents: false // unsafe, see http://goo.gl/tNOPv0
47
- })
48
- );
49
- }
50
-
51
- // Copia todos los archivos HTML a la carpeta tmp_client
52
- function CopyHtmlFilesToTmp() {
53
- return gulp.src(join(APP_CLIENT_SRC, '**', '*.html'), { base: APP_CLIENT_SRC })
54
- .pipe(gulp.dest(TMP_CLIENT_DIR));
55
- }
56
-
57
- // Procesa y genera los archivos de estilos de componentes de la aplicación
58
- function GenerateComponentsStylesheets() {
59
- return gulp.src(join(APP_CLIENT_SRC, '**', '*.scss'), { base: APP_CLIENT_SRC })
60
- .pipe(isProd ? plugins.cached('process-component-scss') : noop())
61
- .pipe(isProd ? plugins.progeny() : noop())
62
- .pipe(isProd ? noop() : plugins.sourcemaps.init())
63
- .pipe(plugins.sass(getPluginConfig('gulp-sass')).on('error', plugins.sass.logError))
64
- .pipe(plugins.postcss(processors))
65
- .on('error', reportPostCssError)
66
- .pipe(isProd ? noop() : plugins.sourcemaps.write('', {
67
- sourceMappingURL: function(file) {
68
- return '/dist/dev/client/' + file.relative.replace(/\\/g, '/') + '.map';
69
- }
70
- }))
71
- .pipe(gulp.dest(isProd ? TMP_CLIENT_DIR : APP_CLIENT_DEST));
72
- }
73
-
74
- // Procesa y genera los archivos de estilos main y de dependencias externas
75
- function GenerateMainAndExternalStylesheets() {
76
- // Obtengo la combinación de streams para CSS y SCSS y los proceso
77
- return merge(GetMainScssStream(), GetExternalCssStream(), GetExternalScssStream())
78
- .pipe(isProd ? plugins.concatCss(gulpConcatCssConfig.targetFile, gulpConcatCssConfig.options) : noop())
79
- .pipe(plugins.postcss(processors))
80
- .on('error', reportPostCssError)
81
- .pipe(isProd ? cleanCss() : noop())
82
- .pipe(gulp.dest(CSS_DEST));
83
- }
84
-
85
- // Genera el stream de archivos SCSS para procesamiento de dependencias externas
86
- function GetMainScssStream() {
87
- // Devuelvo el array de los archivos, pasados por un cache
88
- return gulp.src([
89
- join(CSS_SRC, '**', '*.scss'),
90
- '!' + join(CSS_SRC, '**', '_*.scss')
91
- ], { base: CSS_SRC })
92
- .pipe(isProd ? plugins.cached('process-external-scss') : noop())
93
- .pipe(isProd ? plugins.progeny() : noop())
94
- .pipe(plugins.sass(getPluginConfig('gulp-sass')).on('error', plugins.sass.logError));
95
- }
96
-
97
- // Genera el stream de archivos CSS para procesamiento de dependencias externas
98
- function GetExternalCssStream() {
99
- // Armo el array de dependencias CSS a incluir
100
- let globArray: string[] = DEPENDENCIES.filter(dep => /\.css$/.test(dep.src)).map(dep => dep.src);
101
- // Si el array es vacío, no sigo (falla gulp)
102
- if (!globArray || !globArray.length) return dummyStream();
103
- // Devuelvo el array de los archivos, pasados por un cache
104
- return gulp.src(globArray,{allowEmpty: true})
105
- .pipe(isProd ? plugins.cached('process-external-css') : noop());
106
- }
107
-
108
- // Genera el stream de archivos SCSS para procesamiento de dependencias externas
109
- function GetExternalScssStream() {
110
- // Armo el array de dependencias SCSS a incluir
111
- let globArray: string[] = DEPENDENCIES.filter(dep => /\.scss$/.test(dep.src)).map(dep => dep.src);
112
- // Si el array es vacío, no sigo (falla gulp)
113
- if (!globArray || !globArray.length) return dummyStream();
114
- // Devuelvo el array de los archivos, pasados por un cache
115
- return gulp.src(globArray,{allowEmpty: true})
116
- .pipe(isProd ? plugins.cached('process-external-scss') : noop())
117
- .pipe(isProd ? plugins.progeny() : noop())
118
- .pipe(plugins.sass(getPluginConfig('gulp-sass')).on('error', plugins.sass.logError));
119
- }
120
-
121
- // Ejecuta y combina todas las tareas en un stream mergeado
122
- export = () => merge(
123
- CopyHtmlFilesToTmp(),
124
- GenerateComponentsStylesheets(),
125
- GenerateMainAndExternalStylesheets()
126
- );
@@ -1,68 +0,0 @@
1
- import * as gulp from 'gulp';
2
- import * as gulpLoadPlugins from 'gulp-load-plugins';
3
- import * as merge from 'merge-stream';
4
- import * as slash from 'slash';
5
- import * as replace from 'gulp-replace';
6
- import { join } from 'path';
7
-
8
- import { APP_BASE, APP_CLIENT_DEST, APP_CLIENT_SRC, DEPENDENCIES, CSS_DEST, ASSETS_SRC, TEMPLATE_CONFIG } from '../config';
9
- import { TemplateLocalsBuilder } from '../utils';
10
-
11
- const plugins = <any>gulpLoadPlugins();
12
-
13
-
14
- // Función para inyectar librerías y shims en index.html para caso ambiente de desarrollo
15
- function buildIndex() {
16
- return gulp.src(join(APP_CLIENT_SRC, 'index.html'), { base: APP_CLIENT_SRC })
17
- .pipe(inject('shims'))
18
- .pipe(inject('libs'))
19
- .pipe(inject())
20
- .pipe(plugins.template(new TemplateLocalsBuilder().withStringifiedSystemConfigDev().build(), TEMPLATE_CONFIG))
21
- .pipe(gulp.dest(APP_CLIENT_DEST));
22
- }
23
-
24
- /**
25
- * Injects the file with the given name.
26
- * @param {string} name - The file to be injected.
27
- */
28
- function inject(name?: string) {
29
- return plugins.inject(gulp.src(getInjectablesDependenciesRef(name), { read: false }), {
30
- name,
31
- transform: transformPath()
32
- });
33
- }
34
-
35
- /**
36
- * Returns the injectable dependency, mapping its filename to its path.
37
- * @param {string} name - The dependency to be mapped.
38
- */
39
- function getInjectablesDependenciesRef(name?: string) {
40
- return DEPENDENCIES
41
- .filter(dep => dep['inject'] && dep['inject'] === (name || true))
42
- .map(mapPath);
43
- }
44
-
45
- /**
46
- * Maps the path of the given dependency to its path according to the applications environment.
47
- * @param {any} dep - The dependency to be mapped.
48
- */
49
- function mapPath(dep: any) {
50
- let envPath = dep.src;
51
- if (envPath.startsWith(APP_CLIENT_SRC) && !envPath.endsWith('.scss')) {
52
- envPath = join(APP_CLIENT_DEST, envPath.replace(APP_CLIENT_SRC, ''));
53
- } else if (envPath.startsWith(APP_CLIENT_SRC) && envPath.endsWith('.scss')) {
54
- envPath = envPath.replace(ASSETS_SRC, CSS_DEST).replace('.scss', '.css');
55
- }
56
- return envPath;
57
- }
58
-
59
- /**
60
- * Transform the path of a dependency to its location within the `dist` directory according to the applications
61
- * environment.
62
- */
63
- function transformPath() {
64
- return function (filepath: string) {
65
- arguments[0] = join(APP_BASE, filepath) + `?${Date.now()}`;
66
- return slash(plugins.inject.transform.apply(plugins.inject.transform, arguments));
67
- };
68
- }
@@ -1,64 +0,0 @@
1
- import * as gulp from 'gulp';
2
- import * as gulpLoadPlugins from 'gulp-load-plugins';
3
- import * as merge from 'merge-stream';
4
- import * as slash from 'slash';
5
- import * as replace from 'gulp-replace';
6
- import { join, sep, normalize } from 'path';
7
-
8
- import { APP_CLIENT_BASE, APP_CLIENT_DEST, APP_CLIENT_SRC, CSS_DEST, JS_DEST, JS_PROD_APP_BUNDLE, JS_PROD_SHIMS_BUNDLE, TEMPLATE_CONFIG } from '../config';
9
- import { TemplateLocalsBuilder } from '../utils';
10
-
11
- // Obtengo plugins de gulp
12
- const plugins = <any>gulpLoadPlugins();
13
-
14
- // Función para inyectar dependencias js y css en index.html para caso ambiente de prodcción
15
- function buildIndex() {
16
- return gulp.src(join(APP_CLIENT_SRC, 'index.html'), { base: APP_CLIENT_SRC })
17
- .pipe(injectJs())
18
- .pipe(injectCss())
19
- .pipe(plugins.template(new TemplateLocalsBuilder().withStringifiedSystemConfigDev().build(), TEMPLATE_CONFIG))
20
- .pipe(replace(/<!--.*-->/g, ''))
21
- .pipe(replace(/\s+(\r\n|\r|\n)/g, '\r\n'))
22
- .pipe(replace(/(\r\n|\r|\n){2,}/gm, '\r\n'))
23
- .pipe(gulp.dest(APP_CLIENT_DEST));
24
- }
25
-
26
- // Función para hacer inyección de un array de archivos
27
- function inject(...files: Array<string>) {
28
- return plugins.inject(gulp.src(files, { read: false }), {
29
- files,
30
- transform: transformPath()
31
- });
32
- }
33
-
34
- // Inyecta los archivos JS de shims y app
35
- function injectJs() {
36
- return inject(join(JS_DEST, JS_PROD_SHIMS_BUNDLE), join(JS_DEST, JS_PROD_APP_BUNDLE));
37
- }
38
-
39
- // Inyecta los archivos CSS existentes
40
- function injectCss() {
41
- return inject(
42
- join(CSS_DEST, '**', '*.css'),
43
- '!' + join(CSS_DEST, 'main.css'),
44
- '!' + join(CSS_DEST, '**', 'skin-*.css')
45
- );
46
- }
47
-
48
- // Hace la transformación del path del archivo para inyectar
49
- function transformPath() {
50
- return function(filepath: string) {
51
- let path: Array<string> = normalize(filepath).split(sep);
52
- let slice_after = path.indexOf(APP_CLIENT_DEST);
53
- if (slice_after>-1) {
54
- slice_after++;
55
- } else {
56
- slice_after = 4;
57
- }
58
- arguments[0] = APP_CLIENT_BASE + path.slice(slice_after, path.length).join(sep) + `?${Date.now()}`;
59
- return slash(plugins.inject.transform.apply(plugins.inject.transform, arguments));
60
- };
61
- }
62
-
63
- // Ejecuto todos los builds juntos
64
- export = () => merge(buildIndex());
@@ -1,66 +0,0 @@
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 } from 'path';
7
-
8
- import { APP_CLIENT_DEST, APP_CLIENT_SRC, BOOTSTRAP_MODULE_AOT, TOOLS_DIR, TYPED_COMPILE_INTERVAL, 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 de los archivos typescript del cliente
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_CLIENT_SRC, '**/*.ts'),
29
- '!' + join(APP_CLIENT_SRC, '/' + BOOTSTRAP_MODULE_AOT + '.ts'),
30
- '!' + join(APP_CLIENT_SRC, '**/*.spec.ts'),
31
- '!' + join(APP_CLIENT_SRC, '**/*.e2e-spec.ts'),
32
- ]);
33
-
34
- // Solo uso los typings en la primer compilación
35
- if (firstTime) {
36
- // La primera vez ejecuto build usando los typings manuales
37
- tsProject = makeTsProject({}, APP_CLIENT_SRC);
38
- projectFiles = merge(typings, projectFiles);
39
- } else {
40
- // Las siguientes los hago typeless para acelerar
41
- tsProject = makeTsProject({ /* isolatedModules: true */ }, APP_CLIENT_SRC);
42
- projectFiles = projectFiles.pipe(plugins.cached());
43
- log('Fastbuild ' + chalk.cyan('Ejecutando compilación typeless.'));
44
- }
45
-
46
- // Actualizo flag
47
- firstTime = false;
48
-
49
- // Inicializo proyecto
50
- let result: any = projectFiles
51
- .pipe(plugins.plumber())
52
- .pipe(plugins.sourcemaps.init())
53
- .pipe(tsProject());
54
-
55
- return result.js
56
- .pipe(plugins.sourcemaps.write())
57
- // Use for debugging with Webstorm/IntelliJ
58
- // https://github.com/mgechev/angular-seed/issues/1220
59
- // .pipe(plugins.sourcemaps.write('.', {
60
- // includeContent: false,
61
- // sourceRoot: (file: any) =>
62
- // relative(file.path, Config.PROJECT_ROOT + '/' + Config.APP_SRC).replace(sep, '/') + '/' + Config.APP_SRC
63
- // }))
64
- .pipe(plugins.template(new TemplateLocalsBuilder().withStringifiedSystemConfigDev().build(), TEMPLATE_CONFIG))
65
- .pipe(gulp.dest(APP_CLIENT_DEST));
66
- };
@@ -1,44 +0,0 @@
1
- import { readdirSync, lstatSync } from 'fs';
2
- import * as gulp from 'gulp';
3
- import * as gulpLoadPlugins from 'gulp-load-plugins';
4
- import { join } from 'path';
5
-
6
- import { TMP_CLIENT_DIR, TOOLS_DIR, BOOTSTRAP_DIR, BOOTSTRAP_MAIN_AOT, BOOTSTRAP_MODULE_AOT, TEMPLATE_CONFIG } from '../config';
7
- import { makeTsProject, ngBuildOptimizer, TemplateLocalsBuilder } from '../utils';
8
-
9
- const plugins = <any>gulpLoadPlugins();
10
-
11
- /**
12
- * Executes the build process, transpiling the TypeScript files for the production environment.
13
- */
14
- export = () => {
15
-
16
- const tsProject = makeTsProject({}, TMP_CLIENT_DIR);
17
-
18
- const toIgnore = readdirSync(TMP_CLIENT_DIR)
19
- .filter((f: string) => lstatSync(join(TMP_CLIENT_DIR, f)).isDirectory() && f !== BOOTSTRAP_DIR)
20
- .map((f: string) => '!' + join(TMP_CLIENT_DIR, f, BOOTSTRAP_MAIN_AOT + '.ts'));
21
-
22
- const src = [
23
- TOOLS_DIR + '/manual_typings/**/*.d.ts',
24
- join(TMP_CLIENT_DIR, '**/*.ts'),
25
- join(TMP_CLIENT_DIR, `${BOOTSTRAP_MODULE_AOT}.ts`),
26
- ...toIgnore
27
- ];
28
-
29
- const result = gulp
30
- .src(src)
31
- .pipe(plugins.plumber())
32
- .pipe(tsProject())
33
- .once('error', function(e: any) {
34
- this.once('finish', () => process.exit(1));
35
- });
36
-
37
- return result.js
38
- .pipe(plugins.template(new TemplateLocalsBuilder().withStringifiedSystemConfigDev().build(), TEMPLATE_CONFIG))
39
- .pipe(ngBuildOptimizer())
40
- .pipe(gulp.dest(TMP_CLIENT_DIR))
41
- .on('error', (e: any) => {
42
- console.log(e);
43
- });
44
- };
@@ -1,50 +0,0 @@
1
- import { readdirSync, lstatSync } from 'fs';
2
- import * as gulp from 'gulp';
3
- import * as gulpLoadPlugins from 'gulp-load-plugins';
4
- import { join } from 'path';
5
-
6
- import { TMP_CLIENT_DIR, TOOLS_DIR, BOOTSTRAP_DIR, BOOTSTRAP_MAIN_AOT, TEMPLATE_CONFIG } from '../config';
7
- import { makeTsProject, ngBuildOptimizer, TemplateLocalsBuilder } from '../utils';
8
-
9
- const plugins = <any>gulpLoadPlugins();
10
-
11
- /**
12
- * Executes the build process, transpiling the TypeScript files for the production environment.
13
- */
14
- export = () => {
15
-
16
- const tsProject = makeTsProject(
17
- {
18
- target: 'es2015',
19
- module: 'es2015',
20
- moduleResolution: 'node'
21
- },
22
- TMP_CLIENT_DIR
23
- );
24
-
25
- const toIgnore = readdirSync(TMP_CLIENT_DIR)
26
- .filter((f: string) => lstatSync(join(TMP_CLIENT_DIR, f)).isDirectory() && f !== BOOTSTRAP_DIR)
27
- .map((f: string) => '!' + join(TMP_CLIENT_DIR, f, BOOTSTRAP_MAIN_AOT + '.ts'));
28
-
29
- const src = [
30
- join(TOOLS_DIR, '/manual_typings/**/*.d.ts'),
31
- join(TMP_CLIENT_DIR, '**/*.ts'),
32
- ...toIgnore
33
- ];
34
-
35
- const result = gulp
36
- .src(src)
37
- .pipe(plugins.plumber())
38
- .pipe(tsProject())
39
- .once('error', function(e: any) {
40
- this.once('finish', () => process.exit(1));
41
- });
42
-
43
- return result.js
44
- .pipe(plugins.template(new TemplateLocalsBuilder().withStringifiedSystemConfigDev().build(), TEMPLATE_CONFIG))
45
- .pipe(ngBuildOptimizer())
46
- .pipe(gulp.dest(TMP_CLIENT_DIR))
47
- .on('error', (e: any) => {
48
- console.log(e);
49
- });
50
- };