nx 21.4.0-canary.20250726-64897b7 → 21.4.0-canary.20250729-c2d0ecf
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/bin/post-install.js +8 -22
- package/package.json +11 -11
- package/src/command-line/init/implementation/utils.d.ts.map +1 -1
- package/src/command-line/init/implementation/utils.js +1 -2
- package/src/command-line/nx-cloud/connect/connect-to-nx-cloud.d.ts.map +1 -1
- package/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +4 -4
- package/src/command-line/nx-cloud/connect/view-logs.d.ts.map +1 -1
- package/src/command-line/nx-cloud/connect/view-logs.js +3 -5
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -1
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts.map +1 -1
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +5 -3
- package/src/nx-cloud/utilities/onboarding.d.ts.map +1 -1
- package/src/nx-cloud/utilities/onboarding.js +1 -1
- package/src/nx-cloud/utilities/url-shorten.d.ts +1 -2
- package/src/nx-cloud/utilities/url-shorten.d.ts.map +1 -1
- package/src/nx-cloud/utilities/url-shorten.js +17 -21
- package/src/plugins/js/index.d.ts.map +1 -1
- package/src/plugins/js/index.js +10 -16
- package/src/plugins/js/lock-file/bun-parser.d.ts +15 -0
- package/src/plugins/js/lock-file/bun-parser.d.ts.map +1 -0
- package/src/plugins/js/lock-file/bun-parser.js +964 -0
- package/src/plugins/js/lock-file/lock-file.d.ts +2 -2
- package/src/plugins/js/lock-file/lock-file.d.ts.map +1 -1
- package/src/plugins/js/lock-file/lock-file.js +40 -17
- package/src/utils/ab-testing.d.ts +1 -1
- package/src/utils/ab-testing.d.ts.map +1 -1
- package/src/utils/ab-testing.js +1 -1
- package/src/utils/git-utils.d.ts +6 -6
- package/src/utils/git-utils.d.ts.map +1 -1
- package/src/utils/git-utils.js +75 -50
@@ -2,11 +2,11 @@
|
|
2
2
|
* This is the main API for accessing the lock file functionality.
|
3
3
|
* It encapsulates the package manager specific logic and implementation details.
|
4
4
|
*/
|
5
|
-
import { PackageManager } from '../../../utils/package-manager';
|
6
5
|
import { ProjectGraph, ProjectGraphExternalNode } from '../../../config/project-graph';
|
6
|
+
import { CreateDependenciesContext, CreateNodesContext } from '../../../project-graph/plugins';
|
7
7
|
import { RawProjectGraphDependency } from '../../../project-graph/project-graph-builder';
|
8
8
|
import { PackageJson } from '../../../utils/package-json';
|
9
|
-
import {
|
9
|
+
import { PackageManager } from '../../../utils/package-manager';
|
10
10
|
export declare const LOCKFILES: string[];
|
11
11
|
/**
|
12
12
|
* Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"lock-file.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/lock-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
1
|
+
{"version":3,"file":"lock-file.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nx/src/plugins/js/lock-file/lock-file.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACL,YAAY,EACZ,wBAAwB,EACzB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAC;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC1D,OAAO,EAEL,cAAc,EACf,MAAM,gCAAgC,CAAC;AA8BxC,eAAO,MAAM,SAAS,UAMrB,CAAC;AAQF;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,kBAAkB,GAC1B,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,CAqC1C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,yBAAyB,GACjC,yBAAyB,EAAE,CA8B7B;AAED,wBAAgB,cAAc,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAgBtE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAiBtE;AAED,wBAAgB,eAAe,CAAC,cAAc,EAAE,cAAc,GAAG,MAAM,CAgCtE;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,YAAY,EACnB,cAAc,GAAE,cAAoD,GACnE,MAAM,CA8CR"}
|
@@ -15,32 +15,31 @@ const node_child_process_1 = require("node:child_process");
|
|
15
15
|
const node_fs_1 = require("node:fs");
|
16
16
|
const node_path_1 = require("node:path");
|
17
17
|
const semver_1 = require("semver");
|
18
|
+
const fileutils_1 = require("../../../utils/fileutils");
|
19
|
+
const output_1 = require("../../../utils/output");
|
18
20
|
const package_manager_1 = require("../../../utils/package-manager");
|
19
21
|
const workspace_root_1 = require("../../../utils/workspace-root");
|
20
|
-
const
|
22
|
+
const bun_parser_1 = require("./bun-parser");
|
21
23
|
const npm_parser_1 = require("./npm-parser");
|
22
24
|
const pnpm_parser_1 = require("./pnpm-parser");
|
23
|
-
const yarn_parser_1 = require("./yarn-parser");
|
24
25
|
const project_graph_pruning_1 = require("./project-graph-pruning");
|
25
26
|
const package_json_1 = require("./utils/package-json");
|
26
|
-
const
|
27
|
+
const yarn_parser_1 = require("./yarn-parser");
|
27
28
|
const YARN_LOCK_FILE = 'yarn.lock';
|
28
29
|
const NPM_LOCK_FILE = 'package-lock.json';
|
29
30
|
const PNPM_LOCK_FILE = 'pnpm-lock.yaml';
|
30
|
-
const BUN_LOCK_FILE = 'bun.lockb';
|
31
|
-
const BUN_TEXT_LOCK_FILE = 'bun.lock';
|
32
31
|
exports.LOCKFILES = [
|
33
32
|
YARN_LOCK_FILE,
|
34
33
|
NPM_LOCK_FILE,
|
35
34
|
PNPM_LOCK_FILE,
|
36
|
-
BUN_LOCK_FILE,
|
37
|
-
BUN_TEXT_LOCK_FILE,
|
35
|
+
bun_parser_1.BUN_LOCK_FILE,
|
36
|
+
bun_parser_1.BUN_TEXT_LOCK_FILE,
|
38
37
|
];
|
39
38
|
const YARN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, YARN_LOCK_FILE);
|
40
39
|
const NPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, NPM_LOCK_FILE);
|
41
40
|
const PNPM_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, PNPM_LOCK_FILE);
|
42
|
-
const BUN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, BUN_LOCK_FILE);
|
43
|
-
const BUN_TEXT_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, BUN_TEXT_LOCK_FILE);
|
41
|
+
const BUN_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, bun_parser_1.BUN_LOCK_FILE);
|
42
|
+
const BUN_TEXT_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot, bun_parser_1.BUN_TEXT_LOCK_FILE);
|
44
43
|
/**
|
45
44
|
* Parses lock file and maps dependencies and metadata to {@link LockFileGraph}
|
46
45
|
*/
|
@@ -57,9 +56,16 @@ function getLockFileNodes(packageManager, contents, lockFileHash, context) {
|
|
57
56
|
return (0, npm_parser_1.getNpmLockfileNodes)(contents, lockFileHash);
|
58
57
|
}
|
59
58
|
if (packageManager === 'bun') {
|
60
|
-
|
61
|
-
|
62
|
-
|
59
|
+
const lockFilePath = getLockFilePath(packageManager);
|
60
|
+
if (lockFilePath.endsWith(bun_parser_1.BUN_TEXT_LOCK_FILE)) {
|
61
|
+
// Use new text-based parser
|
62
|
+
return (0, bun_parser_1.getBunTextLockfileNodes)(contents, lockFileHash);
|
63
|
+
}
|
64
|
+
else {
|
65
|
+
// Fallback to yarn parser for binary format
|
66
|
+
const packageJson = (0, fileutils_1.readJsonFile)((0, node_path_1.join)(context.workspaceRoot, 'package.json'));
|
67
|
+
return (0, yarn_parser_1.getYarnLockfileNodes)(contents, lockFileHash, packageJson);
|
68
|
+
}
|
63
69
|
}
|
64
70
|
}
|
65
71
|
catch (e) {
|
@@ -88,8 +94,14 @@ function getLockFileDependencies(packageManager, contents, lockFileHash, context
|
|
88
94
|
return (0, npm_parser_1.getNpmLockfileDependencies)(contents, lockFileHash, context);
|
89
95
|
}
|
90
96
|
if (packageManager === 'bun') {
|
91
|
-
|
92
|
-
|
97
|
+
const lockFilePath = getLockFilePath(packageManager);
|
98
|
+
if (lockFilePath.endsWith(bun_parser_1.BUN_TEXT_LOCK_FILE)) {
|
99
|
+
return (0, bun_parser_1.getBunTextLockfileDependencies)(contents, lockFileHash, context);
|
100
|
+
}
|
101
|
+
else {
|
102
|
+
// Fallback to yarn parser for binary format
|
103
|
+
return (0, yarn_parser_1.getYarnLockfileDependencies)(contents, lockFileHash, context);
|
104
|
+
}
|
93
105
|
}
|
94
106
|
}
|
95
107
|
catch (e) {
|
@@ -134,7 +146,10 @@ function getLockFileName(packageManager) {
|
|
134
146
|
return NPM_LOCK_FILE;
|
135
147
|
}
|
136
148
|
if (packageManager === 'bun') {
|
137
|
-
|
149
|
+
const lockFilePath = getLockFilePath(packageManager);
|
150
|
+
return lockFilePath.endsWith(bun_parser_1.BUN_TEXT_LOCK_FILE)
|
151
|
+
? bun_parser_1.BUN_TEXT_LOCK_FILE
|
152
|
+
: bun_parser_1.BUN_LOCK_FILE;
|
138
153
|
}
|
139
154
|
throw new Error(`Unknown package manager: ${packageManager}`);
|
140
155
|
}
|
@@ -150,10 +165,18 @@ function getLockFilePath(packageManager) {
|
|
150
165
|
}
|
151
166
|
if (packageManager === 'bun') {
|
152
167
|
try {
|
168
|
+
// Check if text format exists first (prefer over binary)
|
169
|
+
if ((0, node_fs_1.existsSync)(BUN_TEXT_LOCK_PATH)) {
|
170
|
+
return BUN_TEXT_LOCK_PATH;
|
171
|
+
}
|
172
|
+
// Fall back to binary format
|
173
|
+
if ((0, node_fs_1.existsSync)(BUN_LOCK_PATH)) {
|
174
|
+
return BUN_LOCK_PATH;
|
175
|
+
}
|
153
176
|
const bunVersion = (0, node_child_process_1.execSync)('bun --version').toString().trim();
|
154
|
-
//
|
177
|
+
// Version-based fallback
|
155
178
|
if ((0, semver_1.gte)(bunVersion, '1.2.0')) {
|
156
|
-
return
|
179
|
+
return BUN_TEXT_LOCK_PATH;
|
157
180
|
}
|
158
181
|
return BUN_LOCK_PATH;
|
159
182
|
}
|
@@ -26,7 +26,7 @@ declare const messageOptions: {
|
|
26
26
|
readonly value: "skip";
|
27
27
|
readonly name: "No";
|
28
28
|
}];
|
29
|
-
readonly footer: "\nRead more about
|
29
|
+
readonly footer: "\nRead more about Nx Cloud at https://nx.dev/nx-cloud";
|
30
30
|
readonly hint: "\n(it's free and can be disabled any time)";
|
31
31
|
}];
|
32
32
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ab-testing.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/ab-testing.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9C,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"ab-testing.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/ab-testing.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9C,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BV,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,cAAc,CAAC;AACrD,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,qBAAa,cAAc;IACzB,OAAO,CAAC,gBAAgB,CAAM;IAE9B,SAAS,CAAC,GAAG,EAAE,UAAU,GAAG,WAAW;IAavC,2BAA2B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;CAIjD;AAED,eAAO,MAAM,QAAQ,gBAAuB,CAAC;AAE7C;;;GAGG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,iBAsBA"}
|
package/src/utils/ab-testing.js
CHANGED
@@ -33,7 +33,7 @@ const messageOptions = {
|
|
33
33
|
},
|
34
34
|
{ value: 'skip', name: 'No' },
|
35
35
|
],
|
36
|
-
footer: '\nRead more about
|
36
|
+
footer: '\nRead more about Nx Cloud at https://nx.dev/nx-cloud',
|
37
37
|
hint: `\n(it's free and can be disabled any time)`,
|
38
38
|
},
|
39
39
|
],
|
package/src/utils/git-utils.d.ts
CHANGED
@@ -32,12 +32,12 @@ export declare class GitRepository {
|
|
32
32
|
private quotePath;
|
33
33
|
private quoteArg;
|
34
34
|
}
|
35
|
-
export
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
export declare function
|
40
|
-
export declare function
|
35
|
+
export interface VcsRemoteInfo {
|
36
|
+
domain: string;
|
37
|
+
slug: string;
|
38
|
+
}
|
39
|
+
export declare function parseVcsRemoteUrl(url: string): VcsRemoteInfo | null;
|
40
|
+
export declare function getVcsRemoteInfo(): VcsRemoteInfo | null;
|
41
41
|
export declare function commitChanges(commitMessage: string, directory?: string): string | null;
|
42
42
|
export declare function getLatestCommitSha(directory?: string): string | null;
|
43
43
|
//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AAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;IAItC,sBAAsB;IAWtB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IAkB9C,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAkC1E,OAAO,CAAC,SAAS;IAWjB,OAAO,CAAC,SAAS;IAQjB,OAAO,CAAC,QAAQ;CAYjB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAmDnE;AAED,wBAAgB,gBAAgB,IAAI,aAAa,GAAG,IAAI,CA8CvD;AAED,wBAAgB,aAAa,CAC3B,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,MAAM,GAAG,IAAI,CA2Bf;AAED,wBAAgB,kBAAkB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAWpE"}
|
package/src/utils/git-utils.js
CHANGED
@@ -2,9 +2,8 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.GitRepository = void 0;
|
4
4
|
exports.cloneFromUpstream = cloneFromUpstream;
|
5
|
-
exports.
|
6
|
-
exports.
|
7
|
-
exports.extractUserAndRepoFromGitHubUrl = extractUserAndRepoFromGitHubUrl;
|
5
|
+
exports.parseVcsRemoteUrl = parseVcsRemoteUrl;
|
6
|
+
exports.getVcsRemoteInfo = getVcsRemoteInfo;
|
8
7
|
exports.commitChanges = commitChanges;
|
9
8
|
exports.getLatestCommitSha = getLatestCommitSha;
|
10
9
|
const child_process_1 = require("child_process");
|
@@ -171,61 +170,87 @@ class GitRepository {
|
|
171
170
|
}
|
172
171
|
}
|
173
172
|
exports.GitRepository = GitRepository;
|
174
|
-
function
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
173
|
+
function parseVcsRemoteUrl(url) {
|
174
|
+
// Remove whitespace and handle common URL formats
|
175
|
+
const cleanUrl = url.trim();
|
176
|
+
// SSH format: git@domain:owner/repo.git
|
177
|
+
const sshMatch = cleanUrl.match(/^git@([^:]+):([^\/]+)\/(.+?)(\.git)?$/);
|
178
|
+
if (sshMatch) {
|
179
|
+
const [, domain, owner, repo] = sshMatch;
|
180
|
+
return {
|
181
|
+
domain,
|
182
|
+
slug: `${owner}/${repo}`,
|
183
|
+
};
|
184
|
+
}
|
185
|
+
// HTTPS with authentication: https://user@domain/owner/repo.git
|
186
|
+
const httpsAuthMatch = cleanUrl.match(/^https?:\/\/[^@]+@([^\/]+)\/([^\/]+)\/(.+?)(\.git)?$/);
|
187
|
+
if (httpsAuthMatch) {
|
188
|
+
const [, domain, owner, repo] = httpsAuthMatch;
|
189
|
+
return {
|
190
|
+
domain,
|
191
|
+
slug: `${owner}/${repo}`,
|
192
|
+
};
|
193
|
+
}
|
194
|
+
// HTTPS format: https://domain/owner/repo.git (without authentication)
|
195
|
+
const httpsMatch = cleanUrl.match(/^https?:\/\/([^@\/]+)\/([^\/]+)\/(.+?)(\.git)?$/);
|
196
|
+
if (httpsMatch) {
|
197
|
+
const [, domain, owner, repo] = httpsMatch;
|
198
|
+
return {
|
199
|
+
domain,
|
200
|
+
slug: `${owner}/${repo}`,
|
201
|
+
};
|
202
|
+
}
|
203
|
+
// SSH alternative format: ssh://git@domain/owner/repo.git or ssh://git@domain:port/owner/repo.git
|
204
|
+
const sshAltMatch = cleanUrl.match(/^ssh:\/\/[^@]+@([^:\/]+)(:[0-9]+)?\/([^\/]+)\/(.+?)(\.git)?$/);
|
205
|
+
if (sshAltMatch) {
|
206
|
+
const [, domain, , owner, repo] = sshAltMatch;
|
207
|
+
return {
|
208
|
+
domain,
|
209
|
+
slug: `${owner}/${repo}`,
|
210
|
+
};
|
211
|
+
}
|
212
|
+
return null;
|
182
213
|
}
|
183
|
-
|
184
|
-
* This is currently duplicated in Nx Console. Please let @MaxKless know if you make changes here.
|
185
|
-
*/
|
186
|
-
function getGithubSlugOrNull() {
|
214
|
+
function getVcsRemoteInfo() {
|
187
215
|
try {
|
188
|
-
const gitRemote =
|
189
|
-
|
216
|
+
const gitRemote = (0, child_process_1.execSync)('git remote -v', {
|
217
|
+
stdio: 'pipe',
|
218
|
+
windowsHide: false,
|
219
|
+
})
|
220
|
+
.toString()
|
221
|
+
.trim();
|
190
222
|
if (!gitRemote || gitRemote.length === 0) {
|
191
|
-
return
|
223
|
+
return null;
|
192
224
|
}
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
foundRemotes[remoteName] = url;
|
210
|
-
if (!firstGitHubUrl) {
|
211
|
-
firstGitHubUrl = url;
|
225
|
+
const lines = gitRemote.split('\n').filter((line) => line.trim());
|
226
|
+
const remotesPriority = ['origin', 'upstream', 'base'];
|
227
|
+
const foundRemotes = {};
|
228
|
+
let firstRemote = null;
|
229
|
+
for (const line of lines) {
|
230
|
+
const match = line.trim().match(/^(\w+)\s+(\S+)\s+\((fetch|push)\)$/);
|
231
|
+
if (match) {
|
232
|
+
const [, remoteName, url] = match;
|
233
|
+
const remoteInfo = parseVcsRemoteUrl(url);
|
234
|
+
if (remoteInfo && !foundRemotes[remoteName]) {
|
235
|
+
foundRemotes[remoteName] = remoteInfo;
|
236
|
+
if (!firstRemote) {
|
237
|
+
firstRemote = remoteInfo;
|
238
|
+
}
|
239
|
+
}
|
240
|
+
}
|
212
241
|
}
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
242
|
+
// Return high-priority remote if found
|
243
|
+
for (const remote of remotesPriority) {
|
244
|
+
if (foundRemotes[remote]) {
|
245
|
+
return foundRemotes[remote];
|
246
|
+
}
|
217
247
|
}
|
248
|
+
// Return first found remote
|
249
|
+
return firstRemote;
|
218
250
|
}
|
219
|
-
|
220
|
-
|
221
|
-
function parseGitHubUrl(url) {
|
222
|
-
const sshPattern = /git@github\.com:([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\.git/;
|
223
|
-
const httpsPattern = /https:\/\/github\.com\/([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)\.git/;
|
224
|
-
let match = url.match(sshPattern) || url.match(httpsPattern);
|
225
|
-
if (match) {
|
226
|
-
return `${match[1]}/${match[2]}`;
|
251
|
+
catch (e) {
|
252
|
+
return null;
|
227
253
|
}
|
228
|
-
return null;
|
229
254
|
}
|
230
255
|
function commitChanges(commitMessage, directory) {
|
231
256
|
try {
|