From 66a39273adcef4069da468c25ec1b7026943c07e Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 16 Apr 2020 10:33:55 +0200 Subject: [PATCH 1/2] packages/cli: added --build flag to watch-deps command --- packages/cli/src/commands/watch-deps/index.ts | 11 +++++++++-- packages/cli/src/index.ts | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/commands/watch-deps/index.ts b/packages/cli/src/commands/watch-deps/index.ts index 11093d7387..68d2417e36 100644 --- a/packages/cli/src/commands/watch-deps/index.ts +++ b/packages/cli/src/commands/watch-deps/index.ts @@ -23,6 +23,7 @@ import { startCompiler } from './compiler'; import { startChild } from './child'; import { waitForExit, run } from 'helpers/run'; import { paths } from 'helpers/paths'; +import { Command } from 'commander'; const PACKAGE_BLACKLIST = [ // We never want to watch for changes in the cli, but all packages will depend on it. @@ -88,8 +89,14 @@ export async function watchDeps(options: Options = {}) { * and instead start up watch mode for that package. Starting watch mode means running the first * available yarn script out of "build:watch", "watch", or "build" --watch. */ -export default async (_command: any, args: string[]) => { - await watchDeps(); +export default async (cmd: Command, args: string[]) => { + const options: Options = {}; + + if (cmd.build) { + options.build = true; + } + + await watchDeps(options); if (args?.length) { await waitForExit(startChild(args)); diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index ca39c1ac3b..1a05b31135 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -70,6 +70,7 @@ const main = (argv: string[]) => { program .command('watch-deps') + .option('--build', 'Build all dependencies on startup') .description('Watch all dependencies while running another command') .action(actionHandler(() => require('commands/watch-deps'))); From 4f9789f23a024cf8e516f939b86f1a92b0652085 Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Thu, 16 Apr 2020 10:35:13 +0200 Subject: [PATCH 2/2] packages/storybook: depend on dist version of local packages and make sure they are built --- packages/storybook/.storybook/main.js | 2 +- packages/storybook/package.json | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/storybook/.storybook/main.js b/packages/storybook/.storybook/main.js index f086fa0d4a..530cd161ec 100644 --- a/packages/storybook/.storybook/main.js +++ b/packages/storybook/.storybook/main.js @@ -13,7 +13,7 @@ module.exports = { webpackFinal: async config => { config.resolve.alias = { ...config.resolve.alias, - '@backstage/theme': path.resolve(__dirname, '../../theme/src'), + '@backstage/theme': path.resolve(__dirname, '../../theme'), }; config.resolve.modules.push(path.resolve(__dirname, '../../core/src')); config.module.rules.push( diff --git a/packages/storybook/package.json b/packages/storybook/package.json index 8b54b2b8e1..857c915357 100644 --- a/packages/storybook/package.json +++ b/packages/storybook/package.json @@ -4,14 +4,17 @@ "description": "Storybook build for core package", "private": true, "scripts": { - "start": "start-storybook -p 6006", - "build-storybook": "build-storybook --output-dir dist" + "start": "backstage-cli watch-deps --build -- start-storybook -p 6006", + "build-storybook": "backstage-cli watch-deps --build -- build-storybook --output-dir dist" }, "workspaces": { "nohoist": [ "@storybook/**" ] }, + "dependencies": { + "@backstage/theme": "0.1.1-alpha.4" + }, "devDependencies": { "@storybook/addon-actions": "^5.3.17", "@storybook/addon-links": "^5.3.17",