@microsoft/managed-apps-cli 0.9.2 → 0.10.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/README.md +23 -43
- package/dist/ArgumentProvider.d.ts.map +1 -1
- package/dist/ArgumentProvider.js +3 -0
- package/dist/ArgumentProvider.js.map +1 -1
- package/dist/Authentication/NodeMsalAuthenticationProvider.js +20 -1
- package/dist/Authentication/NodeMsalAuthenticationProvider.js.map +1 -1
- package/dist/Cli.d.ts.map +1 -1
- package/dist/Cli.js +12 -2
- package/dist/Cli.js.map +1 -1
- package/dist/Constants/CommandRegistry.d.ts.map +1 -1
- package/dist/Constants/CommandRegistry.js +5 -24
- package/dist/Constants/CommandRegistry.js.map +1 -1
- package/dist/Constants/HelpStrings.d.ts +8 -7
- package/dist/Constants/HelpStrings.d.ts.map +1 -1
- package/dist/Constants/HelpStrings.js +78 -73
- package/dist/Constants/HelpStrings.js.map +1 -1
- package/dist/Constants.d.ts +1 -1
- package/dist/Constants.d.ts.map +1 -1
- package/dist/Constants.js +4 -9
- package/dist/Constants.js.map +1 -1
- package/dist/Errors/GitHubErrorMap.d.ts +43 -14
- package/dist/Errors/GitHubErrorMap.d.ts.map +1 -1
- package/dist/Errors/GitHubErrorMap.js +188 -147
- package/dist/Errors/GitHubErrorMap.js.map +1 -1
- package/dist/Logger/CliLogger.d.ts +1 -0
- package/dist/Logger/CliLogger.d.ts.map +1 -1
- package/dist/Logger/CliLogger.js +5 -3
- package/dist/Logger/CliLogger.js.map +1 -1
- package/dist/Types/Argument.types.d.ts +1 -0
- package/dist/Types/Argument.types.d.ts.map +1 -1
- package/dist/Utils/DcfRecovery.d.ts +7 -7
- package/dist/Utils/DcfRecovery.d.ts.map +1 -1
- package/dist/Utils/DcfRecovery.js +17 -37
- package/dist/Utils/DcfRecovery.js.map +1 -1
- package/dist/Utils/DownloadTemplate.d.ts +45 -0
- package/dist/Utils/DownloadTemplate.d.ts.map +1 -0
- package/dist/Utils/DownloadTemplate.js +159 -0
- package/dist/Utils/DownloadTemplate.js.map +1 -0
- package/dist/Utils/EnvVars.d.ts +1 -1
- package/dist/Utils/EnvVars.d.ts.map +1 -1
- package/dist/Utils/GitVersionChecker.d.ts +38 -0
- package/dist/Utils/GitVersionChecker.d.ts.map +1 -0
- package/dist/Utils/GitVersionChecker.js +61 -0
- package/dist/Utils/GitVersionChecker.js.map +1 -0
- package/dist/Utils/MaafAppConfig.d.ts +22 -0
- package/dist/Utils/MaafAppConfig.d.ts.map +1 -0
- package/dist/Utils/MaafAppConfig.js +32 -0
- package/dist/Utils/MaafAppConfig.js.map +1 -0
- package/dist/Utils/NodeVersionChecker.d.ts +3 -6
- package/dist/Utils/NodeVersionChecker.d.ts.map +1 -1
- package/dist/Utils/NodeVersionChecker.js +9 -26
- package/dist/Utils/NodeVersionChecker.js.map +1 -1
- package/dist/Utils/Paging.d.ts +5 -0
- package/dist/Utils/Paging.d.ts.map +1 -1
- package/dist/Utils/Paging.js +29 -0
- package/dist/Utils/Paging.js.map +1 -1
- package/dist/Utils/PinCli.d.ts +28 -0
- package/dist/Utils/PinCli.d.ts.map +1 -0
- package/dist/Utils/PinCli.js +58 -0
- package/dist/Utils/PinCli.js.map +1 -0
- package/dist/Utils/RepoOption.d.ts +35 -0
- package/dist/Utils/RepoOption.d.ts.map +1 -0
- package/dist/Utils/RepoOption.js +36 -0
- package/dist/Utils/RepoOption.js.map +1 -0
- package/dist/Utils/Spinner.d.ts.map +1 -1
- package/dist/Utils/Spinner.js +3 -0
- package/dist/Utils/Spinner.js.map +1 -1
- package/dist/Verbs/AddAction.js +6 -6
- package/dist/Verbs/AddAction.js.map +1 -1
- package/dist/Verbs/AddConnector.d.ts +5 -3
- package/dist/Verbs/AddConnector.d.ts.map +1 -1
- package/dist/Verbs/AddConnector.js +45 -11
- package/dist/Verbs/AddConnector.js.map +1 -1
- package/dist/Verbs/AddConnectorFlows.d.ts +27 -14
- package/dist/Verbs/AddConnectorFlows.d.ts.map +1 -1
- package/dist/Verbs/AddConnectorFlows.js +70 -20
- package/dist/Verbs/AddConnectorFlows.js.map +1 -1
- package/dist/Verbs/AddDataSource.d.ts +3 -4
- package/dist/Verbs/AddDataSource.d.ts.map +1 -1
- package/dist/Verbs/AddDataSource.js +9 -20
- package/dist/Verbs/AddDataSource.js.map +1 -1
- package/dist/Verbs/AddTable.js +6 -6
- package/dist/Verbs/AddTable.js.map +1 -1
- package/dist/Verbs/AuthStatus.d.ts.map +1 -1
- package/dist/Verbs/AuthStatus.js +7 -4
- package/dist/Verbs/AuthStatus.js.map +1 -1
- package/dist/Verbs/BuildMaafApp.js +1 -1
- package/dist/Verbs/BuildMaafApp.js.map +1 -1
- package/dist/Verbs/ConnectorHelpers.d.ts +3 -4
- package/dist/Verbs/ConnectorHelpers.d.ts.map +1 -1
- package/dist/Verbs/ConnectorHelpers.js +8 -9
- package/dist/Verbs/ConnectorHelpers.js.map +1 -1
- package/dist/Verbs/CreateMaafApp.d.ts +0 -29
- package/dist/Verbs/CreateMaafApp.d.ts.map +1 -1
- package/dist/Verbs/CreateMaafApp.js +100 -171
- package/dist/Verbs/CreateMaafApp.js.map +1 -1
- package/dist/Verbs/DeleteDataSource.js +6 -6
- package/dist/Verbs/DeleteDataSource.js.map +1 -1
- package/dist/Verbs/DeployMaafApp.d.ts.map +1 -1
- package/dist/Verbs/DeployMaafApp.js +4 -4
- package/dist/Verbs/DeployMaafApp.js.map +1 -1
- package/dist/Verbs/Dev.js +1 -1
- package/dist/Verbs/Dev.js.map +1 -1
- package/dist/Verbs/GetMaafBuildStatus.d.ts.map +1 -1
- package/dist/Verbs/GetMaafBuildStatus.js +52 -3
- package/dist/Verbs/GetMaafBuildStatus.js.map +1 -1
- package/dist/Verbs/GetSettings.js +1 -1
- package/dist/Verbs/GetSettings.js.map +1 -1
- package/dist/Verbs/Init.d.ts.map +1 -1
- package/dist/Verbs/Init.js +166 -58
- package/dist/Verbs/Init.js.map +1 -1
- package/dist/Verbs/ListConnectorActions.js +12 -9
- package/dist/Verbs/ListConnectorActions.js.map +1 -1
- package/dist/Verbs/ListConnectors.js +2 -2
- package/dist/Verbs/ListConnectors.js.map +1 -1
- package/dist/Verbs/ListMaafApps.js +3 -3
- package/dist/Verbs/ListMaafApps.js.map +1 -1
- package/dist/Verbs/MaafAppPermissions.js +2 -2
- package/dist/Verbs/MaafAppPermissions.js.map +1 -1
- package/dist/Verbs/RefreshDataSource.js +1 -1
- package/dist/Verbs/RefreshDataSource.js.map +1 -1
- package/dist/Verbs/RefreshGitAuth.d.ts.map +1 -1
- package/dist/Verbs/RefreshGitAuth.js +3 -15
- package/dist/Verbs/RefreshGitAuth.js.map +1 -1
- package/dist/Verbs/SetSetting.js +2 -2
- package/dist/Verbs/SetSetting.js.map +1 -1
- package/dist/Verbs/ShowMaafApp.js +2 -2
- package/dist/Verbs/ShowMaafApp.js.map +1 -1
- package/dist/Verbs/VerbConstants.d.ts +19 -22
- package/dist/Verbs/VerbConstants.d.ts.map +1 -1
- package/dist/Verbs/VerbConstants.js +19 -22
- package/dist/Verbs/VerbConstants.js.map +1 -1
- package/package.json +10 -8
|
@@ -11,20 +11,20 @@
|
|
|
11
11
|
* display selection, and error mapping all live here so the caller can stay
|
|
12
12
|
* focused on its own happy-path flow.
|
|
13
13
|
*/
|
|
14
|
-
import { authenticateForRepoAsync
|
|
14
|
+
import { authenticateForRepoAsync } from '@microsoft/managed-apps-actions';
|
|
15
15
|
import { getCliLogger } from '../CliSettings.js';
|
|
16
16
|
import { AuthenticationError } from '../Errors/CliError.js';
|
|
17
|
-
import { mapGitHubServerErrorToCliError, matchGitHubAuthError } from '../Errors/GitHubErrorMap.js';
|
|
17
|
+
import { formatServerError, mapGitHubServerErrorToCliError, matchGitHubAuthError, } from '../Errors/GitHubErrorMap.js';
|
|
18
18
|
import { printInfo } from './ConsoleOutput.js';
|
|
19
19
|
import { ConsoleGitHubDcfDisplay, JsonGitHubDcfDisplay } from './GitHubDcfFlow.js';
|
|
20
20
|
import { computeRepoHash, parseRemoteUrl } from './RepoUrl.js';
|
|
21
21
|
/**
|
|
22
22
|
* Inline DCF recovery branch for the github catch-and-retry. SIGINT handling
|
|
23
23
|
* is scoped to this helper so Ctrl+C during the device-code polling loop
|
|
24
|
-
* doesn't leak a listener back to the verb's outer body.
|
|
25
|
-
* by `authenticateForRepoAsync` are
|
|
26
|
-
* {@link
|
|
27
|
-
*
|
|
24
|
+
* doesn't leak a listener back to the verb's outer body. Structured server
|
|
25
|
+
* errors thrown by `authenticateForRepoAsync` are normalized through
|
|
26
|
+
* {@link formatServerError} before being rethrown so the verb's outer catch
|
|
27
|
+
* (and the single-retry contract) sees CLI-typed errors.
|
|
28
28
|
*
|
|
29
29
|
* Telemetry event prefix is derived from the verb (e.g. `'app create'` →
|
|
30
30
|
* `'Maaf.Create.GitHubDcfRecovery'`) — keeps the call site a one-liner that
|
|
@@ -52,7 +52,7 @@ export async function runDcfRecoveryAsync(options) {
|
|
|
52
52
|
repoHash,
|
|
53
53
|
});
|
|
54
54
|
if (!jsonMode) {
|
|
55
|
-
printInfo('GitHub authentication is required
|
|
55
|
+
printInfo('GitHub authentication is required for this action.');
|
|
56
56
|
}
|
|
57
57
|
const display = composeRecoveryDisplay({ isJson: jsonMode, openBrowser });
|
|
58
58
|
// SIGINT plumbing: a Ctrl+C during the (potentially 15-minute) polling
|
|
@@ -84,17 +84,8 @@ export async function runDcfRecoveryAsync(options) {
|
|
|
84
84
|
repoHost: host,
|
|
85
85
|
repoHash,
|
|
86
86
|
});
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
code: error.code,
|
|
90
|
-
message: error.message,
|
|
91
|
-
status: error.status,
|
|
92
|
-
details: error.details,
|
|
93
|
-
}, { repoUrl: remoteUrl, verb });
|
|
94
|
-
if (mapped)
|
|
95
|
-
throw mapped;
|
|
96
|
-
}
|
|
97
|
-
throw error;
|
|
87
|
+
const mapped = formatServerError(error);
|
|
88
|
+
throw mapped ?? error;
|
|
98
89
|
}
|
|
99
90
|
finally {
|
|
100
91
|
process.removeListener('SIGINT', onSigint);
|
|
@@ -178,9 +169,9 @@ function telemetryEventPrefixForVerb(verb) {
|
|
|
178
169
|
* error escapes untouched so native/none verbs behave identically to the
|
|
179
170
|
* un-wrapped call.
|
|
180
171
|
* - First-attempt errors that {@link matchGitHubAuthError} doesn't recognize
|
|
181
|
-
* are
|
|
182
|
-
*
|
|
183
|
-
* as-is.
|
|
172
|
+
* are normalized via {@link formatServerError} (which handles
|
|
173
|
+
* `GrsServerError`, `HttpClientError`, and structured `Error` envelopes)
|
|
174
|
+
* before being rethrown; everything else escapes as-is.
|
|
184
175
|
* - A matching first-attempt error with no `externalRepoUrl` throws a
|
|
185
176
|
* verb-agnostic {@link AuthenticationError} before DCF is invoked — DCF
|
|
186
177
|
* itself requires a URL to derive host/owner/repo.
|
|
@@ -194,14 +185,6 @@ function telemetryEventPrefixForVerb(verb) {
|
|
|
194
185
|
*/
|
|
195
186
|
export async function withGitHubDcfRecoveryAsync(attempt, options, runDcfRecovery = runDcfRecoveryAsync) {
|
|
196
187
|
const { repoType, externalRepoUrl, tenantId, jsonMode, openBrowser, verb } = options;
|
|
197
|
-
// Local helper: if `e` is a recognized GrsServerError, return the friendly
|
|
198
|
-
// CLI-typed error; otherwise null. Closes over `externalRepoUrl`/`verb` so
|
|
199
|
-
// the two non-matching call sites below stay one line each and can't drift.
|
|
200
|
-
const mapGrsError = (e) => {
|
|
201
|
-
if (!(e instanceof GrsServerError))
|
|
202
|
-
return null;
|
|
203
|
-
return mapGitHubServerErrorToCliError({ code: e.code, message: e.message, status: e.status, details: e.details }, { repoUrl: externalRepoUrl, verb });
|
|
204
|
-
};
|
|
205
188
|
try {
|
|
206
189
|
// Happy path: attempt succeeds on the first try, no DCF, no retry.
|
|
207
190
|
return await attempt({ isRetry: false });
|
|
@@ -211,9 +194,9 @@ export async function withGitHubDcfRecoveryAsync(attempt, options, runDcfRecover
|
|
|
211
194
|
throw err;
|
|
212
195
|
const matched = matchGitHubAuthError(err);
|
|
213
196
|
if (!matched) {
|
|
214
|
-
// Non-matching first-attempt error:
|
|
215
|
-
// CLI errors, otherwise rethrow untouched.
|
|
216
|
-
const mapped =
|
|
197
|
+
// Non-matching first-attempt error: normalize known structured server
|
|
198
|
+
// errors to friendly CLI errors, otherwise rethrow untouched.
|
|
199
|
+
const mapped = formatServerError(err);
|
|
217
200
|
if (mapped)
|
|
218
201
|
throw mapped;
|
|
219
202
|
throw err;
|
|
@@ -249,14 +232,11 @@ export async function withGitHubDcfRecoveryAsync(attempt, options, runDcfRecover
|
|
|
249
232
|
// the device-code flow and another loop would just hang. Fall through
|
|
250
233
|
// to `retryErr` if the mapper somehow returns null (defensive — the
|
|
251
234
|
// mapper recognizes every code matchGitHubAuthError matches on).
|
|
252
|
-
const mapped = mapGitHubServerErrorToCliError(remapped.payload
|
|
253
|
-
repoUrl: externalRepoUrl,
|
|
254
|
-
verb,
|
|
255
|
-
});
|
|
235
|
+
const mapped = mapGitHubServerErrorToCliError(remapped.payload);
|
|
256
236
|
throw mapped ?? retryErr;
|
|
257
237
|
}
|
|
258
238
|
// Non-matching retry error: same map-or-rethrow shape as the first attempt.
|
|
259
|
-
const mapped =
|
|
239
|
+
const mapped = formatServerError(retryErr);
|
|
260
240
|
if (mapped)
|
|
261
241
|
throw mapped;
|
|
262
242
|
throw retryErr;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DcfRecovery.js","sourceRoot":"","sources":["../../src/Utils/DcfRecovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;GASG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"DcfRecovery.js","sourceRoot":"","sources":["../../src/Utils/DcfRecovery.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;GASG;AAEH,OAAO,EAAE,wBAAwB,EAAyB,MAAM,iCAAiC,CAAC;AAGlG,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,O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GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;YAC3C,IAAI,MAAM;gBAAE,MAAM,MAAM,CAAC;YACzB,MAAM,QAAQ,CAAC;QACjB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
export interface ParsedGithubTemplate {
|
|
5
|
+
owner: string;
|
|
6
|
+
repo: string;
|
|
7
|
+
/** Empty string when the whole repo is the template (no subdir). */
|
|
8
|
+
subdir: string;
|
|
9
|
+
/**
|
|
10
|
+
* Optional branch or tag specified via the `#ref` suffix. Commit SHAs are
|
|
11
|
+
* NOT supported — the downloader passes this value to `git clone --branch`,
|
|
12
|
+
* which only resolves named refs, not raw commit hashes.
|
|
13
|
+
*/
|
|
14
|
+
ref: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parses a template source. Accepted shapes:
|
|
18
|
+
*
|
|
19
|
+
* github:<owner>/<repo>[/<subdir>...][#<ref>]
|
|
20
|
+
* gh:<owner>/<repo>[/<subdir>...][#<ref>] (shorthand)
|
|
21
|
+
* <owner>/<repo>[/<subdir>...][#<ref>] (prefix optional)
|
|
22
|
+
* https://github.com/<owner>/<repo>[.git][#<ref>]
|
|
23
|
+
* https://github.com/<owner>/<repo>/tree/<ref>[/<subdir>]
|
|
24
|
+
*
|
|
25
|
+
* Throws `UsageError` for any other shape — non-github providers (`gitlab:`,
|
|
26
|
+
* `bitbucket:`, …), arbitrary tarball URLs, and github file URLs (`/blob/...`).
|
|
27
|
+
* The CLI is intentionally github-only here: github is the only provider in
|
|
28
|
+
* real use, and authentication against private github repos already flows
|
|
29
|
+
* through the user's normal git credential setup.
|
|
30
|
+
*/
|
|
31
|
+
export declare function parseGithubTemplate(source: string): ParsedGithubTemplate;
|
|
32
|
+
/**
|
|
33
|
+
* Downloads a github-hosted template into `dir`. Uses a shallow + partial +
|
|
34
|
+
* sparse clone so only the requested subdirectory is fetched, then copies the
|
|
35
|
+
* working tree into place via `fs.cpSync` and discards the temporary clone.
|
|
36
|
+
*
|
|
37
|
+
* Requires `git` on PATH; callers should run `ensureGitInstalled` in preflight
|
|
38
|
+
* so a missing-git failure surfaces before any server call. Authentication for
|
|
39
|
+
* private repos flows through the user's existing git credential setup
|
|
40
|
+
* (gh, GCM, SSH key, PAT) — the CLI does not inject tokens at this layer.
|
|
41
|
+
*/
|
|
42
|
+
export declare function downloadTemplate(source: string, options: {
|
|
43
|
+
dir: string;
|
|
44
|
+
}): void;
|
|
45
|
+
//# sourceMappingURL=DownloadTemplate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DownloadTemplate.d.ts","sourceRoot":"","sources":["../../src/Utils/DownloadTemplate.ts"],"names":[],"mappings":"AAAA;;GAEG;AASH,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACzB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CA2FxE;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkD/E"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { execFileSync } from 'child_process';
|
|
5
|
+
import * as fs from 'fs';
|
|
6
|
+
import * as os from 'os';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import { UsageError } from '../Errors/CliError.js';
|
|
9
|
+
/**
|
|
10
|
+
* Parses a template source. Accepted shapes:
|
|
11
|
+
*
|
|
12
|
+
* github:<owner>/<repo>[/<subdir>...][#<ref>]
|
|
13
|
+
* gh:<owner>/<repo>[/<subdir>...][#<ref>] (shorthand)
|
|
14
|
+
* <owner>/<repo>[/<subdir>...][#<ref>] (prefix optional)
|
|
15
|
+
* https://github.com/<owner>/<repo>[.git][#<ref>]
|
|
16
|
+
* https://github.com/<owner>/<repo>/tree/<ref>[/<subdir>]
|
|
17
|
+
*
|
|
18
|
+
* Throws `UsageError` for any other shape — non-github providers (`gitlab:`,
|
|
19
|
+
* `bitbucket:`, …), arbitrary tarball URLs, and github file URLs (`/blob/...`).
|
|
20
|
+
* The CLI is intentionally github-only here: github is the only provider in
|
|
21
|
+
* real use, and authentication against private github repos already flows
|
|
22
|
+
* through the user's normal git credential setup.
|
|
23
|
+
*/
|
|
24
|
+
export function parseGithubTemplate(source) {
|
|
25
|
+
if (!source) {
|
|
26
|
+
throw new UsageError('Template source is empty. Use --template to specify one.');
|
|
27
|
+
}
|
|
28
|
+
// 1. Raw github.com URL — common when the user pastes from a browser
|
|
29
|
+
// address bar. We use the WHATWG URL parser rather than regex so query
|
|
30
|
+
// params (`?tab=readme`), mixed-case hosts, trailing slashes, embedded
|
|
31
|
+
// userinfo, and percent-encoded segments all get normalised away
|
|
32
|
+
// automatically. The path is then matched against the two shapes we
|
|
33
|
+
// support: bare-repo (`/<owner>/<repo>[.git]`) and the web-UI subdir
|
|
34
|
+
// form (`/<owner>/<repo>/tree/<branch>[/<subdir>...]`). `/blob/...`
|
|
35
|
+
// (file URLs) and any other path shape are rejected with a clear error
|
|
36
|
+
// so the failure isn't a confusing mid-flow clone failure.
|
|
37
|
+
if (/^https?:\/\//i.test(source)) {
|
|
38
|
+
let url;
|
|
39
|
+
try {
|
|
40
|
+
url = new URL(source);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
throw new UsageError(`Template source '${source}' is not a valid URL.`);
|
|
44
|
+
}
|
|
45
|
+
if (url.hostname.toLowerCase() !== 'github.com') {
|
|
46
|
+
throw new UsageError(`Template source '${source}' uses host '${url.hostname}'; only github.com URLs are supported.`);
|
|
47
|
+
}
|
|
48
|
+
const segments = url.pathname.split('/').filter(Boolean);
|
|
49
|
+
if (segments.length < 2) {
|
|
50
|
+
throw new UsageError(`Template source '${source}' is missing the owner/repo path. ` +
|
|
51
|
+
`Use 'https://github.com/<owner>/<repo>'.`);
|
|
52
|
+
}
|
|
53
|
+
const [owner, rawRepo, ...rest] = segments;
|
|
54
|
+
const repo = rawRepo.endsWith('.git') ? rawRepo.slice(0, -'.git'.length) : rawRepo;
|
|
55
|
+
const hashRef = url.hash ? url.hash.slice(1) : undefined;
|
|
56
|
+
if (rest.length === 0) {
|
|
57
|
+
return { owner, repo, subdir: '', ref: hashRef };
|
|
58
|
+
}
|
|
59
|
+
// Web-UI subdir form: /<owner>/<repo>/tree/<branch>[/<subdir>...]. We can't
|
|
60
|
+
// disambiguate `branch` from `subdir` when the branch name contains a `/`
|
|
61
|
+
// (we'd need to look up refs on the server). The downloadTemplate
|
|
62
|
+
// subdir-not-found error tells the user to switch to the `#<ref>` shorthand.
|
|
63
|
+
if (rest[0].toLowerCase() === 'tree' && rest.length >= 2) {
|
|
64
|
+
return {
|
|
65
|
+
owner,
|
|
66
|
+
repo,
|
|
67
|
+
subdir: rest.slice(2).join('/'),
|
|
68
|
+
ref: hashRef ?? rest[1],
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (rest[0].toLowerCase() === 'blob') {
|
|
72
|
+
throw new UsageError(`Template source '${source}' points at a file ('/blob/...'). ` +
|
|
73
|
+
`Templates must be a directory — use the '/tree/<branch>/<subdir>' URL form instead.`);
|
|
74
|
+
}
|
|
75
|
+
throw new UsageError(`Template source '${source}' has an unrecognised path. Use ` +
|
|
76
|
+
`'https://github.com/<owner>/<repo>' or ` +
|
|
77
|
+
`'https://github.com/<owner>/<repo>/tree/<branch>/<subdir>'.`);
|
|
78
|
+
}
|
|
79
|
+
// 2. Reject any prefix other than `github:` or `gh:` up front so the failure
|
|
80
|
+
// mode is a clear preflight error rather than a confusing clone failure.
|
|
81
|
+
const prefixMatch = /^([a-z][a-z0-9+.-]*):/i.exec(source);
|
|
82
|
+
if (prefixMatch) {
|
|
83
|
+
const prefix = prefixMatch[1].toLowerCase();
|
|
84
|
+
if (prefix !== 'github' && prefix !== 'gh') {
|
|
85
|
+
throw new UsageError(`Template source '${source}' uses unsupported provider prefix '${prefixMatch[1]}:'. ` +
|
|
86
|
+
`Only 'github:' (or 'gh:' shorthand) templates are supported.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// 3. Shorthand: 'github:owner/repo[/subdir][#ref]', 'gh:owner/repo[...]', or
|
|
90
|
+
// bare 'owner/repo[...]'.
|
|
91
|
+
const stripped = source.replace(/^(?:github|gh):/i, '');
|
|
92
|
+
const [pathPart, ref] = stripped.split('#', 2);
|
|
93
|
+
const parts = pathPart.split('/').filter(Boolean);
|
|
94
|
+
if (parts.length < 2) {
|
|
95
|
+
throw new UsageError(`Template source '${source}' is missing the owner/repo path. ` +
|
|
96
|
+
`Expected 'github:<owner>/<repo>[/<subdir>]'.`);
|
|
97
|
+
}
|
|
98
|
+
const [owner, repo, ...subdirParts] = parts;
|
|
99
|
+
return { owner, repo, subdir: subdirParts.join('/'), ref: ref || undefined };
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Downloads a github-hosted template into `dir`. Uses a shallow + partial +
|
|
103
|
+
* sparse clone so only the requested subdirectory is fetched, then copies the
|
|
104
|
+
* working tree into place via `fs.cpSync` and discards the temporary clone.
|
|
105
|
+
*
|
|
106
|
+
* Requires `git` on PATH; callers should run `ensureGitInstalled` in preflight
|
|
107
|
+
* so a missing-git failure surfaces before any server call. Authentication for
|
|
108
|
+
* private repos flows through the user's existing git credential setup
|
|
109
|
+
* (gh, GCM, SSH key, PAT) — the CLI does not inject tokens at this layer.
|
|
110
|
+
*/
|
|
111
|
+
export function downloadTemplate(source, options) {
|
|
112
|
+
const parsed = parseGithubTemplate(source);
|
|
113
|
+
const repoUrl = `https://github.com/${parsed.owner}/${parsed.repo}.git`;
|
|
114
|
+
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'ms-template-'));
|
|
115
|
+
try {
|
|
116
|
+
// `--filter=blob:none` defers blob download until checkout; combined with
|
|
117
|
+
// `--sparse` it means we only ever fetch blobs inside the requested
|
|
118
|
+
// subdir. For no-subdir templates we still want `--depth=1` for a shallow
|
|
119
|
+
// clone but skip `--sparse` so the whole tree checks out.
|
|
120
|
+
const cloneArgs = ['clone', '--depth=1', '--filter=blob:none'];
|
|
121
|
+
if (parsed.subdir)
|
|
122
|
+
cloneArgs.push('--sparse');
|
|
123
|
+
if (parsed.ref)
|
|
124
|
+
cloneArgs.push('--branch', parsed.ref);
|
|
125
|
+
cloneArgs.push(repoUrl, tmp);
|
|
126
|
+
execFileSync('git', cloneArgs, { stdio: ['ignore', 'ignore', 'inherit'] });
|
|
127
|
+
if (parsed.subdir) {
|
|
128
|
+
execFileSync('git', ['-C', tmp, 'sparse-checkout', 'set', parsed.subdir], {
|
|
129
|
+
stdio: ['ignore', 'ignore', 'inherit'],
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
const checkoutSource = parsed.subdir ? path.join(tmp, parsed.subdir) : tmp;
|
|
133
|
+
if (!fs.existsSync(checkoutSource)) {
|
|
134
|
+
// Common cause when this fires from the `/tree/<branch>/<subdir>` URL form:
|
|
135
|
+
// the branch name contains a `/` (e.g. `feat/foo`), and the parser took the
|
|
136
|
+
// first segment after `/tree/` as the ref — so `subdir` ended up shifted
|
|
137
|
+
// and the requested path doesn't exist. The shorthand `#<ref>` form is
|
|
138
|
+
// unambiguous and the recommended workaround.
|
|
139
|
+
throw new UsageError(`Template subdirectory '${parsed.subdir}' was not found in ` +
|
|
140
|
+
`https://github.com/${parsed.owner}/${parsed.repo}` +
|
|
141
|
+
`${parsed.ref ? ` at ref '${parsed.ref}'` : ''}. ` +
|
|
142
|
+
`If the branch name contains '/', use the ` +
|
|
143
|
+
`'github:<owner>/<repo>/<subdir>#<branch>' form to disambiguate.`);
|
|
144
|
+
}
|
|
145
|
+
fs.mkdirSync(options.dir, { recursive: true });
|
|
146
|
+
fs.cpSync(checkoutSource, options.dir, {
|
|
147
|
+
recursive: true,
|
|
148
|
+
force: true,
|
|
149
|
+
// Skip `.git` when copying. With `--sparse` + subdir the .git lives at
|
|
150
|
+
// `tmp/.git` (outside the copy source), so this matters mainly for the
|
|
151
|
+
// no-subdir path where the copy source IS the clone root.
|
|
152
|
+
filter: (src) => path.basename(src) !== '.git',
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
finally {
|
|
156
|
+
fs.rmSync(tmp, { recursive: true, force: true });
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
//# sourceMappingURL=DownloadTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DownloadTemplate.js","sourceRoot":"","sources":["../../src/Utils/DownloadTemplate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAehD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,UAAU,CAAC,0DAA0D,CAAC,CAAC;IACnF,CAAC;IAED,qEAAqE;IACrE,0EAA0E;IAC1E,0EAA0E;IAC1E,oEAAoE;IACpE,uEAAuE;IACvE,wEAAwE;IACxE,uEAAuE;IACvE,0EAA0E;IAC1E,8DAA8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EAAuE;YACvE,uEAAuE;YACvE,0DAA0D;YAC1D,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,MAAM;SAC/C,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
|
package/dist/Utils/EnvVars.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
3
|
*/
|
|
4
|
-
export type CliEnvVarName = 'USE_SP_AUTH' | 'SP_CLIENT_ID' | 'SP_CLIENT_SECRET' | 'SP_TENANT_ID' | 'USE_HTTP_FORWARD' | 'HTTP_FORWARD_URL' | 'HTTP_FORWARD_AUTH_TOKEN' | 'HTTP_FORWARD_TENANT_ID' | 'ENABLE_CONNECTOR_USER_CONSENT' | 'REMOTE_TELEMETRY' | 'CONSOLE_TELEMETRY' | 'ORIGIN' | '
|
|
4
|
+
export type CliEnvVarName = 'USE_SP_AUTH' | 'SP_CLIENT_ID' | 'SP_CLIENT_SECRET' | 'SP_TENANT_ID' | 'USE_HTTP_FORWARD' | 'HTTP_FORWARD_URL' | 'HTTP_FORWARD_AUTH_TOKEN' | 'HTTP_FORWARD_TENANT_ID' | 'ENABLE_CONNECTOR_USER_CONSENT' | 'REMOTE_TELEMETRY' | 'CONSOLE_TELEMETRY' | 'ORIGIN' | 'CONFIG_DIR' | 'WORKING_DIRECTORY' | 'MAAF_DEBUG_ENVIRONMENT_ID' | 'MAAF_GRS_ENDPOINT_OVERRIDE' | 'ENVIRONMENT_ID' | 'APP_DISPLAY_NAME' | 'APP_DESCRIPTION' | 'APP_ID' | 'APP_TEMPLATE' | 'APP_REPOSITORY_ID' | 'APP_REPO' | 'LOCAL_APP_URL' | 'BUILD_PATH' | 'BUILD_COMMAND' | 'BUILD_ENTRY_POINT' | 'CONFIG_ONLY' | 'PORT' | 'CLOUD_INSTANCE' | 'CONNECTOR' | 'CONNECTION_ID' | 'CONNECTION_REF' | 'CONNECTOR_ID' | 'CONNECTOR_SEARCH' | 'CONNECTOR_ACTION_SEARCH' | 'DATASET' | 'TABLE' | 'TABLE_NAME' | 'DATA_SOURCE_NAME' | 'SEARCH_TERM' | 'DATAVERSE_API_SEARCH_TERM' | 'DATAVERSE_ENVIRONMENT_ID' | 'SQL_STORED_PROCEDURE' | 'ENV_URL' | 'SOLUTION_ID' | 'ADD_CONNECTOR_AS' | 'FLOW_ID' | 'FLOW_SEARCH' | 'FLOW_DATA_SOURCE_NAME' | 'REMOVE_FLOW_ID' | 'MAAF_APP_NAME' | 'MAAF_APP_ACCESS' | 'MAAF_COMMIT_SHA' | 'MAAF_PLAY_MODE' | 'MAAF_ENVIRONMENT_ID' | 'MAAF_SHARE_LINK_ID' | 'MAAF_DEPLOY_ARTIFACT' | 'MAAF_GITHUB_REPO' | 'LIST_ENVIRONMENT_ID' | 'LIST_PERMISSION' | 'SKIP_CODEGEN' | 'USE_V1_CODEGEN' | 'APP_SHOW_HEADER';
|
|
5
5
|
export declare function cliEnvVarFullName(name: CliEnvVarName): string;
|
|
6
6
|
export declare function getCliEnvVar(name: CliEnvVarName): string | undefined;
|
|
7
7
|
export declare function getCliEnvVarBool(name: CliEnvVarName): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvVars.d.ts","sourceRoot":"","sources":["../../src/Utils/EnvVars.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,MAAM,aAAa,GAErB,aAAa,GACb,cAAc,GACd,kBAAkB,GAClB,cAAc,GAEd,kBAAkB,GAClB,kBAAkB,GAClB,yBAAyB,GACzB,wBAAwB,GAExB,+BAA+B,GAE/B,kBAAkB,GAClB,mBAAmB,GACnB,QAAQ,GAER,
|
|
1
|
+
{"version":3,"file":"EnvVars.d.ts","sourceRoot":"","sources":["../../src/Utils/EnvVars.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,MAAM,aAAa,GAErB,aAAa,GACb,cAAc,GACd,kBAAkB,GAClB,cAAc,GAEd,kBAAkB,GAClB,kBAAkB,GAClB,yBAAyB,GACzB,wBAAwB,GAExB,+BAA+B,GAE/B,kBAAkB,GAClB,mBAAmB,GACnB,QAAQ,GAER,YAAY,GACZ,mBAAmB,GACnB,2BAA2B,GAC3B,4BAA4B,GAE5B,gBAAgB,GAChB,kBAAkB,GAClB,iBAAiB,GACjB,QAAQ,GACR,cAAc,GACd,mBAAmB,GACnB,UAAU,GACV,eAAe,GACf,YAAY,GACZ,eAAe,GACf,mBAAmB,GACnB,aAAa,GACb,MAAM,GACN,gBAAgB,GAEhB,WAAW,GACX,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,kBAAkB,GAClB,yBAAyB,GACzB,SAAS,GACT,OAAO,GACP,YAAY,GACZ,kBAAkB,GAClB,aAAa,GACb,2BAA2B,GAC3B,0BAA0B,GAC1B,sBAAsB,GACtB,SAAS,GACT,aAAa,GACb,kBAAkB,GAElB,SAAS,GACT,aAAa,GACb,uBAAuB,GACvB,gBAAgB,GAEhB,eAAe,GACf,iBAAiB,GACjB,iBAAiB,GACjB,gBAAgB,GAChB,qBAAqB,GACrB,oBAAoB,GACpB,sBAAsB,GAEtB,kBAAkB,GAElB,qBAAqB,GACrB,iBAAiB,GAEjB,cAAc,GACd,gBAAgB,GAEhB,iBAAiB,CAAC;AAEtB,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAE7D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,GAAG,SAAS,CAEpE;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAE7D;AAED,sGAAsG;AACtG,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEhE;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAErE;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,CAEzD;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEjE;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAErD;AAED,wBAAgB,WAAW,IAAI,OAAO,OAAO,CAAC,GAAG,CAEhD;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,OAAO,OAAO,CAAC,GAAG,GAAG,IAAI,CAE7D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Preflight guard for `ms app create`: throws `ConfigurationError` when `git` is
|
|
6
|
+
* missing from PATH, or present but older than this package's `engines.git`
|
|
7
|
+
* range. Runs ahead of any server call so a local-tooling misconfiguration fails
|
|
8
|
+
* fast and never leaves an orphaned MAAF app + GRS repo behind.
|
|
9
|
+
*
|
|
10
|
+
* The floor lives in `engines.git` (currently `>=2.27.0`), bound by
|
|
11
|
+
* `git clone --sparse` + `git sparse-checkout set` in cone-mode-by-default — both
|
|
12
|
+
* landed in git 2.27.0 (Jun 2020). Every other git invocation in the verb
|
|
13
|
+
* (init/add/commit/push/clone/fetch/checkout, plus `-C` and `--filter=blob:none`)
|
|
14
|
+
* needs older versions, so 2.27.0 is the cumulative floor.
|
|
15
|
+
*
|
|
16
|
+
* Note that `engines.git` is NOT a recognised key in npm / bun / yarn / pnpm —
|
|
17
|
+
* none of them check it at install time (the only `engines` keys with built-in
|
|
18
|
+
* enforcement are `node` and the package manager's own name, and even those
|
|
19
|
+
* default to warn-not-fail). The runtime check below is the sole enforcement
|
|
20
|
+
* point; the manifest entry is documentation and the source of truth this
|
|
21
|
+
* function reads back.
|
|
22
|
+
*
|
|
23
|
+
* Failure postures, by input source:
|
|
24
|
+
* - `engines.git` lives in our own `package.json`, so a missing / invalid
|
|
25
|
+
* value would be a CLI bug. The runtime silently no-ops in that case —
|
|
26
|
+
* blocking a user over OUR misconfiguration would be the wrong trade.
|
|
27
|
+
* The `GitVersionChecker.test.ts` "engines.git is non-empty and a valid
|
|
28
|
+
* semver range" test fails the build if the manifest is broken, so the
|
|
29
|
+
* misconfig never reaches production.
|
|
30
|
+
* - `git --version` output comes from whatever git is on the user's PATH.
|
|
31
|
+
* Real-world dialects include `git version 2.45.2.windows.1`, `git version
|
|
32
|
+
* 2.39.5 (Apple Git-154)`, RC/dev suffixes, etc. `semver.coerce` extracts
|
|
33
|
+
* the leading `<major>.<minor>.<patch>` from any of them; if it can't, we
|
|
34
|
+
* fail open so a non-standard distribution doesn't get blocked over a
|
|
35
|
+
* format we couldn't predict.
|
|
36
|
+
*/
|
|
37
|
+
export declare function ensureGitInstalled(): void;
|
|
38
|
+
//# sourceMappingURL=GitVersionChecker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitVersionChecker.d.ts","sourceRoot":"","sources":["../../src/Utils/GitVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAmBzC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { execFileSync } from 'child_process';
|
|
5
|
+
import semver from 'semver';
|
|
6
|
+
import packageJson from '../../package.json' with { type: 'json' };
|
|
7
|
+
import { ConfigurationError } from '../Errors/CliError.js';
|
|
8
|
+
/**
|
|
9
|
+
* Preflight guard for `ms app create`: throws `ConfigurationError` when `git` is
|
|
10
|
+
* missing from PATH, or present but older than this package's `engines.git`
|
|
11
|
+
* range. Runs ahead of any server call so a local-tooling misconfiguration fails
|
|
12
|
+
* fast and never leaves an orphaned MAAF app + GRS repo behind.
|
|
13
|
+
*
|
|
14
|
+
* The floor lives in `engines.git` (currently `>=2.27.0`), bound by
|
|
15
|
+
* `git clone --sparse` + `git sparse-checkout set` in cone-mode-by-default — both
|
|
16
|
+
* landed in git 2.27.0 (Jun 2020). Every other git invocation in the verb
|
|
17
|
+
* (init/add/commit/push/clone/fetch/checkout, plus `-C` and `--filter=blob:none`)
|
|
18
|
+
* needs older versions, so 2.27.0 is the cumulative floor.
|
|
19
|
+
*
|
|
20
|
+
* Note that `engines.git` is NOT a recognised key in npm / bun / yarn / pnpm —
|
|
21
|
+
* none of them check it at install time (the only `engines` keys with built-in
|
|
22
|
+
* enforcement are `node` and the package manager's own name, and even those
|
|
23
|
+
* default to warn-not-fail). The runtime check below is the sole enforcement
|
|
24
|
+
* point; the manifest entry is documentation and the source of truth this
|
|
25
|
+
* function reads back.
|
|
26
|
+
*
|
|
27
|
+
* Failure postures, by input source:
|
|
28
|
+
* - `engines.git` lives in our own `package.json`, so a missing / invalid
|
|
29
|
+
* value would be a CLI bug. The runtime silently no-ops in that case —
|
|
30
|
+
* blocking a user over OUR misconfiguration would be the wrong trade.
|
|
31
|
+
* The `GitVersionChecker.test.ts` "engines.git is non-empty and a valid
|
|
32
|
+
* semver range" test fails the build if the manifest is broken, so the
|
|
33
|
+
* misconfig never reaches production.
|
|
34
|
+
* - `git --version` output comes from whatever git is on the user's PATH.
|
|
35
|
+
* Real-world dialects include `git version 2.45.2.windows.1`, `git version
|
|
36
|
+
* 2.39.5 (Apple Git-154)`, RC/dev suffixes, etc. `semver.coerce` extracts
|
|
37
|
+
* the leading `<major>.<minor>.<patch>` from any of them; if it can't, we
|
|
38
|
+
* fail open so a non-standard distribution doesn't get blocked over a
|
|
39
|
+
* format we couldn't predict.
|
|
40
|
+
*/
|
|
41
|
+
export function ensureGitInstalled() {
|
|
42
|
+
let versionOutput;
|
|
43
|
+
try {
|
|
44
|
+
versionOutput = execFileSync('git', ['--version'], {
|
|
45
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
46
|
+
}).toString();
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
throw new ConfigurationError("'git' is required but was not found on PATH.");
|
|
50
|
+
}
|
|
51
|
+
const required = packageJson.engines.git;
|
|
52
|
+
if (!semver.validRange(required))
|
|
53
|
+
return;
|
|
54
|
+
const found = semver.coerce(versionOutput);
|
|
55
|
+
if (!found)
|
|
56
|
+
return;
|
|
57
|
+
if (semver.satisfies(found, required))
|
|
58
|
+
return;
|
|
59
|
+
throw new ConfigurationError(`Git ${required} is required (found ${found.version}). Please upgrade git.`);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=GitVersionChecker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitVersionChecker.js","sourceRoot":"","sources":["../../src/Utils/GitVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAE5B,OAAO,WAAW,MAAM,oBAAoB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,kBAAkB;IAChC,IAAI,aAAqB,CAAC;IAC1B,IAAI,CAAC;QACH,aAAa,GAAG,YAAY,CAAC,KAAK,EAAE,CAAC,WAAW,CAAC,EAAE;YACjD,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;SACpC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAChB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,kBAAkB,CAAC,8CAA8C,CAAC,CAAC;IAC/E,CAAC;IAED,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC;QAAE,OAAO;IACzC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK;QAAE,OAAO;IACnB,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC;QAAE,OAAO;IAE9C,MAAM,IAAI,kBAAkB,CAC1B,OAAO,QAAQ,uBAAuB,KAAK,CAAC,OAAO,wBAAwB,CAC5E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import type { AppConfig, RepoType } from '@microsoft/managed-apps-common/config';
|
|
5
|
+
interface BuildMaafAppConfigOptions {
|
|
6
|
+
appId: string;
|
|
7
|
+
appDisplayName: string;
|
|
8
|
+
description: string | null | undefined;
|
|
9
|
+
environmentId: string;
|
|
10
|
+
repoType: RepoType;
|
|
11
|
+
cloud: AppConfig['cloud'];
|
|
12
|
+
buildPath?: string;
|
|
13
|
+
buildCommand?: string;
|
|
14
|
+
buildEntryPoint?: string;
|
|
15
|
+
repositoryId?: string;
|
|
16
|
+
externalRepoUrl?: string;
|
|
17
|
+
appSettings?: AppConfig['appSettings'];
|
|
18
|
+
connectionReferences?: AppConfig['connectionReferences'];
|
|
19
|
+
}
|
|
20
|
+
export declare function buildMaafAppConfig(options: BuildMaafAppConfigOptions): AppConfig;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=MaafAppConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MaafAppConfig.d.ts","sourceRoot":"","sources":["../../src/Utils/MaafAppConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AAGjF,UAAU,yBAAyB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,QAAQ,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,SAAS,CAAC,aAAa,CAAC,CAAC;IACvC,oBAAoB,CAAC,EAAE,SAAS,CAAC,sBAAsB,CAAC,CAAC;CAC1D;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,SAAS,CA+BhF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
|
+
*/
|
|
4
|
+
import { VERSION } from '@microsoft/managed-apps-common/config';
|
|
5
|
+
export function buildMaafAppConfig(options) {
|
|
6
|
+
const appConfig = {
|
|
7
|
+
version: VERSION,
|
|
8
|
+
appId: options.appId,
|
|
9
|
+
appDisplayName: options.appDisplayName,
|
|
10
|
+
environmentId: options.environmentId,
|
|
11
|
+
description: options.description,
|
|
12
|
+
repoType: options.repoType,
|
|
13
|
+
cloud: options.cloud,
|
|
14
|
+
buildPath: options.buildPath ?? './dist',
|
|
15
|
+
buildCommand: options.buildCommand ?? 'npm run build',
|
|
16
|
+
buildEntryPoint: options.buildEntryPoint ?? 'index.html',
|
|
17
|
+
};
|
|
18
|
+
if (options.repositoryId) {
|
|
19
|
+
appConfig.repositoryId = options.repositoryId;
|
|
20
|
+
}
|
|
21
|
+
if (options.externalRepoUrl) {
|
|
22
|
+
appConfig.externalRepoUrl = options.externalRepoUrl;
|
|
23
|
+
}
|
|
24
|
+
if (options.connectionReferences !== undefined) {
|
|
25
|
+
appConfig.connectionReferences = options.connectionReferences;
|
|
26
|
+
}
|
|
27
|
+
if (options.appSettings !== undefined) {
|
|
28
|
+
appConfig.appSettings = options.appSettings;
|
|
29
|
+
}
|
|
30
|
+
return appConfig;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=MaafAppConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MaafAppConfig.js","sourceRoot":"","sources":["../../src/Utils/MaafAppConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;AAkBhE,MAAM,UAAU,kBAAkB,CAAC,OAAkC;IACnE,MAAM,SAAS,GAAc;QAC3B,OAAO,EAAE,OAAO;QAChB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,cAAc,EAAE,OAAO,CAAC,cAAc;QACtC,aAAa,EAAE,OAAO,CAAC,aAAa;QACpC,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,QAAQ;QACxC,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,eAAe;QACrD,eAAe,EAAE,OAAO,CAAC,eAAe,IAAI,YAAY;KACzD,CAAC;IAEF,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC;QACzB,SAAS,CAAC,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAChD,CAAC;IAED,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;QAC5B,SAAS,CAAC,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;IACtD,CAAC;IAED,IAAI,OAAO,CAAC,oBAAoB,KAAK,SAAS,EAAE,CAAC;QAC/C,SAAS,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAChE,CAAC;IAED,IAAI,OAAO,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;QACtC,SAAS,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAC9C,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -2,12 +2,9 @@
|
|
|
2
2
|
* Copyright (C) Microsoft Corporation. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Best-effort guard: warn (never throw) when the running Node.js
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* NO_COLOR/TTY handled by `styleText`.
|
|
5
|
+
* Best-effort guard: warn (never throw) when the running Node.js doesn't satisfy this package's
|
|
6
|
+
* `engines.node` range. Mirrors `scripts/check-bun-version.ts`. Emits via `printWarning` — stderr,
|
|
7
|
+
* so it can't corrupt a `--json` stdout envelope, with NO_COLOR/TTY handled by `styleText`.
|
|
9
8
|
*/
|
|
10
9
|
export declare function warnIfNodeVersionUnsupported(): void;
|
|
11
|
-
/** Parse the leading `major.minor.patch` out of a version or range string (`>=24.5.0` → `[24, 5, 0]`). */
|
|
12
|
-
export declare function parseVersion(value: string): number[];
|
|
13
10
|
//# sourceMappingURL=NodeVersionChecker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeVersionChecker.d.ts","sourceRoot":"","sources":["../../src/Utils/NodeVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"NodeVersionChecker.d.ts","sourceRoot":"","sources":["../../src/Utils/NodeVersionChecker.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,IAAI,CAWnD"}
|