@marina-cloud/cli 0.0.2 → 0.0.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/README.md +4 -2
- package/dist/marina.mjs +41 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Deploy small internal apps to Marina Cloud.
|
|
4
4
|
|
|
5
|
+
Source code and Marina's deployment skill live in the
|
|
6
|
+
[marina-hq/marina](https://github.com/marina-hq/marina) repository.
|
|
7
|
+
|
|
5
8
|
```sh
|
|
6
9
|
npm install -g @marina-cloud/cli
|
|
7
10
|
marina setup
|
|
@@ -16,8 +19,7 @@ The saved credential lives in `~/.marina/profile` with user-only permissions.
|
|
|
16
19
|
Use `marina profile` to inspect the active profile and `marina logout` to remove
|
|
17
20
|
its credential.
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
detected. Install or refresh it explicitly with:
|
|
22
|
+
Install Marina deployment skills with:
|
|
21
23
|
|
|
22
24
|
```sh
|
|
23
25
|
marina skills install
|
package/dist/marina.mjs
CHANGED
|
@@ -147,9 +147,10 @@ async function startDeploy(zip, name, app) {
|
|
|
147
147
|
});
|
|
148
148
|
return res.deploy;
|
|
149
149
|
}
|
|
150
|
-
async function pollDeploy(id) {
|
|
150
|
+
async function pollDeploy(id, onProgress = () => void 0) {
|
|
151
151
|
for (; ; ) {
|
|
152
152
|
const { deploy: deploy2 } = await request(`/v1/deploys/${id}`);
|
|
153
|
+
onProgress(deploy2);
|
|
153
154
|
if (deploy2.status !== "queued" && deploy2.status !== "building") return deploy2;
|
|
154
155
|
await new Promise((resolve2) => setTimeout(resolve2, 500));
|
|
155
156
|
}
|
|
@@ -1564,6 +1565,28 @@ function say(line = "") {
|
|
|
1564
1565
|
function note(line) {
|
|
1565
1566
|
console.error(line);
|
|
1566
1567
|
}
|
|
1568
|
+
function createProgress() {
|
|
1569
|
+
let active = false;
|
|
1570
|
+
let lastPhase = null;
|
|
1571
|
+
let frame = 0;
|
|
1572
|
+
const frames = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
1573
|
+
const interactive = process.stderr.isTTY === true && !json;
|
|
1574
|
+
return {
|
|
1575
|
+
update(phase, line) {
|
|
1576
|
+
if (interactive) {
|
|
1577
|
+
process.stderr.write(`\r\x1B[2K${frames[frame++ % frames.length]} ${line}`);
|
|
1578
|
+
active = true;
|
|
1579
|
+
} else if (phase !== lastPhase) {
|
|
1580
|
+
console.error(json ? JSON.stringify({ type: "progress", phase, message: line }) : line);
|
|
1581
|
+
}
|
|
1582
|
+
lastPhase = phase;
|
|
1583
|
+
},
|
|
1584
|
+
clear() {
|
|
1585
|
+
if (active) process.stderr.write("\r\x1B[2K");
|
|
1586
|
+
active = false;
|
|
1587
|
+
}
|
|
1588
|
+
};
|
|
1589
|
+
}
|
|
1567
1590
|
function result(payload) {
|
|
1568
1591
|
if (json) console.log(JSON.stringify({ schema_version: 1, ok: true, ...payload }, null, 2));
|
|
1569
1592
|
}
|
|
@@ -1749,7 +1772,7 @@ function installSkills(agent) {
|
|
|
1749
1772
|
// package.json
|
|
1750
1773
|
var package_default = {
|
|
1751
1774
|
name: "@marina-cloud/cli",
|
|
1752
|
-
version: "0.0.
|
|
1775
|
+
version: "0.0.3",
|
|
1753
1776
|
description: "Command-line client for Marina Cloud",
|
|
1754
1777
|
homepage: "https://github.com/marina-hq/marina#readme",
|
|
1755
1778
|
bugs: {
|
|
@@ -1894,13 +1917,14 @@ async function deploy(dirArg, flags) {
|
|
|
1894
1917
|
packed = pack(dir);
|
|
1895
1918
|
}
|
|
1896
1919
|
for (const secret of packed.skippedSecrets) say(dim(`skipped ${secret} \u2014 secrets stay local`));
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
);
|
|
1920
|
+
const progress = createProgress();
|
|
1921
|
+
const size = `${String(packed.fileCount)} files, ${String(Math.round(packed.totalBytes / 1024))} KB`;
|
|
1922
|
+
progress.update("uploading", `Uploading ${name} (${size})`);
|
|
1900
1923
|
let started;
|
|
1901
1924
|
try {
|
|
1902
1925
|
started = await startDeploy(packed.zip, name, target);
|
|
1903
1926
|
} catch (error) {
|
|
1927
|
+
progress.clear();
|
|
1904
1928
|
if (error instanceof ApiError && error.code === "not_found" && link) {
|
|
1905
1929
|
failure(
|
|
1906
1930
|
"link_stale",
|
|
@@ -1910,7 +1934,18 @@ async function deploy(dirArg, flags) {
|
|
|
1910
1934
|
}
|
|
1911
1935
|
throw error;
|
|
1912
1936
|
}
|
|
1913
|
-
const
|
|
1937
|
+
const deployedAt = Date.now();
|
|
1938
|
+
let deployed;
|
|
1939
|
+
try {
|
|
1940
|
+
deployed = await pollDeploy(started.id, (current) => {
|
|
1941
|
+
if (current.status !== "queued" && current.status !== "building") return;
|
|
1942
|
+
const elapsed = Math.max(1, Math.round((Date.now() - deployedAt) / 1e3));
|
|
1943
|
+
const message = current.status === "queued" ? `Waiting for a deploy worker (${String(elapsed)}s)` : `Building and verifying (${String(elapsed)}s)`;
|
|
1944
|
+
progress.update(current.status, message);
|
|
1945
|
+
});
|
|
1946
|
+
} finally {
|
|
1947
|
+
progress.clear();
|
|
1948
|
+
}
|
|
1914
1949
|
if (deployed.status === "refused" && deployed.refusal) {
|
|
1915
1950
|
say(`${red("refused")} ${deployed.refusal.message}`);
|
|
1916
1951
|
if (deployed.refusal.action) say(` ${deployed.refusal.action}`);
|