@tinycloud-ai/tinycloud-cli 0.1.2 → 0.1.3
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/dist/main.js +50 -27
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -976,8 +976,14 @@ var DEFAULT_LIMITS = {
|
|
|
976
976
|
maxTotalBytes: 50 * 1024 * 1024,
|
|
977
977
|
maxFileBytes: 10 * 1024 * 1024
|
|
978
978
|
};
|
|
979
|
-
|
|
980
|
-
|
|
979
|
+
var BUILD_OUTPUT_IGNORES = DEFAULT_IGNORES.filter((pattern) => pattern !== "node_modules");
|
|
980
|
+
var BUILD_OUTPUT_LIMITS = {
|
|
981
|
+
maxFiles: 6e4,
|
|
982
|
+
maxTotalBytes: 400 * 1024 * 1024,
|
|
983
|
+
maxFileBytes: 50 * 1024 * 1024
|
|
984
|
+
};
|
|
985
|
+
function loadIgnores(root, base = DEFAULT_IGNORES) {
|
|
986
|
+
const patterns = [...base];
|
|
981
987
|
const file = join2(root, ".tinyignore");
|
|
982
988
|
if (existsSync(file)) {
|
|
983
989
|
for (const line of readFileSync2(file, "utf8").split("\n")) {
|
|
@@ -997,8 +1003,8 @@ function matches(pattern, path) {
|
|
|
997
1003
|
function escapeRegExp(value) {
|
|
998
1004
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
999
1005
|
}
|
|
1000
|
-
function packSource(root, limits = DEFAULT_LIMITS) {
|
|
1001
|
-
const ignores = loadIgnores(root);
|
|
1006
|
+
function packSource(root, limits = DEFAULT_LIMITS, baseIgnores = DEFAULT_IGNORES) {
|
|
1007
|
+
const ignores = loadIgnores(root, baseIgnores);
|
|
1002
1008
|
const files = [];
|
|
1003
1009
|
const skippedSecrets = [];
|
|
1004
1010
|
let sizeBytes = 0;
|
|
@@ -1262,6 +1268,16 @@ function failureRemediation(record) {
|
|
|
1262
1268
|
const remediation = record?.errorDetail?.remediation;
|
|
1263
1269
|
return typeof remediation === "string" && remediation !== "" ? remediation : "Read `tiny logs` for the failure, fix it, and deploy again.";
|
|
1264
1270
|
}
|
|
1271
|
+
function failureCode(record) {
|
|
1272
|
+
const code = record?.errorCode;
|
|
1273
|
+
return typeof code === "string" && code in ERROR_CODES ? code : "PROVIDER_UNAVAILABLE";
|
|
1274
|
+
}
|
|
1275
|
+
function failureLogs(record) {
|
|
1276
|
+
const details = record?.errorDetail?.details;
|
|
1277
|
+
if (typeof details !== "object" || details === null) return null;
|
|
1278
|
+
const logs = details.logs;
|
|
1279
|
+
return typeof logs === "string" && logs.trim() !== "" ? logs.replace(/\s+$/, "") : null;
|
|
1280
|
+
}
|
|
1265
1281
|
|
|
1266
1282
|
// ../cli/src/output.ts
|
|
1267
1283
|
var CLI_API_VERSION = "cli.tinycloud.dev/v1";
|
|
@@ -1651,31 +1667,38 @@ Service account token (shown once): ${created.apiToken}`);
|
|
|
1651
1667
|
);
|
|
1652
1668
|
const status = settled?.status ?? result.status;
|
|
1653
1669
|
const build = buildSummary(settled?.providerState);
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
}
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
|
-
|
|
1670
|
+
const payload = {
|
|
1671
|
+
appId: result.appId,
|
|
1672
|
+
deploymentId: result.deploymentId,
|
|
1673
|
+
status,
|
|
1674
|
+
// Same reason the human output withholds it: nothing the caller
|
|
1675
|
+
// deployed is behind that URL.
|
|
1676
|
+
...status === "failed" ? {} : { url: result.url },
|
|
1677
|
+
warnings: result.warnings,
|
|
1678
|
+
...build ? { build } : {}
|
|
1679
|
+
};
|
|
1680
|
+
const report = status === "failed" ? (human) => {
|
|
1681
|
+
if (args.flags.json !== true) human();
|
|
1682
|
+
} : (human) => output.result(payload, human);
|
|
1683
|
+
report(() => {
|
|
1684
|
+
output.progress("");
|
|
1685
|
+
const built = describeBuild(build);
|
|
1686
|
+
if (built) output.step(true, built);
|
|
1687
|
+
if (settled === null) {
|
|
1688
|
+
output.progress(args.flags["no-wait"] === true ? `\u2192 Deployment ${result.deploymentId} is ${status}. Follow it with \`tiny logs\`.` : `\u2192 Deployment ${result.deploymentId} is still running after ${Math.round(waitTimeoutMs(args) / 1e3)}s. Follow it with \`tiny logs\`.`);
|
|
1689
|
+
} else {
|
|
1690
|
+
output.step(status === "ready", `Deployment ${result.deploymentId} is ${status}`);
|
|
1691
|
+
if (settled.errorCode) output.warn(`${settled.errorCode}: ${describeFailure(settled)}`);
|
|
1692
|
+
const logs = failureLogs(settled);
|
|
1693
|
+
if (logs) output.progress(`
|
|
1694
|
+
${logs}
|
|
1695
|
+
`);
|
|
1675
1696
|
}
|
|
1676
|
-
|
|
1697
|
+
if (status !== "failed") output.step(true, `URL: ${result.url}`);
|
|
1698
|
+
for (const warning of result.warnings) output.warn(warning);
|
|
1699
|
+
});
|
|
1677
1700
|
if (status === "failed") {
|
|
1678
|
-
throw new TinyError(
|
|
1701
|
+
throw new TinyError(failureCode(settled), `Deployment ${result.deploymentId} failed: ${describeFailure(settled)}`, {
|
|
1679
1702
|
// The deployer recorded why and what to do about it; repeating its
|
|
1680
1703
|
// own remediation beats a generic pointer at the logs.
|
|
1681
1704
|
remediation: failureRemediation(settled),
|
package/package.json
CHANGED