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:
Harvey Zack committed 2025-08-03 18:34:30 +08:00
1 parent 3540cd0cce
commit fa755b5f61
11 files changed
+509 -496

No files matched your search

+37 -36
View File
@@ -1,45 +1,46 @@
import fs from 'fs';
import path from 'path';
import { glob } from 'glob';
import { Parcel } from '@parcel/core';
import fs from 'node:fs'
import path from 'node:path'
import { Parcel } from '@parcel/core'
import { glob } from 'glob'
const basePath = 'packages/artplayer';
const basePath = 'packages/artplayer'
const entries = glob.sync(path.join(basePath, 'src/i18n/*.js'), {
ignore: [path.join(basePath, 'src/i18n/index.js'), path.join(basePath, 'src/i18n/zh-cn.js')],
});
ignore: [path.join(basePath, 'src/i18n/index.js'), path.join(basePath, 'src/i18n/zh-cn.js')],
})
const packagePath = path.join(basePath, 'package.json');
const packagePath = path.join(basePath, 'package.json')
const backupPackagePath = path.join(basePath, 'package_backup.json');
(async function build() {
fs.renameSync(packagePath, backupPackagePath);
fs.renameSync(packagePath, backupPackagePath)
const bundler = new Parcel({
entries: entries,
defaultConfig: '@parcel/config-default',
mode: 'production',
defaultTargetOptions: {
distDir: 'packages/artplayer/dist/i18n',
outputFormat: 'global',
sourceMaps: false,
isLibrary: true,
engines: {
browsers: ['last 1 Chrome version'],
},
},
env: {
NODE_ENV: 'production',
},
});
const bundler = new Parcel({
entries,
defaultConfig: '@parcel/config-default',
mode: 'production',
defaultTargetOptions: {
distDir: 'packages/artplayer/dist/i18n',
outputFormat: 'global',
sourceMaps: false,
isLibrary: true,
engines: {
browsers: ['last 1 Chrome version'],
},
},
env: {
NODE_ENV: 'production',
},
})
try {
const { bundleGraph, buildTime } = await bundler.run();
const bundles = bundleGraph.getBundles();
console.log(`✨ Built [i18n] ${bundles.length} bundles in ${buildTime}ms`);
fs.renameSync(backupPackagePath, packagePath);
} catch (err) {
console.log(err.diagnostics);
fs.renameSync(backupPackagePath, packagePath);
}
})();
try {
const { bundleGraph, buildTime } = await bundler.run()
const bundles = bundleGraph.getBundles()
console.log(`✨ Built [i18n] ${bundles.length} bundles in ${buildTime}ms`)
fs.renameSync(backupPackagePath, packagePath)
}
catch (err) {
console.log(err.diagnostics)
fs.renameSync(backupPackagePath, packagePath)
}
})()