Skip to content

Commit 0f81d55

Browse files
shlokaminmjhuffb-cooperkojijerader
authored andcommitted
chore(monorepo): migrate frontend bundling from webpack to vite (#14405)
migrate frontend bundler from webpack to vite Co-authored-by: Jamey Huffnagle <[email protected]> Co-authored-by: Brian Cooper <[email protected]> Co-authored-by: koji <[email protected]> Co-authored-by: Jethary <[email protected]> Co-authored-by: ncdiehl11 <[email protected]> Co-authored-by: smb2268 <[email protected]> Co-authored-by: Brent Hagen <[email protected]>
1 parent 50feb14 commit 0f81d55

File tree

271 files changed

+22250
-20
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

271 files changed

+22250
-20
lines changed

.github/workflows/shared-data-test-lint-deploy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ jobs:
212212
elif [ "${{ format('{0}', startsWith(github.ref, 'refs/tags/components')) }}" = "true" ] ; then
213213
echo "Publishing builds for components@ tags"
214214
echo 'should_publish=true' >> $GITHUB_OUTPUT
215-
else
215+
else
216216
echo "No publish for ref ${{github.ref}} and event ${{github.event_type}}"
217217
echo 'should_publish=false' >> $GITHUB_OUTPUT
218218
fi
@@ -252,7 +252,7 @@ jobs:
252252
run: |
253253
npm config set cache ./.npm-cache
254254
yarn config set cache-folder ./.yarn-cache
255-
make setup-js
255+
make setup-js
256256
- name: 'build typescript'
257257
run: make build-ts
258258
- name: 'build library'

app-shell-odd/src/config/migrate.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ import type {
2222

2323
const CONFIG_VERSION_LATEST = 21 // update this after each config version bump
2424

25+
<<<<<<< HEAD
2526
const PKG_VERSION: string = _PKG_VERSION_
27+
=======
28+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
2629
export const DEFAULTS_V12: ConfigV12 = {
2730
version: 12,
2831
devtools: false,

app-shell-odd/src/constants.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ export const ROBOT_MASS_STORAGE_DEVICE_ENUMERATED: 'shell:ROBOT_MASS_STORAGE_DEV
225225
'shell:ROBOT_MASS_STORAGE_DEVICE_ENUMERATED'
226226
export const NOTIFY_SUBSCRIBE: 'shell:NOTIFY_SUBSCRIBE' =
227227
'shell:NOTIFY_SUBSCRIBE'
228+
<<<<<<< HEAD
229+
=======
230+
export const NOTIFY_UNSUBSCRIBE: 'shell:NOTIFY_UNSUBSCRIBE' =
231+
'shell:NOTIFY_UNSUBSCRIBE'
232+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
228233

229234
// copy
230235
// TODO(mc, 2020-05-11): i18n
@@ -250,8 +255,11 @@ export const HTTP_API_VERSION: 3 = 3
250255

251256
export const SEND_READY_STATUS: 'shell:SEND_READY_STATUS' =
252257
'shell:SEND_READY_STATUS'
258+
<<<<<<< HEAD
253259

254260
export const FAILURE_STATUSES = {
255261
ECONNREFUSED: 'ECONNREFUSED',
256262
ECONNFAILED: 'ECONNFAILED',
257263
} as const
264+
=======
265+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))

app-shell-odd/src/update.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,17 @@ import type { ReleaseSetUrls } from './system-update/types'
1414

1515
const log = createLogger('update')
1616

17+
<<<<<<< HEAD
1718
const OPENTRONS_PROJECT: string = _OPENTRONS_PROJECT_
19+
=======
20+
export const FLEX_MANIFEST_URL =
21+
// @ts-expect-error can't get TS to recognize global.d.ts
22+
global._OPENTRONS_PROJECT_ &&
23+
// @ts-expect-error can't get TS to recognize global.d.ts
24+
global._OPENTRONS_PROJECT_.includes('robot-stack')
25+
? 'https://builds.opentrons.com/ot3-oe/releases.json'
26+
: 'https://ot3-development.builds.opentrons.com/ot3-oe/releases.json'
27+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
1828

1929
export const FLEX_MANIFEST_URL =
2030
OPENTRONS_PROJECT && OPENTRONS_PROJECT.includes('robot-stack')

app-shell-odd/vite.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1+
<<<<<<< HEAD
12
import { versionForProject } from '../scripts/git-version.mjs'
23
import pkg from './package.json'
34
import path from 'path'
45
import { defineConfig } from 'vite'
6+
=======
7+
import { versionForProject } from '../scripts/git-version'
8+
import pkg from './package.json'
9+
import path from 'path'
10+
import { UserConfig, defineConfig } from 'vite'
11+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
512
import react from '@vitejs/plugin-react'
613
import postCssImport from 'postcss-import'
714
import postCssApply from 'postcss-apply'
815
import postColorModFunction from 'postcss-color-mod-function'
916
import postCssPresetEnv from 'postcss-preset-env'
1017
import lostCss from 'lost'
18+
<<<<<<< HEAD
1119
import type { UserConfig } from 'vite'
20+
=======
21+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
1222

1323
export default defineConfig(
1424
async (): Promise<UserConfig> => {
@@ -80,7 +90,11 @@ export default defineConfig(
8090
'../discovery-client/src/index.ts'
8191
),
8292
'@opentrons/usb-bridge/node-client': path.resolve(
93+
<<<<<<< HEAD
8394
'../usb-bridge/node-client/src/index.ts'
95+
=======
96+
'../usb-bridge/node-client/src/inxex.ts'
97+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
8498
),
8599
},
86100
},

app-shell/src/__fixtures__/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
export * from './config'
2+
<<<<<<< HEAD
23
export * from './robots'
4+
=======
5+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))

