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 9a821d0 commit 08ba738
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 133 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 @@
"dependencies": {
"do-bulma": "github:do-community/do-bulma",
"do-vue": "github:do-community/do-vue",
"node-fetch": "^3.3.2",
"pretty-checkbox-vue": "^1.1.9",
"vue": "^3.4.15"
},
Expand Down
8 changes: 3 additions & 5 deletions src/build/get.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 @@ -18,18 +18,16 @@ const fs = require('fs');
const path = require('path');
const imageFilter = require('./imageFilter');

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

let token = process.env.DIGITALOCEAN_TOKEN;
if (fs.existsSync(path.join(__dirname, '..', '..', 'config.js'))) {
const config = require('../../config');
token = config.token;
}

const get = async url => {
const res = await fetch.then(({ default: run }) => run(url, {
const res = await fetch(url, {
headers: { Authorization: `Bearer ${token}` },
}));
});
if (!res.ok) throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);
return await res.json();
};
Expand Down

1 comment on commit 08ba738

@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.

available-images (Build Analysis Report)

Please sign in to comment.