packages/cli: pass config reader to bundler

This commit is contained in:
Patrik Oldsberg
2020-06-04 11:00:08 +02:00
parent c5425c5664
commit 8a0ccc1bcd
4 changed files with 22 additions and 10 deletions
+5 -2
View File
@@ -14,14 +14,17 @@
* limitations under the License.
*/
import { buildBundle } from '../../lib/bundler';
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: 'src/index',
statsJsonEnabled: cmd.stats,
appConfig: await loadConfig(),
config: ConfigReader.fromConfigs(appConfigs),
appConfigs,
});
};
+5 -2
View File
@@ -15,14 +15,17 @@
*/
import { Command } from 'commander';
import { serveBundle } from '../../lib/bundler';
import { loadConfig } from '@backstage/config-loader';
import { ConfigReader } from '@backstage/config';
import { serveBundle } from '../../lib/bundler';
export default async (cmd: Command) => {
const appConfigs = await loadConfig();
const waitForExit = await serveBundle({
entry: 'src/index',
checksEnabled: cmd.check,
appConfig: await loadConfig(),
config: ConfigReader.fromConfigs(appConfigs),
appConfigs,
});
await waitForExit();
+5 -2
View File
@@ -15,14 +15,17 @@
*/
import { Command } from 'commander';
import { serveBundle } from '../../lib/bundler';
import { loadConfig } from '@backstage/config-loader';
import { ConfigReader } from '@backstage/config';
import { serveBundle } from '../../lib/bundler';
export default async (cmd: Command) => {
const appConfigs = await loadConfig();
const waitForExit = await serveBundle({
entry: 'dev/index',
checksEnabled: cmd.check,
appConfig: await loadConfig(),
config: ConfigReader.fromConfigs(appConfigs),
appConfigs,
});
await waitForExit();
+7 -4
View File
@@ -14,21 +14,24 @@
* limitations under the License.
*/
import { AppConfig } from '@backstage/config';
import { AppConfig, Config } from '@backstage/config';
import { BundlingPathsOptions } from './paths';
export type BundlingOptions = {
checksEnabled: boolean;
isDev: boolean;
appConfig: AppConfig[];
config: Config;
appConfigs: AppConfig[];
};
export type ServeOptions = BundlingPathsOptions & {
checksEnabled: boolean;
appConfig: AppConfig[];
config: Config;
appConfigs: AppConfig[];
};
export type BuildOptions = BundlingPathsOptions & {
statsJsonEnabled: boolean;
appConfig: AppConfig[];
config: Config;
appConfigs: AppConfig[];
};