intermediate-component-sa 1.1.0 → 1.1.2
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.
- package/app.server.js +7 -0
- package/client/css/main.css +1 -0
- package/{src/client → client}/index.html +6 -40
- package/client/js/app.js +1 -0
- package/client/js/shims.js +17 -0
- package/package.json +75 -340
- package/{src/server/config/app.config.ts → server/config/app.config.js} +47 -57
- package/server/config/jwt.config.js +4 -0
- package/{src/server/config/logger.config.ts → server/config/logger.config.js} +142 -161
- package/server/config/mssql.config.js +32 -0
- package/server/config/redis.config.js +8 -0
- package/server/config/server.config.js +12 -0
- package/server/config/templates.config.js +23 -0
- package/server/crypt.js +29 -0
- package/server/customRequest.js +373 -0
- package/server/index.js +125 -0
- package/server/interfaces/cleaner.interface.js +2 -0
- package/server/interfaces/supervisor.interface.js +2 -0
- package/{src/server/routes-centralized.ts → server/routes-centralized.js} +39 -36
- package/server/routes.js +7 -0
- package/server/services/index.js +8 -0
- package/server/services/routes.service.js +18 -0
- package/server/shared/file-manager.js +616 -0
- package/server/shared/http.shared.js +39 -0
- package/server/shared/promises.shared.js +14 -0
- package/server/shared/security.shared.js +52 -0
- package/CHANGELOG.md +0 -11
- package/README.md +0 -1
- package/build-dev.bat +0 -2
- package/build-prod-aot.bat +0 -2
- package/build-prod-rollup-aot.bat +0 -2
- package/build-prod.bat +0 -2
- package/config.ts +0 -4
- package/gulpfile.ts +0 -172
- package/index.js +0 -12
- package/karma.conf.js +0 -124
- package/postgrator-test.json +0 -9
- package/postgrator.json +0 -9
- package/src/app.server.ts +0 -4
- package/src/client/app/app.component.ts +0 -37
- package/src/client/app/app.html +0 -6
- package/src/client/app/app.module.ts +0 -36
- package/src/client/app/app.routing.ts +0 -7
- package/src/client/app/hot_loader_main.ts +0 -14
- package/src/client/app/main-aot.ts +0 -8
- package/src/client/app/main.ts +0 -8
- package/src/client/app/rxjs-operators.ts +0 -15
- package/src/server/config/jwt.config.ts +0 -4
- package/src/server/config/mssql.config.ts +0 -30
- package/src/server/config/redis.config.ts +0 -10
- package/src/server/config/server.config.ts +0 -20
- package/src/server/config/templates.config.ts +0 -41
- package/src/server/crypt.ts +0 -37
- package/src/server/customRequest.ts +0 -609
- package/src/server/index.ts +0 -231
- package/src/server/interfaces/cleaner.interface.ts +0 -3
- package/src/server/interfaces/supervisor.interface.ts +0 -3
- package/src/server/routes.ts +0 -6
- package/src/server/services/index.ts +0 -10
- package/src/server/services/routes.service.ts +0 -11
- package/src/server/shared/file-manager.ts +0 -1007
- package/src/server/shared/http.shared.ts +0 -49
- package/src/server/shared/promises.shared.ts +0 -13
- package/src/server/shared/security.shared.ts +0 -90
- package/src/server/tsconfig.json +0 -38
- package/tools/build.js.prod.ts +0 -40
- package/tools/config/project.config.ts +0 -718
- package/tools/config.ts +0 -4
- package/tools/database/SchemaZen.exe +0 -0
- package/tools/database/generate-all-data-scripts.bat +0 -32
- package/tools/database/generate-database-scripts.bat +0 -36
- package/tools/debug.ts +0 -17
- package/tools/env/base.ts +0 -8
- package/tools/env/dev.ts +0 -9
- package/tools/env/env-config.interface.ts +0 -1
- package/tools/env/prod.ts +0 -10
- package/tools/manual_typings/project/sample.package.d.ts +0 -3
- package/tools/manual_typings/seed/angular2-hot-loader.d.ts +0 -9
- package/tools/manual_typings/seed/autoprefixer.d.ts +0 -13
- package/tools/manual_typings/seed/colorguard.d.ts +0 -15
- package/tools/manual_typings/seed/connect-livereload.d.ts +0 -5
- package/tools/manual_typings/seed/cssnano.d.ts +0 -18
- package/tools/manual_typings/seed/doiuse.d.ts +0 -16
- package/tools/manual_typings/seed/express-history-api-fallback.d.ts +0 -18
- package/tools/manual_typings/seed/istream.d.ts +0 -10
- package/tools/manual_typings/seed/karma.d.ts +0 -12
- package/tools/manual_typings/seed/merge-stream.d.ts +0 -8
- package/tools/manual_typings/seed/open.d.ts +0 -8
- package/tools/manual_typings/seed/postcss-reporter.d.ts +0 -20
- package/tools/manual_typings/seed/slash.d.ts +0 -5
- package/tools/manual_typings/seed/stylelint.d.ts +0 -16
- package/tools/manual_typings/seed/systemjs-builder.d.ts +0 -10
- package/tools/manual_typings/seed/tildify.d.ts +0 -5
- package/tools/manual_typings/seed/tiny-lr.d.ts +0 -10
- package/tools/manual_typings/seed/walk.d.ts +0 -10
- package/tools/scripts/install.speech-analytic.sh +0 -35
- package/tools/tasks/build.app.server.ts +0 -57
- package/tools/tasks/build.assets.dev.ts +0 -19
- package/tools/tasks/build.assets.prod.ts +0 -31
- package/tools/tasks/build.bundles.app.aot.ts +0 -31
- package/tools/tasks/build.bundles.app.rollup.aot.ts +0 -101
- package/tools/tasks/build.bundles.app.ts +0 -31
- package/tools/tasks/build.bundles.ts +0 -45
- package/tools/tasks/build.database.scripts.runner.ts +0 -137
- package/tools/tasks/build.database.scripts.ts +0 -27
- package/tools/tasks/build.flags.ts +0 -9
- package/tools/tasks/build.fonts.ts +0 -9
- package/tools/tasks/build.html_css.ts +0 -126
- package/tools/tasks/build.index.dev.ts +0 -68
- package/tools/tasks/build.index.prod.ts +0 -64
- package/tools/tasks/build.js.dev.ts +0 -66
- package/tools/tasks/build.js.prod.aot.ts +0 -44
- package/tools/tasks/build.js.prod.rollup.aot.ts +0 -50
- package/tools/tasks/build.js.prod.ts +0 -40
- package/tools/tasks/build.packages.prod.ts +0 -19
- package/tools/tasks/build.server.dev.ts +0 -59
- package/tools/tasks/build.server.prod.ts +0 -31
- package/tools/tasks/build.server.statics.ts +0 -24
- package/tools/tasks/build.skins.ts +0 -51
- package/tools/tasks/build.sme.prod.aot.ts +0 -6
- package/tools/tasks/build.sme.prod.rollup.aot.ts +0 -6
- package/tools/tasks/build.sme.prod.ts +0 -6
- package/tools/tasks/build.tar.prod.ts +0 -17
- package/tools/tasks/build.test.database.scripts.ts +0 -52
- package/tools/tasks/clean.dev.ts +0 -7
- package/tools/tasks/clean.prod.ts +0 -7
- package/tools/tasks/compile.ahead.prod.ts +0 -65
- package/tools/tasks/copy.client.js.prod.rollup.aot.ts +0 -33
- package/tools/tasks/copy.client.js.prod.ts +0 -18
- package/tools/tasks/copy.server.assets.ts +0 -38
- package/tools/tasks/copy.server.js.prod.ts +0 -16
- package/tools/tasks/css-lint.ts +0 -58
- package/tools/tasks/e2e.ts +0 -32
- package/tools/tasks/karma.run.ts +0 -18
- package/tools/tasks/karma.watch.ts +0 -9
- package/tools/tasks/minify.server.statics.ts +0 -52
- package/tools/tasks/server.prod.ts +0 -6
- package/tools/tasks/server.start.ts +0 -6
- package/tools/tasks/test.database.ts +0 -6
- package/tools/tasks/transpile.bundles.rollup.aot.ts +0 -43
- package/tools/tasks/tslint.ts +0 -64
- package/tools/tasks/watch.file.changes.dev.ts +0 -37
- package/tools/tasks/watch.key.press.dev.ts +0 -116
- package/tools/tasks/webdriver.ts +0 -6
- package/tools/utils/project/sample_util.ts +0 -18
- package/tools/utils/project.utils.ts +0 -4
- package/tools/utils/seed/build_optimizer.ts +0 -26
- package/tools/utils/seed/clean.ts +0 -35
- package/tools/utils/seed/code_change_tools.ts +0 -38
- package/tools/utils/seed/karma.start.ts +0 -10
- package/tools/utils/seed/server.ts +0 -43
- package/tools/utils/seed/sme.ts +0 -51
- package/tools/utils/seed/tasks_tools.ts +0 -70
- package/tools/utils/seed/template_locals.ts +0 -64
- package/tools/utils/seed/tsproject.ts +0 -25
- package/tools/utils/seed.utils.ts +0 -11
- package/tools/utils.ts +0 -5
- package/tsconfig.json +0 -33
- package/tslint.json +0 -120
- package/utils.ts +0 -5
- /package/{src/client → client}/tsconfig.json +0 -0
- /package/{src/server → server}/ssl/star_inconcertcc_com.key +0 -0
- /package/{src/server → server}/ssl/star_inconcertcc_com.pem +0 -0
|
@@ -1,52 +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 { join } from 'path';
|
|
5
|
-
|
|
6
|
-
import { APP_SERVER_DEST } from '../config';
|
|
7
|
-
|
|
8
|
-
const plugins = <any>gulpLoadPlugins();
|
|
9
|
-
const cleanCss = require('gulp-clean-css');
|
|
10
|
-
|
|
11
|
-
// Uso uglify-es para soportar ES6
|
|
12
|
-
var uglifyEs = require('uglify-es');
|
|
13
|
-
var composer = require('gulp-uglify/composer');
|
|
14
|
-
var minify = composer(uglifyEs, console);
|
|
15
|
-
|
|
16
|
-
// Minifica los archivos estaticos js y css del lado servidor
|
|
17
|
-
export = () => {
|
|
18
|
-
|
|
19
|
-
function minifyStaticJs() {
|
|
20
|
-
|
|
21
|
-
let src = [
|
|
22
|
-
join(APP_SERVER_DEST, 'static/js/*.js'),
|
|
23
|
-
'!' + join(APP_SERVER_DEST, 'static/js/*.min.js')
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
return gulp.src(src, {base: APP_SERVER_DEST + '/static/js'})
|
|
27
|
-
.pipe(minify({
|
|
28
|
-
mangle: true
|
|
29
|
-
}))
|
|
30
|
-
.pipe(plugins.rename(function(path: any) {
|
|
31
|
-
path.extname = '.min' + path.extname;
|
|
32
|
-
}))
|
|
33
|
-
.pipe(gulp.dest(join(APP_SERVER_DEST, 'static/js')));
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function minifyStaticCss() {
|
|
37
|
-
|
|
38
|
-
let src = [
|
|
39
|
-
join(APP_SERVER_DEST, 'static/css/*.css'),
|
|
40
|
-
'!' + join(APP_SERVER_DEST, 'static/css/*.min.css')
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
return gulp.src(src, {base: APP_SERVER_DEST + '/static/css'})
|
|
44
|
-
.pipe(cleanCss())
|
|
45
|
-
.pipe(plugins.rename(function(path: any) {
|
|
46
|
-
path.extname = '.min' + path.extname;
|
|
47
|
-
}))
|
|
48
|
-
.pipe(gulp.dest(join(APP_SERVER_DEST, 'static/css')));
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return merge(minifyStaticJs(), minifyStaticCss());
|
|
52
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as gulp from 'gulp';
|
|
2
|
-
import * as gulpLoadPlugins from 'gulp-load-plugins';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
|
|
5
|
-
import { TMP_CLIENT_DIR, JS_DEST, JS_PROD_APP_BUNDLE, TEMPLATE_CONFIG, PRESERVE_SOURCE_MAPS } from '../config';
|
|
6
|
-
import { makeTsProject } from '../utils';
|
|
7
|
-
import { TemplateLocalsBuilder } from '../utils/seed/template_locals';
|
|
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
|
-
const tsProject = makeTsProject(
|
|
16
|
-
{
|
|
17
|
-
allowJs: true,
|
|
18
|
-
declaration: false,
|
|
19
|
-
noFallthroughCasesInSwitch: false
|
|
20
|
-
},
|
|
21
|
-
TMP_CLIENT_DIR
|
|
22
|
-
);
|
|
23
|
-
const src = [join(TMP_CLIENT_DIR, 'bundle.js')];
|
|
24
|
-
const result = gulp
|
|
25
|
-
.src(src)
|
|
26
|
-
.pipe(plugins.plumber())
|
|
27
|
-
.pipe(
|
|
28
|
-
PRESERVE_SOURCE_MAPS ? plugins.sourcemaps.init({ loadMaps: true, largeFile: true }) : plugins.util.noop()
|
|
29
|
-
)
|
|
30
|
-
.pipe(tsProject())
|
|
31
|
-
.once('error', function(e: any) {
|
|
32
|
-
this.once('finish', () => process.exit(1));
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return result.js
|
|
36
|
-
.pipe(PRESERVE_SOURCE_MAPS ? plugins.sourcemaps.write() : plugins.util.noop())
|
|
37
|
-
.pipe(plugins.template(new TemplateLocalsBuilder().build(), TEMPLATE_CONFIG))
|
|
38
|
-
.pipe(plugins.rename(JS_PROD_APP_BUNDLE))
|
|
39
|
-
.pipe(gulp.dest(JS_DEST))
|
|
40
|
-
.on('error', (e: any) => {
|
|
41
|
-
console.log(e);
|
|
42
|
-
});
|
|
43
|
-
};
|
package/tools/tasks/tslint.ts
DELETED
|
@@ -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 tslint from 'tslint';
|
|
5
|
-
import { join } from 'path';
|
|
6
|
-
|
|
7
|
-
import { APP_CLIENT_SRC, APP_SERVER_SRC, CODELYZER_RULES, TOOLS_DIR } from '../config';
|
|
8
|
-
|
|
9
|
-
const plugins = <any>gulpLoadPlugins();
|
|
10
|
-
|
|
11
|
-
// Ejecuta el chequeo de tslint para todos los archivos .ts y .js usando las validaciones nativas y algunas de codelyzer
|
|
12
|
-
export = () => {
|
|
13
|
-
|
|
14
|
-
function lintClientSources() {
|
|
15
|
-
|
|
16
|
-
let src = [
|
|
17
|
-
join(APP_CLIENT_SRC, '**/*.ts'),
|
|
18
|
-
'!' + join(APP_CLIENT_SRC, '**/*.d.ts')
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
// Obtengo objeto programa ts para habilitar el type-checking en el tslint
|
|
22
|
-
let program: any = tslint.Linter.createProgram('src/client/tsconfig.json');
|
|
23
|
-
|
|
24
|
-
return gulp.src(src)
|
|
25
|
-
.pipe(plugins.tslint({
|
|
26
|
-
program: program,
|
|
27
|
-
formatter: 'verbose',
|
|
28
|
-
rulesDirectory: CODELYZER_RULES
|
|
29
|
-
}))
|
|
30
|
-
.pipe(plugins.tslint.report({
|
|
31
|
-
emitError: require('is-ci'),
|
|
32
|
-
sort: true,
|
|
33
|
-
bell: true
|
|
34
|
-
}));
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function lintServerAndToolsSources() {
|
|
38
|
-
|
|
39
|
-
let src = [
|
|
40
|
-
join(APP_SERVER_SRC, '**/*.ts'),
|
|
41
|
-
'!' + join(APP_SERVER_SRC, '**/*.d.ts'),
|
|
42
|
-
join(APP_SERVER_SRC, 'static/js/*.js'),
|
|
43
|
-
join(TOOLS_DIR, '**/*.ts'),
|
|
44
|
-
'!' + join(TOOLS_DIR, '**/*.d.ts')
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
// Obtengo objeto programa ts para habilitar el type-checking en el tslint
|
|
48
|
-
let program: any = tslint.Linter.createProgram('tsconfig.json');
|
|
49
|
-
|
|
50
|
-
return gulp.src(src)
|
|
51
|
-
.pipe(plugins.tslint({
|
|
52
|
-
//program: program,
|
|
53
|
-
formatter: 'verbose',
|
|
54
|
-
rulesDirectory: CODELYZER_RULES
|
|
55
|
-
}))
|
|
56
|
-
.pipe(plugins.tslint.report({
|
|
57
|
-
emitError: require('is-ci'),
|
|
58
|
-
sort: true,
|
|
59
|
-
bell: true
|
|
60
|
-
}));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return merge(lintClientSources(), lintServerAndToolsSources());
|
|
64
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as gulpLoadPlugins from 'gulp-load-plugins';
|
|
2
|
-
import * as runSequence from 'gulp4-run-sequence';
|
|
3
|
-
import * as gulp from 'gulp';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
|
|
6
|
-
import { APP_CLIENT_SRC, APP_SERVER_SRC, TEMP_FILES } from '../config';
|
|
7
|
-
import { notifyLiveReload } from '../utils';
|
|
8
|
-
|
|
9
|
-
// Obtengo plugins de gulp
|
|
10
|
-
const plugins = <any>gulpLoadPlugins();
|
|
11
|
-
|
|
12
|
-
// Lista de carpetas y archivos a mirar
|
|
13
|
-
let paths: string[] = [
|
|
14
|
-
path.join(APP_CLIENT_SRC, '**'),
|
|
15
|
-
path.join(APP_SERVER_SRC, '**')
|
|
16
|
-
].concat(
|
|
17
|
-
TEMP_FILES.map(p => '!' + p)
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
// Espera cambios en los archivos y dispara tarea
|
|
21
|
-
function watchFileChanges(taskname: string) {
|
|
22
|
-
// Devuelvo funcion que ejecuta la tarea
|
|
23
|
-
return function () {
|
|
24
|
-
|
|
25
|
-
// Ejecuto el watch
|
|
26
|
-
plugins.watch(paths, (e: any) =>
|
|
27
|
-
// Cuando se da un cambio disparo nueva ejecucion del evento recibido
|
|
28
|
-
runSequence(
|
|
29
|
-
taskname,
|
|
30
|
-
() => notifyLiveReload(e)
|
|
31
|
-
)
|
|
32
|
-
);
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// Ejecuto el build y me quedo esperando cambios en archivos para reinicar el proceso
|
|
37
|
-
export = watchFileChanges('build.dev');
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import * as runSequence from 'gulp4-run-sequence';
|
|
3
|
-
import * as gulp from 'gulp';
|
|
4
|
-
import * as tty from 'tty';
|
|
5
|
-
|
|
6
|
-
import { APP_CLIENT_SRC, APP_SERVER_SRC, TEMP_FILES } from '../config';
|
|
7
|
-
import { notifyLiveReload } from '../utils';
|
|
8
|
-
import { Chalk } from 'chalk';
|
|
9
|
-
|
|
10
|
-
// Obtengo plugins de gulp
|
|
11
|
-
const chalk: Chalk = require('chalk');
|
|
12
|
-
|
|
13
|
-
// Libreria para capturar eventos de keypress
|
|
14
|
-
let keypress: any = require('keypress');
|
|
15
|
-
|
|
16
|
-
// Flag para sañalizar si se esta compilando
|
|
17
|
-
let buildInProcess: boolean = false;
|
|
18
|
-
|
|
19
|
-
// Lista de teclas para recompilar (ENTER)
|
|
20
|
-
let recompileKeys: string[] = [
|
|
21
|
-
'\r',
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
// Lista de teclas para salir (CTRL + C)
|
|
25
|
-
let exitKeys: string[] = [
|
|
26
|
-
'\u0003',
|
|
27
|
-
];
|
|
28
|
-
|
|
29
|
-
// Asocio el proceso al keypress
|
|
30
|
-
keypress(process.stdin);
|
|
31
|
-
|
|
32
|
-
// Asocio evento keypress para capturar teclas
|
|
33
|
-
process.stdin.on('keypress', function(ch: any, key: any) {
|
|
34
|
-
|
|
35
|
-
// Si me llega una tecla de salida cierro el proceso
|
|
36
|
-
if (key && exitKeys.indexOf(key.sequence) >= 0) {
|
|
37
|
-
// Cierro el proceso
|
|
38
|
-
process.exit();
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
// Cambio el raw mode (cambia segun version de node)
|
|
43
|
-
if (typeof (<any>process.stdin).setRawMode === 'function') {
|
|
44
|
-
(<any>process.stdin).setRawMode(true);
|
|
45
|
-
} else {
|
|
46
|
-
(<any>tty).setRawMode(true);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Retomo el proceso
|
|
50
|
-
process.stdin.resume();
|
|
51
|
-
|
|
52
|
-
// Tarea auxiliar para poder disparar el reload desde el runSequence
|
|
53
|
-
gulp.task('onBuildFinished', function() {
|
|
54
|
-
|
|
55
|
-
// Ejecuto el reload con un archivo generico
|
|
56
|
-
notifyLiveReload({path: 'src/app.server.ts'});
|
|
57
|
-
|
|
58
|
-
// Vuelvo a habilitar el rebuild con ENTER
|
|
59
|
-
buildInProcess = false;
|
|
60
|
-
|
|
61
|
-
// Escribo a log con delay
|
|
62
|
-
setTimeout(() => {
|
|
63
|
-
console.log(chalk.grey(' ----------------------------------------'));
|
|
64
|
-
console.log(chalk.green(' Press ENTER to rebuild project '));
|
|
65
|
-
console.log(chalk.grey(' ----------------------------------------'));
|
|
66
|
-
}, 2000);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
// Espera tecla presionada y dispara tarea
|
|
70
|
-
function watchKeyPress(taskname: string) {
|
|
71
|
-
// Devuelvo funcion que ejecuta la tarea
|
|
72
|
-
return function() {
|
|
73
|
-
|
|
74
|
-
// Habilito el rebuild con ENTER
|
|
75
|
-
buildInProcess = false;
|
|
76
|
-
|
|
77
|
-
// Escribo a log con delay
|
|
78
|
-
setTimeout(() => {
|
|
79
|
-
console.log(chalk.grey(' ----------------------------------------'));
|
|
80
|
-
console.log(chalk.green(' Press ENTER to rebuild project '));
|
|
81
|
-
console.log(chalk.grey(' ----------------------------------------'));
|
|
82
|
-
}, 2500);
|
|
83
|
-
|
|
84
|
-
// Desasocio handlers anteriores
|
|
85
|
-
process.stdin.removeAllListeners('keypress');
|
|
86
|
-
|
|
87
|
-
// Asocio evento keypress para capturar teclas
|
|
88
|
-
process.stdin.on('keypress', function(ch: any, key: any) {
|
|
89
|
-
|
|
90
|
-
// Si no estoy compilando y se recibio un enter disparo nuevo proceso
|
|
91
|
-
if (!buildInProcess && key && recompileKeys.indexOf(key.sequence) >= 0) {
|
|
92
|
-
// Comienza nuevo build, deshabilito el ENTER
|
|
93
|
-
buildInProcess = true;
|
|
94
|
-
// Escribo a log
|
|
95
|
-
console.log(chalk.cyan(' Starting project rebuild process... '));
|
|
96
|
-
console.log(chalk.grey(' ----------------------------------------'));
|
|
97
|
-
// Ejecuto compile y encadeno nuevo watch
|
|
98
|
-
runSequence(
|
|
99
|
-
// Evento la tarea recibida
|
|
100
|
-
taskname,
|
|
101
|
-
// Ejecuto funcion
|
|
102
|
-
'onBuildFinished'
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// Si me llega una tecla de salida cierro el proceso
|
|
107
|
-
if (key && exitKeys.indexOf(key.sequence) >= 0) {
|
|
108
|
-
// Cierro el proceso
|
|
109
|
-
process.exit();
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// Ejecuto el build y me quedo esperando que se presione enter para reinicar proceso
|
|
116
|
-
export = watchKeyPress('build.dev');
|
package/tools/tasks/webdriver.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import * as through2 from 'through2';
|
|
2
|
-
|
|
3
|
-
export function myUtil() {
|
|
4
|
-
// Code goes here
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
// Funcion noop (antes se usaba la de gulp-util pero ahora esta deprecated)
|
|
8
|
-
export function noop() {
|
|
9
|
-
// just pass-through anything
|
|
10
|
-
return through2.obj();
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
// Función para devolver un stream que no hace nada
|
|
14
|
-
export function dummyStream() {
|
|
15
|
-
var pass = through2.obj();
|
|
16
|
-
process.nextTick(pass.end.bind(pass));
|
|
17
|
-
return pass;
|
|
18
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as through from 'through2';
|
|
2
|
-
import { buildOptimizer } from '@angular-devkit/build-optimizer';
|
|
3
|
-
|
|
4
|
-
const inlineSourceMap = (map: any) => {
|
|
5
|
-
return '// # sourceMappingURL=data:application/json;base64,' + new Buffer(JSON.stringify(map)).toString('base64');
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const ngBuildOptimizer = () => {
|
|
9
|
-
return through.obj(function(file: any, encoding: any, callback: any) {
|
|
10
|
-
if (file.isNull()) {
|
|
11
|
-
// nothing to do
|
|
12
|
-
return callback(null, file);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (file.isBuffer()) {
|
|
16
|
-
const res = buildOptimizer({
|
|
17
|
-
content: file.contents.toString(),
|
|
18
|
-
emitSourceMap: true
|
|
19
|
-
});
|
|
20
|
-
if (res.content) {
|
|
21
|
-
file.contents = Buffer.from(res.content + inlineSourceMap(res.sourceMap), encoding);
|
|
22
|
-
}
|
|
23
|
-
return callback(null, file);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import * as log from 'fancy-log';
|
|
2
|
-
import * as rimraf from 'rimraf';
|
|
3
|
-
import { Chalk } from 'chalk';
|
|
4
|
-
|
|
5
|
-
// Obtengo plugins de gulp
|
|
6
|
-
const chalk: Chalk = require('chalk');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Cleans the given path(s) using `rimraf`.
|
|
10
|
-
* @param {string or string[]} paths - The path or list of paths to clean.
|
|
11
|
-
*/
|
|
12
|
-
export function clean(paths: string|string[]): (done: () => void) => void {
|
|
13
|
-
return done => {
|
|
14
|
-
let pathsToClean: string[];
|
|
15
|
-
if (paths instanceof Array) {
|
|
16
|
-
pathsToClean = paths;
|
|
17
|
-
} else {
|
|
18
|
-
pathsToClean = [<string>paths];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let promises = pathsToClean.map(p => {
|
|
22
|
-
return new Promise(resolve => {
|
|
23
|
-
rimraf(p, e => {
|
|
24
|
-
if (e) {
|
|
25
|
-
log('Clean task failed with', e);
|
|
26
|
-
} else {
|
|
27
|
-
log('Deleted', chalk.yellow(p || '-'));
|
|
28
|
-
}
|
|
29
|
-
resolve();
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
Promise.all(promises).then(() => done());
|
|
34
|
-
};
|
|
35
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import * as browserSync from 'browser-sync';
|
|
2
|
-
|
|
3
|
-
import { getPluginConfig } from '../../config';
|
|
4
|
-
|
|
5
|
-
// Timer para hacer el reload cuando hay cambios de codigo
|
|
6
|
-
let reloadTimer: NodeJS.Timer = null;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Initialises BrowserSync with the configuration defined in config.ts.
|
|
10
|
-
*/
|
|
11
|
-
let runServer = () => {
|
|
12
|
-
browserSync.init(getPluginConfig('browser-sync'));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Runs BrowserSync as the listening process for the application.
|
|
17
|
-
*/
|
|
18
|
-
let listen = () => {
|
|
19
|
-
runServer();
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Provides a flag to mark which files have changed and reloads BrowserSync accordingly.
|
|
24
|
-
*/
|
|
25
|
-
let changed = (files: any) => {
|
|
26
|
-
|
|
27
|
-
if (!(files instanceof Array)) {
|
|
28
|
-
files = [files];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Si tengo un timer programado lo limpio
|
|
32
|
-
if (reloadTimer) clearTimeout(reloadTimer);
|
|
33
|
-
|
|
34
|
-
// Programo el reload para dentro de 1 segundo
|
|
35
|
-
reloadTimer = setTimeout(() => browserSync.reload(files), 1000);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export { listen, changed };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as karma from 'karma';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
|
|
4
|
-
export const startKarma = (done: any, config: any = {}) => {
|
|
5
|
-
return new (<any>karma).Server(Object.assign({
|
|
6
|
-
configFile: join(process.cwd(), 'karma.conf.js'),
|
|
7
|
-
singleRun: true
|
|
8
|
-
}, config)).start(done);
|
|
9
|
-
};
|
|
10
|
-
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as express from 'express';
|
|
2
|
-
import * as fallback from 'express-history-api-fallback';
|
|
3
|
-
import * as openResource from 'open';
|
|
4
|
-
import { resolve } from 'path';
|
|
5
|
-
import * as serveStatic from 'serve-static';
|
|
6
|
-
|
|
7
|
-
import * as codeChangeTool from './code_change_tools';
|
|
8
|
-
import { APP_BASE, APP_CLIENT_BASE, APP_CLIENT_PORT, PROD_CLIENT_DEST } from '../../config';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Serves the Single Page Application. More specifically, calls the `listen` method, which itself launches BrowserSync.
|
|
12
|
-
*/
|
|
13
|
-
export function serveSPA() {
|
|
14
|
-
codeChangeTool.listen();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* This utility method is used to notify that a file change has happened and subsequently calls the `changed` method,
|
|
19
|
-
* which itself initiates a BrowserSync reload.
|
|
20
|
-
* @param {any} e - The file that has changed.
|
|
21
|
-
*/
|
|
22
|
-
export function notifyLiveReload(e:any) {
|
|
23
|
-
let fileName = e.path;
|
|
24
|
-
codeChangeTool.changed(fileName);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Starts a new `express` server, serving the built files from `dist/prod`.
|
|
29
|
-
*/
|
|
30
|
-
export function serveProd() {
|
|
31
|
-
let root = resolve(process.cwd(), PROD_CLIENT_DEST);
|
|
32
|
-
let server = express();
|
|
33
|
-
let compression = require('compression');
|
|
34
|
-
server.use(compression());
|
|
35
|
-
|
|
36
|
-
server.use(APP_CLIENT_BASE, serveStatic(root));
|
|
37
|
-
|
|
38
|
-
server.use(fallback('index.html', { root }));
|
|
39
|
-
|
|
40
|
-
server.listen(APP_CLIENT_PORT, () =>
|
|
41
|
-
openResource('http://localhost:' + APP_CLIENT_PORT + APP_BASE)
|
|
42
|
-
);
|
|
43
|
-
}
|
package/tools/utils/seed/sme.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { exec } from 'child_process';
|
|
2
|
-
import { existsSync, mkdirSync } from 'fs';
|
|
3
|
-
import { join } from 'path';
|
|
4
|
-
import { Chalk } from 'chalk';
|
|
5
|
-
|
|
6
|
-
import { JS_DEST, JS_PROD_APP_BUNDLE, SME_DIR } from '../../config';
|
|
7
|
-
|
|
8
|
-
// Obtengo plugins de gulp
|
|
9
|
-
const chalk: Chalk = require('chalk');
|
|
10
|
-
|
|
11
|
-
const isWin = /^win/.test(process.platform);
|
|
12
|
-
|
|
13
|
-
const smeOutFormat: string = 'html';
|
|
14
|
-
/**
|
|
15
|
-
* Creates a source-map-explorer report with the given task name.
|
|
16
|
-
* @param {string} taskName - The name of the task.
|
|
17
|
-
*/
|
|
18
|
-
export function createSME(taskName: string) {
|
|
19
|
-
return (): void => {
|
|
20
|
-
let sme = './node_modules/.bin/source-map-explorer';
|
|
21
|
-
|
|
22
|
-
if (isWin) {
|
|
23
|
-
sme = '.\\node_modules\\.bin\\source-map-explorer.cmd';
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const task = taskName.replace(/\./g, '_');
|
|
27
|
-
const outFileName = `${task}_${now()}.${smeOutFormat}`;
|
|
28
|
-
const out = join(SME_DIR, outFileName);
|
|
29
|
-
|
|
30
|
-
const appBundle = join(JS_DEST, JS_PROD_APP_BUNDLE);
|
|
31
|
-
const appBundleMap = `${appBundle}.map`;
|
|
32
|
-
|
|
33
|
-
if (!existsSync(SME_DIR)) {
|
|
34
|
-
mkdirSync(SME_DIR);
|
|
35
|
-
}
|
|
36
|
-
exec(`${sme} --${smeOutFormat} ${appBundle} ${appBundleMap} > ${out}`,
|
|
37
|
-
(error: Error, stdout: string, stderr: string) => {
|
|
38
|
-
if (error !== null) {
|
|
39
|
-
console.error(chalk.red.bold('source-map-explorer error: ' + error + stderr));
|
|
40
|
-
process.exit(1);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function now(): string {
|
|
47
|
-
const date = new Date();
|
|
48
|
-
return new Date(date.getTime() - (date.getTimezoneOffset() * 60000))
|
|
49
|
-
.toISOString()
|
|
50
|
-
.replace(/[:.]/g, '_');
|
|
51
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { existsSync, lstatSync, readdirSync } from 'fs';
|
|
2
|
-
import * as gulp from 'gulp';
|
|
3
|
-
import * as log from 'fancy-log';
|
|
4
|
-
import * as isstream from 'isstream';
|
|
5
|
-
import * as tildify from 'tildify';
|
|
6
|
-
import { Chalk } from 'chalk';
|
|
7
|
-
import { join } from 'path';
|
|
8
|
-
|
|
9
|
-
// Obtengo plugins de gulp
|
|
10
|
-
const chalk: Chalk = require('chalk');
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Loads the tasks within the given path.
|
|
14
|
-
* @param {string} path - The path to load the tasks from.
|
|
15
|
-
*/
|
|
16
|
-
export function loadTasks(path: string): void {
|
|
17
|
-
log('Loading tasks folder', chalk.yellow(path));
|
|
18
|
-
readDir(path, taskname => registerTask(taskname, path));
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Registers the task by the given taskname and path.
|
|
23
|
-
* @param {string} taskname - The name of the task.
|
|
24
|
-
* @param {string} path - The path of the task.
|
|
25
|
-
*/
|
|
26
|
-
function registerTask(taskname: string, path: string): void {
|
|
27
|
-
const TASK = join(path, taskname);
|
|
28
|
-
log('Registering task', chalk.yellow(tildify(TASK)));
|
|
29
|
-
|
|
30
|
-
gulp.task(taskname, (done: any) => {
|
|
31
|
-
const task = require(TASK);
|
|
32
|
-
if (task.length > 0) {
|
|
33
|
-
return task(done);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const taskReturnedValue = task();
|
|
37
|
-
if (isstream(taskReturnedValue)) {
|
|
38
|
-
return taskReturnedValue;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// TODO: add promise handling if needed at some point.
|
|
42
|
-
|
|
43
|
-
done();
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Reads the files in the given root directory and executes the given callback per found file.
|
|
49
|
-
* @param {string} root - The root directory to read.
|
|
50
|
-
* @param {function} cb - The callback to execute per found file.
|
|
51
|
-
*/
|
|
52
|
-
function readDir(root: string, cb: (taskname: string) => void) {
|
|
53
|
-
if (!existsSync(root)) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
walk(root);
|
|
58
|
-
|
|
59
|
-
function walk(path: string) {
|
|
60
|
-
let files = readdirSync(path);
|
|
61
|
-
for (let i = 0; i < files.length; i += 1) {
|
|
62
|
-
let file = files[i];
|
|
63
|
-
let curPath = join(path, file);
|
|
64
|
-
if (lstatSync(curPath).isFile() && /\.ts$/.test(file)) {
|
|
65
|
-
let taskname = file.replace(/\.ts$/, '');
|
|
66
|
-
cb(taskname);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|