@foal/cli 2.9.0 → 2.10.0

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.
@@ -189,6 +189,24 @@ export declare class FileSystem {
189
189
  * @memberof FileSystem
190
190
  */
191
191
  projectHasDependency(name: string): boolean;
192
+ /**
193
+ * Returns the dependencies of the project package.json.
194
+ *
195
+ * @returns {{ name: string, version: string }[]}
196
+ */
197
+ getProjectDependencies(): {
198
+ name: string;
199
+ version: string;
200
+ }[];
201
+ /**
202
+ * Returns the dev dependencies of the project package.json.
203
+ *
204
+ * @returns {{ name: string, version: string }[]}
205
+ */
206
+ getProjectDevDependencies(): {
207
+ name: string;
208
+ version: string;
209
+ }[];
192
210
  /************************
193
211
  Testing Methods
194
212
  ************************/
@@ -390,6 +390,32 @@ class FileSystem {
390
390
  this.currentDir = initialCurrentDir;
391
391
  return pkg.dependencies.hasOwnProperty(name);
392
392
  }
393
+ /**
394
+ * Returns the dependencies of the project package.json.
395
+ *
396
+ * @returns {{ name: string, version: string }[]}
397
+ */
398
+ getProjectDependencies() {
399
+ const initialCurrentDir = this.currentDir;
400
+ this.cdProjectRootDir();
401
+ const pkg = JSON.parse(fs_1.readFileSync(this.parse('package.json'), 'utf8'));
402
+ this.currentDir = initialCurrentDir;
403
+ return Object.keys(pkg.dependencies)
404
+ .map(name => ({ name, version: pkg.dependencies[name] }));
405
+ }
406
+ /**
407
+ * Returns the dev dependencies of the project package.json.
408
+ *
409
+ * @returns {{ name: string, version: string }[]}
410
+ */
411
+ getProjectDevDependencies() {
412
+ const initialCurrentDir = this.currentDir;
413
+ this.cdProjectRootDir();
414
+ const pkg = JSON.parse(fs_1.readFileSync(this.parse('package.json'), 'utf8'));
415
+ this.currentDir = initialCurrentDir;
416
+ return Object.keys(pkg.devDependencies)
417
+ .map(name => ({ name, version: pkg.devDependencies[name] }));
418
+ }
393
419
  /************************
394
420
  Testing Methods
395
421
  ************************/
@@ -7,19 +7,15 @@
7
7
  "scripts": {
8
8
  "build": "foal rmdir build && tsc -p tsconfig.app.json",
9
9
  "start": "node ./build/index.js",
10
- "develop": "npm run build && concurrently \"tsc -p tsconfig.app.json -w\" \"supervisor -w ./build,./config -e js,json,yml --no-restart-on error ./build/index.js\"",
11
-
10
+ "develop": "npm run build && concurrently -r \"tsc -p tsconfig.app.json -w\" \"supervisor -w ./build,./config -e js,json,yml --no-restart-on error ./build/index.js\"",
12
11
  "build:test": "foal rmdir build && tsc -p tsconfig.test.json",
13
12
  "start:test": "mocha --file ./build/test.js \"./build/**/*.spec.js\"",
14
- "test": "npm run build:test && concurrently \"tsc -p tsconfig.test.json -w\" \"mocha --file ./build/test.js -w \\\"./build/**/*.spec.js\\\"\"",
15
-
13
+ "test": "npm run build:test && concurrently -r \"tsc -p tsconfig.test.json -w\" \"mocha --file ./build/test.js -w \\\"./build/**/*.spec.js\\\"\"",
16
14
  "build:e2e": "foal rmdir build && tsc -p tsconfig.e2e.json",
17
15
  "start:e2e": "mocha --timeout 4000 --file ./build/e2e.js \"./build/e2e/**/*.js\"",
18
- "e2e": "npm run build:e2e && concurrently \"tsc -p tsconfig.e2e.json -w\" \"mocha --file ./build/e2e.js -w \\\"./build/e2e/**/*.js\\\"\"",
19
-
16
+ "e2e": "npm run build:e2e && concurrently -r \"tsc -p tsconfig.e2e.json -w\" \"mocha --file ./build/e2e.js -w \\\"./build/e2e/**/*.js\\\"\"",
20
17
  "lint": "eslint --ext ts src",
21
18
  "lint:fix": "eslint --ext ts --fix src",
22
-
23
19
  "makemigrations": "foal rmdir build && tsc -p tsconfig.app.json && npx typeorm migration:generate --name migration && tsc -p tsconfig.app.json",
24
20
  "migrations": "npx typeorm migration:run",
25
21
  "revertmigration": "npx typeorm migration:revert"
@@ -35,6 +31,7 @@
35
31
  "typeorm": "0.2.26"
36
32
  },
37
33
  "devDependencies": {
34
+ "@foal/cli": "^2.9.0",
38
35
  "@types/mocha": "7.0.2",
39
36
  "@types/node": "10.17.24",
40
37
  "concurrently": "~5.3.0",
@@ -46,4 +43,4 @@
46
43
  "@typescript-eslint/parser": "~2.7.0",
47
44
  "typescript": "~4.0.2"
48
45
  }
49
- }
46
+ }
@@ -7,16 +7,13 @@
7
7
  "scripts": {
8
8
  "build": "foal rmdir build && tsc -p tsconfig.app.json",
9
9
  "start": "node ./build/index.js",
10
- "develop": "npm run build && concurrently \"tsc -p tsconfig.app.json -w\" \"supervisor -w ./build,./config -e js,json,yml --no-restart-on error ./build/index.js\"",
11
-
10
+ "develop": "npm run build && concurrently -r \"tsc -p tsconfig.app.json -w\" \"supervisor -w ./build,./config -e js,json,yml --no-restart-on error ./build/index.js\"",
12
11
  "build:test": "foal rmdir build && tsc -p tsconfig.test.json",
13
12
  "start:test": "mocha --file ./build/test.js \"./build/**/*.spec.js\"",
14
- "test": "npm run build:test && concurrently \"tsc -p tsconfig.test.json -w\" \"mocha --file ./build/test.js -w \\\"./build/**/*.spec.js\\\"\"",
15
-
13
+ "test": "npm run build:test && concurrently -r \"tsc -p tsconfig.test.json -w\" \"mocha --file ./build/test.js -w \\\"./build/**/*.spec.js\\\"\"",
16
14
  "build:e2e": "foal rmdir build && tsc -p tsconfig.e2e.json",
17
15
  "start:e2e": "mocha --timeout 4000 --file ./build/e2e.js \"./build/e2e/**/*.js\"",
18
- "e2e": "npm run build:e2e && concurrently \"tsc -p tsconfig.e2e.json -w\" \"mocha --file ./build/e2e.js -w \\\"./build/e2e/**/*.js\\\"\"",
19
-
16
+ "e2e": "npm run build:e2e && concurrently -r \"tsc -p tsconfig.e2e.json -w\" \"mocha --file ./build/e2e.js -w \\\"./build/e2e/**/*.js\\\"\"",
20
17
  "lint": "eslint --ext ts src",
21
18
  "lint:fix": "eslint --ext ts --fix src"
22
19
  },
