Skip to content

Commit

Permalink
fix production build of storybook for cl
Browse files Browse the repository at this point in the history
  • Loading branch information
shlokamin committed Feb 22, 2024
1 parent 0846fa0 commit 468e4c7
Show file tree
Hide file tree
Showing 22 changed files with 99 additions and 169 deletions.
11 changes: 4 additions & 7 deletions api-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
"description": "Opentrons robot API client for Node.js and the browser",
"version": "0.0.0-dev",
"license": "Apache-2.0",
"main": "dist/api-client.js",
"module": "dist/api-client.mjs",
"main": "src/index.ts",
"types": "lib/index.d.ts",
"source": "src/index.ts",
"browser": {
"./dist/api-client.js": "./dist/api-client.browser.js",
"./dist/api-client.mjs": "./dist/api-client.browser.mjs"
},
"dependencies": {
"@opentrons/shared-data": "link:../shared-data",
"axios": "^0.21.1"
"@types/lodash": "^4.14.191",
"axios": "^0.21.1",
"lodash": "4.17.21"
}
}
2 changes: 1 addition & 1 deletion app/src/atoms/buttons/FloatingActionButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { ICON_DATA_BY_NAME } from '@opentrons/components/src/icons/icon-data'
import { ICON_DATA_BY_NAME } from '@opentrons/components'
import { touchScreenViewport } from '../../DesignTokens/constants'
import { FloatingActionButton } from './'

