wattpm 2.23.0 → 2.25.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/commands/build.js +11 -14
- package/lib/commands/external.js +2 -7
- package/lib/commands/init.js +1 -1
- package/lib/utils.js +17 -2
- package/package.json +7 -7
- package/schema.json +17 -1
package/lib/commands/build.js
CHANGED
|
@@ -8,6 +8,7 @@ import { resolve } from 'node:path'
|
|
|
8
8
|
import {
|
|
9
9
|
buildRuntime,
|
|
10
10
|
findConfigurationFile,
|
|
11
|
+
getPackageArgs,
|
|
11
12
|
getPackageManager,
|
|
12
13
|
getRoot,
|
|
13
14
|
loadConfigurationFile,
|
|
@@ -45,18 +46,7 @@ export async function installDependencies (logger, root, services, production, p
|
|
|
45
46
|
packageManager = getPackageManager(root)
|
|
46
47
|
}
|
|
47
48
|
|
|
48
|
-
const args =
|
|
49
|
-
|
|
50
|
-
if (production) {
|
|
51
|
-
switch (packageManager) {
|
|
52
|
-
case 'pnpm':
|
|
53
|
-
args.push('--prod')
|
|
54
|
-
break
|
|
55
|
-
case 'npm':
|
|
56
|
-
args.push('--omit=dev')
|
|
57
|
-
break
|
|
58
|
-
}
|
|
59
|
-
}
|
|
49
|
+
const args = getPackageArgs(packageManager, production)
|
|
60
50
|
|
|
61
51
|
// Install dependencies of the application
|
|
62
52
|
try {
|
|
@@ -71,12 +61,19 @@ export async function installDependencies (logger, root, services, production, p
|
|
|
71
61
|
}
|
|
72
62
|
|
|
73
63
|
for (const service of services) {
|
|
64
|
+
/* c8 ignore next */
|
|
65
|
+
const servicePackageManager = service.packageManager ?? getPackageManager(service.path) ?? packageManager
|
|
66
|
+
const servicePackageArgs = getPackageArgs(servicePackageManager, production)
|
|
67
|
+
|
|
74
68
|
try {
|
|
75
69
|
logger.info(
|
|
76
|
-
`Installing ${production ? 'production ' : ''}dependencies for the service ${bold(service.id)} using ${
|
|
70
|
+
`Installing ${production ? 'production ' : ''}dependencies for the service ${bold(service.id)} using ${servicePackageManager} ...`
|
|
77
71
|
)
|
|
78
72
|
|
|
79
|
-
await executeCommand(root,
|
|
73
|
+
await executeCommand(root, servicePackageManager, servicePackageArgs, {
|
|
74
|
+
cwd: resolve(root, service.path),
|
|
75
|
+
stdio: 'inherit'
|
|
76
|
+
})
|
|
80
77
|
/* c8 ignore next 6 */
|
|
81
78
|
} catch (error) {
|
|
82
79
|
logger.fatal(
|
package/lib/commands/external.js
CHANGED
|
@@ -10,7 +10,6 @@ import { defaultServiceJson } from '../defaults.js'
|
|
|
10
10
|
import { version } from '../schema.js'
|
|
11
11
|
import {
|
|
12
12
|
findConfigurationFile,
|
|
13
|
-
getPackageManager,
|
|
14
13
|
getRoot,
|
|
15
14
|
loadConfigurationFile,
|
|
16
15
|
loadRawConfigurationFile,
|
|
@@ -254,10 +253,6 @@ export async function resolveServices (
|
|
|
254
253
|
) {
|
|
255
254
|
const config = await loadConfigurationFile(logger, configurationFile)
|
|
256
255
|
|
|
257
|
-
if (!packageManager) {
|
|
258
|
-
getPackageManager(root)
|
|
259
|
-
}
|
|
260
|
-
|
|
261
256
|
// The services which might be to be resolved are the one that have a URL and either
|
|
262
257
|
// no path defined (which means no environment variable set) or a non-existing path (which means not resolved yet)
|
|
263
258
|
const resolvableServices = config.services.filter(service => {
|
|
@@ -321,7 +316,7 @@ export async function resolveServices (
|
|
|
321
316
|
url = parsed.toString()
|
|
322
317
|
}
|
|
323
318
|
|
|
324
|
-
const cloneArgs = ['clone', url, absolutePath]
|
|
319
|
+
const cloneArgs = ['clone', url, absolutePath, '--single-branch', '--depth', 1]
|
|
325
320
|
|
|
326
321
|
let branchLabel = ''
|
|
327
322
|
if (service.gitBranch && service.gitBranch !== 'main') {
|
|
@@ -433,7 +428,7 @@ export async function resolveCommand (logger, args) {
|
|
|
433
428
|
},
|
|
434
429
|
'package-manager': {
|
|
435
430
|
type: 'string',
|
|
436
|
-
short: '
|
|
431
|
+
short: 'P'
|
|
437
432
|
}
|
|
438
433
|
},
|
|
439
434
|
false
|
package/lib/commands/init.js
CHANGED
|
@@ -74,7 +74,7 @@ export async function initCommand (logger, args) {
|
|
|
74
74
|
fixPaths: false
|
|
75
75
|
})
|
|
76
76
|
|
|
77
|
-
await configManager.parse()
|
|
77
|
+
await configManager.parse(true, [], { transformOnValidationErrors: true })
|
|
78
78
|
|
|
79
79
|
await saveConfigurationFile(logger, configurationFile, {
|
|
80
80
|
$schema: schema.$id,
|
package/lib/utils.js
CHANGED
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
import { errors } from '@platformatic/control'
|
|
9
9
|
import { platformaticRuntime, buildRuntime as pltBuildRuntime } from '@platformatic/runtime'
|
|
10
10
|
import { bgGreen, black, bold } from 'colorette'
|
|
11
|
+
import { existsSync } from 'node:fs'
|
|
11
12
|
import { readFile, writeFile } from 'node:fs/promises'
|
|
12
13
|
import { dirname, resolve } from 'node:path'
|
|
13
|
-
import { existsSync } from 'node:fs'
|
|
14
14
|
import { parseArgs as nodeParseArgs } from 'node:util'
|
|
15
15
|
import { pino } from 'pino'
|
|
16
16
|
import pinoPretty from 'pino-pretty'
|
|
@@ -99,6 +99,21 @@ export function getPackageManager (root) {
|
|
|
99
99
|
return 'npm'
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
export function getPackageArgs (packageManager, production) {
|
|
103
|
+
const args = ['install']
|
|
104
|
+
if (production) {
|
|
105
|
+
switch (packageManager) {
|
|
106
|
+
case 'pnpm':
|
|
107
|
+
args.push('--prod')
|
|
108
|
+
break
|
|
109
|
+
case 'npm':
|
|
110
|
+
args.push('--omit=dev')
|
|
111
|
+
break
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return args
|
|
115
|
+
}
|
|
116
|
+
|
|
102
117
|
export function getRoot (positionals) {
|
|
103
118
|
let root = process.cwd()
|
|
104
119
|
|
|
@@ -191,7 +206,7 @@ export async function loadConfigurationFile (logger, configurationFile) {
|
|
|
191
206
|
}
|
|
192
207
|
})
|
|
193
208
|
|
|
194
|
-
await configManager.parse(true, [])
|
|
209
|
+
await configManager.parse(true, [], { transformOnValidationErrors: true })
|
|
195
210
|
return configManager.current
|
|
196
211
|
}
|
|
197
212
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wattpm",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.0",
|
|
4
4
|
"description": "The Node.js Application Server",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"pino-pretty": "^13.0.0",
|
|
36
36
|
"split2": "^4.2.0",
|
|
37
37
|
"table": "^6.8.2",
|
|
38
|
-
"@platformatic/basic": "2.
|
|
39
|
-
"@platformatic/
|
|
40
|
-
"@platformatic/
|
|
41
|
-
"@platformatic/
|
|
42
|
-
"@platformatic/
|
|
38
|
+
"@platformatic/basic": "2.25.0",
|
|
39
|
+
"@platformatic/runtime": "2.25.0",
|
|
40
|
+
"@platformatic/utils": "2.25.0",
|
|
41
|
+
"@platformatic/control": "2.25.0",
|
|
42
|
+
"@platformatic/config": "2.25.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"borp": "^0.19.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"neostandard": "^0.12.0",
|
|
50
50
|
"typescript": "^5.5.4",
|
|
51
51
|
"undici": "^7.0.0",
|
|
52
|
-
"@platformatic/node": "2.
|
|
52
|
+
"@platformatic/node": "2.25.0"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"test": "npm run lint && borp --concurrency=1 --timeout=300000",
|
package/schema.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$id": "https://schemas.platformatic.dev/wattpm/2.
|
|
2
|
+
"$id": "https://schemas.platformatic.dev/wattpm/2.25.0.json",
|
|
3
3
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
@@ -313,6 +313,14 @@
|
|
|
313
313
|
"sourceMaps": {
|
|
314
314
|
"type": "boolean",
|
|
315
315
|
"default": false
|
|
316
|
+
},
|
|
317
|
+
"packageManager": {
|
|
318
|
+
"type": "string",
|
|
319
|
+
"enum": [
|
|
320
|
+
"npm",
|
|
321
|
+
"pnpm",
|
|
322
|
+
"yarn"
|
|
323
|
+
]
|
|
316
324
|
}
|
|
317
325
|
}
|
|
318
326
|
}
|
|
@@ -483,6 +491,14 @@
|
|
|
483
491
|
"sourceMaps": {
|
|
484
492
|
"type": "boolean",
|
|
485
493
|
"default": false
|
|
494
|
+
},
|
|
495
|
+
"packageManager": {
|
|
496
|
+
"type": "string",
|
|
497
|
+
"enum": [
|
|
498
|
+
"npm",
|
|
499
|
+
"pnpm",
|
|
500
|
+
"yarn"
|
|
501
|
+
]
|
|
486
502
|
}
|
|
487
503
|
}
|
|
488
504
|
}
|