@platformatic/next 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/config.d.ts +7 -0
- package/index.js +27 -12
- package/lib/schema.js +1 -0
- package/package.json +6 -6
- package/schema.json +28 -1
package/config.d.ts
CHANGED
|
@@ -153,4 +153,11 @@ export interface PlatformaticNextJsStackable {
|
|
|
153
153
|
application?: {
|
|
154
154
|
basePath?: string;
|
|
155
155
|
};
|
|
156
|
+
deploy?: {
|
|
157
|
+
include?: string[];
|
|
158
|
+
buildCommand?: string;
|
|
159
|
+
installCommand?: string;
|
|
160
|
+
startCommand?: string;
|
|
161
|
+
[k: string]: unknown;
|
|
162
|
+
};
|
|
156
163
|
}
|
package/index.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BaseStackable,
|
|
3
|
+
transformConfig as basicTransformConfig,
|
|
4
|
+
ChildManager,
|
|
5
|
+
errors,
|
|
6
|
+
importFile,
|
|
7
|
+
schemaOptions
|
|
8
|
+
} from '@platformatic/basic'
|
|
2
9
|
import { ConfigManager } from '@platformatic/config'
|
|
3
10
|
import { once } from 'node:events'
|
|
4
11
|
import { readFile } from 'node:fs/promises'
|
|
@@ -42,7 +49,7 @@ export class NextStackable extends BaseStackable {
|
|
|
42
49
|
const { hostname, port } = this.serverConfig ?? {}
|
|
43
50
|
const serverOptions = {
|
|
44
51
|
host: hostname || '127.0.0.1',
|
|
45
|
-
port: port || 0
|
|
52
|
+
port: port || 0
|
|
46
53
|
}
|
|
47
54
|
|
|
48
55
|
this.#basePath = config.application?.basePath
|
|
@@ -55,8 +62,8 @@ export class NextStackable extends BaseStackable {
|
|
|
55
62
|
// Always use URL to avoid serialization problem in Windows
|
|
56
63
|
root: pathToFileURL(this.root),
|
|
57
64
|
basePath: this.#basePath,
|
|
58
|
-
logger: { id: this.id, level: this.logger.level }
|
|
59
|
-
}
|
|
65
|
+
logger: { id: this.id, level: this.logger.level }
|
|
66
|
+
}
|
|
60
67
|
})
|
|
61
68
|
|
|
62
69
|
this.#manager.on('config', config => {
|
|
@@ -78,19 +85,24 @@ export class NextStackable extends BaseStackable {
|
|
|
78
85
|
/* c8 ignore next 5 */
|
|
79
86
|
async getWatchConfig () {
|
|
80
87
|
return {
|
|
81
|
-
enabled: false
|
|
88
|
+
enabled: false
|
|
82
89
|
}
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
getMeta () {
|
|
86
|
-
|
|
87
|
-
|
|
93
|
+
const deploy = this.configManager.current.deploy
|
|
94
|
+
let composer
|
|
95
|
+
|
|
96
|
+
if (this.url) {
|
|
97
|
+
composer = {
|
|
88
98
|
tcp: true,
|
|
89
99
|
url: this.url,
|
|
90
100
|
prefix: this.#basePath,
|
|
91
|
-
wantsAbsoluteUrls: true
|
|
92
|
-
}
|
|
101
|
+
wantsAbsoluteUrls: true
|
|
102
|
+
}
|
|
93
103
|
}
|
|
104
|
+
|
|
105
|
+
return { deploy, composer }
|
|
94
106
|
}
|
|
95
107
|
|
|
96
108
|
async #startNext (nextRoot, serverOptions) {
|
|
@@ -111,12 +123,14 @@ function transformConfig () {
|
|
|
111
123
|
if (typeof this.current.watch !== 'object') {
|
|
112
124
|
this.current.watch = { enabled: this.current.watch || false }
|
|
113
125
|
}
|
|
126
|
+
|
|
127
|
+
basicTransformConfig.call(this)
|
|
114
128
|
}
|
|
115
129
|
|
|
116
130
|
export async function buildStackable (opts) {
|
|
117
131
|
const root = opts.context.directory
|
|
118
132
|
|
|
119
|
-
const configManager = new ConfigManager({ schema, source: opts.config ?? {}, transformConfig })
|
|
133
|
+
const configManager = new ConfigManager({ schema, source: opts.config ?? {}, schemaOptions, transformConfig })
|
|
120
134
|
await configManager.parseAndValidate()
|
|
121
135
|
|
|
122
136
|
return new NextStackable(opts, root, configManager)
|
|
@@ -125,9 +139,10 @@ export async function buildStackable (opts) {
|
|
|
125
139
|
export default {
|
|
126
140
|
configType: 'next',
|
|
127
141
|
configManagerConfig: {
|
|
128
|
-
|
|
142
|
+
schemaOptions,
|
|
143
|
+
transformConfig
|
|
129
144
|
},
|
|
130
145
|
buildStackable,
|
|
131
146
|
schema,
|
|
132
|
-
version: packageJson.version
|
|
147
|
+
version: packageJson.version
|
|
133
148
|
}
|
package/lib/schema.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@platformatic/next",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.7",
|
|
4
4
|
"description": "Platformatic Next.js Stackable",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"@babel/traverse": "^7.25.3",
|
|
21
21
|
"@babel/types": "^7.25.2",
|
|
22
22
|
"semver": "^7.6.3",
|
|
23
|
-
"@platformatic/basic": "2.0.0-alpha.
|
|
24
|
-
"@platformatic/config": "2.0.0-alpha.
|
|
25
|
-
"@platformatic/utils": "2.0.0-alpha.
|
|
23
|
+
"@platformatic/basic": "2.0.0-alpha.7",
|
|
24
|
+
"@platformatic/config": "2.0.0-alpha.7",
|
|
25
|
+
"@platformatic/utils": "2.0.0-alpha.7"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"borp": "^0.17.0",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"react-dom": "^18.3.1",
|
|
35
35
|
"typescript": "^5.5.4",
|
|
36
36
|
"ws": "^8.18.0",
|
|
37
|
-
"@platformatic/composer": "2.0.0-alpha.
|
|
38
|
-
"@platformatic/service": "2.0.0-alpha.
|
|
37
|
+
"@platformatic/composer": "2.0.0-alpha.7",
|
|
38
|
+
"@platformatic/service": "2.0.0-alpha.7"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"test": "npm run lint && borp --concurrency=1 --timeout=180000",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/@platformatic/next/2.0.0-alpha.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/@platformatic/next/2.0.0-alpha.7.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"title": "Platformatic Next.js Stackable",
|
|
5
5
|
"type": "object",
|
|
@@ -500,6 +500,33 @@
|
|
|
500
500
|
}
|
|
501
501
|
},
|
|
502
502
|
"additionalProperties": false
|
|
503
|
+
},
|
|
504
|
+
"deploy": {
|
|
505
|
+
"type": "object",
|
|
506
|
+
"properties": {
|
|
507
|
+
"include": {
|
|
508
|
+
"type": "array",
|
|
509
|
+
"items": {
|
|
510
|
+
"type": "string"
|
|
511
|
+
},
|
|
512
|
+
"default": [
|
|
513
|
+
"dist"
|
|
514
|
+
]
|
|
515
|
+
},
|
|
516
|
+
"buildCommand": {
|
|
517
|
+
"type": "string",
|
|
518
|
+
"default": "npm run build"
|
|
519
|
+
},
|
|
520
|
+
"installCommand": {
|
|
521
|
+
"type": "string",
|
|
522
|
+
"default": "npm ci --omit-dev"
|
|
523
|
+
},
|
|
524
|
+
"startCommand": {
|
|
525
|
+
"type": "string",
|
|
526
|
+
"default": "npm run start"
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
"default": {}
|
|
503
530
|
}
|
|
504
531
|
},
|
|
505
532
|
"additionalProperties": false
|