mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
refactor: update import statements to use node built-in modules
chore: update lerna configuration formatting chore: bump version in package.json to 6.0.0 fix: modify build scripts for improved readability and consistency feat: enhance translation scripts with better error handling and progress tracking chore: improve plugin creation script for better user experience style: format svgo configuration for consistency
This commit is contained in:
1 parent
3540cd0cce
commit
fa755b5f61
11 files changed
+509
-496
No files matched your search
+26
-24
@@ -1,30 +1,32 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { glob } from 'glob';
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import process from 'node:process'
|
||||
import { glob } from 'glob'
|
||||
|
||||
export function getProjects() {
|
||||
return glob
|
||||
.sync('packages/*')
|
||||
.sort()
|
||||
.filter((item) => !item.endsWith('artplayer-template') && !item.endsWith('artplayer-vitepress'))
|
||||
.reduce((result, item) => {
|
||||
const name = item.split(/\/|\\/g).pop();
|
||||
result[name] = path.resolve(process.cwd(), item);
|
||||
return result;
|
||||
}, {});
|
||||
return glob
|
||||
.sync('packages/*')
|
||||
.sort()
|
||||
.filter(item => !item.endsWith('artplayer-template') && !item.endsWith('artplayer-vitepress'))
|
||||
.reduce((result, item) => {
|
||||
const name = item.split(/\/|\\/g).pop()
|
||||
result[name] = path.resolve(process.cwd(), item)
|
||||
return result
|
||||
}, {})
|
||||
}
|
||||
|
||||
export function removeDir(dir) {
|
||||
if (fs.existsSync(dir)) {
|
||||
const files = fs.readdirSync(dir);
|
||||
files.forEach((file) => {
|
||||
const curPath = path.join(dir, file);
|
||||
if (fs.statSync(curPath).isDirectory()) {
|
||||
removeDir(curPath);
|
||||
} else {
|
||||
fs.unlinkSync(curPath);
|
||||
}
|
||||
});
|
||||
fs.rmdirSync(dir);
|
||||
}
|
||||
if (fs.existsSync(dir)) {
|
||||
const files = fs.readdirSync(dir)
|
||||
files.forEach((file) => {
|
||||
const curPath = path.join(dir, file)
|
||||
if (fs.statSync(curPath).isDirectory()) {
|
||||
removeDir(curPath)
|
||||
}
|
||||
else {
|
||||
fs.unlinkSync(curPath)
|
||||
}
|
||||
})
|
||||
fs.rmdirSync(dir)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user