mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-17 10:01:20 -08:00
Vast (#762)
* add artplayer-plugin-vast
* chore: Add create:plugin script to package.json
* chore: Remove deprecated artplayer-plugin-{{name}} and artplayer-plugin-vast types
* chore: Update artplayer-plugin-vast package description
* chore: Update Prettier configuration and dependencies
This commit is contained in:
1 parent
b398749ef8
commit
fac7d15726
24 files changed
+703
-296
No files matched your search
+64
-50
@@ -12,74 +12,88 @@ const projects = getProjects();
|
||||
async function develop(name) {
|
||||
let isOpenBrowser = false;
|
||||
const uncompiledPath = path.resolve(`docs/uncompiled/${name}`);
|
||||
const { version } = JSON.parse(fs.readFileSync(`${projects[name]}/package.json`, 'utf-8'));
|
||||
|
||||
const { url } = await servor({
|
||||
const projectPackageJson = path.join(projects[name], 'package.json');
|
||||
const { version } = JSON.parse(fs.readFileSync(projectPackageJson, 'utf-8'));
|
||||
|
||||
const serverConfig = {
|
||||
root: 'docs',
|
||||
fallback: 'index.html',
|
||||
reload: true,
|
||||
port: 8082,
|
||||
});
|
||||
};
|
||||
|
||||
process.chdir(projects[name]);
|
||||
try {
|
||||
const { url } = await servor(serverConfig);
|
||||
process.chdir(projects[name]);
|
||||
|
||||
const bundler = new Parcel({
|
||||
entries: `${projects[name]}/src/index.js`,
|
||||
defaultConfig: '@parcel/config-default',
|
||||
mode: 'development',
|
||||
targets: {
|
||||
main: {
|
||||
distDir: uncompiledPath,
|
||||
outputFormat: 'global',
|
||||
engines: {
|
||||
browsers: ['last 1 Chrome version'],
|
||||
const bundlerConfig = {
|
||||
entries: `${projects[name]}/src/index.js`,
|
||||
defaultConfig: '@parcel/config-default',
|
||||
mode: 'development',
|
||||
targets: {
|
||||
main: {
|
||||
distDir: uncompiledPath,
|
||||
outputFormat: 'global',
|
||||
engines: {
|
||||
browsers: ['last 1 Chrome version'],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
env: {
|
||||
NODE_ENV: 'development',
|
||||
APP_VER: version,
|
||||
BUILD_DATE: formatDate(Date.now()),
|
||||
},
|
||||
additionalReporters: [
|
||||
{
|
||||
packageName: '@parcel/reporter-cli',
|
||||
resolveFrom: fileURLToPath(import.meta.url),
|
||||
env: {
|
||||
NODE_ENV: 'development',
|
||||
APP_VER: version,
|
||||
BUILD_DATE: formatDate(Date.now()),
|
||||
},
|
||||
],
|
||||
});
|
||||
additionalReporters: [
|
||||
{
|
||||
packageName: '@parcel/reporter-cli',
|
||||
resolveFrom: fileURLToPath(import.meta.url),
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
bundler.watch(async (error, event) => {
|
||||
if (error) throw error;
|
||||
if (event.type === 'buildSuccess') {
|
||||
const bundles = event.bundleGraph.getBundles();
|
||||
console.log(`[${name}]`, `✨ Built ${bundles.length} bundles in ${event.buildTime}ms!`);
|
||||
if (!isOpenBrowser) {
|
||||
isOpenBrowser = true;
|
||||
openBrowser(url);
|
||||
const bundler = new Parcel(bundlerConfig);
|
||||
|
||||
bundler.watch((error, event) => {
|
||||
if (error) {
|
||||
console.error(`Build error: ${error}`);
|
||||
return;
|
||||
}
|
||||
} else if (event.type === 'buildFailure') {
|
||||
console.log(`[${name}]`, event.diagnostics);
|
||||
}
|
||||
});
|
||||
if (event.type === 'buildSuccess') {
|
||||
const bundles = event.bundleGraph.getBundles();
|
||||
console.log(`[${name}] ✨ Built ${bundles.length} bundles in ${event.buildTime}ms!`);
|
||||
if (!isOpenBrowser) {
|
||||
isOpenBrowser = true;
|
||||
openBrowser(url);
|
||||
}
|
||||
} else if (event.type === 'buildFailure') {
|
||||
console.error(`[${name}] Build failure:`, event.diagnostics);
|
||||
}
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`Failed to start development server for ${name}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
(async () => {
|
||||
const response = await prompts({
|
||||
type: 'select',
|
||||
name: 'value',
|
||||
message: 'Which project do you want to develop?',
|
||||
choices: Object.keys(projects).map((name) => {
|
||||
return {
|
||||
try {
|
||||
const response = await prompts({
|
||||
type: 'select',
|
||||
name: 'value',
|
||||
message: 'Which project do you want to develop?',
|
||||
choices: Object.keys(projects).map((name) => ({
|
||||
title: name,
|
||||
value: name,
|
||||
description: projects[name],
|
||||
};
|
||||
}),
|
||||
initial: 0,
|
||||
});
|
||||
})),
|
||||
initial: 0,
|
||||
});
|
||||
|
||||
if (response.value) {
|
||||
develop(response.value);
|
||||
if (response.value) {
|
||||
develop(response.value);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(`Prompt error: ${error.message}`);
|
||||
}
|
||||
})();
|
||||
Reference in new issue
Block a user