Skip to content

Commit 260c580

Browse files
authored
fix(api-client, react-api-client): update build command in api-client and react-api-client (#18637)
* fix(api-client, react-api-client): update build command in api-client and react-api-client
1 parent 7bd07bf commit 260c580

File tree

7 files changed

+96
-178
lines changed

7 files changed

+96
-178
lines changed

.cursorignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,22 @@ api/docs/dist/v2/
8383
*.sublime-workspace
8484

8585
# build artifacts
86+
api-client/dist/
8687
app/dist/
8788
app-shell/dist/
8889
app-shell-odd/dist/
8990
components/lib
9091
discovery-client/lib
9192
labware-designer/dist/
9293
labware-library/dist/
94+
opentrons-ai-client/dist/
9395
protocol-designer/dist/
94-
opentrons-ai-client/dist/
96+
react-api-client/dist/
97+
shared-data/lib/
98+
step-generation/lib/
99+
100+
# docker
101+
Dockerfile
102+
DOCKER.md
103+
docker-compose.yml
104+
.dockerignore

api-client/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
# TODO(mc, 2021-02-12): this may be unnecessary by using `yarn run` instead
55
SHELL := bash
66

7+
# add node_modules/.bin to PATH
8+
PATH := $(shell cd .. && yarn bin):$(PATH)
9+
710
# These variables can be overriden when make is invoked to customize the
811
# behavior of jest
912
tests ?=
@@ -21,8 +24,9 @@ clean:
2124
tsc --build --clean && yarn shx rm -rf \"dist\"
2225

2326
.PHONY: build
27+
build: export NODE_ENV := production
2428
build:
25-
rollup --config rollup.config.js
29+
vite build
2630

2731
.PHONY: test
2832
test:

api-client/vite.config.mts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import path, { resolve } from 'path'
2+
import { defineConfig } from 'vite'
3+
4+
export default defineConfig({
5+
plugins: [],
6+
build: {
7+
// Relative to the root
8+
outDir: 'dist',
9+
lib: {
10+
entry: resolve(__dirname, 'src/index.ts'),
11+
name: 'OpentronsApiClient',
12+
formats: ['es', 'umd'],
13+
fileName: format => `api-client.${format}.js`,
14+
},
15+
rollupOptions: {
16+
external: [],
17+
output: {
18+
globals: {},
19+
},
20+
},
21+
sourcemap: false,
22+
minify: true,
23+
},
24+
optimizeDeps: {
25+
esbuildOptions: {
26+
target: 'es2020',
27+
},
28+
},
29+
resolve: {
30+
alias: {
31+
'@opentrons/shared-data': path.resolve('../shared-data/js/index.ts'),
32+
},
33+
},
34+
})

package.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@
4242
"@eslint-react/eslint-plugin": "1.52.2",
4343
"@ianvs/prettier-plugin-sort-imports": "4.4.1",
4444
"@octokit/rest": "^19.0.5",
45-
"@rollup/plugin-alias": "^3.1.2",
46-
"@rollup/plugin-babel": "^5.3.0",
47-
"@rollup/plugin-commonjs": "^18.0.0",
48-
"@rollup/plugin-json": "^4.1.0",
49-
"@rollup/plugin-node-resolve": "^11.2.1",
50-
"@rollup/plugin-replace": "^2.4.2",
5145
"@storybook/addon-actions": "7.6.17",
5246
"@storybook/addon-essentials": "7.6.17",
5347
"@storybook/addon-links": "7.6.17",
@@ -137,9 +131,6 @@
137131
"redux-mock-store": "1.5.5",
138132
"rehype": "^9.0.0",
139133
"rehype-urls": "^1.0.0",
140-
"rollup": "^2.44.0",
141-
"rollup-plugin-peer-deps-external": "^2.2.4",
142-
"rollup-plugin-terser": "^7.0.2",
143134
"script-ext-html-webpack-plugin": "^2.1.4",
144135
"semver": "^7.3.8",
145136
"shx": "^0.3.4",

react-api-client/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# using bash instead of /bin/bash in SHELL prevents macOS optimizing away our PATH update
44
# TODO(mc, 2021-02-12): this may be unnecessary by using `yarn run` instead
55
SHELL := bash
6+
# add node_modules/.bin to PATH
7+
PATH := $(shell cd .. && yarn bin):$(PATH)
68

79
# These variables can be overriden when make is invoked to customize the
810
# behavior of jest
@@ -21,8 +23,9 @@ clean:
2123
yarn shx rm -rf dist
2224

2325
.PHONY: build
26+
build: export NODE_ENV := production
2427
build:
25-
rollup --config rollup.config.js
28+
vite build
2629

2730
.PHONY: test
2831
test:

react-api-client/vite.config.mts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import path, { resolve } from 'path'
2+
import { defineConfig } from 'vite'
3+
4+
export default defineConfig({
5+
plugins: [],
6+
build: {
7+
// Relative to the root
8+
outDir: 'dist',
9+
lib: {
10+
entry: resolve(__dirname, 'src/index.ts'),
11+
name: 'OpentronsReactApiClient',
12+
formats: ['es', 'umd'],
13+
fileName: format => `react-api-client.${format}.js`,
14+
},
15+
rollupOptions: {
16+
external: [],
17+
output: {
18+
globals: {},
19+
},
20+
},
21+
sourcemap: false,
22+
minify: true,
23+
},
24+
optimizeDeps: {
25+
esbuildOptions: {
26+
target: 'es2020',
27+
},
28+
},
29+
resolve: {
30+
alias: {
31+
'@opentrons/shared-data': path.resolve('../shared-data/js/index.ts'),
32+
'@opentrons/api-client': path.resolve('../api-client/src/index.ts'),
33+
},
34+
},
35+
})

0 commit comments

Comments
 (0)