Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(components, shared-data): fix components and shared-data npm deploy actions #15180

Merged
merged 8 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/components-test-build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ jobs:
npm config set cache ./.npm-cache
yarn config set cache-folder ./.yarn-cache
make setup-js
- name: 'build typescript'
run: make build-ts
- name: 'build library'
- name: 'build typescript types'
run: make -C components build-ts
- name: 'build js bundle'
run: |
make -C components lib
# replace package.json stub version number with version from tag
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/shared-data-test-lint-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,11 @@ jobs:
with:
node-version: '18.19.0'
registry-url: 'https://registry.npmjs.org'
- name: 'install udev for usb-detection'
run: |
# WORKAROUND: Remove microsoft debian repo due to https://github.com/microsoft/linux-package-repositories/issues/130. Remove line below after it is resolved
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update && sudo apt-get install libudev-dev
- name: 'cache yarn cache'
uses: actions/cache@v3
with:
Expand Down
4 changes: 4 additions & 0 deletions components/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ lib: export NODE_ENV := production
lib:
yarn vite build

.PHONY: build-ts
build-ts:
yarn tsc --build --emitDeclarationOnly

# development
#####################################################################

Expand Down
4 changes: 3 additions & 1 deletion components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"source": "src/index.ts",
"types": "lib/index.d.ts",
"style": "src/index.module.css",
"main": "lib/opentrons-components.js",
"main": "lib/index.mjs",
"module": "src/index.ts",
"repository": {
"type": "git",
Expand Down Expand Up @@ -35,8 +35,10 @@
"classnames": "2.2.5",
"interactjs": "^1.10.17",
"lodash": "4.17.21",
"react-i18next": "13.5.0",
"react-popper": "1.0.0",
"react-remove-scroll": "2.4.3",
"react-router-dom": "5.3.4",
"react-select": "5.4.0",
"redux": "4.0.5",
"styled-components": "5.3.6"
Expand Down
4 changes: 3 additions & 1 deletion components/src/hardware-sim/DeckSlotLocation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ interface LegacyDeckSlotLocationProps extends React.SVGProps<SVGGElement> {
slotClipColor?: React.SVGProps<SVGPathElement>['stroke']
}

type AddressableAreaFromDeckDef = typeof ot2DeckDefV5.locations.addressableAreas[number]

// dimensions of the OT-2 fixed trash, not in deck definition
export const OT2_FIXED_TRASH_X_DIMENSION = 172.86
export const OT2_FIXED_TRASH_Y_DIMENSION = 165.86
Expand All @@ -41,7 +43,7 @@ export function LegacyDeckSlotLocation(
if (robotType !== OT2_ROBOT_TYPE) return null

const slotDef = ot2DeckDefV5.locations.addressableAreas.find(
s => s.id === slotName
(s: AddressableAreaFromDeckDef) => s.id === slotName
)
if (slotDef == null) {
console.warn(
Expand Down
190 changes: 118 additions & 72 deletions components/src/images/labware/measurement-guide/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,178 +11,224 @@ export interface DiagramProps {

type Diagrams = Record<string, string[]>

const FOOTPRINT_IMAGE_RELATIVE_PATH = './images/dimensions/[email protected]'
const DIMENSIONS_HEIGHT_PLATE_IMAGE_RELATIVE_PATH =
'./images/dimensions/[email protected]'
const DIMENSIONS_HEIGHT_TIP_RACK_IMAGE_RELATIVE_PATH =
'./images/dimensions/[email protected]'

const DIMENSIONS_HEIGHT_TUBE_RACK_IMAGE_RELATIVE_PATH =
'./images/dimensions/[email protected]'

const DIMENSIONS_HEIGHT_TUBE_RACK_IMAGE_IRREGULAR_RELATIVE_PATH =
'./images/dimensions/[email protected]'

const HEIGHT_ALUM_BLOCK_TUBES_IMAGE_RELATIVE_PATH =
'./images/dimensions/[email protected]'

const HEIGHT_ALUM_BLOCK_PLATE_IMAGE_RELATIVE_PATH =
'./images/dimensions/[email protected]'

const OFFSET_RESEVOIR_IMAGE_RELATIVE_PATH =
'./images/offset/[email protected]'

const SPACING_RESEVOIR_IMAGE_RELATIVE_PATH =
'./images/spacing/[email protected]'

const SPACING_RESEVOIR_MULTI_ROW_IMAGE_RELATIVE_PATH =
'./images/spacing/[email protected]'

const OFFSET_WELL_CIRCULAR_IMAGE_RELATIVE_PATH =
'./images/offset/[email protected]'

const SPACING_WELL_CIRCULAR_IMAGE_RELATIVE_PATH =
'./images/spacing/[email protected]'

const OFFSET_WELL_RECTANGULAR_IMAGE_RELATIVE_PATH =
'./images/offset/[email protected]'

const SPACING_WELL_RECTANGULAR_IMAGE_RELATIVE_PATH =
'./images/spacing/[email protected]'

const DEPTH_LENGTH_TIP_RACK_IMAGE_RELATIVE_PATH =
'./images/depth/[email protected]'

const SHAPE_CIRCULAR_IMAGE_RELATIVE_PATH =
'./images/shape/[email protected]'

const DEPTH_PLATE_FLAT_IMAGE_RELATIVE_PATH =
'./images/depth/[email protected]'

const SHAPE_RECTANGULAR_IMAGE_RELATIVE_PATH =
'./images/shape/[email protected]'

const DEPTH_PLATE_ROUND_IMAGE_RELATIVE_PATH =
'./images/depth/[email protected]'

const DEPTH_PLATE_V_SHAPE_IMAGE_RELATIVE_PATH =
'./images/depth/[email protected]'

const DEPTH_RESEVOIR_AND_TUBES_FLAT_IMAGE_RELATIVE_PATH =
'./images/depth/[email protected]'

const DEPTH_RESEVOIR_AND_TUBES_ROUND_IMAGE_RELATIVE_PATH =
'./images/depth/[email protected]'

const DEPTH_RESEVOIR_AND_TUBES_V_SHAPE_IMAGE_RELATIVE_PATH =
'./images/depth/[email protected]'

const FOOTPRINT_DIAGRAMS: Diagrams = {
wellPlate: [
new URL('./images/dimensions/[email protected]', import.meta.url).href,
new URL(
'./images/dimensions/[email protected]',
import.meta.url
).href,
new URL(FOOTPRINT_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(DIMENSIONS_HEIGHT_PLATE_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
tipRack: [
new URL('./images/dimensions/[email protected]', import.meta.url).href,
new URL('./images/dimensions/[email protected]', import.meta.url).href,
new URL(FOOTPRINT_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(DIMENSIONS_HEIGHT_TIP_RACK_IMAGE_RELATIVE_PATH, import.meta.url)
.href,
],
tubeRack: [
new URL('./images/dimensions/[email protected]', import.meta.url).href,
new URL('./images/dimensions/[email protected]', import.meta.url)
new URL(FOOTPRINT_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(DIMENSIONS_HEIGHT_TUBE_RACK_IMAGE_RELATIVE_PATH, import.meta.url)
.href,
],
reservoir: [
new URL('./images/dimensions/[email protected]', import.meta.url).href,
new URL(
'./images/dimensions/[email protected]',
import.meta.url
).href,
new URL(FOOTPRINT_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(DIMENSIONS_HEIGHT_PLATE_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
irregular: [
new URL('./images/dimensions/[email protected]', import.meta.url).href,
new URL(FOOTPRINT_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(
'./images/dimensions/[email protected]',
DIMENSIONS_HEIGHT_TUBE_RACK_IMAGE_IRREGULAR_RELATIVE_PATH,
import.meta.url
).href,
],
adapter: [
new URL('./images/dimensions/[email protected]', import.meta.url).href,
new URL(
'./images/dimensions/[email protected]',
import.meta.url
).href,
new URL(FOOTPRINT_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(DIMENSIONS_HEIGHT_PLATE_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
}

const ALUM_BLOCK_FOOTPRINTS: Diagrams = {
tubeRack: [
new URL('./images/dimensions/[email protected]', import.meta.url).href,
new URL(
'./images/dimensions/[email protected]',
import.meta.url
).href,
new URL(FOOTPRINT_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(HEIGHT_ALUM_BLOCK_TUBES_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
wellPlate: [
new URL('./images/dimensions/[email protected]', import.meta.url).href,
new URL(
'./images/dimensions/[email protected]',
import.meta.url
).href,
new URL(FOOTPRINT_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(HEIGHT_ALUM_BLOCK_PLATE_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
}

const RESERVOIR_SPACING_DIAGRAMS: Diagrams = {
singleRow: [
new URL('./images/offset/[email protected]', import.meta.url).href,
new URL('./images/spacing/[email protected]', import.meta.url).href,
new URL(OFFSET_RESEVOIR_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SPACING_RESEVOIR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
multiRow: [
new URL('./images/offset/[email protected]', import.meta.url).href,
new URL(
'./images/spacing/[email protected]',
import.meta.url
).href,
new URL(OFFSET_RESEVOIR_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SPACING_RESEVOIR_MULTI_ROW_IMAGE_RELATIVE_PATH, import.meta.url)
.href,
],
}

const SPACING_DIAGRAMS: Diagrams = {
circular: [
new URL('./images/offset/[email protected]', import.meta.url)
.href,
new URL('./images/spacing/[email protected]', import.meta.url)
.href,
new URL(OFFSET_WELL_CIRCULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SPACING_WELL_CIRCULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
rectangular: [
new URL('./images/offset/[email protected]', import.meta.url)
.href,
new URL('./images/spacing/[email protected]', import.meta.url)
.href,
new URL(OFFSET_WELL_RECTANGULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SPACING_WELL_RECTANGULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
}

const TIPRACK_MEASUREMENT_DIAGRAMS: string[] = [
new URL('./images/depth/[email protected]', import.meta.url).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(DEPTH_LENGTH_TIP_RACK_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SHAPE_CIRCULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
]

type NestedDiagrams = Record<string, Record<string, string[]>>

const PLATE_MEASUREMENT_DIAGRAMS: NestedDiagrams = {
flat: {
circular: [
new URL('./images/depth/[email protected]', import.meta.url).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(DEPTH_PLATE_FLAT_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SHAPE_CIRCULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
rectangular: [
new URL('./images/depth/[email protected]', import.meta.url).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(DEPTH_PLATE_FLAT_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SHAPE_RECTANGULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
},
u: {
circular: [
new URL('./images/depth/[email protected]', import.meta.url).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(DEPTH_PLATE_ROUND_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SHAPE_CIRCULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
rectangular: [
new URL('./images/depth/[email protected]', import.meta.url).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(DEPTH_PLATE_ROUND_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SHAPE_RECTANGULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
},
v: {
circular: [
new URL('./images/depth/[email protected]', import.meta.url).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(DEPTH_PLATE_V_SHAPE_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SHAPE_CIRCULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
rectangular: [
new URL('./images/depth/[email protected]', import.meta.url).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(DEPTH_PLATE_V_SHAPE_IMAGE_RELATIVE_PATH, import.meta.url).href,
new URL(SHAPE_RECTANGULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
},
}
const MEASUREMENT_DIAGRAMS: NestedDiagrams = {
flat: {
circular: [
new URL(
'./images/depth/[email protected]',
DEPTH_RESEVOIR_AND_TUBES_FLAT_IMAGE_RELATIVE_PATH,
import.meta.url
).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(SHAPE_CIRCULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
rectangular: [
new URL(
'./images/depth/[email protected]',
DEPTH_RESEVOIR_AND_TUBES_FLAT_IMAGE_RELATIVE_PATH,
import.meta.url
).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(SHAPE_RECTANGULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
},
u: {
circular: [
new URL(
'./images/depth/[email protected]',
DEPTH_RESEVOIR_AND_TUBES_ROUND_IMAGE_RELATIVE_PATH,
import.meta.url
).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(SHAPE_CIRCULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
rectangular: [
new URL(
'./images/depth/[email protected]',
DEPTH_RESEVOIR_AND_TUBES_ROUND_IMAGE_RELATIVE_PATH,
import.meta.url
).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(SHAPE_RECTANGULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
},
v: {
circular: [
new URL(
'./images/depth/[email protected]',
DEPTH_RESEVOIR_AND_TUBES_V_SHAPE_IMAGE_RELATIVE_PATH,
import.meta.url
).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(SHAPE_CIRCULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
rectangular: [
new URL(
'./images/depth/[email protected]',
DEPTH_RESEVOIR_AND_TUBES_V_SHAPE_IMAGE_RELATIVE_PATH,
import.meta.url
).href,
new URL('./images/shape/[email protected]', import.meta.url).href,
new URL(SHAPE_RECTANGULAR_IMAGE_RELATIVE_PATH, import.meta.url).href,
],
},
}
Expand Down
2 changes: 2 additions & 0 deletions components/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export default defineConfig({
// Relative to the root
ssr: 'src/index.ts',
outDir: 'lib',
// do not delete the outdir, typescript types might live there and we dont want to delete them
emptyOutDir: false,
commonjsOptions: {
transformMixedEsModules: true,
esmExternals: true,
Expand Down
4 changes: 3 additions & 1 deletion shared-data/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ lib-js: export NODE_ENV := production
lib-js:
NODE_OPTIONS=--openssl-legacy-provider yarn vite build


.PHONY: build-ts
build-ts:
yarn tsc --build --emitDeclarationOnly

# Python targets

Expand Down
2 changes: 1 addition & 1 deletion shared-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "Apache-2.0",
"source": "js/index.ts",
"types": "lib/js/index.d.ts",
"main": "lib/opentrons-shared-data.js",
"main": "lib/index.mjs",
"module": "js/index.ts",
"dependencies": {
"ajv": "^6.12.3",
Expand Down
Loading
Loading