mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
ci(workspace): [ENG-02] add read-only checks and isolated Pages workflow
This commit is contained in:
1 parent
9a6cfe5c6b
commit
833cc11674
16 files changed
+347
-61
No files matched your search
@@ -3,7 +3,13 @@ import spawn from 'cross-spawn'
|
||||
|
||||
const proc = spawn('npm', ['run', 'build'], {
|
||||
cwd: './packages/artplayer-vitepress/',
|
||||
stdio: 'inherit',
|
||||
})
|
||||
|
||||
proc.stdout.pipe(process.stdout)
|
||||
proc.stderr.pipe(process.stderr)
|
||||
proc.on('error', (error) => {
|
||||
console.error(error.message)
|
||||
process.exitCode = 1
|
||||
})
|
||||
proc.on('close', (code) => {
|
||||
process.exitCode = code ?? 1
|
||||
})
|
||||
@@ -1,5 +1,6 @@
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import { ESLint } from 'eslint'
|
||||
import { glob } from 'glob'
|
||||
|
||||
function ensureDirExists(filePath) {
|
||||
@@ -57,6 +58,13 @@ console.log(`✨ Built ${artplayerTSoutput}`);
|
||||
|
||||
pluginFiles.sort()
|
||||
const allFiles = [...pluginFiles, 'artplayer.d.ts']
|
||||
const eslint = new ESLint({ fix: true, fixTypes: ['layout'] })
|
||||
const results = await eslint.lintFiles(allFiles.map(file => path.join('docs/assets/ts', file)))
|
||||
await ESLint.outputFixes(results)
|
||||
if (results.some(result => result.errorCount)) {
|
||||
const formatter = await eslint.loadFormatter('stylish')
|
||||
throw new Error(formatter.format(results))
|
||||
}
|
||||
const commonJsPath = path.join('docs/assets/js/common.js')
|
||||
const commonJsContent = fs.readFileSync(commonJsPath, 'utf-8')
|
||||
const newLibUris = allFiles.map(file => `'./assets/ts/${file}'`).join(',\n ')
|
||||
|
||||
Reference in new issue
Block a user