mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 10:01:20 -08:00
test(ci): [CI-01] checkpoint verified Ads installed browser coverage
This commit is contained in:
1 parent
18215b97c0
commit
a03e5acc50
18 files changed
+2939
-25
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import process from 'node:process'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { hash } from '../../refactor/scripts/releases.mjs'
|
||||
import { verifyInstalledArtifacts } from '../../scripts/installed-artifacts.mjs'
|
||||
import { compilePackage } from './load.js'
|
||||
|
||||
const root = fileURLToPath(new URL('../../', import.meta.url))
|
||||
|
||||
export async function browserCandidate(name, artifact) {
|
||||
const map = process.env.ARTPLAYER_BROWSER_ARTIFACTS
|
||||
if (map) {
|
||||
assert(!artifact, `Installed browser checks cannot override ${name} artifact`)
|
||||
const { inputs } = verifyInstalledArtifacts(root, map, ['artplayer', 'artplayer-plugin-chapter', name])
|
||||
const input = inputs.find(input => input.name === name)
|
||||
const code = fs.readFileSync(input.file, 'utf8')
|
||||
return { code, provenance: { kind: 'installed', ...input } }
|
||||
}
|
||||
const code = artifact ? fs.readFileSync(artifact, 'utf8') : await compilePackage(name, 'umd')
|
||||
return { code, provenance: { kind: artifact ? 'explicit-artifact' : 'source-build', file: artifact || null, sha256: hash(code) } }
|
||||
}
|
||||
Reference in new issue
Block a user