app-shell/src/__tests__/discovery.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ vi.mock('../log', () => {
2727
},
2828
}
2929
})
30+
<<<<<<< HEAD
3031
vi.mock('../notifications')
32+
=======
33+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
3134

3235
let mockGet = vi.fn(property => {
3336
return []

app-shell/src/config/actions.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ import {
7676
VALUE_UPDATED,
7777
VIEW_PROTOCOL_SOURCE_FOLDER,
7878
NOTIFY_SUBSCRIBE,
79+
<<<<<<< HEAD
80+
=======
81+
NOTIFY_UNSUBSCRIBE,
82+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
7983
ROBOT_MASS_STORAGE_DEVICE_ADDED,
8084
ROBOT_MASS_STORAGE_DEVICE_ENUMERATED,
8185
ROBOT_MASS_STORAGE_DEVICE_REMOVED,
@@ -98,6 +102,10 @@ import type {
98102
AppRestartAction,
99103
NotifySubscribeAction,
100104
NotifyTopic,
105+
<<<<<<< HEAD
106+
=======
107+
NotifyUnsubscribeAction,
108+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
101109
ReloadUiAction,
102110
RobotMassStorageDeviceAdded,
103111
RobotMassStorageDeviceEnumerated,
@@ -419,3 +427,18 @@ export const notifySubscribeAction = (
419427
},
420428
meta: { shell: true },
421429
})
430+
<<<<<<< HEAD
431+
=======
432+
433+
export const notifyUnsubscribeAction = (
434+
hostname: string,
435+
topic: NotifyTopic
436+
): NotifyUnsubscribeAction => ({
437+
type: NOTIFY_UNSUBSCRIBE,
438+
payload: {
439+
hostname,
440+
topic,
441+
},
442+
meta: { shell: true },
443+
})
444+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))

app-shell/src/constants.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ export const ROBOT_MASS_STORAGE_DEVICE_ENUMERATED: 'shell:ROBOT_MASS_STORAGE_DEV
225225
'shell:ROBOT_MASS_STORAGE_DEVICE_ENUMERATED'
226226
export const NOTIFY_SUBSCRIBE: 'shell:NOTIFY_SUBSCRIBE' =
227227
'shell:NOTIFY_SUBSCRIBE'
228+
<<<<<<< HEAD
229+
=======
230+
export const NOTIFY_UNSUBSCRIBE: 'shell:NOTIFY_UNSUBSCRIBE' =
231+
'shell:NOTIFY_UNSUBSCRIBE'
232+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
228233

229234
// copy
230235
// TODO(mc, 2020-05-11): i18n
@@ -245,9 +250,12 @@ export const DISCOVERY_UPDATE_LIST: DISCOVERY_UPDATE_LIST_TYPE =
245250
export const DISCOVERY_REMOVE: DISCOVERY_REMOVE_TYPE = 'discovery:REMOVE'
246251

247252
export const CLEAR_CACHE: CLEAR_CACHE_TYPE = 'discovery:CLEAR_CACHE'
253+
<<<<<<< HEAD
248254
export const HEALTH_STATUS_OK: 'ok' = 'ok'
249255
export const HEALTH_STATUS_NOT_OK: 'notOk' = 'notOk'
250256
export const FAILURE_STATUSES = {
251257
ECONNREFUSED: 'ECONNREFUSED',
252258
ECONNFAILED: 'ECONNFAILED',
253259
} as const
260+
=======
261+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))

app-shell/src/discovery.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,15 @@ import {
99
DEFAULT_PORT,
1010
} from '@opentrons/discovery-client'
1111
import {
12+
CLEAR_CACHE,
13+
DISCOVERY_FINISH,
14+
DISCOVERY_REMOVE,
15+
DISCOVERY_START,
16+
OPENTRONS_USB,
1217
UI_INITIALIZED,
1318
USB_HTTP_REQUESTS_START,
1419
USB_HTTP_REQUESTS_STOP,
15-
} from '@opentrons/app/src/redux/shell/actions'
16-
import {
17-
DISCOVERY_START,
18-
DISCOVERY_FINISH,
19-
DISCOVERY_REMOVE,
20-
CLEAR_CACHE,
21-
} from '@opentrons/app/src/redux/discovery/actions'
22-
import { OPENTRONS_USB } from '@opentrons/app/src/redux/discovery/constants'
20+
} from './constants'
2321