Expand Down
2 changes: 1 addition & 1 deletion app/src/atoms/buttons/MediumButton.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { ICON_DATA_BY_NAME } from '@opentrons/components/src/icons/icon-data'
import { ICON_DATA_BY_NAME } from '@opentrons/components'
import { touchScreenViewport } from '../../DesignTokens/constants'
import { MediumButton } from './'
import type { Story, Meta } from '@storybook/react'
Expand Down
2 changes: 1 addition & 1 deletion app/src/molecules/Modal/ModalHeader.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { COLORS } from '@opentrons/components/src/ui-style-constants'
import { COLORS } from '@opentrons/components'
import { touchScreenViewport } from '../../DesignTokens/constants'
import { ModalHeader } from './ModalHeader'
import type { Story, Meta } from '@storybook/react'
Expand Down
2 changes: 1 addition & 1 deletion app/src/molecules/NavTab/NavTab.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { MemoryRouter } from 'react-router'
import { MemoryRouter } from 'react-router-dom'
import {
Flex,
ALIGN_START,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as React from 'react'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import fixture_96_plate from '@opentrons/shared-data/labware/fixtures/2/fixture_96_plate.json'
import { fixture96Plate } from '@opentrons/shared-data'
import { configReducer } from '../../redux/config/reducer'
import { mockRunData } from './__fixtures__'
import { InterventionModal as InterventionModalComponent } from './'
Expand Down Expand Up @@ -65,7 +65,7 @@ MoveLabwareIntervention.args = {
labware: [
{
id: 'fake_labware_id',
loadName: fixture_96_plate.parameters.loadName,
loadName: fixture96Plate.parameters.loadName,
definitionUri: 'fixture/fixture_96_plate/1',
location: {
slotName: '9',
Expand All @@ -80,13 +80,13 @@ MoveLabwareIntervention.args = {
params: {
displayName: 'fake display name',
labwareId: 'fake_labware_id',
loadName: fixture_96_plate.parameters.loadName,
loadName: fixture96Plate.parameters.loadName,
namespace: 'fixture',
version: 1,
location: { slotName: '9' },
},
result: {
definition: fixture_96_plate,
definition: fixture96Plate,
},
},
],
Expand Down
7 changes: 4 additions & 3 deletions app/src/organisms/InterventionModal/__fixtures__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import {
LabwareDefinition2,
ModuleDefinition,
SPAN7_8_10_11_SLOT,
THERMOCYCLER_MODULE_V1,
getModuleDef2,
} from '@opentrons/shared-data'
import thermocyclerModuleV1 from '@opentrons/shared-data/module/definitions/3/thermocyclerModuleV1.json'

import type { RunData } from '@opentrons/api-client'
import type {
Expand Down Expand Up @@ -204,7 +205,7 @@ export const mockModuleRenderInfoWithLabware = [
moduleId: 'mockTCModuleID',
x: 100,
y: 100,
moduleDef: (thermocyclerModuleV1 as unknown) as ModuleDefinition,
moduleDef: getModuleDef2(THERMOCYCLER_MODULE_V1),
nestedLabwareDef: mockLabwareDefinition,
nestedLabwareId: 'mockLabwareID',
},
Expand All @@ -215,7 +216,7 @@ export const mockModuleRenderInfoWithoutLabware = [
moduleId: 'mockTCModuleID',
x: 100,
y: 100,
moduleDef: (thermocyclerModuleV1 as unknown) as ModuleDefinition,
moduleDef: getModuleDef2(THERMOCYCLER_MODULE_V1),
nestedLabwareDef: null,
nestedLabwareId: null,
},
Expand Down
23 changes: 11 additions & 12 deletions app/src/organisms/LabwarePositionCheck/TerseOffsetTable.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import {
JUSTIFY_SPACE_BETWEEN,
SPACING,
} from '@opentrons/components'
import fixture_12_trough from '@opentrons/shared-data/labware/fixtures/2/fixture_12_trough.json'
import fixture_tiprack_10_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_10_ul.json'
import { fixture12Trough, fixtureTiprack10ul } from '@opentrons/shared-data'
import { LabwareDefinition2, getLabwareDefURI } from '@opentrons/shared-data'

import { touchScreenViewport } from '../../DesignTokens/constants'
Expand Down Expand Up @@ -55,50 +54,50 @@ export const Basic = Template.bind({})
Basic.args = {
offsets: [
{
definitionUri: getLabwareDefURI(fixture_12_trough as LabwareDefinition2),
definitionUri: getLabwareDefURI(fixture12Trough as LabwareDefinition2),
location: { slotName: 'A1' },
vector: { x: 1, y: 2, z: 3 },
},
{
definitionUri: getLabwareDefURI(fixture_12_trough as LabwareDefinition2),
definitionUri: getLabwareDefURI(fixture12Trough as LabwareDefinition2),
location: { slotName: 'A2' },
vector: { x: 1, y: 2, z: 3 },
},
{
definitionUri: getLabwareDefURI(fixture_12_trough as LabwareDefinition2),
definitionUri: getLabwareDefURI(fixture12Trough as LabwareDefinition2),
location: { slotName: 'A3' },
vector: { x: 1, y: 2, z: 3 },
},
{
definitionUri: getLabwareDefURI(fixture_12_trough as LabwareDefinition2),
definitionUri: getLabwareDefURI(fixture12Trough as LabwareDefinition2),
location: { slotName: 'B1' },
vector: { x: 1, y: 2, z: 3 },
},
{
definitionUri: getLabwareDefURI(fixture_12_trough as LabwareDefinition2),
definitionUri: getLabwareDefURI(fixture12Trough as LabwareDefinition2),
location: { slotName: 'B2' },
vector: { x: 1, y: 2, z: 3 },
},
{
definitionUri: getLabwareDefURI(fixture_12_trough as LabwareDefinition2),
definitionUri: getLabwareDefURI(fixture12Trough as LabwareDefinition2),
location: { slotName: 'B3' },
vector: { x: 1, y: 2, z: 3 },
},
{
definitionUri: getLabwareDefURI(fixture_12_trough as LabwareDefinition2),
definitionUri: getLabwareDefURI(fixture12Trough as LabwareDefinition2),
location: { slotName: 'C1' },
vector: { x: 1, y: 2, z: 3 },
},
{
definitionUri: getLabwareDefURI(fixture_12_trough as LabwareDefinition2),
definitionUri: getLabwareDefURI(fixture12Trough as LabwareDefinition2),
location: { slotName: 'C2' },
vector: { x: 1, y: 2, z: 3 },
},
{
definitionUri: getLabwareDefURI(fixture_12_trough as LabwareDefinition2),
definitionUri: getLabwareDefURI(fixture12Trough as LabwareDefinition2),
location: { slotName: 'C3' },
vector: { x: 1, y: 2, z: 3 },
},
],
labwareDefinitions: [fixture_12_trough, fixture_tiprack_10_ul],
labwareDefinitions: [fixture12Trough, fixtureTiprack10ul],
}
2 changes: 1 addition & 1 deletion app/src/styles.global.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This is for loading software keyboard lib's css without changing webpack
*/

@import '../../node_modules/react-simple-keyboard/build/css/index.css';
@import '../node_modules/react-simple-keyboard/build/css/index.css';
@import './atoms/SoftwareKeyboard/CustomKeyboard/index.module.css';
@import './atoms/SoftwareKeyboard/NormalKeyboard/index.module.css';
@import './atoms/SoftwareKeyboard/Numpad/index.module.css';
4 changes: 2 additions & 2 deletions components/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ clean:

.PHONY: dist
dist:
pnpm --cwd .. build-storybook
cd .. && pnpm sb build

.PHONY: lib
lib: export NODE_ENV := production
Expand All @@ -36,7 +36,7 @@ lib:

.PHONY: dev
dev:
pnpm --cwd .. start-storybook --port $(port)
cd .. && pnpm sb dev --port $(port)

.PHONY: test
test:
Expand Down
15 changes: 7 additions & 8 deletions components/src/hardware-sim/BaseDeck/BaseDeck.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as React from 'react'
import fixture_96_plate from '@opentrons/shared-data/labware/fixtures/2/fixture_96_plate.json'
import fixture_tiprack_1000_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_1000_ul.json'
import {fixture96Plate, fixtureTiprack1000ul} from '@opentrons/shared-data'
import {
FLEX_ROBOT_TYPE,
HEATERSHAKER_MODULE_V1,
Expand Down Expand Up @@ -54,34 +53,34 @@ export const BaseDeck: Story = {
labwareOnDeck: [
{
labwareLocation: { slotName: 'C2' },
definition: fixture_96_plate as LabwareDefinition2,
definition: fixture96Plate as LabwareDefinition2,
},
{
labwareLocation: { slotName: 'C3' },
definition: fixture_tiprack_1000_ul as LabwareDefinition2,
definition: fixtureTiprack1000ul as LabwareDefinition2,
},
],
modulesOnDeck: [
{
moduleLocation: { slotName: 'B1' },
moduleModel: THERMOCYCLER_MODULE_V2,
nestedLabwareDef: fixture_96_plate as LabwareDefinition2,
nestedLabwareDef: fixture96Plate as LabwareDefinition2,
innerProps: { lidMotorState: 'open' },
},
{
moduleLocation: { slotName: 'D1' },
moduleModel: TEMPERATURE_MODULE_V2,
nestedLabwareDef: fixture_96_plate as LabwareDefinition2,
nestedLabwareDef: fixture96Plate as LabwareDefinition2,
},
{
moduleLocation: { slotName: 'B3' },
moduleModel: HEATERSHAKER_MODULE_V1,
nestedLabwareDef: fixture_96_plate as LabwareDefinition2,
nestedLabwareDef: fixture96Plate as LabwareDefinition2,
},
{
moduleLocation: { slotName: 'D2' },
moduleModel: MAGNETIC_BLOCK_V1,
nestedLabwareDef: fixture_96_plate as LabwareDefinition2,
nestedLabwareDef: fixture96Plate as LabwareDefinition2,
},
],
darkFill: 'rebeccapurple',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import fixture_96_plate from '@opentrons/shared-data/labware/fixtures/2/fixture_96_plate.json'
import { fixture96Plate } from '@opentrons/shared-data'
import {
FLEX_ROBOT_TYPE,
SINGLE_CENTER_SLOT_FIXTURE,
Expand Down Expand Up @@ -77,7 +77,7 @@ const FLEX_SIMPLEST_DECK_CONFIG: DeckConfiguration = [
export const MoveLabwareOnDeck: Story = {
render: args => (
<MoveLabwareOnDeckComponent
movedLabwareDef={fixture_96_plate as LabwareDefinition2}
movedLabwareDef={fixture96Plate as LabwareDefinition2}
initialLabwareLocation={args.initialLabwareLocation}
finalLabwareLocation={args.finalLabwareLocation}
loadedModules={[]}
Expand Down
32 changes: 17 additions & 15 deletions components/src/hardware-sim/Labware/LabwareRender.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
import * as React from 'react'

import fixture_96_plate from '@opentrons/shared-data/labware/fixtures/2/fixture_96_plate.json'
import fixture_24_tuberack from '@opentrons/shared-data/labware/fixtures/2/fixture_24_tuberack.json'
import fixture_12_trough from '@opentrons/shared-data/labware/fixtures/2/fixture_12_trough.json'
import fixture_tiprack_10_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_10_ul.json'
import fixture_tiprack_300_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_300_ul.json'
import fixture_tiprack_1000_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_1000_ul.json'
import {
fixture96Plate as _fixture96Plate,
fixture24Tuberack as _fixture24Tuberack,
fixture12Trough as _fixture12Trough,
fixtureTiprack10ul as _fixtureTiprack10ul,
fixtureTiprack300ul as _fixtureTiprack300ul,
fixtureTiprack1000ul as _fixtureTiprack1000ul,
} from '@opentrons/shared-data'

import { RobotWorkSpace } from '../Deck'
import { LabwareRender } from './LabwareRender'

import type { Story, Meta } from '@storybook/react'
import type { LabwareDefinition2 } from '@opentrons/shared-data'

const fixture96Plate = fixture_96_plate as LabwareDefinition2
const fixture24Tuberack = fixture_24_tuberack as LabwareDefinition2
const fixture12Trough = fixture_12_trough as LabwareDefinition2
const fixture96Plate = _fixture96Plate as LabwareDefinition2
const fixture24Tuberack = _fixture24Tuberack as LabwareDefinition2
const fixture12Trough = _fixture12Trough as LabwareDefinition2

const fixtureTiprack10 = fixture_tiprack_10_ul as LabwareDefinition2
const fixtureTiprack300 = fixture_tiprack_300_ul as LabwareDefinition2
const fixtureTiprack1000 = fixture_tiprack_1000_ul as LabwareDefinition2
const fixtureTiprack10 = _fixtureTiprack10ul as LabwareDefinition2
const fixtureTiprack300 = _fixtureTiprack300ul as LabwareDefinition2
const fixtureTiprack1000 = _fixtureTiprack1000ul as LabwareDefinition2

const labwareDefMap: Record<string, LabwareDefinition2> = {
[fixture96Plate.metadata.displayName]: fixture96Plate,
Expand All @@ -38,7 +40,7 @@ export default {
decorators: [
Story => (
<RobotWorkSpace
viewBox={`0 0 ${fixture_96_plate.dimensions.xDimension} ${fixture_96_plate.dimensions.yDimension}`}
viewBox={`0 0 ${fixture96Plate.dimensions.xDimension} ${fixture96Plate.dimensions.yDimension}`}
>
{() => <Story />}
</RobotWorkSpace>
Expand All @@ -64,7 +66,7 @@ Basic.argTypes = {
d => labwareDefMap[d].metadata.displayName
),
},
defaultValue: fixture_96_plate.metadata.displayName,
defaultValue: fixture96Plate.metadata.displayName,
},
}
Basic.args = {
Expand All @@ -83,7 +85,7 @@ TipRack.argTypes = {
d => tipRackDefMap[d].metadata.displayName
),
},
defaultValue: fixture_tiprack_10_ul.metadata.displayName,
defaultValue: fixtureTiprack10.metadata.displayName,
},
}
TipRack.args = {
Expand Down
4 changes: 2 additions & 2 deletions components/src/hardware-sim/Module/Module.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react'
import {
fixture96Plate,
getModuleDef2,
LabwareDefinition2,
MAGNETIC_MODULE_V1,
Expand All @@ -12,7 +13,6 @@ import {
HEATERSHAKER_MODULE_V1,
MAGNETIC_BLOCK_V1,
} from '@opentrons/shared-data'
import fixture_96_plate from '@opentrons/shared-data/labware/fixtures/2/fixture_96_plate.json'
import { LabwareRender } from '../Labware'
import { RobotCoordinateSpace } from '../RobotCoordinateSpace'
import { Module as ModuleComponent } from './'
Expand Down Expand Up @@ -50,7 +50,7 @@ const Template: Story<{
orientation={args.orientation}
>
{args.hasLabware ? (
<LabwareRender definition={fixture_96_plate as LabwareDefinition2} />
<LabwareRender definition={fixture96Plate as LabwareDefinition2} />
) : null}
</ModuleComponent>
</RobotCoordinateSpace>
Expand Down
Loading

0 comments on commit 468e4c7

Please sign in to comment.