Plugins: add a bundle plugins folder (#20850)
This commit is contained in:
@@ -18,6 +18,7 @@ import { githubPublishTask } from './tasks/plugin.utils';
|
||||
import { ciBuildPluginTask, ciBuildPluginDocsTask, ciPackagePluginTask, ciPluginReportTask } from './tasks/plugin.ci';
|
||||
import { buildPackageTask } from './tasks/package.build';
|
||||
import { pluginCreateTask } from './tasks/plugin.create';
|
||||
import { bundleManagedTask } from './tasks/plugin/bundle.managed';
|
||||
|
||||
export const run = (includeInternalScripts = false) => {
|
||||
if (includeInternalScripts) {
|
||||
@@ -195,6 +196,13 @@ export const run = (includeInternalScripts = false) => {
|
||||
});
|
||||
});
|
||||
|
||||
program
|
||||
.command('plugin:bundle-managed')
|
||||
.description('Builds managed plugins')
|
||||
.action(async cmd => {
|
||||
await execTask(bundleManagedTask)({});
|
||||
});
|
||||
|
||||
program
|
||||
.command('plugin:github-publish')
|
||||
.option('--dryrun', 'Do a dry run only', false)
|
||||
|
||||
@@ -13,6 +13,7 @@ describe('Manifest', () => {
|
||||
"manifest.ts",
|
||||
"nodeVersionChecker.ts",
|
||||
"package.build.ts",
|
||||
"plugin/bundle.managed.ts",
|
||||
"plugin/bundle.ts",
|
||||
"plugin/create.ts",
|
||||
"plugin/tests.ts",
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
import { Task, TaskRunner } from '../task';
|
||||
import { restoreCwd } from '../../utils/cwd';
|
||||
import execa = require('execa');
|
||||
const fs = require('fs');
|
||||
const util = require('util');
|
||||
|
||||
const readdirPromise = util.promisify(fs.readdir);
|
||||
|
||||
interface BundeManagedOptions {}
|
||||
|
||||
const MANAGED_PLUGINS_PATH = `${process.cwd()}/plugins-bundled`;
|
||||
const MANAGED_PLUGINS_SCOPES = ['internal', 'external'];
|
||||
|
||||
const bundleManagedPluginsRunner: TaskRunner<BundeManagedOptions> = async () => {
|
||||
await Promise.all(
|
||||
MANAGED_PLUGINS_SCOPES.map(async scope => {
|
||||
try {
|
||||
const plugins = await readdirPromise(`${MANAGED_PLUGINS_PATH}/${scope}`);
|
||||
if (plugins.length > 0) {
|
||||
for (const plugin of plugins) {
|
||||
process.chdir(`${MANAGED_PLUGINS_PATH}/${scope}/${plugin}`);
|
||||
try {
|
||||
await execa('yarn', ['dev']);
|
||||
console.log(`[${scope}]: ${plugin} bundled`);
|
||||
} catch (e) {
|
||||
console.log(e.stdout);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
})
|
||||
);
|
||||
restoreCwd();
|
||||
};
|
||||
|
||||
export const bundleManagedTask = new Task<BundeManagedOptions>('Bundle managed plugins', bundleManagedPluginsRunner);
|
||||
Reference in New Issue
Block a user