summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 20:56:19 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-21 20:56:19 +0000
commit0b6210cd37b68b94252cb798598b12974a20e1c1 (patch)
treee371686554a877842d95aa94f100bee552ff2a8e /scripts
parentInitial commit. (diff)
downloadnode-undici-upstream.tar.xz
node-undici-upstream.zip
Adding upstream version 5.28.2+dfsg1+~cs23.11.12.3.upstream/5.28.2+dfsg1+_cs23.11.12.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--scripts/generate-pem.js3
-rw-r--r--scripts/generate-undici-types-package-json.js28
-rw-r--r--scripts/verifyVersion.js15
3 files changed, 46 insertions, 0 deletions
diff --git a/scripts/generate-pem.js b/scripts/generate-pem.js
new file mode 100644
index 0000000..0d7e628
--- /dev/null
+++ b/scripts/generate-pem.js
@@ -0,0 +1,3 @@
+/* istanbul ignore file */
+
+require('https-pem/install')
diff --git a/scripts/generate-undici-types-package-json.js b/scripts/generate-undici-types-package-json.js
new file mode 100644
index 0000000..78095ae
--- /dev/null
+++ b/scripts/generate-undici-types-package-json.js
@@ -0,0 +1,28 @@
+const fs = require('node:fs')
+const path = require('node:path')
+
+const packageJSONPath = path.join(__dirname, '..', 'package.json')
+const packageJSONRaw = fs.readFileSync(packageJSONPath, 'utf-8')
+const packageJSON = JSON.parse(packageJSONRaw)
+
+const licensePath = path.join(__dirname, '..', 'LICENSE')
+const licenseRaw = fs.readFileSync(licensePath, 'utf-8')
+
+const packageTypesJSON = {
+ name: 'undici-types',
+ version: packageJSON.version,
+ description: 'A stand-alone types package for Undici',
+ homepage: packageJSON.homepage,
+ bugs: packageJSON.bugs,
+ repository: packageJSON.repository,
+ license: packageJSON.license,
+ types: 'index.d.ts',
+ files: ['*.d.ts'],
+ contributors: packageJSON.contributors
+}
+
+const packageTypesPath = path.join(__dirname, '..', 'types', 'package.json')
+const licenseTypesPath = path.join(__dirname, '..', 'types', 'LICENSE')
+
+fs.writeFileSync(packageTypesPath, JSON.stringify(packageTypesJSON, null, 2))
+fs.writeFileSync(licenseTypesPath, licenseRaw)
diff --git a/scripts/verifyVersion.js b/scripts/verifyVersion.js
new file mode 100644
index 0000000..8ad2d19
--- /dev/null
+++ b/scripts/verifyVersion.js
@@ -0,0 +1,15 @@
+/* istanbul ignore file */
+
+const [major, minor, patch] = process.versions.node.split('.').map(v => Number(v))
+const required = process.argv.pop().split('.').map(v => Number(v))
+
+const badMajor = major < required[0]
+const badMinor = major === required[0] && minor < required[1]
+const badPatch = major === required[0] && minor === required[1] && patch < required[2]
+
+if (badMajor || badMinor || badPatch) {
+ console.log(`Required Node.js >=${required.join('.')}, got ${process.versions.node}`)
+ console.log('Skipping')
+} else {
+ process.exit(1)
+}