2422
import { getFullConfig, handleConfigChange } from './config'
2523
import { createLogger } from './log'

app-shell/src/main.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ import electronDebug from 'electron-debug'
44
import dns from 'dns'
55
import contextMenu from 'electron-context-menu'
66
import * as electronDevtoolsInstaller from 'electron-devtools-installer'
7+
<<<<<<< HEAD
8+
=======
9+
import { webusb } from 'usb'
10+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
711

812
import { createUi, registerReloadUi } from './ui'
913
import { initializeMenu } from './menu'

app-shell/src/menu.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,12 @@ const helpMenu: MenuItemConstructorOptions = {
3030
},
3131
},
3232
{
33+
<<<<<<< HEAD
3334
label: `View ${PRODUCT_NAME} App Logs`,
35+
=======
36+
// @ts-expect-error can't get TS to recognize global.d.ts
37+
label: `View ${global._PKG_PRODUCT_NAME_} App Logs`,
38+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
3439
click: () => {
3540
shell.openPath(LOG_DIR)
3641
},
@@ -39,7 +44,12 @@ const helpMenu: MenuItemConstructorOptions = {
3944
label: 'Report an Issue',
4045
click: () => {
4146
// eslint-disable-next-line @typescript-eslint/no-floating-promises
47+
<<<<<<< HEAD
4248
shell.openExternal(BUGS_URL)
49+
=======
50+
// @ts-expect-error can't get TS to recognize global.d.ts
51+
shell.openExternal(global._PKG_BUGS_URL_)
52+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
4353
},
4454
},
4555
],

app-shell/src/protocol-storage/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import fse from 'fs-extra'
22
import path from 'path'
33
import { shell } from 'electron'
4+
<<<<<<< HEAD
5+
=======
6+
import first from 'lodash/first'
7+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
48

59
import {
610
ADD_PROTOCOL,

app-shell/src/robot-update/constants.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ const UPDATE_MANIFEST_URLS_INTERNAL_RELEASE = {
1717
}
1818

1919
export const getUpdateManifestUrls = (): UpdateManifestUrls =>
20+
<<<<<<< HEAD
2021
OPENTRONS_PROJECT.includes('robot-stack')
22+
=======
23+
// @ts-expect-error can't get TS to recognize global.d.ts
24+
global._OPENTRONS_PROJECT_.includes('robot-stack')
25+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
2126
? UPDATE_MANIFEST_URLS_RELEASE
2227
: UPDATE_MANIFEST_URLS_INTERNAL_RELEASE
2328

app-shell/src/usb.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import {
1010
} from '@opentrons/usb-bridge/node-client'
1111

1212
import { createLogger } from './log'
13+
<<<<<<< HEAD
14+
=======
15+
import { getProtocolSrcFilePaths } from './protocol-storage'
16+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
1317
import { usbRequestsStart, usbRequestsStop } from './config/actions'
1418
import {
1519
SYSTEM_INFO_INITIALIZED,

app-shell/typings/global.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
/* eslint-disable no-var */
22
declare global {
3+
<<<<<<< HEAD
4+
=======
5+
var _PKG_VERSION_: string
6+
var _PKG_PRODUCT_NAME_: string
7+
var _PKG_BUGS_URL_: string
8+
var _OPENTRONS_PROJECT_: string
9+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
310
var APP_SHELL_REMOTE: { ipcRenderer: IpcRenderer; [key: string]: any }
411
}
512

app-shell/vite.config.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
<<<<<<< HEAD
12
import { versionForProject } from '../scripts/git-version.mjs'
23
import pkg from './package.json'
34
import path from 'path'
45
import { defineConfig } from 'vite'
56
import type { UserConfig } from 'vite'
7+
=======
8+
import { versionForProject } from '../scripts/git-version'
9+
import pkg from './package.json'
10+
import path from 'path'
11+
import { UserConfig, defineConfig } from 'vite'
12+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
613

714
export default defineConfig(
815
async (): Promise<UserConfig> => {

app/index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400i,600,600i,700,700i" rel="stylesheet">
88

99
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
10+
<<<<<<< HEAD
1011
<title>Opentrons</title>
12+
=======
13+
<title>Vite + React + TS</title>
14+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
1115
</head>
1216
<body>
1317
<div id="root"></div>

app/src/App/Navbar.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ export function Navbar({ routes }: { routes: RouteProps[] }): JSX.Element {
129129
alignSelf={ALIGN_STRETCH}
130130
>
131131
<LogoImg
132+
<<<<<<< HEAD
132133
src={PROJECT === 'ot3' ? logoSvgThree : logoSvg}
134+
=======
135+
src={global._OPENTRONS_PROJECT_ === 'ot3' ? logoSvgThree : logoSvg}
136+
>>>>>>> 9359adf484 (chore(monorepo): migrate frontend bundling from webpack to vite (#14405))
133137
alt="opentrons logo"
134138
/>
135139
{navRoutes.map(({ name, navLinkTo }: RouteProps) => (

0 commit comments

Comments
 (0)