wattpm-utils 3.14.0 → 3.16.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/external.js +24 -6
- package/package.json +5 -5
package/lib/commands/external.js
CHANGED
|
@@ -23,6 +23,19 @@ import { installDependencies } from './dependencies.js'
|
|
|
23
23
|
|
|
24
24
|
const originCandidates = ['origin', 'upstream']
|
|
25
25
|
|
|
26
|
+
function parseGitUrl (url) {
|
|
27
|
+
const fragmentIndex = url.indexOf('#')
|
|
28
|
+
|
|
29
|
+
if (fragmentIndex === -1) {
|
|
30
|
+
return { url, branch: null }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const baseUrl = url.substring(0, fragmentIndex)
|
|
34
|
+
const branch = url.substring(fragmentIndex + 1)
|
|
35
|
+
|
|
36
|
+
return { url: baseUrl, branch }
|
|
37
|
+
}
|
|
38
|
+
|
|
26
39
|
async function parseLocalFolder (path) {
|
|
27
40
|
// Read the package.json, if any
|
|
28
41
|
const packageJsonPath = resolve(path, 'package.json')
|
|
@@ -256,7 +269,10 @@ async function importURL (logger, _, configurationFile, rawUrl, id, http, branch
|
|
|
256
269
|
url = http ? `https://github.com/${rawUrl}.git` : `git@github.com:${rawUrl}.git`
|
|
257
270
|
}
|
|
258
271
|
|
|
259
|
-
|
|
272
|
+
const parsed = parseGitUrl(url)
|
|
273
|
+
const effectiveBranch = branch ?? parsed.branch
|
|
274
|
+
|
|
275
|
+
await importApplication(logger, configurationFile, id ?? basename(parsed.url, '.git'), null, parsed.url, effectiveBranch)
|
|
260
276
|
}
|
|
261
277
|
|
|
262
278
|
async function importLocal (logger, root, configurationFile, path, overridenId) {
|
|
@@ -371,10 +387,12 @@ export async function resolveApplications (
|
|
|
371
387
|
const absolutePath = application.path
|
|
372
388
|
const relativePath = relative(root, absolutePath)
|
|
373
389
|
|
|
374
|
-
// Clone and install dependencies
|
|
375
390
|
childLogger.info(`Resolving application ${bold(application.id)} ...`)
|
|
376
391
|
|
|
377
|
-
|
|
392
|
+
const parsedGitUrl = parseGitUrl(application.url)
|
|
393
|
+
let url = parsedGitUrl.url
|
|
394
|
+
const effectiveBranch = application.gitBranch ?? parsedGitUrl.branch
|
|
395
|
+
|
|
378
396
|
if (url.startsWith('http') && username && password) {
|
|
379
397
|
const parsed = new URL(url)
|
|
380
398
|
parsed.username ||= username
|
|
@@ -385,9 +403,9 @@ export async function resolveApplications (
|
|
|
385
403
|
const cloneArgs = ['clone', url, absolutePath, '--single-branch', '--depth', 1]
|
|
386
404
|
|
|
387
405
|
let branchLabel = ''
|
|
388
|
-
if (
|
|
389
|
-
cloneArgs.push('--branch',
|
|
390
|
-
branchLabel = ` (branch ${bold(
|
|
406
|
+
if (effectiveBranch && effectiveBranch !== 'main') {
|
|
407
|
+
cloneArgs.push('--branch', effectiveBranch)
|
|
408
|
+
branchLabel = ` (branch ${bold(effectiveBranch)})`
|
|
391
409
|
}
|
|
392
410
|
|
|
393
411
|
if (username) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wattpm-utils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0",
|
|
4
4
|
"description": "The Node.js Application Server Utilities Commands",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"dotenv": "^16.4.5",
|
|
29
29
|
"execa": "^9.4.0",
|
|
30
30
|
"semver": "^7.7.0",
|
|
31
|
-
"
|
|
32
|
-
"@platformatic/runtime": "3.
|
|
33
|
-
"
|
|
31
|
+
"create-wattpm": "3.16.0",
|
|
32
|
+
"@platformatic/runtime": "3.16.0",
|
|
33
|
+
"@platformatic/foundation": "3.16.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"cleaner-spec-reporter": "^0.5.0",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"neostandard": "^0.12.0",
|
|
41
41
|
"typescript": "^5.5.4",
|
|
42
42
|
"undici": "^7.0.0",
|
|
43
|
-
"@platformatic/node": "3.
|
|
43
|
+
"@platformatic/node": "3.16.0"
|
|
44
44
|
},
|
|
45
45
|
"engines": {
|
|
46
46
|
"node": ">=22.19.0"
|