@platformatic/service 0.9.2 → 0.11.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.
package/index.js CHANGED
@@ -121,6 +121,7 @@ async function loadPlugin (app, config, pluginOptions) {
121
121
  if (plugin.__esModule === true) {
122
122
  plugin = plugin.default
123
123
  }
124
+ /* c8 ignore next 4 */
124
125
  await app.register(plugin, pluginOptions.options)
125
126
  }
126
127
  }
package/lib/compile.js CHANGED
@@ -7,14 +7,11 @@ const loadConfig = require('./load-config.js')
7
7
  const { isFileAccessible } = require('./utils.js')
8
8
 
9
9
  async function getTSCExecutablePath (cwd) {
10
- const { execa } = await import('execa')
11
- const [npmBinLocalFolder, npmBinGlobalFolder] = await Promise.all([
12
- execa('npm', ['bin'], { cwd }).then((result) => result.stdout),
13
- execa('npm', ['bin', '-g'], { cwd }).then((result) => result.stdout)
14
- ])
10
+ const typescriptPath = require.resolve('typescript')
11
+ const typescriptPathCWD = require.resolve('typescript', { paths: [process.cwd()] })
15
12
 
16
- const tscLocalPath = join(npmBinLocalFolder, 'tsc')
17
- const tscGlobalPath = join(npmBinGlobalFolder, 'tsc')
13
+ const tscLocalPath = join(typescriptPath, '..', '..', 'bin', 'tsc')
14
+ const tscGlobalPath = join(typescriptPathCWD, '..', '..', 'bin', 'tsc')
18
15
 
19
16
  const [tscLocalExists, tscGlobalExists] = await Promise.all([
20
17
  isFileAccessible(tscLocalPath),
package/lib/schema.js CHANGED
@@ -168,8 +168,29 @@ const plugin = {
168
168
  required: ['path']
169
169
  }
170
170
 
171
+ const pluginTypes = {
172
+ $id: 'https://schemas.platformatic.dev/service/pluginTypes',
173
+ $defs: {
174
+ plugin
175
+ },
176
+ anyOf: [{
177
+ type: 'array',
178
+ items: {
179
+ anyOf: [{
180
+ $ref: '#/$defs/plugin'
181
+ }, {
182
+ type: 'string'
183
+ }]
184
+ }
185
+ }, {
186
+ $ref: '#/$defs/plugin'
187
+ }, {
188
+ type: 'string'
189
+ }]
190
+ }
191
+
171
192
  const metrics = {
172
- $id: 'https://schemas.platformatic.dev/db/metrics',
193
+ $id: 'https://schemas.platformatic.dev/service/metrics',
173
194
  anyOf: [
174
195
  { type: 'boolean' },
175
196
  {
@@ -193,29 +214,11 @@ const metrics = {
193
214
  }
194
215
 
195
216
  const platformaticServiceSchema = {
196
- $id: 'https://schemas.platformatic.dev/db',
217
+ $id: 'https://schemas.platformatic.dev/service',
197
218
  type: 'object',
198
- $defs: {
199
- plugin
200
- },
201
219
  properties: {
202
220
  server,
203
- plugin: {
204
- anyOf: [{
205
- type: 'array',
206
- items: {
207
- anyOf: [{
208
- $ref: '#/$defs/plugin'
209
- }, {
210
- type: 'string'
211
- }]
212
- }
213
- }, {
214
- $ref: '#/$defs/plugin'
215
- }, {
216
- type: 'string'
217
- }]
218
- },
221
+ plugin: pluginTypes,
219
222
  metrics
220
223
  },
221
224
  additionalProperties: {
@@ -233,4 +236,5 @@ module.exports.metrics = metrics
233
236
  module.exports.cors = cors
234
237
  module.exports.server = server
235
238
  module.exports.plugin = plugin
239
+ module.exports.pluginTypes = pluginTypes
236
240
  module.exports.watch = watch
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/service",
3
- "version": "0.9.2",
3
+ "version": "0.11.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "author": "Matteo Collina <hello@matteocollina.com>",
@@ -35,8 +35,6 @@
35
35
  "@fastify/static": "^6.5.0",
36
36
  "@fastify/swagger": "^8.0.0",
37
37
  "@fastify/under-pressure": "^8.0.0",
38
- "@platformatic/config": "0.9.2",
39
- "@platformatic/utils": "0.9.2",
40
38
  "close-with-grace": "^1.1.0",
41
39
  "commist": "^3.1.2",
42
40
  "desm": "^1.2.0",
@@ -54,7 +52,9 @@
54
52
  "minimist": "^1.2.6",
55
53
  "pino": "^8.4.1",
56
54
  "pino-pretty": "^9.0.0",
57
- "rfdc": "^1.3.0"
55
+ "rfdc": "^1.3.0",
56
+ "@platformatic/config": "0.11.0",
57
+ "@platformatic/utils": "0.11.0"
58
58
  },
59
59
  "standard": {
60
60
  "ignore": [