@@ -30,6 +27,7 @@
30
27
  "typeorm": "0.2.26"
31
28
  },
32
29
  "devDependencies": {
30
+ "@foal/cli": "^2.9.0",
33
31
  "@types/mocha": "7.0.2",
34
32
  "@types/node": "10.17.24",
35
33
  "concurrently": "~5.3.0",
@@ -41,4 +39,4 @@
41
39
  "@typescript-eslint/parser": "~2.7.0",
42
40
  "typescript": "~4.0.2"
43
41
  }
44
- }
42
+ }
@@ -7,16 +7,13 @@
7
7
  "scripts": {
8
8
  "build": "foal rmdir build && tsc -p tsconfig.app.json",
9
9
  "start": "node ./build/index.js",
10
- "develop": "npm run build && concurrently \"tsc -p tsconfig.app.json -w\" \"supervisor -w ./build,./config -e js,json,yml --no-restart-on error ./build/index.js\"",
11
-
10
+ "develop": "npm run build && concurrently -r \"tsc -p tsconfig.app.json -w\" \"supervisor -w ./build,./config -e js,json,yml --no-restart-on error ./build/index.js\"",
12
11
  "build:test": "foal rmdir build && tsc -p tsconfig.test.json",
13
12
  "start:test": "mocha --file ./build/test.js \"./build/**/*.spec.js\"",
14
- "test": "npm run build:test && concurrently \"tsc -p tsconfig.test.json -w\" \"mocha --file ./build/test.js -w \\\"./build/**/*.spec.js\\\"\"",
15
-
13
+ "test": "npm run build:test && concurrently -r \"tsc -p tsconfig.test.json -w\" \"mocha --file ./build/test.js -w \\\"./build/**/*.spec.js\\\"\"",
16
14
  "build:e2e": "foal rmdir build && tsc -p tsconfig.e2e.json",
17
15
  "start:e2e": "mocha --timeout 4000 --file ./build/e2e.js \"./build/e2e/**/*.js\"",
18
- "e2e": "npm run build:e2e && concurrently \"tsc -p tsconfig.e2e.json -w\" \"mocha --file ./build/e2e.js -w \\\"./build/e2e/**/*.js\\\"\"",
19
-
16
+ "e2e": "npm run build:e2e && concurrently -r \"tsc -p tsconfig.e2e.json -w\" \"mocha --file ./build/e2e.js -w \\\"./build/e2e/**/*.js\\\"\"",
20
17
  "lint": "eslint --ext ts src",
21
18
  "lint:fix": "eslint --ext ts --fix src"
22
19
  },
@@ -31,6 +28,7 @@
31
28
  "yamljs": "~0.3.0"
32
29
  },
33
30
  "devDependencies": {
31
+ "@foal/cli": "^2.9.0",
34
32
  "@types/mocha": "7.0.2",
35
33
  "@types/node": "10.17.24",
36
34
  "concurrently": "~5.3.0",
@@ -42,4 +40,4 @@
42
40
  "@typescript-eslint/parser": "~2.7.0",
43
41
  "typescript": "~4.0.2"
44
42
  }
