Skip to content

Commit

Permalink
Merge pull request #8 from IamLizu/add-missing-token
Browse files Browse the repository at this point in the history
Add missing token in domain add
  • Loading branch information
IamLizu authored Aug 1, 2024
2 parents 3181679 + d1bec07 commit 46646e3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ verceler -vt <vercel_token> -gt <github_token> [options]
### Example

```sh
verceler --vt your_vercel_token --gt your_github_token --create-github-workflow --load-env preview,development,production --domain yourdomain.com
verceler -vt your_vercel_token -gt your_github_token --create-github-workflow --load-env preview,development,production --domain yourdomain.com
```

This command will:
Expand Down
4 changes: 3 additions & 1 deletion src/utils/VercelManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ class VercelManager {
addDomain(domain) {
console.log(`\nAdding domain ${domain}...`);
try {
execSync(`vercel domains add ${domain}`);
execSync(
`vercel domains add ${domain} --token ${this.vercelToken}`
);
} catch (error) {
if (error.message.includes("have access")) {
console.log(
Expand Down
12 changes: 9 additions & 3 deletions tests/utils/VercelManager.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ describe("VercelManager", () => {
execSync.mockReturnValue(undefined);
vercelManager.addDomain("example.com");

expect(execSync).toHaveBeenCalledWith("vercel domains add example.com");
expect(execSync).toHaveBeenCalledWith(
"vercel domains add example.com --token mock_token"
);
});

it("should log a message for a false positive warning regarding domain addition", () => {
Expand All @@ -217,7 +219,9 @@ describe("VercelManager", () => {

vercelManager.addDomain("example.com");

expect(execSync).toHaveBeenCalledWith("vercel domains add example.com");
expect(execSync).toHaveBeenCalledWith(
"vercel domains add example.com --token mock_token"
);
expect(console.log).toHaveBeenCalledWith(
"\nAbove error regarding domain is a false positive warning from vercel! Please verify domain addition in your vercel project settings."
);
Expand All @@ -230,7 +234,9 @@ describe("VercelManager", () => {

vercelManager.addDomain("example.com");

expect(execSync).toHaveBeenCalledWith("vercel domains add example.com");
expect(execSync).toHaveBeenCalledWith(
"vercel domains add example.com --token mock_token"
);
expect(console.error).toHaveBeenCalledWith(
"Failed to add domain example.com:",
"Some other error"
Expand Down

0 comments on commit 46646e3

Please sign in to comment.