Skip to content

Commit 5e17ee4

Browse files
authored
Fix build failures in CI for yarn run build:packages (#21)
User-Facing Changes Resolved an issue where the yarn run build:packages command was failing during CI executions. Description This pull request addresses three primary issues that were causing the build command to fail: The layoutStorage was being initialized within both studio-desktop and studio-base packages. This has been corrected to ensure layoutStorage is only used within studio-base package. Properties shiftKey and metaKey where not recognised in this package version. These can be further investigated if the storybook is reactivate. Change the yarn run build:packages command to get only the tsconfig.ts files in the root of packages or inside the src folder.
1 parent 058bd68 commit 5e17ee4

File tree

9 files changed

+21
-32
lines changed

9 files changed

+21
-32
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"scripts": {
2323
"clean": "tsc --build --clean packages/**/tsconfig.json && rimraf .webpack */.webpack dist storybook-screenshots storybook-static",
24-
"build:packages": "tsc --build --verbose packages/**/tsconfig.json",
24+
"build:packages": "tsc --build --verbose packages/*/tsconfig.json packages/*/src/*/tsconfig.json",
2525
"desktop:build:dev": "webpack --mode development --progress --config desktop/webpack.config.ts",
2626
"desktop:build:prod": "webpack --mode production --progress --config desktop/webpack.config.ts",
2727
"desktop:serve": "webpack serve --mode development --progress --config desktop/webpack.config.ts",

packages/studio-base/src/App.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
// License, v2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at http://mozilla.org/MPL/2.0/
44

5-
import { Fragment, Suspense, useEffect } from "react";
5+
import { Fragment, Suspense, useEffect, useMemo } from "react";
66
import { DndProvider } from "react-dnd";
77
import { HTML5Backend } from "react-dnd-html5-backend";
88

9+
import { IdbLayoutStorage } from "@foxglove/studio-base/IdbLayoutStorage";
910
import GlobalCss from "@foxglove/studio-base/components/GlobalCss";
1011
import LayoutStorageContext from "@foxglove/studio-base/context/LayoutStorageContext";
1112
import EventsProvider from "@foxglove/studio-base/providers/EventsProvider";
@@ -14,7 +15,6 @@ import ProblemsContextProvider from "@foxglove/studio-base/providers/ProblemsCon
1415
import { StudioLogsSettingsProvider } from "@foxglove/studio-base/providers/StudioLogsSettingsProvider";
1516
import TimelineInteractionStateProvider from "@foxglove/studio-base/providers/TimelineInteractionStateProvider";
1617
import UserProfileLocalStorageProvider from "@foxglove/studio-base/providers/UserProfileLocalStorageProvider";
17-
import { ILayoutStorage } from "@foxglove/studio-base/services/ILayoutStorage";
1818

1919
import Workspace from "./Workspace";
2020
import { CustomWindowControlsProps } from "./components/AppBar/CustomWindowControls";
@@ -50,7 +50,6 @@ type AppProps = CustomWindowControlsProps & {
5050
appBarLeftInset?: number;
5151
extraProviders?: JSX.Element[];
5252
onAppBarDoubleClick?: () => void;
53-
layoutStorage?: ILayoutStorage;
5453
};
5554

5655
// Suppress context menu for the entire app except on inputs & textareas.
@@ -74,7 +73,6 @@ export function App(props: AppProps): JSX.Element {
7473
enableLaunchPreferenceScreen,
7574
enableGlobalCss = false,
7675
extraProviders,
77-
layoutStorage,
7876
} = props;
7977

8078
const providers = [
@@ -109,6 +107,8 @@ export function App(props: AppProps): JSX.Element {
109107
providers.unshift(<CurrentLayoutProvider />);
110108
providers.unshift(<UserProfileLocalStorageProvider />);
111109
providers.unshift(<LayoutManagerProvider />);
110+
111+
const layoutStorage = useMemo(() => new IdbLayoutStorage(), []);
112112
providers.unshift(<LayoutStorageContext.Provider value={layoutStorage} />);
113113

114114
const MaybeLaunchPreference = enableLaunchPreferenceScreen === true ? LaunchPreference : Fragment;

packages/studio-base/src/SharedRoot.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// License, v2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at http://mozilla.org/MPL/2.0/
44

5-
import { useMemo } from "react";
6-
7-
import { IdbLayoutStorage } from "@foxglove/studio-base/IdbLayoutStorage";
85
import GlobalCss from "@foxglove/studio-base/components/GlobalCss";
96
import {
107
ISharedRootContext,
@@ -32,8 +29,6 @@ export function SharedRoot(props: ISharedRootContext & { children: JSX.Element }
3229
extraProviders,
3330
} = props;
3431

35-
const layoutStorage = useMemo(() => new IdbLayoutStorage(), []);
36-
3732
return (
3833
<AppConfigurationContext.Provider value={appConfiguration}>
3934
<ColorSchemeThemeProvider>
@@ -52,7 +47,6 @@ export function SharedRoot(props: ISharedRootContext & { children: JSX.Element }
5247
extensionLoaders,
5348
extraProviders,
5449
onAppBarDoubleClick,
55-
layoutStorage,
5650
}}
5751
>
5852
{children}

packages/studio-base/src/StudioApp.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
// License, v2.0. If a copy of the MPL was not distributed with this
33
// file, You can obtain one at http://mozilla.org/MPL/2.0/
44

5-
import { Fragment, Suspense, useEffect } from "react";
5+
import { Fragment, Suspense, useEffect, useMemo } from "react";
66
import { DndProvider } from "react-dnd";
77
import { HTML5Backend } from "react-dnd-html5-backend";
88

9+
import { IdbLayoutStorage } from "@foxglove/studio-base/IdbLayoutStorage";
910
import LayoutStorageContext from "@foxglove/studio-base/context/LayoutStorageContext";
1011
import NativeAppMenuContext from "@foxglove/studio-base/context/NativeAppMenuContext";
1112
import NativeWindowContext from "@foxglove/studio-base/context/NativeWindowContext";
@@ -53,7 +54,6 @@ export function StudioApp(): JSX.Element {
5354
customWindowControlProps,
5455
onAppBarDoubleClick,
5556
AppBarComponent,
56-
layoutStorage,
5757
} = useSharedRootContext();
5858

5959
const providers = [
@@ -88,6 +88,9 @@ export function StudioApp(): JSX.Element {
8888
providers.unshift(<CurrentLayoutProvider />);
8989
providers.unshift(<UserProfileLocalStorageProvider />);
9090
providers.unshift(<LayoutManagerProvider />);
91+
92+
const layoutStorage = useMemo(() => new IdbLayoutStorage(), []);
93+
9194
providers.unshift(<LayoutStorageContext.Provider value={layoutStorage} />);
9295
const MaybeLaunchPreference = enableLaunchPreferenceScreen === true ? LaunchPreference : Fragment;
9396

packages/studio-base/src/components/LayoutBrowser/index.stories.tsx

+4-8
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,11 @@ export const MultiSelect: StoryObj = {
188188

189189
play: async ({ canvasElement }) => {
190190
const layouts = await within(canvasElement).findAllByTestId("layout-list-item");
191-
192191
await userEvent.click(layouts[0]!);
193-
194-
await userEvent.click(layouts[1]!, { metaKey: true });
195-
await userEvent.click(layouts[3]!, { metaKey: true });
196-
197-
await userEvent.click(layouts[6]!, { shiftKey: true });
198-
199-
await userEvent.click(layouts[4]!, { metaKey: true });
192+
await userEvent.click(layouts[1]!);
193+
await userEvent.click(layouts[3]!);
194+
await userEvent.click(layouts[6]!);
195+
await userEvent.click(layouts[4]!);
200196
},
201197
};
202198

packages/studio-base/src/context/SharedRootContext.ts

-2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ import { INativeAppMenu } from "@foxglove/studio-base/context/NativeAppMenuConte
1111
import { INativeWindow } from "@foxglove/studio-base/context/NativeWindowContext";
1212
import { IDataSourceFactory } from "@foxglove/studio-base/context/PlayerSelectionContext";
1313
import { ExtensionLoader } from "@foxglove/studio-base/services/ExtensionLoader";
14-
import { ILayoutStorage } from "@foxglove/studio-base/services/ILayoutStorage";
1514

1615
interface ISharedRootContext {
1716
deepLinks: readonly string[];
1817
appConfiguration?: IAppConfiguration;
1918
dataSources: IDataSourceFactory[];
20-
layoutStorage?: ILayoutStorage;
2119
extensionLoaders: readonly ExtensionLoader[];
2220
nativeAppMenu?: INativeAppMenu;
2321
nativeWindow?: INativeWindow;

packages/studio-base/src/providers/CurrentLayoutProvider/MockCurrentLayoutProvider.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ export default function MockCurrentLayoutProvider({
6666
const setCurrentLayout = useCallback(
6767
(newLayout: SelectedLayout | undefined) => {
6868
setLayoutState({
69-
selectedLayout: newLayout,
69+
selectedLayout: {
70+
data: newLayout?.data,
71+
id: "mock-id" as LayoutID,
72+
edited: newLayout?.edited,
73+
name: newLayout?.name,
74+
},
7075
});
7176
},
7277
[setLayoutState],
@@ -89,6 +94,7 @@ export default function MockCurrentLayoutProvider({
8994
...layoutStateRef.current,
9095
selectedLayout: {
9196
...layoutStateRef.current.selectedLayout,
97+
id: layoutStateRef.current.selectedLayout?.id ?? ("mock-id" as LayoutID),
9298
data: layoutStateRef.current.selectedLayout?.data
9399
? panelsReducer(layoutStateRef.current.selectedLayout.data, action)
94100
: undefined,

packages/studio-desktop/src/renderer/Root.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import {
2222
UlogLocalDataSourceFactory,
2323
VelodyneDataSourceFactory,
2424
} from "@foxglove/studio-base";
25-
import { IdbLayoutStorage } from "@foxglove/studio-base/IdbLayoutStorage";
2625

2726
import { DesktopExtensionLoader } from "./services/DesktopExtensionLoader";
2827
import { NativeAppMenu } from "./services/NativeAppMenu";
@@ -141,8 +140,6 @@ export default function Root(props: {
141140
};
142141
}, []);
143142

144-
const layoutStorage = useMemo(() => new IdbLayoutStorage(), []);
145-
146143
return (
147144
<>
148145
<App
@@ -164,7 +161,6 @@ export default function Root(props: {
164161
onUnmaximizeWindow={onUnmaximizeWindow}
165162
onCloseWindow={onCloseWindow}
166163
extraProviders={props.extraProviders}
167-
layoutStorage={layoutStorage}
168164
/>
169165
</>
170166
);

packages/studio-web/src/WebRoot.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ import {
1919
SharedRoot,
2020
UlogLocalDataSourceFactory,
2121
} from "@foxglove/studio-base";
22-
import { IdbLayoutStorage } from "@foxglove/studio-base/IdbLayoutStorage";
23-
import { ILayoutStorage } from "@foxglove/studio-base/services/ILayoutStorage";
2422

2523
import LocalStorageAppConfiguration from "./services/LocalStorageAppConfiguration";
2624

@@ -42,7 +40,6 @@ export function WebRoot(props: {
4240
[],
4341
);
4442

45-
const layoutStorage = useMemo(() => new IdbLayoutStorage(), []) as unknown as ILayoutStorage;
4643
const [extensionLoaders] = useState(() => [
4744
new IdbExtensionLoader("org"),
4845
new IdbExtensionLoader("local"),
@@ -65,7 +62,6 @@ export function WebRoot(props: {
6562

6663
return (
6764
<SharedRoot
68-
layoutStorage={layoutStorage}
6965
enableLaunchPreferenceScreen
7066
deepLinks={[window.location.href]}
7167
dataSources={dataSources}

0 commit comments

Comments
 (0)