45
- }
43
+ }
@@ -7,19 +7,15 @@
7
7
  "scripts": {
8
8
  "build": "foal rmdir build && tsc -p tsconfig.app.json",
9
9
  "start": "node ./build/index.js",
10
- "develop": "npm run build && concurrently \"tsc -p tsconfig.app.json -w\" \"supervisor -w ./build,./config -e js,json,yml --no-restart-on error ./build/index.js\"",
11
-
10
+ "develop": "npm run build && concurrently -r \"tsc -p tsconfig.app.json -w\" \"supervisor -w ./build,./config -e js,json,yml --no-restart-on error ./build/index.js\"",
12
11
  "build:test": "foal rmdir build && tsc -p tsconfig.test.json",
13
12
  "start:test": "mocha --file ./build/test.js \"./build/**/*.spec.js\"",
14
- "test": "npm run build:test && concurrently \"tsc -p tsconfig.test.json -w\" \"mocha --file ./build/test.js -w \\\"./build/**/*.spec.js\\\"\"",
15
-
13
+ "test": "npm run build:test && concurrently -r \"tsc -p tsconfig.test.json -w\" \"mocha --file ./build/test.js -w \\\"./build/**/*.spec.js\\\"\"",
16
14
  "build:e2e": "foal rmdir build && tsc -p tsconfig.e2e.json",
17
15
  "start:e2e": "mocha --timeout 4000 --file ./build/e2e.js \"./build/e2e/**/*.js\"",
18
- "e2e": "npm run build:e2e && concurrently \"tsc -p tsconfig.e2e.json -w\" \"mocha --file ./build/e2e.js -w \\\"./build/e2e/**/*.js\\\"\"",
19
-
16
+ "e2e": "npm run build:e2e && concurrently -r \"tsc -p tsconfig.e2e.json -w\" \"mocha --file ./build/e2e.js -w \\\"./build/e2e/**/*.js\\\"\"",
20
17
  "lint": "eslint --ext ts src",
21
18
  "lint:fix": "eslint --ext ts --fix src",
22
-
23
19
  "makemigrations": "foal rmdir build && tsc -p tsconfig.app.json && npx typeorm migration:generate --name migration && tsc -p tsconfig.app.json",
24
20
  "migrations": "npx typeorm migration:run",
25
21
  "revertmigration": "npx typeorm migration:revert"
@@ -36,6 +32,7 @@
36
32
  "yamljs": "~0.3.0"
37
33
  },
38
34
  "devDependencies": {
35
+ "@foal/cli": "^2.9.0",
39
36
  "@types/mocha": "7.0.2",
40
37
  "@types/node": "10.17.24",
41
38
  "concurrently": "~5.3.0",
@@ -47,4 +44,4 @@
47
44
  "@typescript-eslint/parser": "~2.7.0",
48
45
  "typescript": "~4.0.2"
49
46
  }
50
- }
47
+ }
@@ -1,8 +1,5 @@
1
1
  import 'source-map-support/register';
2
2
 
3
- // std
4
- import * as http from 'http';
5
-
6
3
  // 3p
7
4
  import { Config, createApp, displayServerURL } from '@foal/core';
8
5
 
@@ -12,9 +9,8 @@ import { AppController } from './app/app.controller';
12
9
  async function main() {
13
10
  const app = await createApp(AppController);
14
11
 
15
- const httpServer = http.createServer(app);
16
12
  const port = Config.get('port', 'number', 3001);
17
- httpServer.listen(port, () => displayServerURL(port));
13
+ app.listen(port, () => displayServerURL(port));
18
14
  }
19
15
 
20
16
  main()
@@ -30,7 +30,7 @@ export async function main(/*args*/) {
30
30
  console.log(
31
31
  await getMongoManager().save(user)
32
32
  );
33
- } catch (error) {
33
+ } catch (error: any) {
34
34
  console.log(error.message);
35
35
  } finally {
36
36
  await getConnection().close();
@@ -24,7 +24,7 @@ export async function main(/*args*/) {
24
24
  // user.password = await hashPassword(args.password);
25
25
 
26
26
  console.log(await user.save());
27
- } catch (error) {
27
+ } catch (error: any) {
28
28
  console.log(error.message);
29
29
  } finally {
30
30
  await connection.close();
@@ -16,7 +16,7 @@ export async function main(args: any) {
16
16
  try {
17
17
  // Do something.
18
18
 
19
- } catch (error) {
19
+ } catch (error: any) {
20
20
  console.error(error);
21
21
  } finally {
22
22
  await connection.close();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foal/cli",
3
- "version": "2.9.0",
3
+ "version": "2.10.0",
4
4
  "description": "CLI tool for FoalTS",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -71,5 +71,5 @@
71
71
  "ts-node": "~9.0.0",
72
72
  "typescript": "~4.0.2"
73
73
  },
74
- "gitHead": "ec37607a1ffc61ee9020b5e69ae7aa5e9dced1f4"
74
+ "gitHead": "74055f6a822a42571f6e2ae0b6715b18af297ee7"
75
75
  }