typespeed 2.1.3 → 2.3.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.
- package/app/nodemon.json +5 -0
- package/{test → app}/package.json +1 -2
- package/{test → app}/src/config-development.json +1 -1
- package/{test → app}/src/config.json +3 -4
- package/{test → app}/src/custom-log.class.ts +1 -1
- package/{test → app}/src/main.ts +10 -3
- package/dist/core.decorator.js +1 -67
- package/dist/default/express-server.class.js +9 -8
- package/dist/default/node-cache.class.js +2 -1
- package/dist/default/rabbitmq.class.js +3 -2
- package/dist/default/read-write-db.class.js +8 -7
- package/dist/default/redis.class.js +3 -2
- package/dist/typespeed.js +85 -1
- package/package.json +16 -5
- package/src/core.decorator.ts +1 -68
- package/src/default/express-server.class.ts +4 -3
- package/src/default/node-cache.class.ts +2 -1
- package/src/default/rabbitmq.class.ts +2 -1
- package/src/default/read-write-db.class.ts +2 -2
- package/src/default/redis.class.ts +2 -2
- package/src/typespeed.ts +86 -1
- package/test/first-page.test.ts +45 -0
- package/tsconfig.json +2 -3
- package/test/nodemon.json +0 -6
- /package/{test → app}/node_modules/.package-lock.json +0 -0
- /package/{test → app}/node_modules/@types/body-parser/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/body-parser/README.md +0 -0
- /package/{test → app}/node_modules/@types/body-parser/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/body-parser/package.json +0 -0
- /package/{test → app}/node_modules/@types/connect/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/connect/README.md +0 -0
- /package/{test → app}/node_modules/@types/connect/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/connect/package.json +0 -0
- /package/{test → app}/node_modules/@types/express/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/express/README.md +0 -0
- /package/{test → app}/node_modules/@types/express/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/express/package.json +0 -0
- /package/{test → app}/node_modules/@types/express-serve-static-core/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/express-serve-static-core/README.md +0 -0
- /package/{test → app}/node_modules/@types/express-serve-static-core/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/express-serve-static-core/package.json +0 -0
- /package/{test → app}/node_modules/@types/mime/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/mime/Mime.d.ts +0 -0
- /package/{test → app}/node_modules/@types/mime/README.md +0 -0
- /package/{test → app}/node_modules/@types/mime/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/mime/lite.d.ts +0 -0
- /package/{test → app}/node_modules/@types/mime/package.json +0 -0
- /package/{test → app}/node_modules/@types/node/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/node/README.md +0 -0
- /package/{test → app}/node_modules/@types/node/assert/strict.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/assert.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/async_hooks.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/buffer.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/child_process.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/cluster.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/console.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/constants.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/crypto.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/dgram.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/diagnostics_channel.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/dns/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/dns.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/dom-events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/domain.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/fs/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/fs.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/globals.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/globals.global.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/http.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/http2.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/https.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/inspector.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/module.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/net.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/os.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/package.json +0 -0
- /package/{test → app}/node_modules/@types/node/path.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/perf_hooks.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/process.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/punycode.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/querystring.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/readline/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/readline.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/repl.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/stream/consumers.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/stream/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/stream/web.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/stream.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/string_decoder.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/test.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/timers/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/timers.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/tls.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/trace_events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/assert/strict.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/assert.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/async_hooks.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/buffer.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/child_process.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/cluster.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/console.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/constants.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/crypto.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/dgram.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/dns/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/dns.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/dom-events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/domain.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/fs/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/fs.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/globals.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/http.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/http2.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/https.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/inspector.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/module.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/net.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/os.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/path.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/perf_hooks.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/process.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/punycode.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/querystring.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/readline/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/readline.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/repl.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/stream/consumers.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/stream/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/stream/web.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/stream.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/string_decoder.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/test.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/timers/promises.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/timers.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/tls.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/trace_events.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/tty.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/url.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/util.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/v8.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/vm.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/wasi.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/worker_threads.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/ts4.8/zlib.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/tty.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/url.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/util.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/v8.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/vm.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/wasi.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/worker_threads.d.ts +0 -0
- /package/{test → app}/node_modules/@types/node/zlib.d.ts +0 -0
- /package/{test → app}/node_modules/@types/qs/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/qs/README.md +0 -0
- /package/{test → app}/node_modules/@types/qs/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/qs/package.json +0 -0
- /package/{test → app}/node_modules/@types/range-parser/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/range-parser/README.md +0 -0
- /package/{test → app}/node_modules/@types/range-parser/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/range-parser/package.json +0 -0
- /package/{test → app}/node_modules/@types/send/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/send/README.md +0 -0
- /package/{test → app}/node_modules/@types/send/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/send/package.json +0 -0
- /package/{test → app}/node_modules/@types/serve-static/LICENSE +0 -0
- /package/{test → app}/node_modules/@types/serve-static/README.md +0 -0
- /package/{test → app}/node_modules/@types/serve-static/index.d.ts +0 -0
- /package/{test → app}/node_modules/@types/serve-static/package.json +0 -0
- /package/{test → app}/node_modules/colors/LICENSE +0 -0
- /package/{test → app}/node_modules/colors/README.md +0 -0
- /package/{test → app}/node_modules/colors/examples/normal-usage.js +0 -0
- /package/{test → app}/node_modules/colors/examples/safe-string.js +0 -0
- /package/{test → app}/node_modules/colors/index.d.ts +0 -0
- /package/{test → app}/node_modules/colors/lib/colors.js +0 -0
- /package/{test → app}/node_modules/colors/lib/custom/trap.js +0 -0
- /package/{test → app}/node_modules/colors/lib/custom/zalgo.js +0 -0
- /package/{test → app}/node_modules/colors/lib/extendStringPrototype.js +0 -0
- /package/{test → app}/node_modules/colors/lib/index.js +0 -0
- /package/{test → app}/node_modules/colors/lib/maps/america.js +0 -0
- /package/{test → app}/node_modules/colors/lib/maps/rainbow.js +0 -0
- /package/{test → app}/node_modules/colors/lib/maps/random.js +0 -0
- /package/{test → app}/node_modules/colors/lib/maps/zebra.js +0 -0
- /package/{test → app}/node_modules/colors/lib/styles.js +0 -0
- /package/{test → app}/node_modules/colors/lib/system/has-flag.js +0 -0
- /package/{test → app}/node_modules/colors/lib/system/supports-colors.js +0 -0
- /package/{test → app}/node_modules/colors/package.json +0 -0
- /package/{test → app}/node_modules/colors/safe.d.ts +0 -0
- /package/{test → app}/node_modules/colors/safe.js +0 -0
- /package/{test → app}/node_modules/colors/themes/generic-logging.js +0 -0
- /package/{test → app}/node_modules/dateformat/LICENSE +0 -0
- /package/{test → app}/node_modules/dateformat/Readme.md +0 -0
- /package/{test → app}/node_modules/dateformat/lib/dateformat.js +0 -0
- /package/{test → app}/node_modules/dateformat/package.json +0 -0
- /package/{test → app}/node_modules/mkdirp/CHANGELOG.md +0 -0
- /package/{test → app}/node_modules/mkdirp/LICENSE +0 -0
- /package/{test → app}/node_modules/mkdirp/bin/cmd.js +0 -0
- /package/{test → app}/node_modules/mkdirp/index.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/find-made.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/mkdirp-manual.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/mkdirp-native.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/opts-arg.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/path-arg.js +0 -0
- /package/{test → app}/node_modules/mkdirp/lib/use-native.js +0 -0
- /package/{test → app}/node_modules/mkdirp/package.json +0 -0
- /package/{test → app}/node_modules/mkdirp/readme.markdown +0 -0
- /package/{test → app}/node_modules/tinytim/.travis.yml +0 -0
- /package/{test → app}/node_modules/tinytim/README.md +0 -0
- /package/{test → app}/node_modules/tinytim/index.js +0 -0
- /package/{test → app}/node_modules/tinytim/lib/index.js +0 -0
- /package/{test → app}/node_modules/tinytim/lib/tinytim.js +0 -0
- /package/{test → app}/node_modules/tinytim/package.json +0 -0
- /package/{test → app}/node_modules/tinytim/test/files/html.tim +0 -0
- /package/{test → app}/node_modules/tinytim/test/files/string.tim +0 -0
- /package/{test → app}/node_modules/tinytim/test/files/string2.tim +0 -0
- /package/{test → app}/node_modules/tinytim/test/render-file-replace.js +0 -0
- /package/{test → app}/node_modules/tinytim/test/render-replace.js +0 -0
- /package/{test → app}/node_modules/tinytim/test/tim-replace.js +0 -0
- /package/{test → app}/node_modules/tracer/README.md +0 -0
- /package/{test → app}/node_modules/tracer/lib/color_console.js +0 -0
- /package/{test → app}/node_modules/tracer/lib/console.js +0 -0
- /package/{test → app}/node_modules/tracer/lib/dailyfile.js +0 -0
- /package/{test → app}/node_modules/tracer/lib/index.js +0 -0
- /package/{test → app}/node_modules/tracer/lib/settings.js +0 -0
- /package/{test → app}/node_modules/tracer/lib/utils.js +0 -0
- /package/{test → app}/node_modules/tracer/package.json +0 -0
- /package/{test → app}/node_modules/tracer/types/index.d.ts +0 -0
- /package/{test → app}/src/aop-test.class.ts +0 -0
- /package/{test → app}/src/config-production.json +0 -0
- /package/{test → app}/src/entities/mutil-users.class.ts +0 -0
- /package/{test → app}/src/entities/user-dto.class.ts +0 -0
- /package/{test → app}/src/first-page.class.ts +0 -0
- /package/{test → app}/src/jwt-authentication.class.ts +0 -0
- /package/{test → app}/src/second-page.class.ts +0 -0
- /package/{test → app}/src/test-database.class.ts +0 -0
- /package/{test → app}/src/test-log.class.ts +0 -0
- /package/{test → app}/src/test-mq.class.ts +0 -0
- /package/{test → app}/src/test-orm.class.ts +0 -0
- /package/{test → app}/src/test-request.class.ts +0 -0
- /package/{test → app}/src/user-model.class.ts +0 -0
- /package/{test → app}/src/views/index.html +0 -0
- /package/{test → app}/src/views/upload.html +0 -0
- /package/{test → app}/static/favicon.ico +0 -0
- /package/{test → app}/static/k.jpg +0 -0
- /package/{test → app}/tsconfig.json +0 -0
package/src/typespeed.ts
CHANGED
|
@@ -1,8 +1,93 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
import * as fs from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
import * as walkSync from "walk-sync";
|
|
5
|
+
|
|
6
|
+
let globalConfig = {};
|
|
7
|
+
const coreDir = __dirname;
|
|
8
|
+
const mainPath = path.dirname(getRootPath(new Error().stack.split("\n")) || process.argv[1]);
|
|
9
|
+
const configFile = mainPath + "/config.json";
|
|
10
|
+
if (fs.existsSync(configFile)) {
|
|
11
|
+
globalConfig = JSON.parse(fs.readFileSync(configFile, "utf-8"));
|
|
12
|
+
const nodeEnv = process.env.NODE_ENV || "development";
|
|
13
|
+
const envConfigFile = mainPath + "/config-" + nodeEnv + ".json";
|
|
14
|
+
if (fs.existsSync(envConfigFile)) {
|
|
15
|
+
globalConfig = Object.assign(globalConfig, JSON.parse(fs.readFileSync(envConfigFile, "utf-8")));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function app<T extends { new(...args: any[]): {} }>(constructor: T) {
|
|
20
|
+
const coreFiles = walkSync(coreDir, { globs: ['**/*.ts'], ignore: ['**/*.d.ts', 'scaffold/**'] });
|
|
21
|
+
const mainFiles = walkSync(mainPath, { globs: ['**/*.ts'] });
|
|
22
|
+
|
|
23
|
+
(async function () {
|
|
24
|
+
try {
|
|
25
|
+
for (let p of coreFiles) {
|
|
26
|
+
let moduleName = p.replace(".d.ts", "").replace(".ts", "");
|
|
27
|
+
await import(coreDir + "/" + moduleName);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
for (let p of mainFiles) {
|
|
31
|
+
let moduleName = p.replace(".d.ts", "").replace(".ts", "");
|
|
32
|
+
await import(mainPath + "/" + moduleName);
|
|
33
|
+
}
|
|
34
|
+
} catch (err) {
|
|
35
|
+
console.error(err);
|
|
36
|
+
}
|
|
37
|
+
//log("main start")
|
|
38
|
+
const main = new constructor();
|
|
39
|
+
main["main"]();
|
|
40
|
+
}());
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function config(node: string) {
|
|
44
|
+
return globalConfig[node] || null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function value(configPath: string): any {
|
|
48
|
+
return function (target: any, propertyKey: string) {
|
|
49
|
+
if (globalConfig === undefined) {
|
|
50
|
+
Object.defineProperty(target, propertyKey, {
|
|
51
|
+
get: () => {
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
let pathNodes = configPath.split(".");
|
|
57
|
+
let nodeValue = globalConfig;
|
|
58
|
+
for (let i = 0; i < pathNodes.length; i++) {
|
|
59
|
+
nodeValue = nodeValue[pathNodes[i]];
|
|
60
|
+
}
|
|
61
|
+
Object.defineProperty(target, propertyKey, {
|
|
62
|
+
get: () => {
|
|
63
|
+
return nodeValue;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function getRootPath(lines: string[]) {
|
|
71
|
+
const macths = ["at Function.Module._load", "at Module.require", "at require", "at Object.<anonymous>"];
|
|
72
|
+
let matchIndex = 0;
|
|
73
|
+
for (let line of lines) {
|
|
74
|
+
if (line.includes(macths[matchIndex])) {
|
|
75
|
+
if(matchIndex === macths.length - 1) {
|
|
76
|
+
return line.split("(")[1].split(":")[0];
|
|
77
|
+
}
|
|
78
|
+
matchIndex++;
|
|
79
|
+
}else{
|
|
80
|
+
matchIndex = 0;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export { app, value, config };
|
|
1
87
|
export * from "./core.decorator";
|
|
2
88
|
export * from "./route.decorator";
|
|
3
89
|
export * from "./database.decorator";
|
|
4
90
|
|
|
5
|
-
|
|
6
91
|
export { default as LogFactory} from "./factory/log-factory.class";
|
|
7
92
|
export { default as CacheFactory} from "./factory/cache-factory.class";
|
|
8
93
|
export { default as DataSourceFactory} from "./factory/data-source-factory.class";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const chaiObj = require('chai');
|
|
2
|
+
|
|
3
|
+
chaiObj.use(require("chai-http"));
|
|
4
|
+
|
|
5
|
+
const firstPageRequests = [
|
|
6
|
+
{
|
|
7
|
+
"url": "/first",
|
|
8
|
+
"expect": "FirstPage index running",
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"url": "/first/sendJson",
|
|
12
|
+
"expect": JSON.stringify({
|
|
13
|
+
"from": "sendJson",
|
|
14
|
+
"to": "Browser"
|
|
15
|
+
}),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"url": "/first/sendResult",
|
|
19
|
+
"expect": "sendResult",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"url": "/first/renderTest",
|
|
23
|
+
"expect": "Hello zzz!",
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
describe("First page", () => {
|
|
28
|
+
let appClose;
|
|
29
|
+
before(() => {
|
|
30
|
+
appClose = require("../app/src/main");
|
|
31
|
+
});
|
|
32
|
+
firstPageRequests.forEach((testRequest) => {
|
|
33
|
+
it(testRequest.url, (done) => {
|
|
34
|
+
chaiObj.request("http://localhost:8081").get(testRequest.url).end((err, res) => {
|
|
35
|
+
chaiObj.assert.equal(testRequest.expect, res.text);
|
|
36
|
+
return done();
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
after(() => {
|
|
41
|
+
if(appClose != null){
|
|
42
|
+
appClose.default();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
package/tsconfig.json
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"module": "CommonJS",
|
|
4
|
-
//"declaration": true,
|
|
5
4
|
"emitDecoratorMetadata": true,
|
|
6
5
|
"experimentalDecorators": true,
|
|
7
6
|
"allowSyntheticDefaultImports": true,
|
|
8
7
|
"forceConsistentCasingInFileNames": true,
|
|
9
8
|
"target": "ES2017",
|
|
10
|
-
//"sourceMap": true,
|
|
11
9
|
"outDir": "./dist",
|
|
12
10
|
"baseUrl": "./",
|
|
13
11
|
"typeRoots": [
|
|
@@ -21,6 +19,7 @@
|
|
|
21
19
|
"exclude": [
|
|
22
20
|
"node_modules",
|
|
23
21
|
"dist",
|
|
24
|
-
"test"
|
|
22
|
+
"test",
|
|
23
|
+
"app"
|
|
25
24
|
]
|
|
26
25
|
}
|
package/test/nodemon.json
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|