@platformatic/nest 2.67.0-alpha.1 → 2.69.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.
Files changed (3) hide show
  1. package/index.js +13 -0
  2. package/package.json +8 -7
  3. package/schema.json +1 -1
package/index.js CHANGED
@@ -11,6 +11,7 @@ import {
11
11
  } from '@platformatic/basic'
12
12
  import { ConfigManager } from '@platformatic/config'
13
13
  import { features } from '@platformatic/utils'
14
+ import getPort from 'get-port'
14
15
  import inject from 'light-my-request'
15
16
  import { readFile } from 'node:fs/promises'
16
17
  import { dirname, resolve } from 'node:path'
@@ -167,6 +168,18 @@ export class NestStackable extends BaseStackable {
167
168
  }
168
169
  }
169
170
 
171
+ async getChildManagerContext (basePath) {
172
+ const context = await super.getChildManagerContext(basePath)
173
+
174
+ // In development mode we need to choose the random port in advance as the Nest CLI will start a new process
175
+ // every time the code changes and thus we need to ensure that the port is always the same.
176
+ if (!this.isProduction && (context.port === true || context.port === 0)) {
177
+ context.port = await getPort()
178
+ }
179
+
180
+ return context
181
+ }
182
+
170
183
  async #startProduction (listen) {
171
184
  // Listen if entrypoint
172
185
  if (this.#app && listen) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/nest",
3
- "version": "2.67.0-alpha.1",
3
+ "version": "2.69.0",
4
4
  "description": "Platformatic Nest.js Stackable",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -15,12 +15,13 @@
15
15
  },
16
16
  "homepage": "https://github.com/platformatic/platformatic#readme",
17
17
  "dependencies": {
18
+ "get-port": "^7.1.0",
18
19
  "light-my-request": "^6.0.0",
19
20
  "pino-http": "^10.2.0",
20
- "@platformatic/basic": "2.67.0-alpha.1",
21
- "@platformatic/generators": "2.67.0-alpha.1",
22
- "@platformatic/utils": "2.67.0-alpha.1",
23
- "@platformatic/config": "2.67.0-alpha.1"
21
+ "@platformatic/basic": "2.69.0",
22
+ "@platformatic/config": "2.69.0",
23
+ "@platformatic/generators": "2.69.0",
24
+ "@platformatic/utils": "2.69.0"
24
25
  },
25
26
  "devDependencies": {
26
27
  "@nestjs/cli": "^11.0.7",
@@ -33,8 +34,8 @@
33
34
  "neostandard": "^0.12.0",
34
35
  "tsx": "^4.19.0",
35
36
  "typescript": "^5.5.4",
36
- "@platformatic/service": "2.67.0-alpha.1",
37
- "@platformatic/composer": "2.67.0-alpha.1"
37
+ "@platformatic/composer": "2.69.0",
38
+ "@platformatic/service": "2.69.0"
38
39
  },
39
40
  "scripts": {
40
41
  "test": "pnpm run lint && borp --concurrency=1 --no-timeout",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/nest/2.67.0-alpha.1.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/nest/2.69.0.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic NestJS Stackable",
5
5
  "type": "object",