@osdk/cli 0.19.0-next-20240426195134 → 0.19.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/CHANGELOG.md +3 -6
- package/README.md +148 -0
- package/build/js/chunk-3NRUGBBO.browser.mjs +15 -0
- package/build/js/chunk-3NRUGBBO.browser.mjs.map +1 -0
- package/build/js/chunk-C5C5AQYT.browser.mjs +9 -0
- package/build/js/{chunk-ZSTKOCBT.mjs → chunk-E2SEJZTC.mjs} +1 -1
- package/build/js/chunk-F6DFEGKQ.browser.mjs +118 -0
- package/build/js/chunk-F6DFEGKQ.browser.mjs.map +1 -0
- package/build/js/chunk-FRT6INSG.browser.mjs +65 -0
- package/build/js/chunk-FRT6INSG.browser.mjs.map +1 -0
- package/build/js/{chunk-7G2FSZUY.cjs → chunk-HQDDGVB7.cjs} +1 -1
- package/build/js/chunk-HQDDGVB7.cjs.map +1 -0
- package/build/js/{chunk-DKCYYJ36.mjs → chunk-MQIOUPGJ.mjs} +40 -40
- package/build/js/chunk-MQIOUPGJ.mjs.map +1 -0
- package/build/js/chunk-NTRB7WUY.browser.mjs +199 -0
- package/build/js/chunk-NTRB7WUY.browser.mjs.map +1 -0
- package/build/js/{chunk-DKKDHTGT.cjs → chunk-RHOIENYA.cjs} +41 -41
- package/build/js/chunk-RHOIENYA.cjs.map +1 -0
- package/build/js/{handleGenerate-ZYXEGPSG-Q3HISCOY.cjs → handleGenerate-YNVZFAXQ-3KAATT5S.cjs} +5 -5
- package/build/js/handleGenerate-YNVZFAXQ-3KAATT5S.cjs.map +1 -0
- package/build/js/handleGenerate-YNVZFAXQ-FJO7YEOC.browser.mjs +151 -0
- package/build/js/handleGenerate-YNVZFAXQ-FJO7YEOC.browser.mjs.map +1 -0
- package/build/js/{handleGenerate-ZYXEGPSG-T7AGZBSH.mjs → handleGenerate-YNVZFAXQ-RJ45FF22.mjs} +5 -5
- package/build/js/handleGenerate-YNVZFAXQ-RJ45FF22.mjs.map +1 -0
- package/build/js/index.browser.mjs +527 -0
- package/build/js/index.browser.mjs.map +1 -0
- package/build/js/index.cjs +12 -12
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +12 -12
- package/build/js/index.mjs.map +1 -1
- package/build/js/loginFlow-H6IOYVXH.browser.mjs +4 -0
- package/build/js/{loginFlow-3V5OVOTH.cjs → loginFlow-QTUKYZEL.cjs} +2 -2
- package/build/js/{loginFlow-IBTRFIH3.mjs → loginFlow-ZFVT2AFZ.mjs} +2 -2
- package/build/js/loginFlow-ZFVT2AFZ.mjs.map +1 -0
- package/build/js/siteDeployCommand-CY2WWLXP.browser.mjs +135 -0
- package/build/js/siteDeployCommand-CY2WWLXP.browser.mjs.map +1 -0
- package/build/js/{siteDeployCommand-P2IDJRWT.cjs → siteDeployCommand-EYM2TXE6.cjs} +10 -10
- package/build/js/siteDeployCommand-EYM2TXE6.cjs.map +1 -0
- package/build/js/{siteDeployCommand-PJJT2NNF.mjs → siteDeployCommand-GV3QRLZD.mjs} +8 -8
- package/build/js/siteDeployCommand-GV3QRLZD.mjs.map +1 -0
- package/build/js/versionDeleteCommand-2OJI3HPR.browser.mjs +33 -0
- package/build/js/versionDeleteCommand-2OJI3HPR.browser.mjs.map +1 -0
- package/build/js/{versionDeleteCommand-4FUKGJQ2.mjs → versionDeleteCommand-E6727BXW.mjs} +4 -4
- package/build/js/versionDeleteCommand-E6727BXW.mjs.map +1 -0
- package/build/js/{versionDeleteCommand-X7IHRPH3.cjs → versionDeleteCommand-LZJDT2HD.cjs} +6 -6
- package/build/js/versionDeleteCommand-LZJDT2HD.cjs.map +1 -0
- package/build/js/versionGetCommand-4LGRRMQM.cjs +29 -0
- package/build/js/versionGetCommand-4LGRRMQM.cjs.map +1 -0
- package/build/js/versionGetCommand-A6BVV3GL.browser.mjs +27 -0
- package/build/js/versionGetCommand-A6BVV3GL.browser.mjs.map +1 -0
- package/build/js/{versionGetCommand-7ZWZ3BQY.mjs → versionGetCommand-XCXFCFAP.mjs} +7 -6
- package/build/js/versionGetCommand-XCXFCFAP.mjs.map +1 -0
- package/build/js/versionListCommand-2LWNOKV2.browser.mjs +32 -0
- package/build/js/versionListCommand-2LWNOKV2.browser.mjs.map +1 -0
- package/build/js/{versionListCommand-5K3FUVCO.mjs → versionListCommand-TSPBNGWW.mjs} +5 -5
- package/build/js/versionListCommand-TSPBNGWW.mjs.map +1 -0
- package/build/js/{versionListCommand-RZYNYI4A.cjs → versionListCommand-ZHIPVSQP.cjs} +7 -7
- package/build/js/versionListCommand-ZHIPVSQP.cjs.map +1 -0
- package/build/js/{versionSetCommand-C2NZCHJY.mjs → versionSetCommand-FUZKBVIF.mjs} +4 -4
- package/build/js/versionSetCommand-FUZKBVIF.mjs.map +1 -0
- package/build/js/versionSetCommand-SN2KIDW3.browser.mjs +27 -0
- package/build/js/versionSetCommand-SN2KIDW3.browser.mjs.map +1 -0
- package/build/js/{versionSetCommand-CXMMMNSS.cjs → versionSetCommand-TAHDYWUK.cjs} +6 -6
- package/build/js/versionSetCommand-TAHDYWUK.cjs.map +1 -0
- package/build/js/{versionUnsetCommand-ZQHUGPWQ.mjs → versionUnsetCommand-BJPJ2XCE.mjs} +4 -4
- package/build/js/{versionUnsetCommand-I46GWIIR.cjs.map → versionUnsetCommand-BJPJ2XCE.mjs.map} +1 -1
- package/build/js/{versionUnsetCommand-I46GWIIR.cjs → versionUnsetCommand-MGG4LFZL.cjs} +6 -6
- package/build/js/{versionUnsetCommand-ZQHUGPWQ.mjs.map → versionUnsetCommand-MGG4LFZL.cjs.map} +1 -1
- package/build/js/versionUnsetCommand-Q6IDL3M4.browser.mjs +32 -0
- package/build/js/versionUnsetCommand-Q6IDL3M4.browser.mjs.map +1 -0
- package/build/types/commands/site/version/get/versionGetCommand.d.mts.map +1 -1
- package/build/types/net/third-party-applications/DeployWebsiteRequest.d.mts +4 -0
- package/build/types/net/third-party-applications/DeployWebsiteRequest.d.mts.map +1 -0
- package/build/types/net/third-party-applications/ListVersionsResponse.d.mts +6 -0
- package/build/types/net/third-party-applications/ListVersionsResponse.d.mts.map +1 -0
- package/build/types/net/third-party-applications/Version.d.mts +4 -0
- package/build/types/net/third-party-applications/Version.d.mts.map +1 -0
- package/build/types/net/third-party-applications/Website.d.mts +5 -0
- package/build/types/net/third-party-applications/Website.d.mts.map +1 -0
- package/build/types/net/third-party-applications/deleteVersion.d.mts +4 -0
- package/build/types/net/third-party-applications/deleteVersion.d.mts.map +1 -0
- package/build/types/net/third-party-applications/deployWebsite.d.mts +6 -0
- package/build/types/net/third-party-applications/deployWebsite.d.mts.map +1 -0
- package/build/types/net/third-party-applications/getWebsite.d.mts +5 -0
- package/build/types/net/third-party-applications/getWebsite.d.mts.map +1 -0
- package/build/types/net/third-party-applications/index.d.mts +10 -10
- package/build/types/net/third-party-applications/index.d.mts.map +1 -1
- package/build/types/net/third-party-applications/listVersions.d.mts +5 -0
- package/build/types/net/third-party-applications/listVersions.d.mts.map +1 -0
- package/build/types/net/third-party-applications/undeployWebsite.d.mts +4 -0
- package/build/types/net/third-party-applications/undeployWebsite.d.mts.map +1 -0
- package/build/types/net/third-party-applications/uploadVersion.d.mts +5 -0
- package/build/types/net/third-party-applications/uploadVersion.d.mts.map +1 -0
- package/package.json +6 -4
- package/build/js/chunk-DKCYYJ36.mjs.map +0 -1
- package/build/js/chunk-DKKDHTGT.cjs.map +0 -1
- package/build/js/handleGenerate-ZYXEGPSG-Q3HISCOY.cjs.map +0 -1
- package/build/js/handleGenerate-ZYXEGPSG-T7AGZBSH.mjs.map +0 -1
- package/build/js/siteDeployCommand-P2IDJRWT.cjs.map +0 -1
- package/build/js/siteDeployCommand-PJJT2NNF.mjs.map +0 -1
- package/build/js/versionDeleteCommand-4FUKGJQ2.mjs.map +0 -1
- package/build/js/versionDeleteCommand-X7IHRPH3.cjs.map +0 -1
- package/build/js/versionGetCommand-3HMZEFY6.cjs +0 -28
- package/build/js/versionGetCommand-3HMZEFY6.cjs.map +0 -1
- package/build/js/versionGetCommand-7ZWZ3BQY.mjs.map +0 -1
- package/build/js/versionListCommand-5K3FUVCO.mjs.map +0 -1
- package/build/js/versionListCommand-RZYNYI4A.cjs.map +0 -1
- package/build/js/versionSetCommand-C2NZCHJY.mjs.map +0 -1
- package/build/js/versionSetCommand-CXMMMNSS.cjs.map +0 -1
- package/build/types/net/third-party-applications/ListWebsiteVersionsResponse.d.mts +0 -6
- package/build/types/net/third-party-applications/ListWebsiteVersionsResponse.d.mts.map +0 -1
- package/build/types/net/third-party-applications/UpdateWebsiteDeploymentRequest.d.mts +0 -4
- package/build/types/net/third-party-applications/UpdateWebsiteDeploymentRequest.d.mts.map +0 -1
- package/build/types/net/third-party-applications/WebsiteDeployment.d.mts +0 -5
- package/build/types/net/third-party-applications/WebsiteDeployment.d.mts.map +0 -1
- package/build/types/net/third-party-applications/WebsiteVersion.d.mts +0 -4
- package/build/types/net/third-party-applications/WebsiteVersion.d.mts.map +0 -1
- package/build/types/net/third-party-applications/deleteWebsiteDeployment.d.mts +0 -4
- package/build/types/net/third-party-applications/deleteWebsiteDeployment.d.mts.map +0 -1
- package/build/types/net/third-party-applications/deleteWebsiteVersion.d.mts +0 -4
- package/build/types/net/third-party-applications/deleteWebsiteVersion.d.mts.map +0 -1
- package/build/types/net/third-party-applications/getWebsiteDeployment.d.mts +0 -5
- package/build/types/net/third-party-applications/getWebsiteDeployment.d.mts.map +0 -1
- package/build/types/net/third-party-applications/listWebsiteVersions.d.mts +0 -5
- package/build/types/net/third-party-applications/listWebsiteVersions.d.mts.map +0 -1
- package/build/types/net/third-party-applications/updateWebsiteDeployment.d.mts +0 -6
- package/build/types/net/third-party-applications/updateWebsiteDeployment.d.mts.map +0 -1
- package/build/types/net/third-party-applications/uploadWebsiteVersion.d.mts +0 -5
- package/build/types/net/third-party-applications/uploadWebsiteVersion.d.mts.map +0 -1
- /package/build/js/{chunk-7G2FSZUY.cjs.map → chunk-C5C5AQYT.browser.mjs.map} +0 -0
- /package/build/js/{chunk-ZSTKOCBT.mjs.map → chunk-E2SEJZTC.mjs.map} +0 -0
- /package/build/js/{loginFlow-3V5OVOTH.cjs.map → loginFlow-H6IOYVXH.browser.mjs.map} +0 -0
- /package/build/js/{loginFlow-IBTRFIH3.mjs.map → loginFlow-QTUKYZEL.cjs.map} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkEVW4VRJL_cjs = require('./chunk-EVW4VRJL.cjs');
|
|
4
|
-
require('./chunk-
|
|
4
|
+
require('./chunk-HQDDGVB7.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
module.exports = chunkEVW4VRJL_cjs.invokeLoginFlow;
|
|
9
9
|
//# sourceMappingURL=out.js.map
|
|
10
|
-
//# sourceMappingURL=loginFlow-
|
|
10
|
+
//# sourceMappingURL=loginFlow-QTUKYZEL.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-NTRB7WUY.browser.mjs';
|
|
2
|
+
import { ExitProcessError, isValidSemver } from './chunk-FRT6INSG.browser.mjs';
|
|
3
|
+
import './chunk-C5C5AQYT.browser.mjs';
|
|
4
|
+
import { consola } from 'consola';
|
|
5
|
+
import archiver from 'archiver';
|
|
6
|
+
import { colorize } from 'consola/utils';
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import { Readable } from 'stream';
|
|
10
|
+
import { exec } from 'child_process';
|
|
11
|
+
import { promisify } from 'util';
|
|
12
|
+
|
|
13
|
+
async function autoVersion(tagPrefix = "") {
|
|
14
|
+
const [matchPrefix, prefixRegex] = tagPrefix !== "" ? [tagPrefix, new RegExp(`^${tagPrefix}`)] : [void 0, new RegExp(`^v?`)];
|
|
15
|
+
const gitVersion = await gitDescribe(matchPrefix);
|
|
16
|
+
const version = gitVersion.trim().replace(prefixRegex, "");
|
|
17
|
+
if (!isValidSemver(version)) {
|
|
18
|
+
throw new ExitProcessError(2, `The version string ${version} is not SemVer compliant.`);
|
|
19
|
+
}
|
|
20
|
+
return version;
|
|
21
|
+
}
|
|
22
|
+
async function gitDescribe(matchPrefix) {
|
|
23
|
+
let gitVersion;
|
|
24
|
+
try {
|
|
25
|
+
const execAsync = promisify(exec);
|
|
26
|
+
const {
|
|
27
|
+
stdout
|
|
28
|
+
} = await execAsync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match="${matchPrefix}*"` : ""}`, {
|
|
29
|
+
encoding: "utf8"
|
|
30
|
+
});
|
|
31
|
+
gitVersion = stdout;
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (error instanceof Error) {
|
|
34
|
+
const errorMessage = error.message.toLowerCase();
|
|
35
|
+
if (errorMessage.includes("not recognized") || errorMessage.includes("command not found") || errorMessage.includes("no such file or directory")) {
|
|
36
|
+
throw new ExitProcessError(2, "Unable to determine auto version using git-describe as git is not installed or found in the PATH.", `You can set up git and try again or supply a --version option to set the version manually`);
|
|
37
|
+
}
|
|
38
|
+
if (errorMessage.includes("fatal: not a git repository")) {
|
|
39
|
+
throw new ExitProcessError(2, `Unable to determine auto version using git-describe as the current directory is not a git repository.`, `You can run the command in a git repository and try again or supply a --version option to set the version manually`);
|
|
40
|
+
}
|
|
41
|
+
if (errorMessage.includes("fatal: no names found, cannot describe anything.")) {
|
|
42
|
+
throw new ExitProcessError(2, `Unable to determine auto version using git-describe as no matching tags were found.`, `You can create a tag matching the configured tag prefix and try again or supply a --version option to set the version manually`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
throw new ExitProcessError(2, `Unable to determine auto version using git-describe: ${error}.`, `You can supply a --version option to set the version manually`);
|
|
46
|
+
}
|
|
47
|
+
return gitVersion;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// src/commands/site/deploy/siteDeployCommand.mts
|
|
51
|
+
async function siteDeployCommand({
|
|
52
|
+
selectedVersion,
|
|
53
|
+
application,
|
|
54
|
+
foundryUrl,
|
|
55
|
+
uploadOnly,
|
|
56
|
+
directory,
|
|
57
|
+
token,
|
|
58
|
+
tokenFile
|
|
59
|
+
}) {
|
|
60
|
+
const loadedToken = await loadToken(token, tokenFile);
|
|
61
|
+
const tokenProvider = () => loadedToken;
|
|
62
|
+
const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);
|
|
63
|
+
let siteVersion;
|
|
64
|
+
if (typeof selectedVersion === "string") {
|
|
65
|
+
siteVersion = selectedVersion;
|
|
66
|
+
} else {
|
|
67
|
+
siteVersion = await autoVersion(selectedVersion.tagPrefix);
|
|
68
|
+
consola.info(`Auto version inferred next version to be: ${siteVersion}`);
|
|
69
|
+
}
|
|
70
|
+
consola.debug(`Using directory for site files: "${path.resolve(directory)}`);
|
|
71
|
+
const stat = await fs.promises.stat(directory);
|
|
72
|
+
if (!stat.isDirectory()) {
|
|
73
|
+
throw new ExitProcessError(2, "Specified path exists but is not a directory");
|
|
74
|
+
}
|
|
75
|
+
consola.start("Zipping site files");
|
|
76
|
+
const archive = archiver("zip").directory(directory, false);
|
|
77
|
+
logArchiveStats(archive);
|
|
78
|
+
consola.start("Uploading site files");
|
|
79
|
+
await Promise.all([third_party_applications_exports.uploadVersion(
|
|
80
|
+
clientCtx,
|
|
81
|
+
application,
|
|
82
|
+
siteVersion,
|
|
83
|
+
Readable.toWeb(archive)
|
|
84
|
+
// This cast is because the dom fetch doesnt align type wise with streams
|
|
85
|
+
), archive.finalize()]);
|
|
86
|
+
consola.success("Upload complete");
|
|
87
|
+
if (!uploadOnly) {
|
|
88
|
+
const website = await third_party_applications_exports.deployWebsite(clientCtx, application, {
|
|
89
|
+
version: siteVersion
|
|
90
|
+
});
|
|
91
|
+
consola.success(`Deployed ${siteVersion} successfully`);
|
|
92
|
+
const domain = website.subdomains[0];
|
|
93
|
+
if (domain != null) {
|
|
94
|
+
logSiteLink("View live site:", `https://${domain}`);
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
const website = await third_party_applications_exports.getWebsite(clientCtx, application);
|
|
98
|
+
const domain = website?.subdomains[0];
|
|
99
|
+
consola.debug("Upload only mode enabled, skipping deployment");
|
|
100
|
+
if (domain != null) {
|
|
101
|
+
logSiteLink("Preview link:", `https://${domain}/.system/preview?previewVersion=${siteVersion}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function logArchiveStats(archive) {
|
|
106
|
+
let archiveStats = {
|
|
107
|
+
fileCount: 0,
|
|
108
|
+
bytes: 0
|
|
109
|
+
};
|
|
110
|
+
archive.on("progress", (progress) => {
|
|
111
|
+
archiveStats = {
|
|
112
|
+
fileCount: progress.entries.total,
|
|
113
|
+
bytes: progress.fs.totalBytes
|
|
114
|
+
};
|
|
115
|
+
});
|
|
116
|
+
archive.on("finish", () => {
|
|
117
|
+
consola.debug(`Zipped ${archiveStats.fileCount} files and ${archiveStats.bytes} bytes`);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function logSiteLink(title, link) {
|
|
121
|
+
consola.box({
|
|
122
|
+
message: `${title}
|
|
123
|
+
|
|
124
|
+
${colorize("green", link)}`,
|
|
125
|
+
style: {
|
|
126
|
+
padding: 2,
|
|
127
|
+
borderColor: "green",
|
|
128
|
+
borderStyle: "rounded"
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export { siteDeployCommand as default };
|
|
134
|
+
//# sourceMappingURL=out.js.map
|
|
135
|
+
//# sourceMappingURL=siteDeployCommand-CY2WWLXP.browser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/deploy/siteDeployCommand.mts","../../src/util/autoVersion.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,SAAS,eAAe;AAGxB,OAAO,cAAc;AACrB,SAAS,gBAAgB;AACzB,YAAY,QAAQ;A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,SAAS,SAAS,WAAW,CAAC;AACpC,YAAQ,MAAM,+CAA+C;AAC7D,QAAI,UAAU,MAAM;AAClB,kBAAY,iBAAiB,WAAW,MAAM,mCAAmC,WAAW,EAAE;AAAA,IAChG;AAAA,EACF;AACF;AACA,SAAS,gBAAgB,SAAS;AAChC,MAAI,eAAe;AAAA,IACjB,WAAW;AAAA,IACX,OAAO;AAAA,EACT;AACA,UAAQ,GAAG,YAAY,cAAY;AACjC,mBAAe;AAAA,MACb,WAAW,SAAS,QAAQ;AAAA,MAC5B,OAAO,SAAS,GAAG;AAAA,IACrB;AAAA,EACF,CAAC;AACD,UAAQ,GAAG,UAAU,MAAM;AACzB,YAAQ,MAAM,UAAU,aAAa,SAAS,cAAc,aAAa,KAAK,QAAQ;AAAA,EACxF,CAAC;AACH;AACA,SAAS,YAAY,OAAO,MAAM;AAChC,UAAQ,IAAI;AAAA,IACV,SAAS,GAAG,KAAK;AAAA;AAAA,EAAO,SAAS,SAAS,IAAI,CAAC;AAAA,IAC/C,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AACH","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport archiver from \"archiver\";\nimport { colorize } from \"consola/utils\";\nimport * as fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Readable } from \"node:stream\";\nimport { autoVersion as findAutoVersion } from \"../../../util/autoVersion.js\";\nimport { loadToken } from \"../../../util/token.js\";\nexport default async function siteDeployCommand({\n selectedVersion,\n application,\n foundryUrl,\n uploadOnly,\n directory,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n let siteVersion;\n if (typeof selectedVersion === \"string\") {\n siteVersion = selectedVersion;\n } else {\n siteVersion = await findAutoVersion(selectedVersion.tagPrefix);\n consola.info(`Auto version inferred next version to be: ${siteVersion}`);\n }\n consola.debug(`Using directory for site files: \"${path.resolve(directory)}`);\n const stat = await fs.promises.stat(directory);\n if (!stat.isDirectory()) {\n throw new ExitProcessError(2, \"Specified path exists but is not a directory\");\n }\n consola.start(\"Zipping site files\");\n const archive = archiver(\"zip\").directory(directory, false);\n logArchiveStats(archive);\n consola.start(\"Uploading site files\");\n await Promise.all([thirdPartyApplications.uploadVersion(clientCtx, application, siteVersion, Readable.toWeb(archive) // This cast is because the dom fetch doesnt align type wise with streams\n ), archive.finalize()]);\n consola.success(\"Upload complete\");\n if (!uploadOnly) {\n const website = await thirdPartyApplications.deployWebsite(clientCtx, application, {\n version: siteVersion\n });\n consola.success(`Deployed ${siteVersion} successfully`);\n const domain = website.subdomains[0];\n if (domain != null) {\n logSiteLink(\"View live site:\", `https://${domain}`);\n }\n } else {\n const website = await thirdPartyApplications.getWebsite(clientCtx, application);\n const domain = website?.subdomains[0];\n consola.debug(\"Upload only mode enabled, skipping deployment\");\n if (domain != null) {\n logSiteLink(\"Preview link:\", `https://${domain}/.system/preview?previewVersion=${siteVersion}`);\n }\n }\n}\nfunction logArchiveStats(archive) {\n let archiveStats = {\n fileCount: 0,\n bytes: 0\n };\n archive.on(\"progress\", progress => {\n archiveStats = {\n fileCount: progress.entries.total,\n bytes: progress.fs.totalBytes\n };\n });\n archive.on(\"finish\", () => {\n consola.debug(`Zipped ${archiveStats.fileCount} files and ${archiveStats.bytes} bytes`);\n });\n}\nfunction logSiteLink(title, link) {\n consola.box({\n message: `${title}\\n\\n${colorize(\"green\", link)}`,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExitProcessError, isValidSemver } from \"@osdk/cli.common\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\n/**\n * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the\n * latest tag (without any filtering) and if the tag starts with \"v\", it will be removed.\n * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.\n * @returns A promise that resolves to the version string.\n * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.\n */\nexport async function autoVersion(tagPrefix = \"\") {\n const [matchPrefix, prefixRegex] = tagPrefix !== \"\" ? [tagPrefix, new RegExp(`^${tagPrefix}`)] : [undefined, new RegExp(`^v?`)];\n const gitVersion = await gitDescribe(matchPrefix);\n const version = gitVersion.trim().replace(prefixRegex, \"\");\n if (!isValidSemver(version)) {\n throw new ExitProcessError(2, `The version string ${version} is not SemVer compliant.`);\n }\n return version;\n}\nasync function gitDescribe(matchPrefix) {\n let gitVersion;\n try {\n const execAsync = promisify(exec);\n const {\n stdout\n } = await execAsync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match=\"${matchPrefix}*\"` : \"\"}`, {\n encoding: \"utf8\"\n });\n gitVersion = stdout;\n } catch (error) {\n if (error instanceof Error) {\n const errorMessage = error.message.toLowerCase();\n if (errorMessage.includes(\"not recognized\") || errorMessage.includes(\"command not found\") || errorMessage.includes(\"no such file or directory\")) {\n throw new ExitProcessError(2, \"Unable to determine auto version using git-describe as git is not installed or found in the PATH.\", `You can set up git and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: not a git repository\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as the current directory is not a git repository.`, `You can run the command in a git repository and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: no names found, cannot describe anything.\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as no matching tags were found.`, `You can create a tag matching the configured tag prefix and try again or supply a --version option to set the version manually`);\n }\n }\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe: ${error}.`, `You can supply a --version option to set the version manually`);\n }\n return gitVersion;\n}"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkRHOIENYA_cjs = require('./chunk-RHOIENYA.cjs');
|
|
4
4
|
var chunk467BAS7X_cjs = require('./chunk-467BAS7X.cjs');
|
|
5
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-HQDDGVB7.cjs');
|
|
6
6
|
var consola = require('consola');
|
|
7
7
|
var archiver = require('archiver');
|
|
8
8
|
var utils = require('consola/utils');
|
|
@@ -83,9 +83,9 @@ async function siteDeployCommand({
|
|
|
83
83
|
token,
|
|
84
84
|
tokenFile
|
|
85
85
|
}) {
|
|
86
|
-
const loadedToken = await
|
|
86
|
+
const loadedToken = await chunkRHOIENYA_cjs.loadToken(token, tokenFile);
|
|
87
87
|
const tokenProvider = () => loadedToken;
|
|
88
|
-
const clientCtx =
|
|
88
|
+
const clientCtx = chunkRHOIENYA_cjs.createInternalClientContext(foundryUrl, tokenProvider);
|
|
89
89
|
let siteVersion;
|
|
90
90
|
if (typeof selectedVersion === "string") {
|
|
91
91
|
siteVersion = selectedVersion;
|
|
@@ -102,7 +102,7 @@ async function siteDeployCommand({
|
|
|
102
102
|
const archive = archiver__default.default("zip").directory(directory, false);
|
|
103
103
|
logArchiveStats(archive);
|
|
104
104
|
consola.consola.start("Uploading site files");
|
|
105
|
-
await Promise.all([
|
|
105
|
+
await Promise.all([chunkRHOIENYA_cjs.third_party_applications_exports.uploadVersion(
|
|
106
106
|
clientCtx,
|
|
107
107
|
application,
|
|
108
108
|
siteVersion,
|
|
@@ -111,17 +111,17 @@ async function siteDeployCommand({
|
|
|
111
111
|
), archive.finalize()]);
|
|
112
112
|
consola.consola.success("Upload complete");
|
|
113
113
|
if (!uploadOnly) {
|
|
114
|
-
const
|
|
114
|
+
const website = await chunkRHOIENYA_cjs.third_party_applications_exports.deployWebsite(clientCtx, application, {
|
|
115
115
|
version: siteVersion
|
|
116
116
|
});
|
|
117
117
|
consola.consola.success(`Deployed ${siteVersion} successfully`);
|
|
118
|
-
const domain =
|
|
118
|
+
const domain = website.subdomains[0];
|
|
119
119
|
if (domain != null) {
|
|
120
120
|
logSiteLink("View live site:", `https://${domain}`);
|
|
121
121
|
}
|
|
122
122
|
} else {
|
|
123
|
-
const
|
|
124
|
-
const domain =
|
|
123
|
+
const website = await chunkRHOIENYA_cjs.third_party_applications_exports.getWebsite(clientCtx, application);
|
|
124
|
+
const domain = website?.subdomains[0];
|
|
125
125
|
consola.consola.debug("Upload only mode enabled, skipping deployment");
|
|
126
126
|
if (domain != null) {
|
|
127
127
|
logSiteLink("Preview link:", `https://${domain}/.system/preview?previewVersion=${siteVersion}`);
|
|
@@ -158,4 +158,4 @@ ${utils.colorize("green", link)}`,
|
|
|
158
158
|
|
|
159
159
|
module.exports = siteDeployCommand;
|
|
160
160
|
//# sourceMappingURL=out.js.map
|
|
161
|
-
//# sourceMappingURL=siteDeployCommand-
|
|
161
|
+
//# sourceMappingURL=siteDeployCommand-EYM2TXE6.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/deploy/siteDeployCommand.mts","../../src/util/autoVersion.ts"],"names":[],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AM,EAAE;AAAA,IACpD;AAAA,EACF,OAAO;AACL,UAAM,UAAU,MAAM,iCAAuB,WAAW,WAAW,WAAW;AAC9E,UAAM,SAAS,SAAS,WAAW,CAAC;AACpC,YAAQ,MAAM,+CAA+C;AAC7D,QAAI,UAAU,MAAM;AAClB,kBAAY,iBAAiB,WAAW,MAAM,mCAAmC,WAAW,EAAE;AAAA,IAChG;AAAA,EACF;AACF;AACA,SAAS,gBAAgB,SAAS;AAChC,MAAI,eAAe;AAAA,IACjB,WAAW;AAAA,IACX,OAAO;AAAA,EACT;AACA,UAAQ,GAAG,YAAY,cAAY;AACjC,mBAAe;AAAA,MACb,WAAW,SAAS,QAAQ;AAAA,MAC5B,OAAO,SAAS,GAAG;AAAA,IACrB;AAAA,EACF,CAAC;AACD,UAAQ,GAAG,UAAU,MAAM;AACzB,YAAQ,MAAM,UAAU,aAAa,SAAS,cAAc,aAAa,KAAK,QAAQ;AAAA,EACxF,CAAC;AACH;AACA,SAAS,YAAY,OAAO,MAAM;AAChC,UAAQ,IAAI;AAAA,IACV,SAAS,GAAG,KAAK;AAAA;AAAA,EAAO,SAAS,SAAS,IAAI,CAAC;AAAA,IAC/C,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AACH","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport archiver from \"archiver\";\nimport { colorize } from \"consola/utils\";\nimport * as fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Readable } from \"node:stream\";\nimport { autoVersion as findAutoVersion } from \"../../../util/autoVersion.js\";\nimport { loadToken } from \"../../../util/token.js\";\nexport default async function siteDeployCommand({\n selectedVersion,\n application,\n foundryUrl,\n uploadOnly,\n directory,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n let siteVersion;\n if (typeof selectedVersion === \"string\") {\n siteVersion = selectedVersion;\n } else {\n siteVersion = await findAutoVersion(selectedVersion.tagPrefix);\n consola.info(`Auto version inferred next version to be: ${siteVersion}`);\n }\n consola.debug(`Using directory for site files: \"${path.resolve(directory)}`);\n const stat = await fs.promises.stat(directory);\n if (!stat.isDirectory()) {\n throw new ExitProcessError(2, \"Specified path exists but is not a directory\");\n }\n consola.start(\"Zipping site files\");\n const archive = archiver(\"zip\").directory(directory, false);\n logArchiveStats(archive);\n consola.start(\"Uploading site files\");\n await Promise.all([thirdPartyApplications.uploadVersion(clientCtx, application, siteVersion, Readable.toWeb(archive) // This cast is because the dom fetch doesnt align type wise with streams\n ), archive.finalize()]);\n consola.success(\"Upload complete\");\n if (!uploadOnly) {\n const website = await thirdPartyApplications.deployWebsite(clientCtx, application, {\n version: siteVersion\n });\n consola.success(`Deployed ${siteVersion} successfully`);\n const domain = website.subdomains[0];\n if (domain != null) {\n logSiteLink(\"View live site:\", `https://${domain}`);\n }\n } else {\n const website = await thirdPartyApplications.getWebsite(clientCtx, application);\n const domain = website?.subdomains[0];\n consola.debug(\"Upload only mode enabled, skipping deployment\");\n if (domain != null) {\n logSiteLink(\"Preview link:\", `https://${domain}/.system/preview?previewVersion=${siteVersion}`);\n }\n }\n}\nfunction logArchiveStats(archive) {\n let archiveStats = {\n fileCount: 0,\n bytes: 0\n };\n archive.on(\"progress\", progress => {\n archiveStats = {\n fileCount: progress.entries.total,\n bytes: progress.fs.totalBytes\n };\n });\n archive.on(\"finish\", () => {\n consola.debug(`Zipped ${archiveStats.fileCount} files and ${archiveStats.bytes} bytes`);\n });\n}\nfunction logSiteLink(title, link) {\n consola.box({\n message: `${title}\\n\\n${colorize(\"green\", link)}`,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExitProcessError, isValidSemver } from \"@osdk/cli.common\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\n/**\n * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the\n * latest tag (without any filtering) and if the tag starts with \"v\", it will be removed.\n * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.\n * @returns A promise that resolves to the version string.\n * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.\n */\nexport async function autoVersion(tagPrefix = \"\") {\n const [matchPrefix, prefixRegex] = tagPrefix !== \"\" ? [tagPrefix, new RegExp(`^${tagPrefix}`)] : [undefined, new RegExp(`^v?`)];\n const gitVersion = await gitDescribe(matchPrefix);\n const version = gitVersion.trim().replace(prefixRegex, \"\");\n if (!isValidSemver(version)) {\n throw new ExitProcessError(2, `The version string ${version} is not SemVer compliant.`);\n }\n return version;\n}\nasync function gitDescribe(matchPrefix) {\n let gitVersion;\n try {\n const execAsync = promisify(exec);\n const {\n stdout\n } = await execAsync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match=\"${matchPrefix}*\"` : \"\"}`, {\n encoding: \"utf8\"\n });\n gitVersion = stdout;\n } catch (error) {\n if (error instanceof Error) {\n const errorMessage = error.message.toLowerCase();\n if (errorMessage.includes(\"not recognized\") || errorMessage.includes(\"command not found\") || errorMessage.includes(\"no such file or directory\")) {\n throw new ExitProcessError(2, \"Unable to determine auto version using git-describe as git is not installed or found in the PATH.\", `You can set up git and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: not a git repository\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as the current directory is not a git repository.`, `You can run the command in a git repository and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: no names found, cannot describe anything.\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as no matching tags were found.`, `You can create a tag matching the configured tag prefix and try again or supply a --version option to set the version manually`);\n }\n }\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe: ${error}.`, `You can supply a --version option to set the version manually`);\n }\n return gitVersion;\n}"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-
|
|
1
|
+
import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-MQIOUPGJ.mjs';
|
|
2
2
|
import { ExitProcessError, isValidSemver } from './chunk-CWMSASIM.mjs';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-E2SEJZTC.mjs';
|
|
4
4
|
import { consola } from 'consola';
|
|
5
5
|
import archiver from 'archiver';
|
|
6
6
|
import { colorize } from 'consola/utils';
|
|
@@ -76,7 +76,7 @@ async function siteDeployCommand({
|
|
|
76
76
|
const archive = archiver("zip").directory(directory, false);
|
|
77
77
|
logArchiveStats(archive);
|
|
78
78
|
consola.start("Uploading site files");
|
|
79
|
-
await Promise.all([third_party_applications_exports.
|
|
79
|
+
await Promise.all([third_party_applications_exports.uploadVersion(
|
|
80
80
|
clientCtx,
|
|
81
81
|
application,
|
|
82
82
|
siteVersion,
|
|
@@ -85,17 +85,17 @@ async function siteDeployCommand({
|
|
|
85
85
|
), archive.finalize()]);
|
|
86
86
|
consola.success("Upload complete");
|
|
87
87
|
if (!uploadOnly) {
|
|
88
|
-
const
|
|
88
|
+
const website = await third_party_applications_exports.deployWebsite(clientCtx, application, {
|
|
89
89
|
version: siteVersion
|
|
90
90
|
});
|
|
91
91
|
consola.success(`Deployed ${siteVersion} successfully`);
|
|
92
|
-
const domain =
|
|
92
|
+
const domain = website.subdomains[0];
|
|
93
93
|
if (domain != null) {
|
|
94
94
|
logSiteLink("View live site:", `https://${domain}`);
|
|
95
95
|
}
|
|
96
96
|
} else {
|
|
97
|
-
const
|
|
98
|
-
const domain =
|
|
97
|
+
const website = await third_party_applications_exports.getWebsite(clientCtx, application);
|
|
98
|
+
const domain = website?.subdomains[0];
|
|
99
99
|
consola.debug("Upload only mode enabled, skipping deployment");
|
|
100
100
|
if (domain != null) {
|
|
101
101
|
logSiteLink("Preview link:", `https://${domain}/.system/preview?previewVersion=${siteVersion}`);
|
|
@@ -132,4 +132,4 @@ ${colorize("green", link)}`,
|
|
|
132
132
|
|
|
133
133
|
export { siteDeployCommand as default };
|
|
134
134
|
//# sourceMappingURL=out.js.map
|
|
135
|
-
//# sourceMappingURL=siteDeployCommand-
|
|
135
|
+
//# sourceMappingURL=siteDeployCommand-GV3QRLZD.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/deploy/siteDeployCommand.mts","../../src/util/autoVersion.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,SAAS,eAAe;AAGxB,OAAO,cAAc;AACrB,SAAS,gBAAgB;AACzB,YAAY,QAAQ;AACpB,OAAO,UAAU;AACjB,SAAS,gBAAgB;;;ACNzB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAS1B,eAAsB,YAAY,YAAY,IAAI;AAChD,QAAM,CAAC,aAAa,WAAW,IAAI,cAAc,KAAK,CAAC,WAAW,IAAI,OAAO,IAAI,SAAS,EAAE,CAAC,IAAI,CAA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AW;AAAA,IACX,OAAO;AAAA,EACT;AACA,UAAQ,GAAG,YAAY,cAAY;AACjC,mBAAe;AAAA,MACb,WAAW,SAAS,QAAQ;AAAA,MAC5B,OAAO,SAAS,GAAG;AAAA,IACrB;AAAA,EACF,CAAC;AACD,UAAQ,GAAG,UAAU,MAAM;AACzB,YAAQ,MAAM,UAAU,aAAa,SAAS,cAAc,aAAa,KAAK,QAAQ;AAAA,EACxF,CAAC;AACH;AACA,SAAS,YAAY,OAAO,MAAM;AAChC,UAAQ,IAAI;AAAA,IACV,SAAS,GAAG,KAAK;AAAA;AAAA,EAAO,SAAS,SAAS,IAAI,CAAC;AAAA,IAC/C,OAAO;AAAA,MACL,SAAS;AAAA,MACT,aAAa;AAAA,MACb,aAAa;AAAA,IACf;AAAA,EACF,CAAC;AACH","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { ExitProcessError } from \"@osdk/cli.common\";\nimport archiver from \"archiver\";\nimport { colorize } from \"consola/utils\";\nimport * as fs from \"node:fs\";\nimport path from \"node:path\";\nimport { Readable } from \"node:stream\";\nimport { autoVersion as findAutoVersion } from \"../../../util/autoVersion.js\";\nimport { loadToken } from \"../../../util/token.js\";\nexport default async function siteDeployCommand({\n selectedVersion,\n application,\n foundryUrl,\n uploadOnly,\n directory,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n let siteVersion;\n if (typeof selectedVersion === \"string\") {\n siteVersion = selectedVersion;\n } else {\n siteVersion = await findAutoVersion(selectedVersion.tagPrefix);\n consola.info(`Auto version inferred next version to be: ${siteVersion}`);\n }\n consola.debug(`Using directory for site files: \"${path.resolve(directory)}`);\n const stat = await fs.promises.stat(directory);\n if (!stat.isDirectory()) {\n throw new ExitProcessError(2, \"Specified path exists but is not a directory\");\n }\n consola.start(\"Zipping site files\");\n const archive = archiver(\"zip\").directory(directory, false);\n logArchiveStats(archive);\n consola.start(\"Uploading site files\");\n await Promise.all([thirdPartyApplications.uploadVersion(clientCtx, application, siteVersion, Readable.toWeb(archive) // This cast is because the dom fetch doesnt align type wise with streams\n ), archive.finalize()]);\n consola.success(\"Upload complete\");\n if (!uploadOnly) {\n const website = await thirdPartyApplications.deployWebsite(clientCtx, application, {\n version: siteVersion\n });\n consola.success(`Deployed ${siteVersion} successfully`);\n const domain = website.subdomains[0];\n if (domain != null) {\n logSiteLink(\"View live site:\", `https://${domain}`);\n }\n } else {\n const website = await thirdPartyApplications.getWebsite(clientCtx, application);\n const domain = website?.subdomains[0];\n consola.debug(\"Upload only mode enabled, skipping deployment\");\n if (domain != null) {\n logSiteLink(\"Preview link:\", `https://${domain}/.system/preview?previewVersion=${siteVersion}`);\n }\n }\n}\nfunction logArchiveStats(archive) {\n let archiveStats = {\n fileCount: 0,\n bytes: 0\n };\n archive.on(\"progress\", progress => {\n archiveStats = {\n fileCount: progress.entries.total,\n bytes: progress.fs.totalBytes\n };\n });\n archive.on(\"finish\", () => {\n consola.debug(`Zipped ${archiveStats.fileCount} files and ${archiveStats.bytes} bytes`);\n });\n}\nfunction logSiteLink(title, link) {\n consola.box({\n message: `${title}\\n\\n${colorize(\"green\", link)}`,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ExitProcessError, isValidSemver } from \"@osdk/cli.common\";\nimport { exec } from \"node:child_process\";\nimport { promisify } from \"node:util\";\n\n/**\n * Gets the version string using git describe. If the @param tagPrefix is empty, git describe will return the\n * latest tag (without any filtering) and if the tag starts with \"v\", it will be removed.\n * @param tagPrefix The prefix to use for matching against tags. Defaults to an empty string.\n * @returns A promise that resolves to the version string.\n * @throws An error if the version string is not SemVer compliant or if the version cannot be determined.\n */\nexport async function autoVersion(tagPrefix = \"\") {\n const [matchPrefix, prefixRegex] = tagPrefix !== \"\" ? [tagPrefix, new RegExp(`^${tagPrefix}`)] : [undefined, new RegExp(`^v?`)];\n const gitVersion = await gitDescribe(matchPrefix);\n const version = gitVersion.trim().replace(prefixRegex, \"\");\n if (!isValidSemver(version)) {\n throw new ExitProcessError(2, `The version string ${version} is not SemVer compliant.`);\n }\n return version;\n}\nasync function gitDescribe(matchPrefix) {\n let gitVersion;\n try {\n const execAsync = promisify(exec);\n const {\n stdout\n } = await execAsync(`git describe --tags --first-parent --dirty${matchPrefix != null ? ` --match=\"${matchPrefix}*\"` : \"\"}`, {\n encoding: \"utf8\"\n });\n gitVersion = stdout;\n } catch (error) {\n if (error instanceof Error) {\n const errorMessage = error.message.toLowerCase();\n if (errorMessage.includes(\"not recognized\") || errorMessage.includes(\"command not found\") || errorMessage.includes(\"no such file or directory\")) {\n throw new ExitProcessError(2, \"Unable to determine auto version using git-describe as git is not installed or found in the PATH.\", `You can set up git and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: not a git repository\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as the current directory is not a git repository.`, `You can run the command in a git repository and try again or supply a --version option to set the version manually`);\n }\n if (errorMessage.includes(\"fatal: no names found, cannot describe anything.\")) {\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe as no matching tags were found.`, `You can create a tag matching the configured tag prefix and try again or supply a --version option to set the version manually`);\n }\n }\n throw new ExitProcessError(2, `Unable to determine auto version using git-describe: ${error}.`, `You can supply a --version option to set the version manually`);\n }\n return gitVersion;\n}"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { handlePromptCancel } from './chunk-3NRUGBBO.browser.mjs';
|
|
2
|
+
import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-NTRB7WUY.browser.mjs';
|
|
3
|
+
import './chunk-FRT6INSG.browser.mjs';
|
|
4
|
+
import './chunk-C5C5AQYT.browser.mjs';
|
|
5
|
+
import { consola } from 'consola';
|
|
6
|
+
import { colorize } from 'consola/utils';
|
|
7
|
+
|
|
8
|
+
async function versionDeleteCommand({
|
|
9
|
+
version,
|
|
10
|
+
yes,
|
|
11
|
+
application,
|
|
12
|
+
foundryUrl,
|
|
13
|
+
token,
|
|
14
|
+
tokenFile
|
|
15
|
+
}) {
|
|
16
|
+
if (!yes) {
|
|
17
|
+
const confirmed = await consola.prompt(`Are you sure you want to delete the version ${version}?
|
|
18
|
+
${colorize("bold", "This action cannot be undone.")}`, {
|
|
19
|
+
type: "confirm"
|
|
20
|
+
});
|
|
21
|
+
handlePromptCancel(confirmed);
|
|
22
|
+
}
|
|
23
|
+
consola.start(`Deleting version ${version}`);
|
|
24
|
+
const loadedToken = await loadToken(token, tokenFile);
|
|
25
|
+
const tokenProvider = () => loadedToken;
|
|
26
|
+
const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);
|
|
27
|
+
await third_party_applications_exports.deleteVersion(clientCtx, application, version);
|
|
28
|
+
consola.success(`Deleted version ${version}`);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { versionDeleteCommand as default };
|
|
32
|
+
//# sourceMappingURL=out.js.map
|
|
33
|
+
//# sourceMappingURL=versionDeleteCommand-2OJI3HPR.browser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/version/delete/versionDeleteCommand.mts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAGzB,eAAO,qBAA4C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,MAAI,CAAC,KAAK;AACR,UAAM,YAAY,MAAM,QAAQ,OAAO,+CAA+C,OAAO;AAAA,EAAM,SAAS,QAAQ,+BAA+B,CAAC,IAAI;AAAA,MACtJ,MAAM;AAAA,IACR,CAAC;AACD,uBAAmB,SAAS;AAAA,EAC9B;AACA,UAAQ,MAAM,oBAAoB,OAAO,EAAE;AAC3C,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,QAAM,iCAAuB,cAAc,WAAW,aAAa,OAAO;AAC1E,UAAQ,QAAQ,mBAAmB,OAAO,EAAE;AAC9C","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport { handlePromptCancel } from \"../../../../consola/handlePromptCancel.js\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionDeleteCommand({\n version,\n yes,\n application,\n foundryUrl,\n token,\n tokenFile\n}) {\n if (!yes) {\n const confirmed = await consola.prompt(`Are you sure you want to delete the version ${version}?\\n${colorize(\"bold\", \"This action cannot be undone.\")}`, {\n type: \"confirm\"\n });\n handlePromptCancel(confirmed);\n }\n consola.start(`Deleting version ${version}`);\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n await thirdPartyApplications.deleteVersion(clientCtx, application, version);\n consola.success(`Deleted version ${version}`);\n}"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { handlePromptCancel } from './chunk-IV3QY3PZ.mjs';
|
|
2
|
-
import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-
|
|
2
|
+
import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-MQIOUPGJ.mjs';
|
|
3
3
|
import './chunk-CWMSASIM.mjs';
|
|
4
|
-
import './chunk-
|
|
4
|
+
import './chunk-E2SEJZTC.mjs';
|
|
5
5
|
import { consola } from 'consola';
|
|
6
6
|
import { colorize } from 'consola/utils';
|
|
7
7
|
|
|
@@ -24,10 +24,10 @@ ${colorize("bold", "This action cannot be undone.")}`, {
|
|
|
24
24
|
const loadedToken = await loadToken(token, tokenFile);
|
|
25
25
|
const tokenProvider = () => loadedToken;
|
|
26
26
|
const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);
|
|
27
|
-
await third_party_applications_exports.
|
|
27
|
+
await third_party_applications_exports.deleteVersion(clientCtx, application, version);
|
|
28
28
|
consola.success(`Deleted version ${version}`);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export { versionDeleteCommand as default };
|
|
32
32
|
//# sourceMappingURL=out.js.map
|
|
33
|
-
//# sourceMappingURL=versionDeleteCommand-
|
|
33
|
+
//# sourceMappingURL=versionDeleteCommand-E6727BXW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/version/delete/versionDeleteCommand.mts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAGzB,eAAO,qBAA4C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,MAAI,CAAC,KAAK;AACR,UAAM,YAAY,MAAM,QAAQ,OAAO,+CAA+C,OAAO;AAAA,EAAM,SAAS,QAAQ,+BAA+B,CAAC,IAAI;AAAA,MACtJ,MAAM;AAAA,IACR,CAAC;AACD,uBAAmB,SAAS;AAAA,EAC9B;AACA,UAAQ,MAAM,oBAAoB,OAAO,EAAE;AAC3C,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,QAAM,iCAAuB,cAAc,WAAW,aAAa,OAAO;AAC1E,UAAQ,QAAQ,mBAAmB,OAAO,EAAE;AAC9C","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport { handlePromptCancel } from \"../../../../consola/handlePromptCancel.js\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionDeleteCommand({\n version,\n yes,\n application,\n foundryUrl,\n token,\n tokenFile\n}) {\n if (!yes) {\n const confirmed = await consola.prompt(`Are you sure you want to delete the version ${version}?\\n${colorize(\"bold\", \"This action cannot be undone.\")}`, {\n type: \"confirm\"\n });\n handlePromptCancel(confirmed);\n }\n consola.start(`Deleting version ${version}`);\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n await thirdPartyApplications.deleteVersion(clientCtx, application, version);\n consola.success(`Deleted version ${version}`);\n}"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkDQYIDDJN_cjs = require('./chunk-DQYIDDJN.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkRHOIENYA_cjs = require('./chunk-RHOIENYA.cjs');
|
|
5
5
|
require('./chunk-467BAS7X.cjs');
|
|
6
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-HQDDGVB7.cjs');
|
|
7
7
|
var consola = require('consola');
|
|
8
8
|
var utils = require('consola/utils');
|
|
9
9
|
|
|
@@ -23,13 +23,13 @@ ${utils.colorize("bold", "This action cannot be undone.")}`, {
|
|
|
23
23
|
chunkDQYIDDJN_cjs.handlePromptCancel(confirmed);
|
|
24
24
|
}
|
|
25
25
|
consola.consola.start(`Deleting version ${version}`);
|
|
26
|
-
const loadedToken = await
|
|
26
|
+
const loadedToken = await chunkRHOIENYA_cjs.loadToken(token, tokenFile);
|
|
27
27
|
const tokenProvider = () => loadedToken;
|
|
28
|
-
const clientCtx =
|
|
29
|
-
await
|
|
28
|
+
const clientCtx = chunkRHOIENYA_cjs.createInternalClientContext(foundryUrl, tokenProvider);
|
|
29
|
+
await chunkRHOIENYA_cjs.third_party_applications_exports.deleteVersion(clientCtx, application, version);
|
|
30
30
|
consola.consola.success(`Deleted version ${version}`);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
module.exports = versionDeleteCommand;
|
|
34
34
|
//# sourceMappingURL=out.js.map
|
|
35
|
-
//# sourceMappingURL=versionDeleteCommand-
|
|
35
|
+
//# sourceMappingURL=versionDeleteCommand-LZJDT2HD.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/version/delete/versionDeleteCommand.mts"],"names":[],"mappings":";;;;;;;;;;;;AAiBA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAGzB,eAAO,qBAA4C;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,MAAI,CAAC,KAAK;AACR,UAAM,YAAY,MAAM,QAAQ,OAAO,+CAA+C,OAAO;AAAA,EAAM,SAAS,QAAQ,+BAA+B,CAAC,IAAI;AAAA,MACtJ,MAAM;AAAA,IACR,CAAC;AACD,uBAAmB,SAAS;AAAA,EAC9B;AACA,UAAQ,MAAM,oBAAoB,OAAO,EAAE;AAC3C,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,QAAM,iCAAuB,cAAc,WAAW,aAAa,OAAO;AAC1E,UAAQ,QAAQ,mBAAmB,OAAO,EAAE;AAC9C","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport { handlePromptCancel } from \"../../../../consola/handlePromptCancel.js\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionDeleteCommand({\n version,\n yes,\n application,\n foundryUrl,\n token,\n tokenFile\n}) {\n if (!yes) {\n const confirmed = await consola.prompt(`Are you sure you want to delete the version ${version}?\\n${colorize(\"bold\", \"This action cannot be undone.\")}`, {\n type: \"confirm\"\n });\n handlePromptCancel(confirmed);\n }\n consola.start(`Deleting version ${version}`);\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n await thirdPartyApplications.deleteVersion(clientCtx, application, version);\n consola.success(`Deleted version ${version}`);\n}"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkRHOIENYA_cjs = require('./chunk-RHOIENYA.cjs');
|
|
4
|
+
require('./chunk-467BAS7X.cjs');
|
|
5
|
+
require('./chunk-HQDDGVB7.cjs');
|
|
6
|
+
var consola = require('consola');
|
|
7
|
+
|
|
8
|
+
async function versionGetCommand({
|
|
9
|
+
foundryUrl,
|
|
10
|
+
application,
|
|
11
|
+
token,
|
|
12
|
+
tokenFile
|
|
13
|
+
}) {
|
|
14
|
+
const loadedToken = await chunkRHOIENYA_cjs.loadToken(token, tokenFile);
|
|
15
|
+
const tokenProvider = () => loadedToken;
|
|
16
|
+
const clientCtx = chunkRHOIENYA_cjs.createInternalClientContext(foundryUrl, tokenProvider);
|
|
17
|
+
consola.consola.start("Getting live version");
|
|
18
|
+
const website = await chunkRHOIENYA_cjs.third_party_applications_exports.getWebsite(clientCtx, application);
|
|
19
|
+
const deployedVersion = website?.deployedVersion;
|
|
20
|
+
if (!deployedVersion) {
|
|
21
|
+
consola.consola.info("No live site version set");
|
|
22
|
+
} else {
|
|
23
|
+
consola.consola.success(`Live site version is ${deployedVersion}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
module.exports = versionGetCommand;
|
|
28
|
+
//# sourceMappingURL=out.js.map
|
|
29
|
+
//# sourceMappingURL=versionGetCommand-4LGRRMQM.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/version/get/versionGetCommand.mts"],"names":[],"mappings":";;;;;;;;;AAiBA,SAAS,eAAe;AAExB,eAAO,kBAAyC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,UAAQ,MAAM,sBAAsB;AACpC,QAAM,UAAU,MAAM,iCAAuB,WAAW,WAAW,WAAW;AAC9E,QAAM,kBAAkB,SAAS;AACjC,MAAI,CAAC,iBAAiB;AACpB,YAAQ,KAAK,0BAA0B;AAAA,EACzC,OAAO;AACL,YAAQ,QAAQ,wBAAwB,eAAe,EAAE;AAAA,EAC3D;AACF","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { consola } from \"consola\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionGetCommand({\n foundryUrl,\n application,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.start(\"Getting live version\");\n const website = await thirdPartyApplications.getWebsite(clientCtx, application);\n const deployedVersion = website?.deployedVersion;\n if (!deployedVersion) {\n consola.info(\"No live site version set\");\n } else {\n consola.success(`Live site version is ${deployedVersion}`);\n }\n}"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-NTRB7WUY.browser.mjs';
|
|
2
|
+
import './chunk-FRT6INSG.browser.mjs';
|
|
3
|
+
import './chunk-C5C5AQYT.browser.mjs';
|
|
4
|
+
import { consola } from 'consola';
|
|
5
|
+
|
|
6
|
+
async function versionGetCommand({
|
|
7
|
+
foundryUrl,
|
|
8
|
+
application,
|
|
9
|
+
token,
|
|
10
|
+
tokenFile
|
|
11
|
+
}) {
|
|
12
|
+
const loadedToken = await loadToken(token, tokenFile);
|
|
13
|
+
const tokenProvider = () => loadedToken;
|
|
14
|
+
const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);
|
|
15
|
+
consola.start("Getting live version");
|
|
16
|
+
const website = await third_party_applications_exports.getWebsite(clientCtx, application);
|
|
17
|
+
const deployedVersion = website?.deployedVersion;
|
|
18
|
+
if (!deployedVersion) {
|
|
19
|
+
consola.info("No live site version set");
|
|
20
|
+
} else {
|
|
21
|
+
consola.success(`Live site version is ${deployedVersion}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { versionGetCommand as default };
|
|
26
|
+
//# sourceMappingURL=out.js.map
|
|
27
|
+
//# sourceMappingURL=versionGetCommand-A6BVV3GL.browser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/version/get/versionGetCommand.mts"],"names":[],"mappings":";;;;;;;;;AAiBA,SAAS,eAAe;AAExB,eAAO,kBAAyC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,UAAQ,MAAM,sBAAsB;AACpC,QAAM,UAAU,MAAM,iCAAuB,WAAW,WAAW,WAAW;AAC9E,QAAM,kBAAkB,SAAS;AACjC,MAAI,CAAC,iBAAiB;AACpB,YAAQ,KAAK,0BAA0B;AAAA,EACzC,OAAO;AACL,YAAQ,QAAQ,wBAAwB,eAAe,EAAE;AAAA,EAC3D;AACF","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { consola } from \"consola\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionGetCommand({\n foundryUrl,\n application,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.start(\"Getting live version\");\n const website = await thirdPartyApplications.getWebsite(clientCtx, application);\n const deployedVersion = website?.deployedVersion;\n if (!deployedVersion) {\n consola.info(\"No live site version set\");\n } else {\n consola.success(`Live site version is ${deployedVersion}`);\n }\n}"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-
|
|
1
|
+
import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-MQIOUPGJ.mjs';
|
|
2
2
|
import './chunk-CWMSASIM.mjs';
|
|
3
|
-
import './chunk-
|
|
3
|
+
import './chunk-E2SEJZTC.mjs';
|
|
4
4
|
import { consola } from 'consola';
|
|
5
5
|
|
|
6
6
|
async function versionGetCommand({
|
|
@@ -13,14 +13,15 @@ async function versionGetCommand({
|
|
|
13
13
|
const tokenProvider = () => loadedToken;
|
|
14
14
|
const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);
|
|
15
15
|
consola.start("Getting live version");
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const website = await third_party_applications_exports.getWebsite(clientCtx, application);
|
|
17
|
+
const deployedVersion = website?.deployedVersion;
|
|
18
|
+
if (!deployedVersion) {
|
|
18
19
|
consola.info("No live site version set");
|
|
19
20
|
} else {
|
|
20
|
-
consola.success(`Live site version is ${
|
|
21
|
+
consola.success(`Live site version is ${deployedVersion}`);
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export { versionGetCommand as default };
|
|
25
26
|
//# sourceMappingURL=out.js.map
|
|
26
|
-
//# sourceMappingURL=versionGetCommand-
|
|
27
|
+
//# sourceMappingURL=versionGetCommand-XCXFCFAP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/version/get/versionGetCommand.mts"],"names":[],"mappings":";;;;;;;;;AAiBA,SAAS,eAAe;AAExB,eAAO,kBAAyC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,UAAQ,MAAM,sBAAsB;AACpC,QAAM,UAAU,MAAM,iCAAuB,WAAW,WAAW,WAAW;AAC9E,QAAM,kBAAkB,SAAS;AACjC,MAAI,CAAC,iBAAiB;AACpB,YAAQ,KAAK,0BAA0B;AAAA,EACzC,OAAO;AACL,YAAQ,QAAQ,wBAAwB,eAAe,EAAE;AAAA,EAC3D;AACF","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { consola } from \"consola\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionGetCommand({\n foundryUrl,\n application,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.start(\"Getting live version\");\n const website = await thirdPartyApplications.getWebsite(clientCtx, application);\n const deployedVersion = website?.deployedVersion;\n if (!deployedVersion) {\n consola.info(\"No live site version set\");\n } else {\n consola.success(`Live site version is ${deployedVersion}`);\n }\n}"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { loadToken, createInternalClientContext, third_party_applications_exports } from './chunk-NTRB7WUY.browser.mjs';
|
|
2
|
+
import './chunk-FRT6INSG.browser.mjs';
|
|
3
|
+
import './chunk-C5C5AQYT.browser.mjs';
|
|
4
|
+
import { consola } from 'consola';
|
|
5
|
+
import { colorize } from 'consola/utils';
|
|
6
|
+
|
|
7
|
+
async function versionListCommand({
|
|
8
|
+
foundryUrl,
|
|
9
|
+
application,
|
|
10
|
+
token,
|
|
11
|
+
tokenFile
|
|
12
|
+
}) {
|
|
13
|
+
const loadedToken = await loadToken(token, tokenFile);
|
|
14
|
+
const tokenProvider = () => loadedToken;
|
|
15
|
+
const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);
|
|
16
|
+
consola.start("Fetching versions & deployed version");
|
|
17
|
+
const [versions, website] = await Promise.all([third_party_applications_exports.listVersions(clientCtx, application), third_party_applications_exports.getWebsite(clientCtx, application)]);
|
|
18
|
+
if (versions.data.length === 0) {
|
|
19
|
+
consola.info("No site versions found");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
consola.success("Found versions:");
|
|
23
|
+
const semver = await import('semver');
|
|
24
|
+
const sortedVersions = semver.rsort(versions.data.map((v) => v.version).filter((v) => semver.valid(v)));
|
|
25
|
+
for (const version of sortedVersions) {
|
|
26
|
+
consola.log(` - ${version}${website?.deployedVersion && version === website?.deployedVersion ? colorize("green", ` (deployed)`) : ""}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { versionListCommand as default };
|
|
31
|
+
//# sourceMappingURL=out.js.map
|
|
32
|
+
//# sourceMappingURL=versionListCommand-2LWNOKV2.browser.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/commands/site/version/list/versionListCommand.mts"],"names":[],"mappings":";;;;;;;;;AAiBA,SAAS,eAAe;AACxB,SAAS,gBAAgB;AAEzB,eAAO,mBAA0C;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,cAAc,MAAM,UAAU,OAAO,SAAS;AACpD,QAAM,gBAAgB,MAAM;AAC5B,QAAM,YAAY,4BAA4B,YAAY,aAAa;AACvE,UAAQ,MAAM,sCAAsC;AACpD,QAAM,CAAC,UAAU,OAAO,IAAI,MAAM,QAAQ,IAAI,CAAC,iCAAuB,aAAa,WAAW,WAAW,GAAG,iCAAuB,WAAW,WAAW,WAAW,CAAC,CAAC;AACtK,MAAI,SAAS,KAAK,WAAW,GAAG;AAC9B,YAAQ,KAAK,wBAAwB;AACrC;AAAA,EACF;AACA,UAAQ,QAAQ,iBAAiB;AACjC,QAAM,SAAS,MAAM,OAAO,QAAQ;AACpC,QAAM,iBAAiB,OAAO,MAAM,SAAS,KAAK,IAAI,OAAK,EAAE,OAAO,EAAE,OAAO,OAAK,OAAO,MAAM,CAAC,CAAC,CAAC;AAClG,aAAW,WAAW,gBAAgB;AACpC,YAAQ,IAAI,SAAS,OAAO,GAAG,SAAS,mBAAmB,YAAY,SAAS,kBAAkB,SAAS,SAAS,aAAa,IAAI,EAAE,EAAE;AAAA,EAC3I;AACF","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createInternalClientContext, thirdPartyApplications } from \"#net\";\nimport { consola } from \"consola\";\nimport { colorize } from \"consola/utils\";\nimport { loadToken } from \"../../../../util/token.js\";\nexport default async function versionListCommand({\n foundryUrl,\n application,\n token,\n tokenFile\n}) {\n const loadedToken = await loadToken(token, tokenFile);\n const tokenProvider = () => loadedToken;\n const clientCtx = createInternalClientContext(foundryUrl, tokenProvider);\n consola.start(\"Fetching versions & deployed version\");\n const [versions, website] = await Promise.all([thirdPartyApplications.listVersions(clientCtx, application), thirdPartyApplications.getWebsite(clientCtx, application)]);\n if (versions.data.length === 0) {\n consola.info(\"No site versions found\");\n return;\n }\n consola.success(\"Found versions:\");\n const semver = await import(\"semver\");\n const sortedVersions = semver.rsort(versions.data.map(v => v.version).filter(v => semver.valid(v)));\n for (const version of sortedVersions) {\n consola.log(` - ${version}${website?.deployedVersion && version === website?.deployedVersion ? colorize(\"green\", ` (deployed)`) : \"\"}`);\n }\n}"]}
|