@platformatic/service 1.21.1 → 1.23.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/lib/generator/service-generator.js +14 -19
- package/package.json +10 -10
|
@@ -13,13 +13,18 @@ class ServiceGenerator extends BaseGenerator {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
async _beforePrepare () {
|
|
16
|
-
this.config.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
if (!this.config.isRuntimeContext) {
|
|
17
|
+
this.addEnvVars({
|
|
18
|
+
PLT_SERVER_HOSTNAME: this.config.hostname,
|
|
19
|
+
PLT_SERVER_LOGGER_LEVEL: 'info',
|
|
20
|
+
PORT: 3042
|
|
21
|
+
}, { overwrite: false })
|
|
22
22
|
}
|
|
23
|
+
|
|
24
|
+
this.addEnvVars({
|
|
25
|
+
PLT_TYPESCRIPT: this.config.typescript
|
|
26
|
+
}, { overwrite: false })
|
|
27
|
+
|
|
23
28
|
this.config.dependencies = {
|
|
24
29
|
'@platformatic/service': `^${this.platformaticVersion}`
|
|
25
30
|
}
|
|
@@ -66,18 +71,11 @@ declare module 'fastify' {
|
|
|
66
71
|
}
|
|
67
72
|
`
|
|
68
73
|
this.addFile({ path: '', file: 'global.d.ts', contents: GLOBAL_TYPES_TEMPLATE })
|
|
69
|
-
if (this.config.isRuntimeContext) {
|
|
70
|
-
// remove env variables that are not for the plugins
|
|
71
|
-
delete this.config.env.PLT_SERVER_HOSTNAME
|
|
72
|
-
delete this.config.env.PORT
|
|
73
|
-
delete this.config.env.PLT_SERVER_LOGGER_LEVEL
|
|
74
|
-
}
|
|
75
|
-
|
|
76
74
|
this.addFile({ path: '', file: 'README.md', contents: await readFile(join(__dirname, 'README.md')) })
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
async _getConfigFileContents () {
|
|
80
|
-
const {
|
|
78
|
+
const { isRuntimeContext } = this.config
|
|
81
79
|
const version = this.platformaticVersion
|
|
82
80
|
const config = {
|
|
83
81
|
$schema: `https://platformatic.dev/schemas/v${version}/service`,
|
|
@@ -91,11 +89,8 @@ declare module 'fastify' {
|
|
|
91
89
|
paths: [
|
|
92
90
|
{ path: './plugins', encapsulate: false },
|
|
93
91
|
'./routes'
|
|
94
|
-
]
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (typescript === true) {
|
|
98
|
-
config.plugins.typescript = true
|
|
92
|
+
],
|
|
93
|
+
typescript: `{${this.getEnvVarName('PLT_TYPESCRIPT')}}`
|
|
99
94
|
}
|
|
100
95
|
}
|
|
101
96
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/service",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -77,14 +77,14 @@
|
|
|
77
77
|
"rfdc": "^1.3.1",
|
|
78
78
|
"ua-parser-js": "^1.0.37",
|
|
79
79
|
"undici": "^6.6.0",
|
|
80
|
-
"@platformatic/authenticate": "1.
|
|
81
|
-
"@platformatic/client": "1.
|
|
82
|
-
"@platformatic/config": "1.
|
|
83
|
-
"@platformatic/
|
|
84
|
-
"@platformatic/
|
|
85
|
-
"@platformatic/scalar-theme": "1.
|
|
86
|
-
"@platformatic/telemetry": "1.
|
|
87
|
-
"@platformatic/utils": "1.
|
|
80
|
+
"@platformatic/authenticate": "1.23.0",
|
|
81
|
+
"@platformatic/client": "1.23.0",
|
|
82
|
+
"@platformatic/config": "1.23.0",
|
|
83
|
+
"@platformatic/generators": "1.23.0",
|
|
84
|
+
"@platformatic/metaconfig": "1.23.0",
|
|
85
|
+
"@platformatic/scalar-theme": "1.23.0",
|
|
86
|
+
"@platformatic/telemetry": "1.23.0",
|
|
87
|
+
"@platformatic/utils": "1.23.0"
|
|
88
88
|
},
|
|
89
89
|
"standard": {
|
|
90
90
|
"ignore": [
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
]
|
|
100
100
|
},
|
|
101
101
|
"scripts": {
|
|
102
|
-
"test": "pnpm run lint &&
|
|
102
|
+
"test": "pnpm run lint && borp -T --concurrency=1 --timeout 120000 && tsd",
|
|
103
103
|
"unit": "borp --pattern 'test/**/*.test.{js,mjs}' --ignore 'fixtures/**/*' --concurrency=1 --timeout=120000 --no-typescript",
|
|
104
104
|
"build": "node lib/schema.js | json2ts > config.d.ts",
|
|
105
105
|
"lint": "standard | snazzy && ts-standard | snazzy && tsd"
|