Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrades project to storybook v7 and updates all dependencies #48

Merged
merged 17 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-typescript",
"@babel/preset-react"
]
}
9 changes: 5 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ module.exports = {
'@typescript-eslint',
],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
'prettier',
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
"prettier",
"plugin:storybook/recommended"
],
};
8 changes: 4 additions & 4 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Required to retrieve git history
- uses: actions/setup-node@v2
- uses: actions/setup-node@v3
with:
node-version: '12'
node-version: 20
- run: npm ci
- uses: chromaui/action@v1
- uses: chromaui/action@latest
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
node-version: 20
- run: npm ci
- run: npm test
- uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
43 changes: 32 additions & 11 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
const path = require("path");

module.exports = {
core: {
builder: "webpack5",
},
stories: ["../src/**/*.stories.tsx"],

// Add any Storybook addons you want here: https://storybook.js.org/addons/
addons: [
'@storybook/addon-essentials',
],
addons: ['@storybook/addon-essentials', "@storybook/addon-styling-webpack", ({
name: "@storybook/addon-styling-webpack",

options: {
rules: [{
test: /\.css$/,
sideEffects: true,
use: [
require.resolve("style-loader"),
{
loader: require.resolve("css-loader"),
options: {


},
},
],
},],
}
})],

webpackFinal: async (config) => {
config.module.rules.push({
test: /\.scss$/,
Expand All @@ -35,15 +51,20 @@ module.exports = {

config.module.rules.push({
test: /\.svg$/u,
use: [
{
loader: "@svgr/webpack",
},
],
use: ["@svgr/webpack"],
});

config.resolve.extensions.push(".svg");

return config;
},

framework: {
name: "@storybook/react-webpack5",
options: {}
},

docs: {
autodocs: true
}
};
3 changes: 0 additions & 3 deletions .svgrrc.js

This file was deleted.

8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ Shared Frontend Components for SRF applications
- [Sass](https://sass-lang.com/)
- [TypeScript](https://www.typescriptlang.org/)
- [Storybook](https://storybook.js.org/) to help you create and show off your components
- [Jest](https://jestjs.io/) and [React Testing Library](https://github.com/testing-library/react-testing-library) enabling testing of the components

## Usage

Expand Down Expand Up @@ -86,12 +85,6 @@ In case this solution doesn't work for your usecase. It is possible to adjust th

ℹ️ If you have to update the _secrets_ (e.g. `CHROMATIC_PROJECT_TOKEN` for deployment to chromatic or `NPM_TOKEN` for deploying on NPM), you can change them on https://github.com/mmz-srf/feathers/settings/secrets/actions

### Testing

```
npm run test
```

### Building

```
Expand Down Expand Up @@ -127,7 +120,6 @@ This will generate:
/YourComponentName
YourComponentName.tsx
YourComponentName.stories.tsx
YourComponentName.test.tsx
YourComponentName.types.ts
YourComponentName.scss
```
Expand Down
16 changes: 0 additions & 16 deletions jest.config.js

This file was deleted.

1 change: 0 additions & 1 deletion jest.setup.ts

This file was deleted.

Loading