@argos-ci/cli 4.2.1-alpha.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 +9 -18
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
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
|
-
import {
|
|
4
|
+
import { Option, program } from "commander";
|
|
5
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";
|
|
@@ -572,29 +572,20 @@ function loginCommand(program) {
|
|
|
572
572
|
});
|
|
573
573
|
}
|
|
574
574
|
//#endregion
|
|
575
|
-
//#region src/commands/
|
|
576
|
-
function
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
if (!Number.isSafeInteger(prNumber) || prNumber <= 0) throw new InvalidArgumentError("pull request number must be a positive integer");
|
|
580
|
-
return prNumber;
|
|
581
|
-
}
|
|
582
|
-
function publishCommand(program) {
|
|
583
|
-
program.command("publish").alias("deploy").argument("<directory>", "Directory of the static build to publish").description("Publish a static build (Storybook or any static site) to Argos").addOption(tokenOption).addOption(new Option("--environment <string>", "Deployment environment").choices(["preview", "production"]).default("preview").env("ARGOS_ENVIRONMENT")).addOption(new Option("--commit <string>", "Git commit SHA").env("ARGOS_COMMIT")).addOption(new Option("--branch <string>", "Git branch name").env("ARGOS_BRANCH")).addOption(new Option("--pr-number <number>", "Pull request number").argParser(parsePrNumber).env("ARGOS_PR_NUMBER")).action(async (directory, options) => {
|
|
584
|
-
const spinner = ora("Publishing").start();
|
|
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();
|
|
585
579
|
try {
|
|
586
580
|
const result = await deploy({
|
|
587
581
|
token: options.token,
|
|
588
582
|
root: resolve(directory),
|
|
589
|
-
environment: options.
|
|
590
|
-
commit: options.commit ?? void 0,
|
|
591
|
-
branch: options.branch ?? void 0,
|
|
592
|
-
prNumber: options.prNumber
|
|
583
|
+
environment: options.prod ? "production" : void 0
|
|
593
584
|
});
|
|
594
|
-
spinner.succeed(`
|
|
585
|
+
spinner.succeed(`Deployed: ${result.url}`);
|
|
595
586
|
} catch (error) {
|
|
596
587
|
if (error instanceof Error) {
|
|
597
|
-
spinner.fail(`
|
|
588
|
+
spinner.fail(`Deploy failed: ${error.message}`);
|
|
598
589
|
console.error(error.stack);
|
|
599
590
|
}
|
|
600
591
|
process.exit(1);
|
|
@@ -611,7 +602,7 @@ skipCommand(program);
|
|
|
611
602
|
finalizeCommand(program);
|
|
612
603
|
buildCommand(program);
|
|
613
604
|
loginCommand(program);
|
|
614
|
-
|
|
605
|
+
deployCommand(program);
|
|
615
606
|
if (!process.argv.slice(2).length) program.outputHelp();
|
|
616
607
|
else program.parse(process.argv);
|
|
617
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
|
}
|