@platformatic/basic 2.0.0-alpha.6 → 2.0.0-alpha.7

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
@@ -73,8 +73,8 @@ async function buildStackable (opts) {
73
73
 
74
74
  const imported = await importStackablePackage(opts, toImport, autodetectDescription)
75
75
 
76
- if (!hadConfig) {
77
- const serviceRoot = relative(process.cwd(), opts.context.directory)
76
+ const serviceRoot = relative(process.cwd(), opts.context.directory)
77
+ if (!hadConfig && !existsSync(resolve(serviceRoot, 'platformatic.application.json'))) {
78
78
  const logger = pino({
79
79
  level: opts.context.serverConfig?.logger?.level ?? 'warn',
80
80
  name: opts.context.serviceId
@@ -92,9 +92,24 @@ async function buildStackable (opts) {
92
92
  return imported.buildStackable(opts)
93
93
  }
94
94
 
95
+ /* c8 ignore next 3 */
96
+ export function transformConfig () {
97
+ // This is currently empty but it left as a placeholder for the future
98
+ }
99
+
100
+ export const schemaOptions = {
101
+ useDefaults: true,
102
+ coerceTypes: true,
103
+ allErrors: true,
104
+ strict: false
105
+ }
106
+
95
107
  export default {
96
108
  configType: 'nodejs',
97
- configManagerConfig: {},
109
+ configManagerConfig: {
110
+ schemaOptions,
111
+ transformConfig
112
+ },
98
113
  buildStackable,
99
114
  schema,
100
115
  version: packageJson.version
package/lib/base.js CHANGED
@@ -57,8 +57,11 @@ export class BaseStackable {
57
57
  return this
58
58
  }
59
59
 
60
- async getMetrics ({ format }) {
61
- return null
60
+ async collectMetrics () {
61
+ return {
62
+ defaultMetrics: true,
63
+ httpMetrics: false
64
+ }
62
65
  }
63
66
 
64
67
  async getOpenapiSchema () {
package/lib/schema.js CHANGED
@@ -7,25 +7,51 @@ const application = {
7
7
  type: 'object',
8
8
  properties: {
9
9
  basePath: {
10
- type: 'string',
11
- },
10
+ type: 'string'
11
+ }
12
12
  },
13
- additionalProperties: false,
13
+ additionalProperties: false
14
14
  }
15
15
 
16
16
  const watch = {
17
17
  anyOf: [
18
18
  schemas.watch,
19
19
  {
20
- type: 'boolean',
20
+ type: 'boolean'
21
21
  },
22
22
  {
23
+ type: 'string'
24
+ }
25
+ ]
26
+ }
27
+
28
+ const deploy = {
29
+ type: 'object',
30
+ properties: {
31
+ include: {
32
+ type: 'array',
33
+ items: {
34
+ type: 'string'
35
+ },
36
+ default: ['dist']
37
+ },
38
+ buildCommand: {
23
39
  type: 'string',
40
+ default: 'npm run build'
24
41
  },
25
- ],
42
+ installCommand: {
43
+ type: 'string',
44
+ default: 'npm ci --omit-dev'
45
+ },
46
+ startCommand: {
47
+ type: 'string',
48
+ default: 'npm run start'
49
+ }
50
+ },
51
+ default: {}
26
52
  }
27
53
 
28
- export const schemaComponents = { application, watch }
54
+ export const schemaComponents = { application, deploy, watch }
29
55
 
30
56
  export const schema = {
31
57
  $id: `https://schemas.platformatic.dev/@platformatic/basic/${packageJson.version}.json`,
@@ -34,10 +60,10 @@ export const schema = {
34
60
  type: 'object',
35
61
  properties: {
36
62
  $schema: {
37
- type: 'string',
38
- },
63
+ type: 'string'
64
+ }
39
65
  },
40
- additionalProperties: true,
66
+ additionalProperties: true
41
67
  }
42
68
 
43
69
  /* c8 ignore next 3 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platformatic/basic",
3
- "version": "2.0.0-alpha.6",
3
+ "version": "2.0.0-alpha.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -19,9 +19,9 @@
19
19
  "pino": "^9.3.2",
20
20
  "semver": "^7.6.3",
21
21
  "undici": "^6.19.5",
22
- "@platformatic/config": "2.0.0-alpha.6",
23
- "@platformatic/itc": "2.0.0-alpha.6",
24
- "@platformatic/utils": "2.0.0-alpha.6"
22
+ "@platformatic/config": "2.0.0-alpha.7",
23
+ "@platformatic/itc": "2.0.0-alpha.7",
24
+ "@platformatic/utils": "2.0.0-alpha.7"
25
25
  },
26
26
  "devDependencies": {
27
27
  "borp": "^0.17.0",
@@ -36,8 +36,8 @@
36
36
  "typescript": "^5.5.4",
37
37
  "vite": "^5.4.0",
38
38
  "ws": "^8.18.0",
39
- "@platformatic/composer": "2.0.0-alpha.6",
40
- "@platformatic/service": "2.0.0-alpha.6"
39
+ "@platformatic/composer": "2.0.0-alpha.7",
40
+ "@platformatic/service": "2.0.0-alpha.7"
41
41
  },
42
42
  "scripts": {
43
43
  "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.6.json",
2
+ "$id": "https://schemas.platformatic.dev/@platformatic/basic/2.0.0-alpha.7.json",
3
3
  "$schema": "http://json-schema.org/draft-07/schema#",
4
4
  "title": "Platformatic Stackable",
5
5
  "type": "object",