Skip to content

Commit 85d74c2

Browse files
committed
Using dedent for the error messages
1 parent 3b6fcc9 commit 85d74c2

File tree

5 files changed

+31
-10
lines changed

5 files changed

+31
-10
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
"chalk": "^5.4.1",
108108
"change-case": "^5.4.4",
109109
"chrome-webstore-upload": "^3.1.4",
110+
"dedent": "^1.5.3",
110111
"dotenv": "^16.4.7",
111112
"exponential-backoff": "^3.1.2",
112113
"form-data": "^4.0.2",

pnpm-lock.yaml

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env node
22
import chalk from "chalk";
3+
import dedent from "dedent";
34
import yargs from "yargs/yargs";
45
import { getCookies, getJsonStoresFromCli } from "./cli.js";
56
import { ChromeOptions, prepareToDeployChrome } from "./stores/chrome/chrome-input.js";
@@ -42,8 +43,12 @@ function verifySelectiveDeployments(storesToInclude: Array<SupportedStores>): bo
4243
if (storesUnsupported.length > 0) {
4344
const store = storesUnsupported.length === 1 ? "store" : "stores";
4445
throw new Error(
45-
chalk.red(`Unsupported ${store}: ${storesUnsupported}
46-
Supported stores: ${Stores}`)
46+
chalk.red(
47+
dedent(`
48+
Unsupported ${store}: ${storesUnsupported}
49+
Supported stores: ${Stores}
50+
`)
51+
)
4752
);
4853
}
4954
return true;

src/stores/edge/edge-deploy.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Axios, { type AxiosInstance, type AxiosResponse } from "axios";
22
import chalk from "chalk";
3+
import dedent from "dedent";
34
import { backOff } from "exponential-backoff";
45
import status from "http-status";
56
import { EdgeOptionsPublishApi } from "./edge-input.js";
@@ -43,10 +44,10 @@ async function handleRequestWithBackOff<T>({
4344
chalk.yellow(
4445
getVerboseMessage({
4546
store: STORE,
46-
message: `
47-
Too many requests. A retry will automatically be at ${newTime}
48-
Or, you can deploy manually: https://partner.microsoft.com/en-us/dashboard/microsoftedge/${productId}/packages/dashboard
49-
`.trim(),
47+
message: dedent(`
48+
Too many requests. A retry will automatically be at ${newTime}
49+
Or, you can deploy manually: https://partner.microsoft.com/en-us/dashboard/microsoftedge/${productId}/packages/dashboard
50+
`),
5051
prefix: "Warning"
5152
})
5253
)

src/stores/firefox/firefox-deploy.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Axios, { type AxiosInstance, type AxiosResponse } from "axios";
22
import chalk from "chalk";
3+
import dedent from "dedent";
34
import { backOff } from "exponential-backoff";
45
import FormData from "form-data";
56
import status from "http-status";
@@ -45,10 +46,10 @@ async function handleRequestWithBackOff<T>({
4546
chalk.yellow(
4647
getVerboseMessage({
4748
store: STORE,
48-
message: `
49-
Too many requests. A retry will automatically be at ${newTime}
50-
Or, you can deploy manually: https://addons.mozilla.org/developers/addon/${extId}/versions/submit/
51-
`.trim(),
49+
message: dedent(`
50+
Too many requests. A retry will automatically be at ${newTime}
51+
Or, you can deploy manually: https://addons.mozilla.org/developers/addon/${extId}/versions/submit/
52+
`),
5253
prefix: "Warning"
5354
})
5455
)

0 commit comments

Comments
 (0)