@flink-app/flink 0.4.1 → 0.4.4

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/cli/build.ts CHANGED
@@ -3,10 +3,10 @@ import TypeScriptCompiler from "../src/TypeScriptCompiler";
3
3
  import { getOption } from "./cli-utils";
4
4
 
5
5
  module.exports = async function run(args: string[]) {
6
- const startTime = Date.now();
6
+ const startTime = Date.now();
7
7
 
8
- if (args.includes("--help")) {
9
- console.log(`
8
+ if (args.includes("--help")) {
9
+ console.log(`
10
10
  Description
11
11
  Builds the application.
12
12
  Will generate intermediates files in .flink and compile/transpile
@@ -22,31 +22,27 @@ module.exports = async function run(args: string[]) {
22
22
  --help Displays this message
23
23
  `);
24
24
 
25
- process.exit(0);
26
- }
25
+ process.exit(0);
26
+ }
27
27
 
28
- let dir = "./";
29
- if (args[0] && !args[0].startsWith("--")) {
30
- dir = args[0];
31
- }
28
+ let dir = "./";
29
+ if (args[0] && !args[0].startsWith("--")) {
30
+ dir = args[0];
31
+ }
32
32
 
33
- const exclude = getOption(args, "exclude", "/spec") as string;
33
+ const exclude = getOption(args, "exclude", "/spec") as string;
34
34
 
35
- await TypeScriptCompiler.clean(dir);
35
+ await TypeScriptCompiler.clean(dir);
36
36
 
37
- const compiler = new TypeScriptCompiler(dir);
37
+ const compiler = new TypeScriptCompiler(dir);
38
38
 
39
- if (!compiler.getPreEmitDiagnostics()) {
40
- process.exit(1);
41
- }
39
+ if (!compiler.getPreEmitDiagnostics()) {
40
+ process.exit(1);
41
+ }
42
42
 
43
- await Promise.all([
44
- compiler.parseRepos(),
45
- compiler.parseHandlers(exclude.split(",")),
46
- compiler.generateStartScript(),
47
- ]);
43
+ await Promise.all([compiler.parseRepos(), compiler.parseHandlers(exclude.split(",")), compiler.parseJobs(), compiler.generateStartScript()]);
48
44
 
49
- console.log(`Compilation done, took ${Date.now() - startTime}ms`);
45
+ console.log(`Compilation done, took ${Date.now() - startTime}ms`);
50
46
 
51
- compiler.emit();
47
+ compiler.emit();
52
48
  };
package/cli/run.ts CHANGED
@@ -16,8 +16,9 @@ module.exports = async function run(args: string[]) {
16
16
  If no directory is provided, the current directory will be used.
17
17
 
18
18
  Options
19
- --entry Entry script for app, default "/src/index.ts"
20
- --help Displays this message
19
+ --entry Entry script for app, default "/src/index.ts"
20
+ --help Displays this message
21
+ --precompiled Will run a precompiled app, default false
21
22
  `);
22
23
 
23
24
  process.exit(0);
@@ -34,6 +35,15 @@ module.exports = async function run(args: string[]) {
34
35
  entry = entry.startsWith("/") ? entry : "/" + entry;
35
36
  }
36
37
 
38
+ if (args.includes("--precompiled")) {
39
+ if (args.includes("--entry")) {
40
+ console.warn("WARNING: --entry is ignored when using --precompiled");
41
+ }
42
+
43
+ require("child_process").fork(dir + "/dist/.flink/start.js");
44
+ return;
45
+ }
46
+
37
47
  await TypeScriptCompiler.clean(dir);
38
48
 
39
49
  const compiler = new TypeScriptCompiler(dir);
package/dist/cli/build.js CHANGED
@@ -65,11 +65,7 @@ module.exports = function run(args) {
65
65
  if (!compiler.getPreEmitDiagnostics()) {
66
66
  process.exit(1);
67
67
  }
68
- return [4 /*yield*/, Promise.all([
69
- compiler.parseRepos(),
70
- compiler.parseHandlers(exclude.split(",")),
71
- compiler.generateStartScript(),
72
- ])];
68
+ return [4 /*yield*/, Promise.all([compiler.parseRepos(), compiler.parseHandlers(exclude.split(",")), compiler.parseJobs(), compiler.generateStartScript()])];
73
69
  case 2:
74
70
  _a.sent();
75
71
  console.log("Compilation done, took ".concat(Date.now() - startTime, "ms"));
package/dist/cli/run.js CHANGED
@@ -49,7 +49,7 @@ module.exports = function run(args) {
49
49
  case 0:
50
50
  startTime = Date.now();
51
51
  if (args.includes("--help")) {
52
- console.log("\n Description\n Compiles and starts the application.\n\n Usage\n $ flink run <dir>\n\n <dir> represents the directory of the Flink application.\n If no directory is provided, the current directory will be used.\n \n Options \n --entry Entry script for app, default \"/src/index.ts\"\n --help Displays this message\n ");
52
+ console.log("\n Description\n Compiles and starts the application.\n\n Usage\n $ flink run <dir>\n\n <dir> represents the directory of the Flink application.\n If no directory is provided, the current directory will be used.\n \n Options \n --entry Entry script for app, default \"/src/index.ts\"\n --help Displays this message\n --precompiled Will run a precompiled app, default false\n ");
53
53
  process.exit(0);
54
54
  }
55
55
  dir = "./";
@@ -61,6 +61,13 @@ module.exports = function run(args) {
61
61
  entry = args[args.indexOf("--entry") + 1];
62
62
  entry = entry.startsWith("/") ? entry : "/" + entry;
63
63
  }
64
+ if (args.includes("--precompiled")) {
65
+ if (args.includes("--entry")) {
66
+ console.warn("WARNING: --entry is ignored when using --precompiled");
67
+ }
68
+ require("child_process").fork(dir + "/dist/.flink/start.js");
69
+ return [2 /*return*/];
70
+ }
64
71
  return [4 /*yield*/, TypeScriptCompiler_1.default.clean(dir)];
65
72
  case 1:
66
73
  _a.sent();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flink-app/flink",
3
- "version": "0.4.1",
3
+ "version": "0.4.4",
4
4
  "description": "Typescript only framework for creating REST-like APIs on top of Express and mongodb",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "main": "dist/src/index.js",
@@ -9,7 +9,6 @@
9
9
  "test": "jasmine-ts --preserve-symlinks --config=./spec/support/jasmine.json",
10
10
  "test:watch": "nodemon --ext ts --exec 'jasmine-ts --config=./spec/support/jasmine.json'",
11
11
  "start": "ts-node src/index.ts",
12
- "postinstall": "npm run build",
13
12
  "prepublish": "npm run build",
14
13
  "build": "tsc --project tsconfig.dist.json",
15
14
  "watch": "nodemon --exec 'tsc --project tsconfig.dist.json'",
@@ -28,6 +27,7 @@
28
27
  "@types/express": "^4.17.13",
29
28
  "@types/fs-extra": "^9.0.12",
30
29
  "@types/mongodb": "3.6.12",
30
+ "@types/ms": "^0.7.31",
31
31
  "@types/uuid": "^8.3.0",
32
32
  "ajv": "^8.2.0",
33
33
  "ajv-formats": "^2.1.0",
@@ -57,7 +57,6 @@
57
57
  "@types/jasmine": "^3.7.1",
58
58
  "@types/json-schema": "^7.0.7",
59
59
  "@types/mkdirp": "^1.0.1",
60
- "@types/ms": "^0.7.31",
61
60
  "@types/node": "^15.0.1",
62
61
  "jasmine": "^3.7.0",
63
62
  "jasmine-spec-reporter": "^7.0.0",
@@ -66,5 +65,5 @@
66
65
  "rimraf": "^3.0.2",
67
66
  "ts-node": "^9.1.1"
68
67
  },
69
- "gitHead": "70eb91072256cd5e0c4e3c5fb013d99f0a2a82e1"
68
+ "gitHead": "f7b39bc69a69b51311352b1368093bc4c5d05a39"
70
69
  }