@argos-ci/cli 4.2.0 → 4.3.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/dist/index.mjs +23 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { mkdir, readFile, rename, unlink, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { Option, program } from "commander";
|
|
5
|
-
import { finalize, skip, upload } from "@argos-ci/core";
|
|
5
|
+
import { deploy, finalize, skip, upload } from "@argos-ci/core";
|
|
6
6
|
import ora from "ora";
|
|
7
7
|
import { createClient, formatAPIError, throwAPIError } from "@argos-ci/api-client";
|
|
8
8
|
import { homedir } from "node:os";
|
|
@@ -572,6 +572,27 @@ function loginCommand(program) {
|
|
|
572
572
|
});
|
|
573
573
|
}
|
|
574
574
|
//#endregion
|
|
575
|
+
//#region src/commands/deploy.ts
|
|
576
|
+
function deployCommand(program) {
|
|
577
|
+
program.command("deploy").argument("<directory>", "Directory of the static build to deploy").description("Deploy a static build (Storybook or any static site) to Argos").addOption(tokenOption).addOption(new Option("--prod", "Deploy as a production deployment").default(false)).action(async (directory, options) => {
|
|
578
|
+
const spinner = ora("Deploying").start();
|
|
579
|
+
try {
|
|
580
|
+
const result = await deploy({
|
|
581
|
+
token: options.token,
|
|
582
|
+
root: resolve(directory),
|
|
583
|
+
environment: options.prod ? "production" : void 0
|
|
584
|
+
});
|
|
585
|
+
spinner.succeed(`Deployed: ${result.url}`);
|
|
586
|
+
} catch (error) {
|
|
587
|
+
if (error instanceof Error) {
|
|
588
|
+
spinner.fail(`Deploy failed: ${error.message}`);
|
|
589
|
+
console.error(error.stack);
|
|
590
|
+
}
|
|
591
|
+
process.exit(1);
|
|
592
|
+
}
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
//#endregion
|
|
575
596
|
//#region src/index.ts
|
|
576
597
|
const rawPkg = await readFile(resolve(fileURLToPath(new URL(".", import.meta.url)), "..", "package.json"), "utf8");
|
|
577
598
|
const pkg = JSON.parse(rawPkg);
|
|
@@ -581,6 +602,7 @@ skipCommand(program);
|
|
|
581
602
|
finalizeCommand(program);
|
|
582
603
|
buildCommand(program);
|
|
583
604
|
loginCommand(program);
|
|
605
|
+
deployCommand(program);
|
|
584
606
|
if (!process.argv.slice(2).length) program.outputHelp();
|
|
585
607
|
else program.parse(process.argv);
|
|
586
608
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/cli",
|
|
3
3
|
"description": "Command-line (CLI) for visual testing with Argos.",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.3.0",
|
|
5
5
|
"bin": {
|
|
6
6
|
"argos": "./bin/argos-cli.js"
|
|
7
7
|
},
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@argos-ci/api-client": "0.
|
|
38
|
-
"@argos-ci/core": "5.
|
|
37
|
+
"@argos-ci/api-client": "0.19.0",
|
|
38
|
+
"@argos-ci/core": "5.3.0",
|
|
39
39
|
"commander": "^14.0.3",
|
|
40
40
|
"open": "^11.0.0",
|
|
41
41
|
"ora": "^9.3.0",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"check-format": "prettier --check --ignore-unknown --ignore-path=../../.gitignore --ignore-path=../../.prettierignore .",
|
|
52
52
|
"lint": "eslint ."
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "9ff7241b23dce530910d0fffd113db23e2fbe949"
|
|
55
55
|
}
|