mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
update demo
This commit is contained in:
1 parent
5959eb4669
commit
8ff35b5f6f
9 files changed
+375
-57
No files matched your search
+16
-6
@@ -1,16 +1,26 @@
|
||||
import fs from 'fs';
|
||||
import cpy from 'cpy';
|
||||
import path from 'path';
|
||||
import { glob } from 'glob';
|
||||
|
||||
const reg = /^import.*;$/gim;
|
||||
const types = glob.sync('packages/artplayer/types/*');
|
||||
const output = path.join('docs/assets/ts/artplayer.d.ts');
|
||||
const artplayerTS = glob.sync('packages/artplayer/types/*.d.ts');
|
||||
const artplayerTSoutput = path.join('docs/assets/ts/artplayer.d.ts');
|
||||
|
||||
let code = '';
|
||||
for (let index = 0; index < types.length; index++) {
|
||||
const type = types[index];
|
||||
for (let index = 0; index < artplayerTS.length; index++) {
|
||||
const type = artplayerTS[index];
|
||||
code += String(fs.readFileSync(type)).replace(reg, '') + '\n';
|
||||
}
|
||||
|
||||
fs.writeFileSync(output, code.trim());
|
||||
console.log(`✨ Built artplayer.d.ts`);
|
||||
fs.writeFileSync(artplayerTSoutput, code.trim());
|
||||
console.log(`✨ Built ${artplayerTSoutput}`);
|
||||
|
||||
(async function () {
|
||||
const pluginsTS = glob.sync('packages/artplayer-plugin-*/types/*.d.ts');
|
||||
for (let index = 0; index < pluginsTS.length; index++) {
|
||||
const type = pluginsTS[index];
|
||||
await cpy(type, 'docs/assets/ts/', { flat: true });
|
||||
console.log(`✨ Copy ${type}`);
|
||||
}
|
||||
})();
|
||||
Reference in new issue
Block a user