From e973f234b7f50271c64bb1391bd58e6b95da458a Mon Sep 17 00:00:00 2001 From: Tony133 Date: Tue, 23 Mar 2021 17:52:29 +0100 Subject: [PATCH] chore(): updated gulp configurations --- Gulpfile.js | 109 +-- package-lock.json | 641 +++++++++++++++++- package.json | 12 + sample/000-dogs-app/test/health.e2e-spec.ts | 10 +- sample/001-mongoose-app/package.json | 4 +- sample/002-microservice-app/package.json | 5 +- sample/003-memory-app/package.json | 3 +- sample/004-grpc-app/package.json | 3 +- sample/005-typeorm-app/package-lock.json | 29 +- sample/005-typeorm-app/package.json | 4 +- .../package-lock.json | 29 +- sample/006-multi-db-typeorm-app/package.json | 4 +- sample/007-sequelize-app/package.json | 4 +- tools/gulp/config.ts | 8 + tools/gulp/gulpfile.ts | 5 + tools/gulp/tasks/build.ts | 16 + tools/gulp/tasks/clean.ts | 34 + tools/gulp/tasks/copy-misc.ts | 18 + tools/gulp/tasks/move.ts | 25 + tools/gulp/tasks/samples.ts | 71 ++ tools/gulp/tsconfig.json | 25 + tools/gulp/util/task-helpers.ts | 14 + 22 files changed, 931 insertions(+), 142 deletions(-) create mode 100644 tools/gulp/config.ts create mode 100644 tools/gulp/gulpfile.ts create mode 100644 tools/gulp/tasks/build.ts create mode 100644 tools/gulp/tasks/clean.ts create mode 100644 tools/gulp/tasks/copy-misc.ts create mode 100644 tools/gulp/tasks/move.ts create mode 100644 tools/gulp/tasks/samples.ts create mode 100644 tools/gulp/tsconfig.json create mode 100644 tools/gulp/util/task-helpers.ts diff --git a/Gulpfile.js b/Gulpfile.js index 7b9ae3444..a0962e1a3 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -1,107 +1,16 @@ -// @ts-check - -const childProcess = require('child_process'); -const fs = require('fs'); -const path = require('path'); - -const ts = require('gulp-typescript'); -const gulp = require('gulp'); -const clean = require('gulp-clean'); - -const { join } = require('path'); -const debug = require('gulp-debug'); -const { promisify } = require('util'); - -const exec = promisify(childProcess.exec); - -/** - * SETTINGS - */ -const DIST = join(__dirname, 'dist'); -const LIB = join(__dirname, 'lib'); -const SAMPLE = join(__dirname, 'sample'); - -const terminus = ts.createProject(join(__dirname, 'tsconfig.json')); - -/** - * UTIL - */ -function getFolders(dir) { - return fs - .readdirSync(dir) - .filter((file) => fs.statSync(path.join(dir, file)).isDirectory()); -} - -const getDirs = (base) => getFolders(base).map((path) => `${base}/${path}`).filter(p => !p.includes('deprecated')); - +'use strict'; /** - * TASK + * Load the TypeScript compiler, then load the TypeScript gulpfile which simply loads all + * the tasks. The tasks are really inside tools/gulp/tasks. */ -gulp.task('clean', () => { - return gulp - .src( - [DIST, SAMPLE + '/*/node_modules/@nestjs/terminus', SAMPLE + '/*/dist'], - { - allowEmpty: true, - }, - ) - .pipe(clean()); -}); - -gulp.task('move:protos', () => { - return gulp - .src(join(LIB, './**/*.proto'), { base: LIB }) - .pipe(debug({ title: 'move:protos' })) - .pipe(gulp.dest(join(DIST))); -}); - -gulp.task('build', () => { - return terminus.src().pipe(terminus()).pipe(gulp.dest(DIST)); -}); - -gulp.task('move', () => { - const directories = getDirs(SAMPLE); - - let stream = gulp.src(['dist/**/*']); - - directories.forEach((dir) => { - stream = stream.pipe(gulp.dest(dir + '/node_modules/@nestjs/terminus')); - }); - return stream; -}); - -gulp.task('install:sample', async () => { - const directories = getDirs(SAMPLE); - - const promises = directories.map((dir) => - exec(`npm install --prefix ${dir}`), - ); - - return await Promise.all(promises); -}); - -gulp.task('build:sample', async () => { - const directories = getDirs(SAMPLE); +const path = require('path'); - const promises = directories.map((dir) => - exec(`npm run build --prefix ${dir}`), - ); +const projectDir = __dirname; +const tsconfigPath = path.join(projectDir, 'tools/gulp/tsconfig.json'); - return await Promise.all(promises); +require('ts-node').register({ + project: tsconfigPath }); -/** - * Aliases - */ -gulp.task('default', gulp.series(['clean', 'build', 'move:protos'])); -gulp.task('build:app', gulp.series(['default'])); -gulp.task( - 'build:all', - gulp.series([ - 'build:app', - 'install:sample', - 'move', - 'build:sample', - ]), -); +require('./tools/gulp/gulpfile'); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 9f071798c..a6d73272c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3997,6 +3997,12 @@ "integrity": "sha1-p5SvDAWrF1KEbudTofIRoFugxE8=", "dev": true }, + "array-filter": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-1.0.0.tgz", + "integrity": "sha1-uveeYubvTCpMC4MSMtr/7CUfnYM=", + "dev": true + }, "array-find-index": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-find-index/-/array-find-index-1.0.2.tgz", @@ -4364,6 +4370,15 @@ "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", "dev": true }, + "available-typed-arrays": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz", + "integrity": "sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ==", + "dev": true, + "requires": { + "array-filter": "^1.0.0" + } + }, "avvio": { "version": "7.2.1", "resolved": "https://registry.npmjs.org/avvio/-/avvio-7.2.1.tgz", @@ -5300,6 +5315,12 @@ "parse5": "^3.0.1" } }, + "child_process": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/child_process/-/child_process-1.0.2.tgz", + "integrity": "sha1-sffn/HPSXn/R1FWtyU4UODAYK1o=", + "dev": true + }, "chokidar": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.1.2.tgz", @@ -5926,6 +5947,53 @@ "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", "dev": true }, + "cli-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.0.tgz", + "integrity": "sha512-a0VZ8LeraW0jTuCkuAGMNufareGHhyZU9z8OGsW0gXd1hZGi1SRuNRXdbGkraBBKnhyUhyebFWnRbp+dIn0f0A==", + "dev": true, + "requires": { + "ansi-regex": "^2.1.1", + "d": "^1.0.1", + "es5-ext": "^0.10.51", + "es6-iterator": "^2.0.3", + "memoizee": "^0.4.14", + "timers-ext": "^0.1.7" + }, + "dependencies": { + "d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "dev": true, + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "es5-ext": { + "version": "0.10.53", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz", + "integrity": "sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q==", + "dev": true, + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.3", + "next-tick": "~1.0.0" + } + }, + "es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "dev": true, + "requires": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + } + } + }, "cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", @@ -7342,6 +7410,32 @@ "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true }, + "delete-empty": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/delete-empty/-/delete-empty-3.0.0.tgz", + "integrity": "sha512-ZUyiwo76W+DYnKsL3Kim6M/UOavPdBJgDYWOmuQhYaZvJH0AXAHbUNyEDtRbBra8wqqr686+63/0azfEk1ebUQ==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.0", + "minimist": "^1.2.0", + "path-starts-with": "^2.0.0", + "rimraf": "^2.6.2" + }, + "dependencies": { + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + } + } + }, "denque": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz", @@ -8754,6 +8848,23 @@ } } }, + "ext": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz", + "integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==", + "dev": true, + "requires": { + "type": "^2.0.0" + }, + "dependencies": { + "type": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/type/-/type-2.5.0.tgz", + "integrity": "sha512-180WMDQaIMm3+7hGXWf12GtdniDEy7nYcyFMKJn/eZz/6tSLXrUN9V0wKSbMjej0I1WHWbpREDEKHtqPQa9NNw==", + "dev": true + } + } + }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -9477,6 +9588,12 @@ "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", "dev": true }, + "fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=", + "dev": true + }, "fs-extra": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", @@ -10432,6 +10549,12 @@ "integrity": "sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA==", "dev": true }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, "plugin-error": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-1.0.1.tgz", @@ -10462,11 +10585,12 @@ "dev": true }, "through2": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz", - "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.2.tgz", + "integrity": "sha512-enaDQ4MUyP2W6ZyT6EsMzqBPZaM/avg8iuo+l2d3QCs0J+6RaqkHV/2/lOwDTueBHeJ/2LG9lrLW3d5rWPucuQ==", "dev": true, "requires": { + "inherits": "^2.0.4", "readable-stream": "2 || 3" } } @@ -10541,6 +10665,12 @@ "ansi-regex": "^2.0.0" } }, + "has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true + }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -11041,6 +11171,12 @@ "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", "dev": true }, + "is-bigint": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.1.tgz", + "integrity": "sha512-J0ELF4yHFxHy0cmSxZuheDOz2luOdVvqjwmEcj8H/L1JHeuEDSDbeRP+Dk9kFVk5RTFzbucJ2Kb9F7ixY2QaCg==", + "dev": true + }, "is-binary-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", @@ -11056,6 +11192,15 @@ "integrity": "sha1-CWQ5Bg9KpBGr7hkUOoTWpVNG1uI=", "dev": true }, + "is-boolean-object": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.0.tgz", + "integrity": "sha512-a7Uprx8UtD+HWdyYwnD1+ExtTgqQtD2k/1yJgtXP6wnMm8byhkoTZRl+95LLThpzNZJ5aEvi46cdH+ayMFRwmA==", + "dev": true, + "requires": { + "call-bind": "^1.0.0" + } + }, "is-buffer": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", @@ -11174,6 +11319,12 @@ "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", "dev": true }, + "is-generator-function": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.8.tgz", + "integrity": "sha512-2Omr/twNtufVZFr1GhxjOMFPAj2sjc/dKaIqBhvo4qciXfJmITGH6ZGd8eZYNHza8t1y0e01AuqRhJwfWp26WQ==", + "dev": true + }, "is-glob": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", @@ -11254,6 +11405,12 @@ } } }, + "is-number-object": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.4.tgz", + "integrity": "sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw==", + "dev": true + }, "is-obj": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", @@ -11287,6 +11444,12 @@ "integrity": "sha1-DFLlS8yjkbssSUsh6GJtczbG45c=", "dev": true }, + "is-promise": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz", + "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==", + "dev": true + }, "is-property": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", @@ -11364,6 +11527,134 @@ "text-extensions": "^1.0.0" } }, + "is-typed-array": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.5.tgz", + "integrity": "sha512-S+GRDgJlR3PyEbsX/Fobd9cqpZBuvUS+8asRqYDMLCb2qMzt1oz5m5oxQCxOgUDxiWsOVNi4yaF+/uvdlHlYug==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.2", + "call-bind": "^1.0.2", + "es-abstract": "^1.18.0-next.2", + "foreach": "^2.0.5", + "has-symbols": "^1.0.1" + }, + "dependencies": { + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "es-abstract": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", + "integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "is-callable": "^1.2.3", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.2", + "is-string": "^1.0.5", + "object-inspect": "^1.9.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.0" + }, + "dependencies": { + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + } + } + }, + "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true + }, + "is-callable": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", + "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", + "dev": true + }, + "is-regex": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz", + "integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-symbols": "^1.0.1" + } + }, + "object-inspect": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", + "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "string.prototype.trimend": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "string.prototype.trimstart": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + } + } + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -14250,6 +14541,15 @@ } } }, + "lru-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz", + "integrity": "sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM=", + "dev": true, + "requires": { + "es5-ext": "~0.10.2" + } + }, "lunr": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.7.tgz", @@ -14386,6 +14686,81 @@ "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=", "dev": true }, + "memoizee": { + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.15.tgz", + "integrity": "sha512-UBWmJpLZd5STPm7PMUlOw/TSy972M+z8gcyQ5veOnSDRREz/0bmpyTfKt3/51DhEBqCZQn1udM/5flcSPYhkdQ==", + "dev": true, + "requires": { + "d": "^1.0.1", + "es5-ext": "^0.10.53", + "es6-weak-map": "^2.0.3", + "event-emitter": "^0.3.5", + "is-promise": "^2.2.2", + "lru-queue": "^0.1.0", + "next-tick": "^1.1.0", + "timers-ext": "^0.1.7" + }, + "dependencies": { + "d": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", + "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==", + "dev": true, + "requires": { + "es5-ext": "^0.10.50", + "type": "^1.0.1" + } + }, + "es5-ext": { + "version": "0.10.53", + "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz", + "integrity": "sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q==", + "dev": true, + "requires": { + "es6-iterator": "~2.0.3", + "es6-symbol": "~3.1.3", + "next-tick": "~1.0.0" + }, + "dependencies": { + "next-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", + "dev": true + } + } + }, + "es6-symbol": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz", + "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==", + "dev": true, + "requires": { + "d": "^1.0.1", + "ext": "^1.1.2" + } + }, + "es6-weak-map": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz", + "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==", + "dev": true, + "requires": { + "d": "1", + "es5-ext": "^0.10.46", + "es6-iterator": "^2.0.3", + "es6-symbol": "^3.1.1" + } + }, + "next-tick": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.1.0.tgz", + "integrity": "sha512-CXdUiJembsNjuToQvxayPZF9Vqht7hewsvy2sOWafLvi2awflj9mOC6bHIg50orX8IJvWKY9wYQ/zB2kogPslQ==", + "dev": true + } + } + }, "memory-pager": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz", @@ -15026,7 +15401,7 @@ }, "next-tick": { "version": "1.0.0", - "resolved": "http://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", + "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=", "dev": true }, @@ -16101,6 +16476,27 @@ "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", "dev": true }, + "path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", + "dev": true, + "requires": { + "process": "^0.11.1", + "util": "^0.10.3" + }, + "dependencies": { + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + } + } + }, "path-dirname": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", @@ -16146,6 +16542,12 @@ "integrity": "sha1-v8zcjfWxLcUsi0PsONGNcsBLqW0=", "dev": true }, + "path-starts-with": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-starts-with/-/path-starts-with-2.0.0.tgz", + "integrity": "sha512-3UHTHbJz5+NLkPafFR+2ycJOjoc4WV2e9qCZCnm71zHiWaFrm1XniLVTkZXvaRgxr1xFh9JsTdicpH2yM03nLA==", + "dev": true + }, "path-to-regexp": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.2.0.tgz", @@ -16163,7 +16565,7 @@ }, "pause-stream": { "version": "0.0.11", - "resolved": "http://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", "dev": true, "requires": { @@ -16566,6 +16968,12 @@ "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", "dev": true }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, "process-nextick-args": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", @@ -19459,7 +19867,7 @@ }, "through": { "version": "2.3.8", - "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, @@ -19524,6 +19932,16 @@ "integrity": "sha1-dkpaEa9QVhkhsTPztE5hhofg9cM=", "dev": true }, + "timers-ext": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz", + "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==", + "dev": true, + "requires": { + "es5-ext": "~0.10.46", + "next-tick": "1" + } + }, "tiny-inflate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/tiny-inflate/-/tiny-inflate-1.0.2.tgz", @@ -19825,6 +20243,12 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "dev": true }, + "type": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==", + "dev": true + }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -20069,6 +20493,18 @@ } } }, + "unbox-primitive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.0.tgz", + "integrity": "sha512-P/51NX+JXyxK/aigg1/ZgyccdAxm5K1+n8+tvqSntjOivPt19gvm1VC49RWYetsiub8WViUchdxl/KWHHB0kzA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.0", + "has-symbols": "^1.0.0", + "which-boxed-primitive": "^1.0.1" + } + }, "unc-path-regex": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", @@ -20347,6 +20783,20 @@ "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", "dev": true }, + "util": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.3.tgz", + "integrity": "sha512-I8XkoQwE+fPQEhy9v012V+TSdH2kp9ts29i20TaaDUXsg7x/onePbhFJUExBfv/2ay1ZOp/Vsm3nDlmnFGSAog==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "safe-buffer": "^5.1.2", + "which-typed-array": "^1.1.2" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -20643,12 +21093,191 @@ "isexe": "^2.0.0" } }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, "which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "which-typed-array": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.4.tgz", + "integrity": "sha512-49E0SpUe90cjpoc7BOJwyPHRqSAd12c10Qm2amdEZrJPCY2NDxaW01zHITrem+rnETY3dwrbH3UUrUwagfCYDA==", + "dev": true, + "requires": { + "available-typed-arrays": "^1.0.2", + "call-bind": "^1.0.0", + "es-abstract": "^1.18.0-next.1", + "foreach": "^2.0.5", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.1", + "is-typed-array": "^1.1.3" + }, + "dependencies": { + "es-abstract": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.18.0.tgz", + "integrity": "sha512-LJzK7MrQa8TS0ja2w3YNLzUgJCGPdPOV1yVvezjNnS89D+VR08+Szt2mz3YB2Dck/+w5tfIq/RoUAFqJJGM2yw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "is-callable": "^1.2.3", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.2", + "is-string": "^1.0.5", + "object-inspect": "^1.9.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.0" + }, + "dependencies": { + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + } + } + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true + }, + "is-callable": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.3.tgz", + "integrity": "sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ==", + "dev": true + }, + "is-regex": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.2.tgz", + "integrity": "sha512-axvdhb5pdhEVThqJzYXwMlVuZwC+FF2DpcOhTS+y/8jVq4trxyPgfcwIxIKiyeuLlSQYKkmUaPQJ8ZE4yNKXDg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-symbols": "^1.0.1" + }, + "dependencies": { + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + } + } + }, + "object-inspect": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.9.0.tgz", + "integrity": "sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "string.prototype.trimend": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "dependencies": { + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + } + } + }, + "string.prototype.trimstart": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "dependencies": { + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + } + } + } + } + }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", diff --git a/package.json b/package.json index 4a6371225..8013c3ab0 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "scripts": { "build": "gulp", "build:all": "gulp build:all", + "build:samples": "gulp install:samples && npm run build && gulp build:samples && gulp test:samples && gulp test:e2e:samples", "clean": "gulp clean", "lint": "eslint \"lib/**/*.ts\" --fix", "precommit": "lint-staged", @@ -72,7 +73,18 @@ "gulp-clean": "0.4.0", "gulp-debug": "4.0.0", "gulp-typescript": "5.0.1", +<<<<<<< HEAD "husky": "5.2.0", +======= + "child_process": "1.0.2", + "cli-color": "2.0.0", + "delete-empty": "3.0.0", + "deprecate": "1.1.1", + "fs": "0.0.1-security", + "path": "0.12.7", + "util": "0.12.3", + "husky": "5.0.9", +>>>>>>> chore(): updated gulp configurations "jest": "26.6.3", "lint-staged": "10.5.4", "mongoose": "5.10.9", diff --git a/sample/000-dogs-app/test/health.e2e-spec.ts b/sample/000-dogs-app/test/health.e2e-spec.ts index 27636096d..5d761a845 100644 --- a/sample/000-dogs-app/test/health.e2e-spec.ts +++ b/sample/000-dogs-app/test/health.e2e-spec.ts @@ -18,12 +18,12 @@ describe('HealthModule (e2e)', () => { it('/health (GET)', () => { return request(app.getHttpServer()) .get('/health') - .expect(503) + .expect(200) .expect({ - status: 'error', - error: { - dog: { status: 'down', badboys: 1 }, - }, + status: 'ok', + info: { dog: { status: 'up', badboys: 0 } }, + error: {}, + details: { dog: { status: 'up', badboys: 0 } } }); }); }); diff --git a/sample/001-mongoose-app/package.json b/sample/001-mongoose-app/package.json index e56e85f1b..1f9eb3383 100644 --- a/sample/001-mongoose-app/package.json +++ b/sample/001-mongoose-app/package.json @@ -8,10 +8,10 @@ "prestart:prod": "tsc", "start:prod": "node dist/main.js", "build": "rm -rf dist && tsc -p tsconfig.json", - "test": "jest --config=jest.json", + "test": "jest", "test:watch": "jest --watch --config=jest.json", "test:coverage": "jest --config=jest.json --coverage --coverageDirectory=coverage", - "e2e": "jest --config=e2e/jest-e2e.json --forceExit", + "test:e2e": "echo 'No e2e tests implemented yet.'", "e2e:watch": "jest --watch --config=e2e/jest-e2e.json" }, "dependencies": { diff --git a/sample/002-microservice-app/package.json b/sample/002-microservice-app/package.json index 7dd713c1b..27139e1e9 100644 --- a/sample/002-microservice-app/package.json +++ b/sample/002-microservice-app/package.json @@ -8,10 +8,10 @@ "prestart:prod": "tsc", "start:prod": "node dist/main.js", "build": "rm -rf dist && tsc -p tsconfig.json", - "test": "jest --config=jest.json", + "test": "jest", "test:watch": "jest --watch --config=jest.json", "test:coverage": "jest --config=jest.json --coverage --coverageDirectory=coverage", - "e2e": "jest --config=e2e/jest-e2e.json --forceExit", + "test:e2e": "echo 'No e2e tests implemented yet.'", "e2e:watch": "jest --watch --config=e2e/jest-e2e.json" }, "dependencies": { @@ -31,7 +31,6 @@ }, "devDependencies": { "@types/jest": "26.0.22", - "@types/node": "14.14.37", "@typescript-eslint/eslint-plugin": "4.19.0", "@typescript-eslint/parser": "4.19.0", diff --git a/sample/003-memory-app/package.json b/sample/003-memory-app/package.json index 45169e34c..0718d3652 100644 --- a/sample/003-memory-app/package.json +++ b/sample/003-memory-app/package.json @@ -10,8 +10,9 @@ "start": "ts-node src/main.ts", "prestart:prod": "tsc", "start:prod": "node dist/main.js", - "test": "jest --config=jest.json", + "test": "jest", "test:coverage": "jest --config=jest.json --coverage --coverageDirectory=coverage", + "test:e2e": "echo 'No e2e tests implemented yet.'", "test:watch": "jest --watch --config=jest.json" }, "dependencies": { diff --git a/sample/004-grpc-app/package.json b/sample/004-grpc-app/package.json index 0d456d967..5c701cd3f 100644 --- a/sample/004-grpc-app/package.json +++ b/sample/004-grpc-app/package.json @@ -12,8 +12,9 @@ "prestart:prod": "tsc", "start:prod": "node dist/main.js", "start:server": "ts-node src/server/main.ts", - "test": "jest --config=jest.json", + "test": "jest", "test:coverage": "jest --config=jest.json --coverage --coverageDirectory=coverage", + "test:e2e": "echo 'No e2e tests implemented yet.'", "test:watch": "jest --watch --config=jest.json" }, "dependencies": { diff --git a/sample/005-typeorm-app/package-lock.json b/sample/005-typeorm-app/package-lock.json index b75331069..42bc586ee 100644 --- a/sample/005-typeorm-app/package-lock.json +++ b/sample/005-typeorm-app/package-lock.json @@ -7928,6 +7928,12 @@ "isexe": "^2.0.0" } }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, "widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", @@ -8091,21 +8097,26 @@ "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" }, "dependencies": { "y18n": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", - "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } }, diff --git a/sample/005-typeorm-app/package.json b/sample/005-typeorm-app/package.json index 3eaa0541c..7f5f3deb4 100644 --- a/sample/005-typeorm-app/package.json +++ b/sample/005-typeorm-app/package.json @@ -8,10 +8,10 @@ "prestart:prod": "tsc", "start:prod": "node dist/main.js", "build": "rm -rf dist && tsc -p tsconfig.json", - "test": "jest --config=jest.json", + "test": "jest", "test:watch": "jest --watch --config=jest.json", "test:coverage": "jest --config=jest.json --coverage --coverageDirectory=coverage", - "e2e": "jest --config=e2e/jest-e2e.json --forceExit", + "test:e2e": "echo 'No e2e tests implemented yet.'", "e2e:watch": "jest --watch --config=e2e/jest-e2e.json" }, "dependencies": { diff --git a/sample/006-multi-db-typeorm-app/package-lock.json b/sample/006-multi-db-typeorm-app/package-lock.json index 6bfc08499..cfbc79d97 100644 --- a/sample/006-multi-db-typeorm-app/package-lock.json +++ b/sample/006-multi-db-typeorm-app/package-lock.json @@ -7921,6 +7921,12 @@ "isexe": "^2.0.0" } }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, "widest-line": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", @@ -8084,21 +8090,26 @@ "require-main-filename": "^2.0.0", "set-blocking": "^2.0.0", "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" }, "dependencies": { "y18n": { - "version": "5.0.5", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz", - "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.1.tgz", + "integrity": "sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ==", "dev": true }, "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "requires": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + } } } }, diff --git a/sample/006-multi-db-typeorm-app/package.json b/sample/006-multi-db-typeorm-app/package.json index 5c3730d7f..35068e9ad 100644 --- a/sample/006-multi-db-typeorm-app/package.json +++ b/sample/006-multi-db-typeorm-app/package.json @@ -8,10 +8,10 @@ "prestart:prod": "tsc", "start:prod": "node dist/main.js", "build": "rm -rf dist && tsc -p tsconfig.json", - "test": "jest --config=jest.json", + "test": "jest", "test:watch": "jest --watch --config=jest.json", "test:coverage": "jest --config=jest.json --coverage --coverageDirectory=coverage", - "e2e": "jest --config=e2e/jest-e2e.json --forceExit", + "test:e2e": "echo 'No e2e tests implemented yet.'", "e2e:watch": "jest --watch --config=e2e/jest-e2e.json" }, "dependencies": { diff --git a/sample/007-sequelize-app/package.json b/sample/007-sequelize-app/package.json index 093aeb110..d8bbc60a1 100644 --- a/sample/007-sequelize-app/package.json +++ b/sample/007-sequelize-app/package.json @@ -8,10 +8,10 @@ "prestart:prod": "tsc", "start:prod": "node dist/main.js", "build": "rm -rf dist && tsc -p tsconfig.json", - "test": "jest --config=jest.json", + "test": "jest", "test:watch": "jest --watch --config=jest.json", "test:coverage": "jest --config=jest.json --coverage --coverageDirectory=coverage", - "e2e": "jest --config=e2e/jest-e2e.json --forceExit", + "test:e2e": "echo 'No e2e tests implemented yet.'", "e2e:watch": "jest --watch --config=e2e/jest-e2e.json" }, "dependencies": { diff --git a/tools/gulp/config.ts b/tools/gulp/config.ts new file mode 100644 index 000000000..9985d1c77 --- /dev/null +++ b/tools/gulp/config.ts @@ -0,0 +1,8 @@ +import { getDirs } from './util/task-helpers'; + +// All paths are related to the base dir +export const libPath = 'lib'; +export const samplePath = 'sample'; +export const distPath = 'dist'; + +export const libPaths = getDirs(libPath); diff --git a/tools/gulp/gulpfile.ts b/tools/gulp/gulpfile.ts new file mode 100644 index 000000000..e8d0a80ab --- /dev/null +++ b/tools/gulp/gulpfile.ts @@ -0,0 +1,5 @@ +import './tasks/copy-misc'; +import './tasks/clean'; +import './tasks/move'; +import './tasks/build'; +import './tasks/samples'; diff --git a/tools/gulp/tasks/build.ts b/tools/gulp/tasks/build.ts new file mode 100644 index 000000000..d9e83834d --- /dev/null +++ b/tools/gulp/tasks/build.ts @@ -0,0 +1,16 @@ +import { dest, src, task, series } from 'gulp'; +import { join } from 'path'; +import { distPath } from '../config'; +import * as ts from 'gulp-typescript'; + +/** + * Moves the compiled nest files into the `samples/*` dirs. + */ +function build() { + const terminus = ts.createProject(join(__dirname, 'tsconfig.json')); + + return src().pipe(terminus()).pipe(dest(distPath)); +} + +task('build', build); +task('build:app', series('default')); diff --git a/tools/gulp/tasks/clean.ts b/tools/gulp/tasks/clean.ts new file mode 100644 index 000000000..73009957b --- /dev/null +++ b/tools/gulp/tasks/clean.ts @@ -0,0 +1,34 @@ +import { task, src, series } from 'gulp'; +import { libPath } from '../config'; +import * as clean from 'gulp-clean'; +import * as deleteEmpty from 'delete-empty'; + +/** + * Cleans the build output assets from the packages folders + */ +function cleanOutput() { + return src( + [ + `${libPath}/**/*.js`, + `${libPath}/**/*.d.ts`, + `${libPath}/**/*.js.map`, + `${libPath}/**/*.d.ts.map`, + ], + { + read: false, + }, + ).pipe(clean()); +} + +/** + * Cleans empty dirs + */ +function cleanDirs(done: () => void) { + deleteEmpty.sync(`${libPath}/`); + done(); +} + +task('clean:output', cleanOutput); +task('clean:dirs', cleanDirs); +task('clean:bundle', series('clean:output', 'clean:dirs')); +task('default', series('clean:output', 'clean:dirs')); diff --git a/tools/gulp/tasks/copy-misc.ts b/tools/gulp/tasks/copy-misc.ts new file mode 100644 index 000000000..234b188aa --- /dev/null +++ b/tools/gulp/tasks/copy-misc.ts @@ -0,0 +1,18 @@ +import { task, src, dest } from 'gulp'; +import { libPaths } from '../config'; + +/** + * Copies assets like README.md or LICENSE from the project base path + * to all the packages. + */ +function copyMisc(): NodeJS.ReadWriteStream { + const miscFiles = src(['README.md', 'LICENSE', '.npmignore']); + // Since `dest()` does not take a string-array, we have to append it + // ourselves + return libPaths.reduce( + (stream, libPaths) => stream.pipe(dest(libPaths)), + miscFiles, + ); +} + +task('copy-misc', copyMisc); diff --git a/tools/gulp/tasks/move.ts b/tools/gulp/tasks/move.ts new file mode 100644 index 000000000..19d4da2ea --- /dev/null +++ b/tools/gulp/tasks/move.ts @@ -0,0 +1,25 @@ +import { dest, src, task } from 'gulp'; +import { join } from 'path'; +import { samplePath, libPath, distPath } from '../config'; +import { getDirs } from '../util/task-helpers'; +import { debug } from 'gulp-debug'; + +/** + * Moves the compiled nest files into the `samples/*` dirs. + */ +function move() { + const samplesDirs = getDirs(samplePath); + const distFiles = src(['node_modules/@nestjs/**/*']); + + return samplesDirs.reduce( + (distFile, dir) => distFile.pipe(dest(join(dir, '/node_modules/@nestjs/terminus'))), + distFiles, + ); +} + +task('move', move); +task('move:protos', () => { + return src(join(libPath, './**/*.proto'), { base: libPath }) + .pipe(debug({ title: 'move:protos' })) + .pipe(dest(join(distPath))); +}); diff --git a/tools/gulp/tasks/samples.ts b/tools/gulp/tasks/samples.ts new file mode 100644 index 000000000..f7704484b --- /dev/null +++ b/tools/gulp/tasks/samples.ts @@ -0,0 +1,71 @@ +import * as childProcess from 'child_process'; +import * as clc from 'cli-color'; +import * as log from 'fancy-log'; +import { task, series } from 'gulp'; +import { resolve } from 'path'; +import { promisify } from 'util'; +import { samplePath } from '../config'; +import { getDirs } from '../util/task-helpers'; + +const exec = promisify(childProcess.exec); + +async function executeNpmScriptInSamples( + script: string, + appendScript?: string, +) { + const directories = getDirs(samplePath); + + for await (const dir of directories) { + const dirName = dir.replace(resolve(__dirname, '../../../'), ''); + log.info(`Running ${clc.blue(script)} in ${clc.magenta(dirName)}`); + try { + const result = await exec( + `${script} --prefix ${dir} ${appendScript ? '-- ' + appendScript : ''}`, + ); + log.info( + `Finished running ${clc.blue(script)} in ${clc.magenta(dirName)}`, + ); + if (result.stderr) { + log.error(result.stderr); + } + if (result.stdout) { + log.error(result.stdout); + } + } catch (err) { + log.error( + `Failed running ${clc.blue(script)} in ${clc.magenta(dirName)}`, + ); + if (err.stderr) { + log.error(err.stderr); + } + if (err.stdout) { + log.error(err.stdout); + } + process.exit(1); + } + } +} + +task('install:samples', async () => + executeNpmScriptInSamples( + // 'npm ci --no-audit --no-shrinkwrap --no-optional', + 'npm install', + ), +); +task('build:samples', async () => executeNpmScriptInSamples('npm run build')); +task('test:samples', async () => + executeNpmScriptInSamples('npm run test', '--passWithNoTests'), +); +task('test:e2e:samples', async () => + executeNpmScriptInSamples('npm run test:e2e', '--passWithNoTests'), +); + +task( + 'build:all', + series([ + 'build:app', + 'install:samples', + 'move', + 'build:samples', + ]), +); diff --git a/tools/gulp/tsconfig.json b/tools/gulp/tsconfig.json new file mode 100644 index 000000000..6438b3c5a --- /dev/null +++ b/tools/gulp/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "experimentalDecorators": true, + "noUnusedParameters": false, + "noUnusedLocals": false, + "lib": ["es2015", "dom", "es2016.array.include"], + "module": "commonjs", + "moduleResolution": "node", + "outDir": "../../dist/tools/gulp", + "strictNullChecks": true, + "strictFunctionTypes": true, + "noImplicitThis": true, + "noEmitOnError": true, + "noImplicitAny": false, + "target": "es5", + "types": [ + "node" + ], + "typeRoots": ["./typings", "../../node_modules/@types/"], + "baseUrl": ".", + }, + "files": [ + "gulpfile.ts" + ] +} diff --git a/tools/gulp/util/task-helpers.ts b/tools/gulp/util/task-helpers.ts new file mode 100644 index 000000000..ab6f4d77d --- /dev/null +++ b/tools/gulp/util/task-helpers.ts @@ -0,0 +1,14 @@ +import { readdirSync, statSync } from 'fs'; +import { join } from 'path'; + +function isDirectory(path: string) { + return statSync(path).isDirectory(); +} + +export function getFolders(dir: string) { + return readdirSync(dir).filter(file => isDirectory(join(dir, file))); +} + +export function getDirs(base: string) { + return getFolders(base).map((path) => `${base}/${path}`).filter(p => !p.includes('deprecated')); +}