Skip to content

Commit

Permalink
chore: remove unnecessary whatwg-url dependency (#3297)
Browse files Browse the repository at this point in the history
  • Loading branch information
fahslaj committed Aug 18, 2022
1 parent 10c347f commit b4d0467
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 23 deletions.
1 change: 0 additions & 1 deletion commands/create/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
const fs = require("fs-extra");
const path = require("path");
const os = require("os");
const { URL } = require("whatwg-url");
const { camelCase } = require("yargs-parser");
const dedent = require("dedent");
const initPackageJson = require("pify")(require("init-package-json"));
Expand Down
1 change: 0 additions & 1 deletion commands/create/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"slash": "^3.0.0",
"validate-npm-package-license": "^3.0.4",
"validate-npm-package-name": "^4.0.0",
"whatwg-url": "^8.4.0",
"yargs-parser": "20.2.4"
}
}
27 changes: 16 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@
"upath": "^2.0.1",
"validate-npm-package-license": "^3.0.4",
"validate-npm-package-name": "^4.0.0",
"whatwg-url": "^8.4.0",
"write-file-atomic": "^4.0.1",
"write-json-file": "^4.3.0",
"write-pkg": "^4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions utils/gitlab-client/__tests__/GitLabClient.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const { GitLabClient } = require("../lib/GitLabClient");
describe("GitLabClient", () => {
describe("constructor", () => {
it("sets `baseUrl` and `token`", () => {
const client = new GitLabClient("http://some/host", "TOKEN");
const client = new GitLabClient("TOKEN", "http://some/host");

expect(client.baseUrl).toEqual("http://some/host");
expect(client.token).toEqual("TOKEN");
Expand All @@ -18,7 +18,7 @@ describe("GitLabClient", () => {

describe("releasesUrl", () => {
it("returns a GitLab releases API URL", () => {
const client = new GitLabClient("http://some/host", "TOKEN");
const client = new GitLabClient("TOKEN", "http://some/host");
const url = client.releasesUrl("the-namespace", "the-project");

expect(url).toEqual("http://some/host/projects/the-namespace%2Fthe-project/releases");
Expand All @@ -27,7 +27,7 @@ describe("GitLabClient", () => {

describe("createRelease", () => {
it("requests releases api with release", () => {
const client = new GitLabClient("http://some/host", "TOKEN");
const client = new GitLabClient("TOKEN", "http://some/host");
fetch.mockResolvedValue({ ok: true });
const release = {
owner: "the-owner",
Expand Down
2 changes: 1 addition & 1 deletion utils/gitlab-client/__tests__/gitlab-client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("createGitLabClient", () => {

createGitLabClient();

expect(GitLabClient).toHaveBeenCalledWith("http://some/host", "TOKEN");
expect(GitLabClient).toHaveBeenCalledWith("TOKEN", "http://some/host");
});

it("has a createRelease method like ocktokit", () => {
Expand Down
2 changes: 1 addition & 1 deletion utils/gitlab-client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function createGitLabClient() {
throw new Error("A GL_TOKEN environment variable is required.");
}

const client = new GitLabClient(GL_API_URL, GL_TOKEN);
const client = new GitLabClient(GL_TOKEN, GL_API_URL);

return OcktokitAdapter(client);
}
3 changes: 1 addition & 2 deletions utils/gitlab-client/lib/GitLabClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

const path = require("path");

const { URL } = require("whatwg-url");
const log = require("npmlog");
const fetch = require("node-fetch");

class GitLabClient {
constructor(baseUrl = "https://gitlab.com/api/v4", token) {
constructor(token, baseUrl = "https://gitlab.com/api/v4") {
this.baseUrl = baseUrl;
this.token = token;
}
Expand Down
3 changes: 1 addition & 2 deletions utils/gitlab-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
},
"dependencies": {
"node-fetch": "^2.6.1",
"npmlog": "^6.0.2",
"whatwg-url": "^8.4.0"
"npmlog": "^6.0.2"
}
}

0 comments on commit b4d0467

Please sign in to comment.