feat(cli): introduce backstage-cli plugin:export

This commit is contained in:
Bilawal Hameed
2020-07-08 15:46:46 +02:00
parent 8688a33f14
commit 904941125e
2 changed files with 36 additions and 0 deletions
@@ -0,0 +1,30 @@
/*
* Copyright 2020 Spotify AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Command } from 'commander';
import { loadConfig } from '@backstage/config-loader';
import { ConfigReader } from '@backstage/config';
import { buildBundle } from '../../lib/bundler';
export default async (cmd: Command) => {
const appConfigs = await loadConfig();
await buildBundle({
entry: 'dev/index',
statsJsonEnabled: cmd.stats,
config: ConfigReader.fromConfigs(appConfigs),
appConfigs,
});
};
+6
View File
@@ -103,6 +103,12 @@ const main = (argv: string[]) => {
.option('--check', 'Enable type checking and linting')
.action(lazyAction(() => import('./commands/plugin/serve'), 'default'));
program
.command('plugin:export')
.description('Exports the dev/ folder of a plugin')
.option('--stats', 'Write bundle stats to output directory')
.action(lazyAction(() => import('./commands/plugin/export'), 'default'));
program
.command('plugin:diff')
.option('--check', 'Fail if changes are required')