wattpm-utils 3.53.0-alpha.0 → 3.54.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/dependencies.js +47 -4
- package/package.json +5 -5
|
@@ -11,7 +11,7 @@ import { loadConfiguration } from '@platformatic/runtime'
|
|
|
11
11
|
import { bold } from 'colorette'
|
|
12
12
|
import { execa } from 'execa'
|
|
13
13
|
import { existsSync } from 'node:fs'
|
|
14
|
-
import { readFile, writeFile } from 'node:fs/promises'
|
|
14
|
+
import { readFile, rm, writeFile } from 'node:fs/promises'
|
|
15
15
|
import { resolve } from 'node:path'
|
|
16
16
|
import { parseEnv } from 'node:util'
|
|
17
17
|
import { rsort, satisfies } from 'semver'
|
|
@@ -37,6 +37,36 @@ async function executeCommand (root, ...args) {
|
|
|
37
37
|
return execa(...args)
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
async function withTemporaryPnpmConfig (directory, fn) {
|
|
41
|
+
const npmrc = resolve(directory, '.npmrc')
|
|
42
|
+
const marker = 'minimum-release-age-exclude[]=@platformatic/*'
|
|
43
|
+
let originalContents = null
|
|
44
|
+
|
|
45
|
+
if (!existsSync(npmrc)) {
|
|
46
|
+
await writeFile(npmrc, `${marker}\n`, 'utf-8')
|
|
47
|
+
} else {
|
|
48
|
+
const contents = await readFile(npmrc, 'utf-8')
|
|
49
|
+
if (!contents.includes(marker)) {
|
|
50
|
+
originalContents = contents
|
|
51
|
+
const prefix = contents.endsWith('\n') || contents.length === 0 ? '' : '\n'
|
|
52
|
+
await writeFile(npmrc, `${contents}${prefix}${marker}\n`, 'utf-8')
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
return await fn()
|
|
58
|
+
} finally {
|
|
59
|
+
if (originalContents !== null) {
|
|
60
|
+
await writeFile(npmrc, originalContents, 'utf-8')
|
|
61
|
+
} else if (existsSync(npmrc)) {
|
|
62
|
+
const contents = await readFile(npmrc, 'utf-8')
|
|
63
|
+
if (contents === `${marker}\n`) {
|
|
64
|
+
await rm(npmrc, { force: true })
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
40
70
|
export async function installDependencies (logger, root, applications, production, packageManager) {
|
|
41
71
|
if (typeof applications === 'string') {
|
|
42
72
|
const config = await loadConfiguration(applications, null, { validate: false })
|
|
@@ -59,11 +89,17 @@ export async function installDependencies (logger, root, applications, productio
|
|
|
59
89
|
try {
|
|
60
90
|
logger.info(`Installing ${production ? 'production ' : ''}dependencies for the project using ${packageManager} ...`)
|
|
61
91
|
|
|
62
|
-
|
|
92
|
+
const installProjectDependencies = () => executeCommand(root, packageManager, args, {
|
|
63
93
|
cwd: root,
|
|
64
94
|
stdio: 'inherit',
|
|
65
95
|
reject: process.env.PLT_IGNORE_INSTALL_FAILURES !== 'true'
|
|
66
96
|
})
|
|
97
|
+
|
|
98
|
+
if (packageManager === 'pnpm') {
|
|
99
|
+
await withTemporaryPnpmConfig(root, installProjectDependencies)
|
|
100
|
+
} else {
|
|
101
|
+
await installProjectDependencies()
|
|
102
|
+
}
|
|
67
103
|
/* c8 ignore next 7 */
|
|
68
104
|
} catch (error) {
|
|
69
105
|
return logFatalError(
|
|
@@ -102,11 +138,18 @@ export async function installDependencies (logger, root, applications, productio
|
|
|
102
138
|
}
|
|
103
139
|
}
|
|
104
140
|
|
|
105
|
-
|
|
106
|
-
|
|
141
|
+
const applicationRoot = resolve(root, path)
|
|
142
|
+
const installApplicationDependencies = () => executeCommand(root, applicationPackageManager, applicationPackageArgs, {
|
|
143
|
+
cwd: applicationRoot,
|
|
107
144
|
stdio: 'inherit',
|
|
108
145
|
reject: process.env.PLT_IGNORE_INSTALL_FAILURES !== 'true'
|
|
109
146
|
})
|
|
147
|
+
|
|
148
|
+
if (applicationPackageManager === 'pnpm') {
|
|
149
|
+
await withTemporaryPnpmConfig(applicationRoot, installApplicationDependencies)
|
|
150
|
+
} else {
|
|
151
|
+
await installApplicationDependencies()
|
|
152
|
+
}
|
|
110
153
|
/* c8 ignore next 7 */
|
|
111
154
|
} catch (error) {
|
|
112
155
|
return logFatalError(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wattpm-utils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.54.0",
|
|
4
4
|
"description": "The Node.js Application Server Utilities Commands",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"execa": "^9.4.0",
|
|
30
30
|
"semver": "^7.7.0",
|
|
31
31
|
"tar": "^7.5.7",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"@platformatic/runtime": "3.
|
|
32
|
+
"@platformatic/foundation": "3.54.0",
|
|
33
|
+
"create-wattpm": "3.54.0",
|
|
34
|
+
"@platformatic/runtime": "3.54.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"cleaner-spec-reporter": "^0.5.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"neostandard": "^0.12.0",
|
|
42
42
|
"typescript": "^5.5.4",
|
|
43
43
|
"undici": "^7.0.0",
|
|
44
|
-
"@platformatic/node": "3.
|
|
44
|
+
"@platformatic/node": "3.54.0"
|
|
45
45
|
},
|
|
46
46
|
"engines": {
|
|
47
47
|
"node": ">=22.19.0"
|