From 27c088987c58876cd5577c449e72c5cfcc35a00a Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Sun, 1 Oct 2023 08:53:18 +0000 Subject: [PATCH 1/3] refactor: esm --- package.json | 3 ++- src/build.js | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 5bafe7c..33c6a35 100644 --- a/package.json +++ b/package.json @@ -10,5 +10,6 @@ }, "engines": { "node": ">= 14.15.0" - } + }, + "type": "module" } diff --git a/src/build.js b/src/build.js index 97192ef..6014286 100644 --- a/src/build.js +++ b/src/build.js @@ -2,14 +2,15 @@ // for deployment outside of GitLab CI, e.g. Cloudflare Pages and Netlify -const { stream: gotStream } = require('got') -const got = require('got') -const unzip = require('extract-zip') -const { join } = require('path') -const { mkdir } = require('fs/promises') -const { createWriteStream } = require('fs') -const { pipeline } = require('stream/promises') +import got from 'got' +import unzip from 'extract-zip' +import { dirname, join } from 'node:path' +import { mkdir } from 'node:fs/promises' +import { createWriteStream } from 'node:fs' +import { pipeline } from 'node:stream/promises' +import { fileURLToPath } from 'node:url' +const __dirname = dirname(fileURLToPath(import.meta.url)) const rootPath = join(__dirname, '..') const tmpPath = join(rootPath, 'tmp') const publicPath = join(rootPath, 'public') @@ -35,7 +36,7 @@ const f = async () => { console.log(`Downloading artifacts.zip from "${artifactsUrl}"`) try { await pipeline( - gotStream(artifactsUrl), + got.stream(artifactsUrl), createWriteStream(zipPath) ) await pipelineStatus(pipelineUrl) @@ -50,7 +51,7 @@ const f = async () => { try { await pipeline( - gotStream(ghMirror), + got.stream(ghMirror), createWriteStream(zipPath) ) } catch ({ message }) { From 9e26295de2718619310c2e4d816dce7964a60292 Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Sun, 1 Oct 2023 08:55:18 +0000 Subject: [PATCH 2/3] chore(deps): bump got from 11 to 13 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 33c6a35..9fb50c7 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ }, "dependencies": { "extract-zip": "^2.0.1", - "got": "^11.8.3" + "got": "^13.0.0" }, "engines": { "node": ">= 14.15.0" From 516fd4afc6282caf66794a8c277bdc46bab3ea85 Mon Sep 17 00:00:00 2001 From: Ming Di Leom <2809763-curben@users.noreply.gitlab.com> Date: Sun, 1 Oct 2023 09:15:12 +0000 Subject: [PATCH 3/3] chore(node): require at least Node 18 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9fb50c7..61f2bb1 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "got": "^13.0.0" }, "engines": { - "node": ">= 14.15.0" + "node": ">= 18.12.0" }, "type": "module" }