parent
36d681724d
commit
9328fc75c9
|
@ -10,5 +10,6 @@
|
|||
},
|
||||
"engines": {
|
||||
"node": ">= 14.15.0"
|
||||
}
|
||||
},
|
||||
"type": "module"
|
||||
}
|
||||
|
|
19
src/build.js
19
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 }) {
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
'use strict'
|
||||
|
||||
const { join } = require('path')
|
||||
const { appendFile, readdir, readFile, rm } = require('fs/promises')
|
||||
import { dirname, join } from 'node:path'
|
||||
import { appendFile, readdir, readFile, rm } from 'node:fs/promises'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
const { parse } = JSON
|
||||
|
||||
const f = async () => {
|
||||
// __dirname is src/
|
||||
const outputFile = join(__dirname, '../tmp/tracking-data-raw.txt')
|
||||
const outputFile = join(__dirname, '..', 'tmp','tracking-data-raw.txt')
|
||||
await rm(outputFile, { force: true })
|
||||
const domains = join(__dirname, '../tmp/tracker-radar/domains')
|
||||
const domains = join(__dirname, '..', 'tmp', 'tracker-radar', 'domains')
|
||||
const countries = await readdir(domains)
|
||||
for (const country of countries) {
|
||||
const files = await readdir(join(domains, country))
|
||||
|
|
Loading…
Reference in New Issue