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