@platformatic/runtime 0.41.1 → 0.41.3
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/fixtures/configs/monorepo-watch.json +12 -0
- package/fixtures/monorepo-watch/service1/platformatic.service.json +13 -0
- package/fixtures/monorepo-watch/service1/plugin.js +8 -0
- package/lib/app.js +5 -2
- package/package.json +9 -9
- package/test/api.test.js +3 -1
- package/test/cli/watch.test.mjs +25 -0
package/lib/app.js
CHANGED
|
@@ -85,7 +85,7 @@ class PlatformaticApp {
|
|
|
85
85
|
|
|
86
86
|
await this.#initializeConfig()
|
|
87
87
|
this.#originalWatch = this.config.configManager.current.watch
|
|
88
|
-
this.config.configManager.current.watch = false
|
|
88
|
+
this.config.configManager.current.watch = { enabled: false }
|
|
89
89
|
|
|
90
90
|
const { configManager } = this.config
|
|
91
91
|
configManager.update({
|
|
@@ -108,7 +108,10 @@ class PlatformaticApp {
|
|
|
108
108
|
this.#logAndExit(err)
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
if (
|
|
111
|
+
if (
|
|
112
|
+
config.plugins !== undefined &&
|
|
113
|
+
this.#originalWatch?.enabled !== false
|
|
114
|
+
) {
|
|
112
115
|
this.#startFileWatching()
|
|
113
116
|
}
|
|
114
117
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/runtime",
|
|
3
|
-
"version": "0.41.
|
|
3
|
+
"version": "0.41.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"standard": "^17.1.0",
|
|
25
25
|
"tsd": "^0.29.0",
|
|
26
26
|
"typescript": "^5.1.6",
|
|
27
|
-
"@platformatic/sql-graphql": "0.41.
|
|
28
|
-
"@platformatic/sql-mapper": "0.41.
|
|
27
|
+
"@platformatic/sql-graphql": "0.41.3",
|
|
28
|
+
"@platformatic/sql-mapper": "0.41.3"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@hapi/topo": "^6.0.2",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"pino": "^8.14.1",
|
|
43
43
|
"pino-pretty": "^10.0.0",
|
|
44
44
|
"undici": "^5.22.1",
|
|
45
|
-
"@platformatic/composer": "0.41.
|
|
46
|
-
"@platformatic/config": "0.41.
|
|
47
|
-
"@platformatic/db": "0.41.
|
|
48
|
-
"@platformatic/service": "0.41.
|
|
49
|
-
"@platformatic/telemetry": "0.41.
|
|
50
|
-
"@platformatic/utils": "0.41.
|
|
45
|
+
"@platformatic/composer": "0.41.3",
|
|
46
|
+
"@platformatic/config": "0.41.3",
|
|
47
|
+
"@platformatic/db": "0.41.3",
|
|
48
|
+
"@platformatic/service": "0.41.3",
|
|
49
|
+
"@platformatic/telemetry": "0.41.3",
|
|
50
|
+
"@platformatic/utils": "0.41.3"
|
|
51
51
|
},
|
|
52
52
|
"standard": {
|
|
53
53
|
"ignore": [
|
package/test/api.test.js
CHANGED
package/test/cli/watch.test.mjs
CHANGED
|
@@ -282,3 +282,28 @@ test('watches CommonJS files with hotreload on a single service', { timeout: 300
|
|
|
282
282
|
|
|
283
283
|
assert.ok(restartedThirdTime)
|
|
284
284
|
})
|
|
285
|
+
|
|
286
|
+
test('should not watch files if watch = false', async (t) => {
|
|
287
|
+
const tmpDir = await mkdtemp(join(base, 'watch-'))
|
|
288
|
+
t.after(() => saferm(tmpDir))
|
|
289
|
+
t.diagnostic(`using ${tmpDir}`)
|
|
290
|
+
const configFileSrc = join(fixturesDir, 'configs', 'monorepo-watch.json')
|
|
291
|
+
const configFileDst = join(tmpDir, 'configs', 'monorepo-watch.json')
|
|
292
|
+
const appSrc = join(fixturesDir, 'monorepo-watch')
|
|
293
|
+
const appDst = join(tmpDir, 'monorepo-watch')
|
|
294
|
+
const cjsPluginFilePath = join(appDst, 'service1', 'plugin.js')
|
|
295
|
+
|
|
296
|
+
await Promise.all([
|
|
297
|
+
cp(configFileSrc, configFileDst),
|
|
298
|
+
cp(appSrc, appDst, { recursive: true })
|
|
299
|
+
])
|
|
300
|
+
|
|
301
|
+
await writeFile(cjsPluginFilePath, createCjsLoggingPlugin('v1', false))
|
|
302
|
+
const { child, url } = await start('-c', configFileDst)
|
|
303
|
+
t.after(() => child.kill('SIGINT'))
|
|
304
|
+
await writeFile(cjsPluginFilePath, createCjsLoggingPlugin('v2', true))
|
|
305
|
+
await sleep(5000)
|
|
306
|
+
const res = await request(`${url}/version`)
|
|
307
|
+
const version = await res.body.text()
|
|
308
|
+
assert.strictEqual(version, 'v1')
|
|
309
|
+
})
|