Skip to content
This repository was archived by the owner on Dec 22, 2024. It is now read-only.

Commit f587f97

Browse files
authored
Merge pull request #117 from openscript-ch/migrate-to-vite-3
Migrate to vite 4
2 parents d8333fc + ddba5ca commit f587f97

File tree

11 files changed

+25492
-34291
lines changed

11 files changed

+25492
-34291
lines changed

.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.145.1/containers/typescript-node/.devcontainer/base.Dockerfile
22

3-
ARG VARIANT="16-bullseye"
3+
ARG VARIANT="18-bullseye"
44
FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT}
55

66
# [Optional] Uncomment this section to install additional OS packages.

.devcontainer/devcontainer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "react-vite-storybook-typescript-starter",
33
"build": {
44
"dockerfile": "Dockerfile",
5-
"args": { "VARIANT": "16" }
5+
"args": { "VARIANT": "18-bullseye" }
66
},
77

88
// Add the IDs of extensions you want installed when the container is created.
@@ -22,7 +22,7 @@
2222
// "forwardPorts": [],
2323

2424
// Use 'postCreateCommand' to run commands after the container is created.
25-
"postCreateCommand": "npm install"
25+
"postCreateCommand": "npm install --legacy-peer-deps"
2626

2727
// Uncomment to connect as a non-root user. See https://aka.ms/vscode-remote/containers/non-root.
2828
// "remoteUser": "node"

.eslintrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ module.exports = {
2727
'import/no-extraneous-dependencies': 'off',
2828
'react/require-default-props': 'off',
2929
'react/jsx-fragments': ['error', 'element'],
30+
'react/no-unknown-property': ['error', { ignore: ['css'] }],
3031
},
3132
};

.github/workflows/cd-npm.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@ jobs:
1313
- name: Checkout repo
1414
uses: actions/checkout@v3
1515
with:
16-
fetch-depth: '0'
16+
fetch-depth: '1'
1717

1818
- name: Configure node for npmjs.org as registry
1919
uses: actions/setup-node@v3
2020
with:
21-
node-version: '16.x'
21+
node-version: '18.x'
2222
registry-url: 'https://registry.npmjs.org'
2323

2424
- name: Install dependencies
25-
run: npm ci
25+
run: npm ci --legacy-peer-deps
2626

2727
- name: Build
2828
run: npm run build

.github/workflows/cd-storybook.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
- name: Use nodejs
1818
uses: actions/setup-node@v3
1919
with:
20-
node-version: '16.x'
20+
node-version: '18.x'
2121

2222
- name: Install dependencies
23-
run: npm ci
23+
run: npm ci --legacy-peer-deps
2424

2525
- name: Build storybook
2626
run: npm run build:storybook

.github/workflows/check-size.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@ jobs:
1515
- name: Checkout repo
1616
uses: actions/checkout@v3
1717

18+
- name: Use nodejs
19+
uses: actions/setup-node@v3
20+
with:
21+
node-version: '18.x'
22+
23+
- name: Install dependencies
24+
run: npm ci --legacy-peer-deps
25+
1826
- uses: andresz1/size-limit-action@v1
1927
with:
2028
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
skip_step: install

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ${{ matrix.os }}
99
strategy:
1010
matrix:
11-
node: ['14.x', '16.x']
11+
node: ['18.x']
1212
os: [ubuntu-latest, windows-latest, macOS-latest]
1313

1414
steps:
@@ -22,7 +22,7 @@ jobs:
2222
cache: npm
2323

2424
- name: Install dependencies
25-
run: npm ci
25+
run: npm ci --legacy-peer-deps
2626

2727
- name: Check format
2828
run: npm run check:format

.storybook/main.js

100644100755
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
11
const react = require("@vitejs/plugin-react");
2-
32
module.exports = {
43
stories: ["../stories/Start.stories.mdx", "../stories/**/*.stories.mdx", "../stories/**/*.stories.@(js|jsx|ts|tsx)"],
5-
staticDirs: [{ from: '../docs', to: '/docs'}],
4+
staticDirs: [{
5+
from: '../docs',
6+
to: '/docs'
7+
}],
68
addons: [{
79
name: '@storybook/addon-docs',
810
options: {
911
configureJSX: true,
1012
transcludeMarkdown: true
1113
}
1214
}, "@storybook/addon-links", "@storybook/addon-essentials", "@storybook/addon-storysource"],
13-
core: {
14-
"builder": "@storybook/builder-vite"
15-
},
16-
1715
async viteFinal(config, {
1816
configType
1917
}) {
2018
config.plugins = config.plugins.filter(plugin => !(Array.isArray(plugin) && plugin[0]?.name.includes("vite:react")));
21-
2219
if (config.optimizeDeps) {
2320
config.optimizeDeps.include = [...(config.optimizeDeps.include || []), '@emotion/react/jsx-dev-runtime'];
2421
}
25-
2622
config.plugins.push(react({
2723
exclude: [/\.stories\.(t|j)sx?$/, /node_modules/],
2824
jsxImportSource: "@emotion/react",
2925
babel: {
3026
plugins: ["@emotion/babel-plugin"]
3127
}
3228
}));
33-
3429
if (configType === "PRODUCTION") {
35-
return { ...config,
30+
return {
31+
...config,
3632
base: './'
3733
};
3834
}
39-
4035
return config;
36+
},
37+
framework: {
38+
name: "@storybook/react-vite",
39+
options: {}
40+
},
41+
docs: {
42+
docsPage: "automatic"
4143
}
42-
43-
};
44+
};

0 commit comments

Comments
 (0)