mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 19:06:15 -08:00
1 parent
45ec17798f
commit
2fc9d4d3e9
144 files changed
+732
-1472
No files matched your search
+14
-5
@@ -1,27 +1,34 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { glob } from 'glob';
|
||||
import { Parcel } from '@parcel/core';
|
||||
|
||||
const basePath = 'packages/artplayer/src/i18n';
|
||||
const basePath = 'packages/artplayer';
|
||||
|
||||
const entries = glob.sync(
|
||||
path.join(basePath, '*.js'),
|
||||
path.join(basePath, 'src/i18n/*.js'),
|
||||
{
|
||||
ignore: [
|
||||
path.join(basePath, 'index.js'),
|
||||
path.join(basePath, 'zh-cn.js'),
|
||||
path.join(basePath, 'src/i18n/index.js'),
|
||||
path.join(basePath, 'src/i18n/zh-cn.js'),
|
||||
]
|
||||
}
|
||||
);
|
||||
|
||||
const packagePath = path.join(basePath, 'package.json');
|
||||
const backupPackagePath = path.join(basePath, 'package_backup.json');
|
||||
|
||||
(async function build() {
|
||||
fs.renameSync(packagePath, backupPackagePath);
|
||||
|
||||
const bundler = new Parcel({
|
||||
entries: entries,
|
||||
defaultConfig: '@parcel/config-default',
|
||||
mode: 'production',
|
||||
defaultTargetOptions: {
|
||||
distDir: 'packages/artplayer/dist/i18n',
|
||||
sourceMaps: false,
|
||||
outputFormat: 'global',
|
||||
sourceMaps: false,
|
||||
isLibrary: true,
|
||||
engines: {
|
||||
browsers: ['last 1 Chrome version'],
|
||||
@@ -36,7 +43,9 @@ const entries = glob.sync(
|
||||
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);
|
||||
}
|
||||
})();
|
||||
@@ -14,6 +14,7 @@ async function build(name, targetName) {
|
||||
|
||||
const targets = {
|
||||
main: {
|
||||
context: "browser",
|
||||
distDir: `${projects[name]}/dist`,
|
||||
sourceMap: false,
|
||||
outputFormat: 'global',
|
||||
@@ -22,6 +23,7 @@ async function build(name, targetName) {
|
||||
},
|
||||
},
|
||||
legacy: {
|
||||
context: "browser",
|
||||
distDir: `${projects[name]}/dist`,
|
||||
sourceMap: false,
|
||||
outputFormat: 'global',
|
||||
|
||||
Reference in new issue
Block a user