Skip to content

Commit df1cf8f

Browse files
authored
Speed up CI by avoiding the need to package (#9791)
* optimise typechecking * fix builds
1 parent caf3650 commit df1cf8f

File tree

17 files changed

+123
-51
lines changed

17 files changed

+123
-51
lines changed

.github/actions/install-frontend-deps/action.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ runs:
3333
- name: Build Css
3434
shell: bash
3535
run: pnpm css
36-
- name: Create packages
37-
shell: bash
38-
run: pnpm package
3936
- name: Build frontend
4037
if: inputs.skip_build == 'false'
4138
# && steps.frontend-cache.outputs.cache-hit != 'true'

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ jobs:
3030
run: |
3131
. venv/bin/activate
3232
pip install -U build hatch packaging>=23.2 # packaging>=23.2 is needed to build Lite due to https://github.com/pypa/hatch/issues/1381
33+
pnpm package
3334
pnpm --filter @gradio/client --filter @gradio/lite --filter @gradio/preview build
3435
3536
- name: create and publish versions

client/js/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"skipLibCheck": true,
1515

1616
/* Bundler */
17-
"moduleResolution": "bundler",
17+
"moduleResolution": "Bundler",
1818
"skipDefaultLibCheck": true,
1919
"allowImportingTsExtensions": true,
2020
"esModuleInterop": true,

js/_website/tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
"skipLibCheck": true,
1010
"sourceMap": true,
1111
"strict": true,
12-
"typeRoots": ["node_modules/@types", "./app.d.ts"]
12+
"typeRoots": ["node_modules/@types", "./app.d.ts"],
13+
"moduleResolution": "bundler",
14+
"module": "esnext",
15+
"customConditions": ["gradio"],
16+
"target": "es2022"
1317
}
1418
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
1519
//

js/app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"@gradio/wasm": "workspace:^",
3131
"@huggingface/space-header": "^1.0.3",
3232
"@self/build": "workspace:^",
33-
"@sveltejs/adapter-node": "^5.2.2"
33+
"@sveltejs/adapter-node": "^5.2.2",
34+
"svelte-preprocess": "^6.0.3"
3435
}
3536
}

js/app/postcss.config.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

js/app/svelte.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import adapter from "@sveltejs/adapter-node";
22
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
3-
import sveltePreprocess from "svelte-preprocess";
3+
import { sveltePreprocess } from "svelte-preprocess";
44
import custom_media from "postcss-custom-media";
55
import global_data from "@csstools/postcss-global-data";
66
import { resolve } from "path";
@@ -13,7 +13,6 @@ const theme_token_path = join(
1313
__dirname,
1414
"..",
1515
"..",
16-
1716
"theme",
1817
"src",
1918
"tokens.css"

js/app/tsconfig.json

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@
1010
"sourceMap": true,
1111
"strict": true,
1212
"moduleResolution": "bundler",
13-
"module": "esnext"
13+
"module": "esnext",
14+
"customConditions": ["gradio"],
15+
"target": "esnext"
1416
}
15-
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
16-
// except $lib which is handled by https://kit.svelte.dev/docs/configuration#files
17-
//
18-
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
19-
// from the referenced tsconfig.json - TypeScript does not merge them in
2017
}

js/component-test/tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
"sourceMap": true,
1111
"strict": true,
1212
"typeRoots": ["node_modules/@types", "./app.d.ts"],
13-
"outDir": "./.svelte-kit"
13+
"outDir": "./.svelte-kit",
14+
"moduleResolution": "bundler",
15+
"module": "esnext",
16+
"target": "es2022",
17+
"customConditions": ["gradio"]
1418
}
1519
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
1620
//

js/lite/vite.config.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { defineConfig } from "vite";
2-
import { svelte } from "@sveltejs/vite-plugin-svelte";
3-
import sveltePreprocess from "svelte-preprocess";
2+
import { svelte, vitePreprocess } from "@sveltejs/vite-plugin-svelte";
3+
import { sveltePreprocess } from "svelte-preprocess";
44
// @ts-ignore
55
import custom_media from "postcss-custom-media";
66
import global_data from "@csstools/postcss-global-data";
@@ -146,14 +146,17 @@ export default defineConfig(({ mode }) => {
146146
accessors: true
147147
},
148148
hot: !process.env.VITEST && !production,
149-
preprocess: sveltePreprocess({
150-
postcss: {
151-
plugins: [
152-
global_data({ files: [theme_token_path] }),
153-
custom_media()
154-
]
155-
}
156-
})
149+
preprocess: [
150+
vitePreprocess(),
151+
sveltePreprocess({
152+
postcss: {
153+
plugins: [
154+
global_data({ files: [theme_token_path] }),
155+
custom_media()
156+
]
157+
}
158+
})
159+
]
157160
}),
158161

159162
inject_ejs(),
@@ -163,7 +166,7 @@ export default defineConfig(({ mode }) => {
163166
mode === "test" && mock_modules()
164167
],
165168
optimizeDeps: {
166-
exclude: ["@ffmpeg/ffmpeg", "@ffmpeg/util"]
169+
exclude: ["@ffmpeg/ffmpeg", "@ffmpeg/util", "@gradio/wasm"]
167170
},
168171
test: {
169172
setupFiles: [resolve(__dirname, "../../.config/setup_vite_tests.ts")],
@@ -180,6 +183,7 @@ export default defineConfig(({ mode }) => {
180183
},
181184

182185
resolve: {
186+
conditions: ["gradio"],
183187
alias: {
184188
// For the Wasm app to import the wheel file URLs.
185189
"gradio.whl": resolve(

0 commit comments

Comments
 (0)