@multiplatform.one/cli 7.83.2 → 7.84.1
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/source.json +2 -2
- package/lib/source.mjs +7 -1
- package/package.json +3 -3
- package/src/source.ts +11 -0
- package/types/source.d.ts.map +1 -1
package/lib/source.json
CHANGED
package/lib/source.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { join, resolve } from "node:path";
|
|
|
5
5
|
|
|
6
6
|
//#region src/source.ts
|
|
7
7
|
const monorepoUrl = "https://git.corp.bitspur.com/multiplatform.one/mpo.git";
|
|
8
|
+
const corpHost = "git.corp.bitspur.com";
|
|
8
9
|
function isGitUrl(source) {
|
|
9
10
|
return /^(https?|ssh|git|file):\/\//.test(source) || /^[\w.-]+@[\w.-]+:/.test(source);
|
|
10
11
|
}
|
|
@@ -89,7 +90,12 @@ function classifySourceFailure(stderr) {
|
|
|
89
90
|
var SourceAccessError = class extends Error {
|
|
90
91
|
constructor(url, kind, gitOutput, reason) {
|
|
91
92
|
const host = /^[a-z]+:\/\/(?:[^@/]*@)?([^/:]+)/i.exec(url)?.[1] ?? /@([^:]+):/.exec(url)?.[1];
|
|
92
|
-
const
|
|
93
|
+
const corpPath = host === corpHost ? /^(?:[a-z+]+:\/\/(?:[^@/]*@)?[^/:]+(?::\d+)?\/|[^@]+@[^:]+:)(.+?)(?:\.git)?\/?$/i.exec(url)?.[1] : void 0;
|
|
94
|
+
const lines = kind === "network" ? [`Cannot reach the source repository ${url}${reason ? `: ${reason}` : ""}.`, `The CLI scaffolds from this git repository, so it needs a network path to ${host ?? "its host"} (check the connection, proxy or VPN).`] : [
|
|
95
|
+
`Cannot read the source repository ${url}${kind === "auth" ? ": access denied" : ""}.`,
|
|
96
|
+
...kind === "auth" && corpPath ? [`You need read access to ${corpPath} on ${corpHost}; ask the project owner.`] : [],
|
|
97
|
+
"The CLI scaffolds from this git repository, so it needs read access to it: an account that can clone it, and a credential git uses without asking (a token in a git credential helper for https, an SSH key for ssh)."
|
|
98
|
+
];
|
|
93
99
|
lines.push(`Check with: git ls-remote ${url}`);
|
|
94
100
|
lines.push("Or scaffold from a copy you can read: --source <path|url>");
|
|
95
101
|
const detail = gitOutput.split("\n").map((line) => line.trim()).filter(Boolean).slice(-4);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/cli",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.84.1",
|
|
4
4
|
"description": "multiplatform.one cli — mpo init clones and prunes the monorepo, mpo update merges it back",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"create-multiplatform-app",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@multiplatform.one/utils": "^7.
|
|
60
|
+
"@multiplatform.one/utils": "^7.84.1",
|
|
61
61
|
"commander": "^15.0.0",
|
|
62
62
|
"dotenv": "^17.4.2",
|
|
63
63
|
"inquirer": "^14.2.3",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@types/inquirer": "^9.0.10",
|
|
70
70
|
"@types/node": "^26.6.5",
|
|
71
71
|
"typescript": "~5.9.3",
|
|
72
|
-
"vitest": "^4.1.
|
|
72
|
+
"vitest": "^4.1.12"
|
|
73
73
|
},
|
|
74
74
|
"engines": {
|
|
75
75
|
"node": ">= 16.0"
|
package/src/source.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { cliRoot, cliVersion } from "./commands/provenance";
|
|
|
5
5
|
|
|
6
6
|
export const monorepoUrl = "https://git.corp.bitspur.com/multiplatform.one/mpo.git";
|
|
7
7
|
|
|
8
|
+
const corpHost = "git.corp.bitspur.com";
|
|
9
|
+
|
|
8
10
|
export interface SourceSpec {
|
|
9
11
|
/** Path to a local clone, or a git URL. */
|
|
10
12
|
source: string;
|
|
@@ -126,6 +128,12 @@ export class SourceAccessError extends Error {
|
|
|
126
128
|
readonly gitOutput: string;
|
|
127
129
|
constructor(url: string, kind: SourceFailure, gitOutput: string, reason?: string) {
|
|
128
130
|
const host = /^[a-z]+:\/\/(?:[^@/]*@)?([^/:]+)/i.exec(url)?.[1] ?? /@([^:]+):/.exec(url)?.[1];
|
|
131
|
+
const corpPath =
|
|
132
|
+
host === corpHost
|
|
133
|
+
? /^(?:[a-z+]+:\/\/(?:[^@/]*@)?[^/:]+(?::\d+)?\/|[^@]+@[^:]+:)(.+?)(?:\.git)?\/?$/i.exec(
|
|
134
|
+
url,
|
|
135
|
+
)?.[1]
|
|
136
|
+
: undefined;
|
|
129
137
|
const lines =
|
|
130
138
|
kind === "network"
|
|
131
139
|
? [
|
|
@@ -134,6 +142,9 @@ export class SourceAccessError extends Error {
|
|
|
134
142
|
]
|
|
135
143
|
: [
|
|
136
144
|
`Cannot read the source repository ${url}${kind === "auth" ? ": access denied" : ""}.`,
|
|
145
|
+
...(kind === "auth" && corpPath
|
|
146
|
+
? [`You need read access to ${corpPath} on ${corpHost}; ask the project owner.`]
|
|
147
|
+
: []),
|
|
137
148
|
"The CLI scaffolds from this git repository, so it needs read access to it: an account that can clone it, and a credential git uses without asking (a token in a git credential helper for https, an SSH key for ssh).",
|
|
138
149
|
];
|
|
139
150
|
lines.push(`Check with: git ls-remote ${url}`);
|
package/types/source.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,2DAA2D,CAAC;
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,WAAW,2DAA2D,CAAC;AAIpF,MAAM,WAAW,UAAU;IACzB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,8CAA8C;IAC9C,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,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