Skip to content

Commit 62ab531

Browse files
committed
refactor: upgrade vite for vitest and storybook
Tough cookie. There is a problem with resolving react-remove-scroll, figured it by reducing allowed amount of server conditions.
1 parent 93c0057 commit 62ab531

File tree

25 files changed

+548
-193
lines changed

25 files changed

+548
-193
lines changed

.storybook/main.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as path from "node:path";
2-
import type { StorybookConfig } from "@storybook/react-vite";
32
import { existsSync, readdirSync } from "node:fs";
3+
import { defaultClientConditions } from "vite";
4+
import type { StorybookConfig } from "@storybook/react-vite";
45

56
const isFolderEmpty = (folderPath: string) => {
67
if (!existsSync(folderPath)) {
@@ -82,15 +83,8 @@ export default {
8283
resolve: {
8384
...config.resolve,
8485
conditions: hasPrivateFolders
85-
? [
86-
"webstudio-private",
87-
"webstudio",
88-
"import",
89-
"module",
90-
"browser",
91-
"default",
92-
]
93-
: ["webstudio", "import", "module", "browser", "default"],
86+
? ["webstudio-private", "webstudio", ...defaultClientConditions]
87+
: ["webstudio", ...defaultClientConditions],
9488

9589
alias: [
9690
{

apps/builder/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"dev": "pnpm build:http-client && remix vite:dev",
1515
"dev:auth": "pnpm build:http-client && DEBUG=OAuth2Strategy,ws:* remix vite:dev",
1616
"typecheck": "tsc --noEmit --emitDeclarationOnly false",
17-
"test": "pnpm build:http-client && vitest run"
17+
"test": "vitest run"
1818
},
1919
"dependencies": {
2020
"@atlaskit/pragmatic-drag-and-drop": "^1.5.2",
@@ -138,7 +138,7 @@
138138
"type-fest": "^4.37.0",
139139
"typescript": "5.8.2",
140140
"vite": "^5.4.11",
141-
"vitest": "^3.0.8"
141+
"vitest": "^3.1.2"
142142
},
143143
"sideEffects": false,
144144
"license": "AGPL-3.0-or-later"

apps/builder/vite.config.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,6 @@ const hasPrivateFolders =
2222
}).length > 0;
2323

2424
export default defineConfig(({ mode }) => {
25-
if (mode === "test") {
26-
return {
27-
resolve: {
28-
conditions: hasPrivateFolders
29-
? ["webstudio-private", "webstudio"]
30-
: ["webstudio"],
31-
alias: [
32-
{
33-
find: "~",
34-
replacement: resolve("app"),
35-
},
36-
],
37-
},
38-
};
39-
}
40-
4125
if (mode === "development") {
4226
// Enable self-signed certificates for development service 2 service fetch calls.
4327
// This is particularly important for secure communication with the oauth.ws.token endpoint.

apps/builder/vitest.config.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { resolve } from "node:path";
2+
import { defineConfig } from "vitest/config";
3+
4+
export default defineConfig({
5+
resolve: {
6+
alias: [
7+
{
8+
find: "~",
9+
replacement: resolve("app"),
10+
},
11+
],
12+
},
13+
// resolve webstudio condition in tests
14+
ssr: {
15+
resolve: {
16+
conditions: ["webstudio", "node", "development|production"],
17+
// conditions: ["webstudio", ...defaultServerConditions],
18+
},
19+
},
20+
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"tsx": "^4.19.3",
5353
"typescript": "5.8.2",
5454
"typescript-eslint": "^8.26.1",
55-
"vite": "^5.4.11"
55+
"vite": "^6.3.3"
5656
},
5757
"engines": {
5858
"node": "20",

packages/asset-uploader/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"devDependencies": {
2525
"@types/fontkit": "^2.0.7",
2626
"@webstudio-is/tsconfig": "workspace:*",
27-
"vitest": "^3.0.8",
27+
"vitest": "^3.1.2",
2828
"zod": "^3.24.2"
2929
},
3030
"exports": {

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"ts-expect": "^1.3.0",
8383
"vike": "^0.4.228",
8484
"vite": "^5.4.11",
85-
"vitest": "^3.0.8",
85+
"vitest": "^3.1.2",
8686
"wrangler": "^3.63.2"
8787
}
8888
}

packages/css-data/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"@webstudio-is/tsconfig": "workspace:*",
2121
"html-tags": "^4.0.0",
2222
"mdn-data": "2.8.0",
23-
"vitest": "^3.0.8",
23+
"vitest": "^3.1.2",
2424
"zod": "^3.24.2"
2525
},
2626
"peerDependencies": {

packages/css-engine/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@webstudio-is/tsconfig": "workspace:*",
2323
"react": "18.3.0-canary-14898b6a9-20240318",
2424
"react-dom": "18.3.0-canary-14898b6a9-20240318",
25-
"vitest": "^3.0.8"
25+
"vitest": "^3.1.2"
2626
},
2727
"exports": {
2828
".": {

packages/design-system/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@webstudio-is/tsconfig": "workspace:*",
1818
"react": "18.3.0-canary-14898b6a9-20240318",
1919
"react-dom": "18.3.0-canary-14898b6a9-20240318",
20-
"vitest": "^3.0.8",
20+
"vitest": "^3.1.2",
2121
"zod": "^3.24.2"
2222
},
2323
"peerDependencies": {

0 commit comments

Comments
 (0)