Skip to content

Commit 39ace08

Browse files
fix: removed node-fetch dependency from marketplace
1 parent d611039 commit 39ace08

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

scripts/release/marketplaceRelease.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const nodefetch = require("node-fetch");
21
const { join } = require("path");
32

43
const config = {
@@ -63,7 +62,7 @@ async function getGithubAssetUrl() {
6362
for (let attempt = 1; attempt <= maxRetries; attempt++) {
6463
console.log(`Attempt ${attempt}/${maxRetries}: Fetching release for tag ${tag}`);
6564

66-
const releaseData = await fetch(
65+
const releaseData = await fetchData(
6766
"GET",
6867
`https://api.github.com/repos/mendix/native-widgets/releases/tags/${tag}`
6968
);
@@ -128,13 +127,13 @@ async function fetchContributor(method, path, body) {
128127
const pass = process.env.CPAPI_PASS_PROD;
129128
const credentials = `${user}:${pass}`;
130129

131-
return fetch(method, `${config.contributorUrl}/${path}`, body, {
130+
return fetchData(method, `${config.contributorUrl}/${path}`, body, {
132131
OpenID: config.openIdUrl,
133132
Authorization: `Basic ${Buffer.from(credentials).toString("base64")}`
134133
});
135134
}
136135

137-
async function fetch(method, url, body, additionalHeaders) {
136+
async function fetchData(method, url, body, additionalHeaders) {
138137
let response;
139138
const httpsOptions = {
140139
method,
@@ -149,7 +148,7 @@ async function fetch(method, url, body, additionalHeaders) {
149148

150149
console.log(`Fetching URL (${method}): ${url}`);
151150
try {
152-
response = await nodefetch(url, httpsOptions);
151+
response = await fetch(url, httpsOptions);
153152
} catch (error) {
154153
throw new Error(`An error occurred while retrieving data from ${url}. Technical error: ${error.message}`);
155154
}
@@ -203,7 +202,7 @@ async function verifyReleasePublished(contentId, expectedVersion, pkgName) {
203202

204203
try {
205204
// Call the Mendix Content API to get all released module versions
206-
const versionsResponse = await nodefetch(
205+
const versionsResponse = await fetch(
207206
`https://marketplace-api.mendix.com/v1/content/${contentId}/versions`,
208207
{
209208
method: "GET",

0 commit comments

Comments
 (0)