From 904941125e4318a08bbef738368a3c181472f5fd Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Wed, 8 Jul 2020 15:46:46 +0200 Subject: [PATCH 1/3] feat(cli): introduce backstage-cli plugin:export --- packages/cli/src/commands/plugin/export.ts | 30 ++++++++++++++++++++++ packages/cli/src/index.ts | 6 +++++ 2 files changed, 36 insertions(+) create mode 100644 packages/cli/src/commands/plugin/export.ts diff --git a/packages/cli/src/commands/plugin/export.ts b/packages/cli/src/commands/plugin/export.ts new file mode 100644 index 0000000000..b6db0d8ddd --- /dev/null +++ b/packages/cli/src/commands/plugin/export.ts @@ -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, + }); +}; diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 9a102ab7d3..7521549d96 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -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') From 617d1b94465a6e152e9e190a12967b919198e4e7 Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Wed, 8 Jul 2020 16:22:33 +0200 Subject: [PATCH 2/3] fix: re-ran yarn install --- yarn.lock | 7 ------- 1 file changed, 7 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8f5d9e8cec..0641f5ed77 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3960,13 +3960,6 @@ "@types/node" "*" rollup "^0.63.4" -"@types/sanitize-html@^1.23.3": - version "1.23.3" - resolved "https://registry.npmjs.org/@types/sanitize-html/-/sanitize-html-1.23.3.tgz#26527783aba3bf195ad8a3c3e51bd3713526fc0d" - integrity sha512-Isg8N0ifKdDq6/kaNlIcWfapDXxxquMSk2XC5THsOICRyOIhQGds95XH75/PL/g9mExi4bL8otIqJM/Wo96WxA== - dependencies: - htmlparser2 "^4.1.0" - "@types/serve-static@*": version "1.13.3" resolved "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.3.tgz#eb7e1c41c4468272557e897e9171ded5e2ded9d1" From c639909e78827eef6d1df10e9b5aa31a2eb15cee Mon Sep 17 00:00:00 2001 From: Bilawal Hameed Date: Wed, 8 Jul 2020 16:39:46 +0200 Subject: [PATCH 3/3] fix: add yarn export to techdocs plugin --- plugins/techdocs/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/techdocs/package.json b/plugins/techdocs/package.json index d8ee613407..98fbac1492 100644 --- a/plugins/techdocs/package.json +++ b/plugins/techdocs/package.json @@ -12,6 +12,7 @@ }, "scripts": { "build": "backstage-cli plugin:build", + "export": "backstage-cli plugin:export", "start": "backstage-cli plugin:serve", "lint": "backstage-cli lint", "test": "backstage-cli test",