mirror of
https://github.com/zoriya/v10.git
synced 2026-08-16 02:45:09 +00:00
feat(packages): add poster component to video skins (#994)
This commit is contained in:
@@ -1,27 +1,12 @@
|
||||
import { copyFileSync, existsSync, mkdirSync, readdirSync, statSync } from 'node:fs';
|
||||
import { resolve } from 'node:path';
|
||||
import { mirrorTemplatesToSrc, removeGeneratedSrcFiles } from './shared.js';
|
||||
|
||||
const root = resolve(import.meta.dirname, '..');
|
||||
const templatesDir = resolve(root, 'templates');
|
||||
const srcDir = resolve(root, 'src');
|
||||
const created = await mirrorTemplatesToSrc();
|
||||
const removed = await removeGeneratedSrcFiles();
|
||||
|
||||
/** Recursively copy template files into `src/`, preserving relative paths. */
|
||||
function mirror(dir: string) {
|
||||
for (const entry of readdirSync(dir)) {
|
||||
const templatePath = resolve(dir, entry);
|
||||
const targetPath = resolve(srcDir, templatePath.slice(templatesDir.length + 1));
|
||||
|
||||
if (statSync(templatePath).isDirectory()) {
|
||||
mkdirSync(targetPath, { recursive: true });
|
||||
mirror(templatePath);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!existsSync(targetPath)) {
|
||||
copyFileSync(templatePath, targetPath);
|
||||
console.log(`Created ${targetPath.slice(root.length + 1)}`);
|
||||
}
|
||||
}
|
||||
for (const file of created) {
|
||||
console.log(`Created ${file}`);
|
||||
}
|
||||
|
||||
mirror(templatesDir);
|
||||
for (const file of removed) {
|
||||
console.log(`Removed generated ${file}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user