@foal/cli 4.4.0 → 4.5.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.
@@ -18,12 +18,17 @@ function connectReact(path) {
18
18
  }
19
19
  return;
20
20
  }
21
+ const outputPath = (0, path_1.join)((0, path_1.relative)(path, process.cwd()), 'public')
22
+ // Make projects generated on Windows build on Unix.
23
+ .replace(/\\/g, '/');
21
24
  fs
22
25
  .cd(path)
23
26
  .modify('package.json', content => {
24
27
  const pkg = JSON.parse(content);
25
28
  pkg.proxy = 'http://localhost:3001';
26
29
  return JSON.stringify(pkg, null, 2);
27
- });
30
+ })
31
+ .copy('react/env.development', '.env.development')
32
+ .render('react/env', '.env', { path: outputPath });
28
33
  }
29
34
  exports.connectReact = connectReact;
@@ -12,7 +12,7 @@ function createRestApi({ name, register, auth }) {
12
12
  auth = auth || false;
13
13
  const fs = new file_system_1.FileSystem();
14
14
  if (fs.projectHasDependency('mongodb')) {
15
- throw new file_system_1.ClientError('"foal generate|g rest-api <name>" cannot be used in a MongoDB project.');
15
+ throw new file_system_1.ClientError('"npx foal generate|g rest-api <name>" cannot be used in a MongoDB project.');
16
16
  }
17
17
  if (fs.exists('src/app/entities') && fs.exists('src/app/controllers')) {
18
18
  fs.cd('src/app');
@@ -5,18 +5,18 @@
5
5
  "license": "MIT",
6
6
  "repository": {},
7
7
  "scripts": {
8
- "build": "foal rmdir build && tsc -p tsconfig.app.json",
8
+ "build": "npx foal rmdir build && tsc -p tsconfig.app.json",
9
9
  "start": "node ./build/index.js",
10
10
  "dev": "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\"",
11
- "build:test": "foal rmdir build && tsc -p tsconfig.test.json",
11
+ "build:test": "npx foal rmdir build && tsc -p tsconfig.test.json",
12
12
  "start:test": "mocha --file ./build/test.js \"./build/**/*.spec.js\"",
13
13
  "test": "npm run build:test && concurrently -r \"tsc -p tsconfig.test.json -w\" \"mocha --file ./build/test.js -w \\\"./build/**/*.spec.js\\\"\"",
14
- "build:e2e": "foal rmdir build && tsc -p tsconfig.e2e.json",
14
+ "build:e2e": "npx foal rmdir build && tsc -p tsconfig.e2e.json",
15
15
  "start:e2e": "mocha --timeout 4000 --file ./build/e2e.js \"./build/e2e/**/*.js\"",
16
16
  "e2e": "npm run build:e2e && concurrently -r \"tsc -p tsconfig.e2e.json -w\" \"mocha --file ./build/e2e.js -w \\\"./build/e2e/**/*.js\\\"\"",
17
17
  "lint": "eslint --ext ts src",
18
18
  "lint:fix": "eslint --ext ts --fix src",
19
- "makemigrations": "foal rmdir build && tsc -p tsconfig.app.json && npx typeorm migration:generate src/migrations/migration -d build/db -p && tsc -p tsconfig.app.json",
19
+ "makemigrations": "npx foal rmdir build && tsc -p tsconfig.app.json && npx typeorm migration:generate src/migrations/migration -d build/db -p && tsc -p tsconfig.app.json",
20
20
  "migrations": "npx typeorm migration:run -d build/db",
21
21
  "revertmigration": "npx typeorm migration:revert -d build/db"
22
22
  },
@@ -32,10 +32,10 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@foal/cli": "^4.0.0",
35
- "@types/mocha": "10.0.6",
35
+ "@types/mocha": "10.0.7",
36
36
  "@types/node": "18.18.6",
37
37
  "concurrently": "~8.2.2",
38
- "mocha": "~10.4.0",
38
+ "mocha": "~10.7.0",
39
39
  "supertest": "~7.0.0",
40
40
  "supervisor": "~0.12.0",
41
41
  "eslint": "~8.48.0",
@@ -5,13 +5,13 @@
5
5
  "license": "MIT",
6
6
  "repository": {},
7
7
  "scripts": {
8
- "build": "foal rmdir build && tsc -p tsconfig.app.json",
8
+ "build": "npx foal rmdir build && tsc -p tsconfig.app.json",
9
9
  "start": "node ./build/index.js",
10
10
  "dev": "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\"",
11
- "build:test": "foal rmdir build && tsc -p tsconfig.test.json",
11
+ "build:test": "npx foal rmdir build && tsc -p tsconfig.test.json",
12
12
  "start:test": "mocha --file ./build/test.js \"./build/**/*.spec.js\"",
13
13
  "test": "npm run build:test && concurrently -r \"tsc -p tsconfig.test.json -w\" \"mocha --file ./build/test.js -w \\\"./build/**/*.spec.js\\\"\"",
14
- "build:e2e": "foal rmdir build && tsc -p tsconfig.e2e.json",
14
+ "build:e2e": "npx foal rmdir build && tsc -p tsconfig.e2e.json",
15
15
  "start:e2e": "mocha --timeout 4000 --file ./build/e2e.js \"./build/e2e/**/*.js\"",
16
16
  "e2e": "npm run build:e2e && concurrently -r \"tsc -p tsconfig.e2e.json -w\" \"mocha --file ./build/e2e.js -w \\\"./build/e2e/**/*.js\\\"\"",
17
17
  "lint": "eslint --ext ts src",
@@ -22,16 +22,16 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@foal/core": "^4.0.0",
25
- "mongodb": "~5.8.1",
25
+ "mongodb": "~5.9.2",
26
26
  "source-map-support": "~0.5.21",
27
27
  "typeorm": "0.3.17"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@foal/cli": "^4.0.0",
31
- "@types/mocha": "10.0.6",
31
+ "@types/mocha": "10.0.7",
32
32
  "@types/node": "18.18.6",
33
33
  "concurrently": "~8.2.2",
34
- "mocha": "~10.4.0",
34
+ "mocha": "~10.7.0",
35
35
  "supertest": "~7.0.0",
36
36
  "supervisor": "~0.12.0",
37
37
  "eslint": "~8.48.0",
@@ -10,40 +10,31 @@
10
10
  height: 100%
11
11
  }
12
12
  body {
13
- margin: 0;
14
- text-align: center;
15
- font-family: Arial;
16
- background-color: #282c34;
13
+ background-size: cover;
14
+ background-repeat: no-repeat;
15
+ background-image: url("data:image/svg+xml,%3Csvg%20id%3D%22visual%22%20viewBox%3D%220%200%20900%20600%22%20width%3D%22900%22%20height%3D%22600%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xmlns%3Axlink%3D%22http%3A%2F%2Fwww.w3.org%2F1999%2Fxlink%22%20version%3D%221.1%22%3E%3Cdefs%3E%3Cfilter%20id%3D%22blur1%22%20x%3D%22-10%25%22%20y%3D%22-10%25%22%20width%3D%22120%25%22%20height%3D%22120%25%22%3E%3CfeFlood%20flood-opacity%3D%220%22%20result%3D%22BackgroundImageFix%22%3E%3C%2FfeFlood%3E%3CfeBlend%20mode%3D%22normal%22%20in%3D%22SourceGraphic%22%20in2%3D%22BackgroundImageFix%22%20result%3D%22shape%22%3E%3C%2FfeBlend%3E%3CfeGaussianBlur%20stdDeviation%3D%22161%22%20result%3D%22effect1_foregroundBlur%22%3E%3C%2FfeGaussianBlur%3E%3C%2Ffilter%3E%3C%2Fdefs%3E%3Crect%20width%3D%22900%22%20height%3D%22600%22%20fill%3D%22%234FACF7%22%3E%3C%2Frect%3E%3Cg%20filter%3D%22url(%23blur1)%22%3E%3Ccircle%20cx%3D%22828%22%20cy%3D%22361%22%20fill%3D%22%230066FF%22%20r%3D%22357%22%3E%3C%2Fcircle%3E%3Ccircle%20cx%3D%22652%22%20cy%3D%22263%22%20fill%3D%22%234FACF7%22%20r%3D%22357%22%3E%3C%2Fcircle%3E%3Ccircle%20cx%3D%22832%22%20cy%3D%226%22%20fill%3D%22%230066FF%22%20r%3D%22357%22%3E%3C%2Fcircle%3E%3Ccircle%20cx%3D%22617%22%20cy%3D%22590%22%20fill%3D%22%230066FF%22%20r%3D%22357%22%3E%3C%2Fcircle%3E%3Ccircle%20cx%3D%223%22%20cy%3D%2218%22%20fill%3D%22%234FACF7%22%20r%3D%22357%22%3E%3C%2Fcircle%3E%3Ccircle%20cx%3D%2290%22%20cy%3D%22295%22%20fill%3D%22%230066FF%22%20r%3D%22357%22%3E%3C%2Fcircle%3E%3C%2Fg%3E%3C%2Fsvg%3E");
17
16
  }
18
- .wrapper {
19
- height: 95%;
17
+ body {
18
+ font-family: Arial, sans-serif;
20
19
  display: flex;
21
- flex-direction: column;
22
20
  justify-content: center;
21
+ align-items: center;
22
+ height: 100vh;
23
+ margin: 0;
24
+ background-color: #f4f4f9;
25
+ color: white;
23
26
  }
24
27
  h1 {
25
- color: white;
26
- font-weight: bold;
27
- margin-bottom: 40px;
28
- letter-spacing: 2px;
28
+ font-size: 2.5rem;
29
+ margin-bottom: 0.5rem;
29
30
  }
30
- a {
31
- color: #4B89EC;
32
- letter-spacing: 1px;
33
- font-size: 1.3rem;
34
- font-weight: bold;
31
+ p {
32
+ font-size: 1.2rem;
33
+ color: rgb(230, 238, 252);
35
34
  }
36
35
  </style>
37
36
  </head>
38
37
  <body>
39
- <div class="wrapper">
40
- <div>
41
- <img src="logo.png" alt="FoalTS logo">
42
- </div>
43
- <h1>Welcome on board ✨</h1>
44
- <div>
45
- <a href="https://foalts.org/docs/tutorials/simple-todo-list/1-installation">Learn FoalTS</a>
46
- </div>
47
- </div>
38
+ <h1>Your app is running!</h1>
48
39
  </body>
49
40
  </html>
@@ -1,7 +1,7 @@
1
1
  import 'source-map-support/register';
2
2
 
3
3
  // 3p
4
- import { Config, createApp, displayServerURL } from '@foal/core';
4
+ import { Config, createApp, Logger, ServiceManager } from '@foal/core';
5
5
 
6
6
  // App
7
7
  import { AppController } from './app/app.controller';
@@ -10,10 +10,13 @@ import { dataSource } from './db';
10
10
  async function main() {
11
11
  await dataSource.initialize();
12
12
 
13
- const app = await createApp(AppController);
13
+ const serviceManager = new ServiceManager();
14
+ const logger = serviceManager.get(Logger);
15
+
16
+ const app = await createApp(AppController, { serviceManager });
14
17
 
15
18
  const port = Config.get('port', 'number', 3001);
16
- app.listen(port, () => displayServerURL(port));
19
+ app.listen(port, () => logger.info(`Listening on port ${port}...`));
17
20
  }
18
21
 
19
22
  main()
@@ -0,0 +1 @@
1
+ BUILD_PATH='/* path */'
@@ -0,0 +1,3 @@
1
+ # Proxify requests to the development server.
2
+ # See https://github.com/facebook/create-react-app/issues/12304
3
+ DANGEROUSLY_DISABLE_HOST_CHECK=true
@@ -16,7 +16,7 @@ async function runScript({ name }, argv, log = console.log) {
16
16
  + ' Please build your script by running the command "npm run build" or using "npm run dev".');
17
17
  }
18
18
  else {
19
- log(`The script "${name}" does not exist. You can create it by running the command "foal g script ${name}".`);
19
+ log(`The script "${name}" does not exist. You can create it by running the command "npx foal g script ${name}".`);
20
20
  }
21
21
  return;
22
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@foal/cli",
3
- "version": "4.4.0",
3
+ "version": "4.5.0",
4
4
  "description": "CLI tool for FoalTS",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -57,21 +57,21 @@
57
57
  "bin/"
58
58
  ],
59
59
  "dependencies": {
60
- "ajv": "~8.12.0",
60
+ "ajv": "~8.17.0",
61
61
  "ajv-formats": "~2.1.1",
62
62
  "cli-spinner": "~0.2.10",
63
63
  "colors": "1.4.0",
64
- "commander": "~12.0.0",
64
+ "commander": "~12.1.0",
65
65
  "node-fetch": "~2.7.0"
66
66
  },
67
67
  "devDependencies": {
68
- "@types/mocha": "10.0.6",
68
+ "@types/mocha": "10.0.7",
69
69
  "@types/node": "18.18.6",
70
70
  "copyfiles": "~2.4.1",
71
- "mocha": "~10.4.0",
71
+ "mocha": "~10.7.0",
72
72
  "rimraf": "~5.0.5",
73
73
  "ts-node": "~10.9.2",
74
74
  "typescript": "~4.9.5"
75
75
  },
76
- "gitHead": "7940702713d1c4fbd4bf12747deadafcf1daa3b9"
76
+ "gitHead": "c99451588302b9ea8837b6d4a1d9e376712b30e8"
77
77
  }