parent
47d23fc9b2
commit
e4eb2bb4a0
|
@ -10,5 +10,6 @@
|
|||
},
|
||||
"engines": {
|
||||
"node": ">= 18.12.0"
|
||||
}
|
||||
},
|
||||
"type": "module"
|
||||
}
|
||||
|
|
23
src/build.js
23
src/build.js
|
@ -7,15 +7,16 @@
|
|||
// Instead of using the API, I find it easier to failover to GitHub.
|
||||
// ref: https://gitlab.com/gitlab-org/gitlab/-/issues/29257
|
||||
|
||||
const { stream: gotStream } = require('got')
|
||||
const got = require('got')
|
||||
const unzip = require('extract-zip')
|
||||
const { basename, join } = require('path')
|
||||
const { mkdir, readdir, rm } = require('fs/promises')
|
||||
const { createWriteStream } = require('fs')
|
||||
const { pipeline } = require('stream/promises')
|
||||
const envVar = process.env
|
||||
import got from 'got'
|
||||
import unzip from 'extract-zip'
|
||||
import { basename, dirname, join } from 'node:path'
|
||||
import { mkdir, readdir, rm } 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 envVar = process.env
|
||||
const rootPath = join(__dirname, '..')
|
||||
const tmpPath = join(rootPath, 'tmp')
|
||||
const publicPath = join(rootPath, 'public')
|
||||
|
@ -61,7 +62,7 @@ const dl = async (project) => {
|
|||
console.log(`Downloading ${filename} from "${link}"`)
|
||||
try {
|
||||
await pipeline(
|
||||
gotStream(link),
|
||||
got.stream(link),
|
||||
createWriteStream(zipPath)
|
||||
)
|
||||
await pipelineStatus(pipelineUrl)
|
||||
|
@ -78,7 +79,7 @@ const dl = async (project) => {
|
|||
|
||||
try {
|
||||
await pipeline(
|
||||
gotStream(mirrorLink),
|
||||
got.stream(mirrorLink),
|
||||
createWriteStream(zipPath)
|
||||
)
|
||||
} catch ({ message }) {
|
||||
|
@ -103,7 +104,7 @@ const oisdDl = async (link, filename) => {
|
|||
console.log(`Downloading ${filename} from "${link}"`)
|
||||
try {
|
||||
await pipeline(
|
||||
gotStream(link),
|
||||
got.stream(link),
|
||||
createWriteStream(txtPath)
|
||||
)
|
||||
} catch ({ message }) {
|
||||
|
|
Loading…
Reference in New Issue