Skip to content

Commit

Permalink
Remove node-fetch usage
Browse files Browse the repository at this point in the history
  • Loading branch information
MattIPv4 committed Apr 2, 2024
1 parent fdc0e6e commit e08fa35
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 137 deletions.
127 changes: 0 additions & 127 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 @@ -40,7 +40,6 @@
"html-webpack-plugin": "^5.6.0",
"jsdom": "^23.2.0",
"mini-css-extract-plugin": "^2.7.7",
"node-fetch": "^3.3.2",
"path-browserify": "^1.0.1",
"posthtml": "^0.16.6",
"posthtml-expressions": "^1.11.3",
Expand Down
8 changes: 3 additions & 5 deletions src/build/createGitHubComment.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2022 DigitalOcean
Copyright 2024 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

const fetch = import('node-fetch');

module.exports = async args => {
const baseURL = `https://${process.env.SPACES_BUCKET}.${process.env.SPACES_REGION}.digitaloceanspaces.com`;
const tools = args.map(data => {
Expand All @@ -28,7 +26,7 @@ module.exports = async args => {
| ${tools.join(' | ')} |
|${(new Array(tools.length).fill('---')).join('|')}|`;

const res = await fetch.then(({ default: run }) => run(
const res = await fetch(
`https://api.github.com/repos/${process.env.REPO_NAME}/commits/${process.env.COMMIT_SHA}/comments`,
{
method: 'POST',
Expand All @@ -41,7 +39,7 @@ module.exports = async args => {
Authorization: `Basic ${Buffer.from(`github-actions:${process.env.GITHUB_ACCESS_TOKEN}`).toString('base64')}`,
},
},
)).catch(async e => {
).catch(async e => {
console.log(await e.json());
process.exit(1);
});
Expand Down
6 changes: 2 additions & 4 deletions src/build/fetchTemplate.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ const { JSDOM } = jsdom;
const fs = require('fs');
const ensureDir = require('./ensureDir');

const fetch = import('node-fetch');

const wwwSelectors = {
content: '[class^="Layout"] > *, [class*=" Layout"] > *',
header: 'nav, [class^="Header"], [class*=" Header"]',
Expand All @@ -44,13 +42,13 @@ const baseHtml = async mode => {

// Support developing a tool for WWW
if (mode === 'www') {
const res = await fetch.then(({ default: run }) => run('https://www.digitalocean.com'));
const res = await fetch('https://www.digitalocean.com');
return await res.text();
}

// Default to a tool for Community tooling
if (mode === 'community') {
const res = await fetch.then(({ default: run }) => run('https://www.digitalocean.com/community'));
const res = await fetch('https://www.digitalocean.com/community');
return await res.text();
}

Expand Down

1 comment on commit e08fa35

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit has been deployed to DigitalOcean Spaces for easy reviewing.

do-vue (Build Analysis Report)

Please sign in to comment.