Skip to content

Commit

Permalink
build TS types along with JS bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
shlokamin committed May 17, 2024
1 parent 08ee506 commit 420a8f8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
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
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/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
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
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default defineConfig({
esbuildOptions: {
target: 'es2020',
},
exclude: ['node_modules']
exclude: ['node_modules'],
},
css: {
postcss: {
Expand Down

0 comments on commit 420a8f8

Please sign in to comment.