@platformatic/basic 2.0.0-alpha.20 → 2.0.0-alpha.22

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/index.js CHANGED
@@ -56,17 +56,10 @@ async function importStackablePackage (opts, pkg, autodetectDescription) {
56
56
  throw e
57
57
  }
58
58
 
59
- const rootFolder = relative(process.cwd(), workerData.dirname)
60
-
61
- let errorMessage = `Unable to import package '${pkg}'. Please add it as a dependency `
62
-
63
- if (rootFolder) {
64
- errorMessage += `in the package.json file in the folder ${relative(rootFolder, opts.context.directory)}.`
65
- } else {
66
- errorMessage += 'in the root package.json file.'
67
- }
68
-
69
- throw new Error(errorMessage)
59
+ const serviceDirectory = relative(workerData.dirname, opts.context.directory)
60
+ throw new Error(
61
+ `Unable to import package '${pkg}'. Please add it as a dependency in the package.json file in the folder ${serviceDirectory}.`
62
+ )
70
63
  }
71
64
  }
72
65
 
@@ -1,4 +1,5 @@
1
1
  import { ITC } from '@platformatic/itc'
2
+ import { setupNodeHTTPTelemetry } from '@platformatic/telemetry'
2
3
  import { createPinoWritable, ensureLoggableError } from '@platformatic/utils'
3
4
  import { tracingChannel } from 'node:diagnostics_channel'
4
5
  import { once } from 'node:events'
@@ -6,6 +7,7 @@ import { readFile } from 'node:fs/promises'
6
7
  import { register } from 'node:module'
7
8
  import { platform, tmpdir } from 'node:os'
8
9
  import { basename, resolve } from 'node:path'
10
+ import { fileURLToPath } from 'node:url'
9
11
  import { isMainThread } from 'node:worker_threads'
10
12
  import pino from 'pino'
11
13
  import { getGlobalDispatcher, setGlobalDispatcher } from 'undici'
@@ -13,7 +15,6 @@ import { WebSocket } from 'ws'
13
15
  import { exitCodes } from '../errors.js'
14
16
  import { importFile } from '../utils.js'
15
17
  import { getSocketPath, isWindows } from './child-manager.js'
16
- import { setupNodeHTTPTelemetry } from '@platformatic/telemetry'
17
18
 
18
19
  function createInterceptor (itc) {
19
20
  return function (dispatch) {
@@ -223,6 +224,10 @@ async function main () {
223
224
 
224
225
  globalThis.platformatic = data
225
226
 
227
+ if (data.root && isMainThread) {
228
+ process.chdir(fileURLToPath(data.root))
229
+ }
230
+
226
231
  if (loader) {
227
232
  register(loader, { data })
228
233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/basic",
3
- "version": "2.0.0-alpha.20",
3
+ "version": "2.0.0-alpha.22",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -23,10 +23,10 @@
23
23
  "split2": "^4.2.0",
24
24
  "undici": "^6.19.5",
25
25
  "ws": "^8.18.0",
26
- "@platformatic/config": "2.0.0-alpha.20",
27
- "@platformatic/telemetry": "2.0.0-alpha.20",
28
- "@platformatic/itc": "2.0.0-alpha.20",
29
- "@platformatic/utils": "2.0.0-alpha.20"
26
+ "@platformatic/config": "2.0.0-alpha.22",
27
+ "@platformatic/utils": "2.0.0-alpha.22",
28
+ "@platformatic/itc": "2.0.0-alpha.22",
29
+ "@platformatic/telemetry": "2.0.0-alpha.22"
30
30
  },
31
31
  "devDependencies": {
32
32
  "borp": "^0.17.0",
@@ -40,8 +40,8 @@
40
40
  "react-dom": "^18.3.1",
41
41
  "typescript": "^5.5.4",
42
42
  "vite": "^5.4.0",
43
- "@platformatic/composer": "2.0.0-alpha.20",
44
- "@platformatic/service": "2.0.0-alpha.20"
43
+ "@platformatic/composer": "2.0.0-alpha.22",
44
+ "@platformatic/service": "2.0.0-alpha.22"
45
45
  },
46
46
  "scripts": {
47
47
  "gen-schema": "node lib/schema.js > schema.json",
package/schema.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://schemas.platformatic.dev/@platformatic/basic/2.0.0-alpha.20.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/basic/2.0.0-alpha.22.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Stackable",
5
5
  "type": "object",