Skip to content

Commit

Permalink
Merge pull request #112 from InseeFr/feat/upgrade-storybook-and-stories
Browse files Browse the repository at this point in the history
feat:config-storybook
  • Loading branch information
jdirand authored Oct 16, 2023
2 parents 41cc003 + e0ee395 commit a08e2eb
Show file tree
Hide file tree
Showing 86 changed files with 176,667 additions and 8,372 deletions.
18 changes: 18 additions & 0 deletions .babelrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"targets": {
"chrome": 100,
"safari": 15,
"firefox": 91
}
}
],
"@babel/preset-typescript",
"@babel/preset-react"
],
"plugins": []
}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
needs: test_lint
strategy:
matrix:
node: ["16", "17"]
node: ["16", "18"]
os: [ubuntu-latest]
name: Test with Node v${{ matrix.node }} on ${{ matrix.os }}
steps:
Expand Down
51 changes: 0 additions & 51 deletions .github/workflows/jekyll-gh-pages.yml

This file was deleted.

74 changes: 37 additions & 37 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,50 @@
name: Deploy to GitHub Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
- run: npm run build-storybook
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: "./storybook-static"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- run: |
if [ -e yarn.lock ]; then
yarn install --frozen-lockfile
elif [ -e package-lock.json ]; then
npm ci
else
npm i
fi
- run: npm run build-storybook
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: "./storybook-static"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,12 @@ jspm_packages
*.tgz

storybook-static/

# Yarn 3 files
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
79 changes: 45 additions & 34 deletions .storybook/main.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,57 @@
const config = require("process");
const path = require("path");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
import config from "process";
import { resolve } from "path";
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";

module.exports = {
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
addons: [
export const stories = ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"];
export const staticDirs = ["../public"];
export const features = {
storyStoreV7: false,
};
export const addons = [
{
name: "@storybook/addon-docs",
options: {
configureJSX: true,
babelOptions: {},
sourceLoaderOptions: null,
transcludeMarkdown: true,
},
},
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
],
framework: "@storybook/react",
core: {
builder: "@storybook/builder-webpack5",
},

webpackFinal: async (config, { configType }) => {
"@storybook/addon-mdx-gfm",
];
export const framework = {
name: "@storybook/react-webpack5",
options: { fastRefresh: true },
};
export async function webpackFinal(config, { configType }) {
config.module.rules.push({
test: /\.scss$/,
use: ["style-loader", "css-loader", "sass-loader"],
include: path.resolve(__dirname, "../"),
test: /\.scss$/,
use: ["style-loader", "css-loader", "sass-loader"],
include: resolve(__dirname, "../"),
});

config.resolve = {
extensions: [".js", ".jsx", ".ts", ".tsx"],
modules: [
...(config.resolve.modules || []),
path.resolve(__dirname, "../src"),
],
fallback: {
...(config.resolve || {}).fallback,
fs: false,
stream: false,
os: false,
},
plugins: [
...(config.resolve.plugins || []),
new TsconfigPathsPlugin({
extensions: config.resolve.extensions,
}),
],
extensions: [".js", ".jsx", ".ts", ".tsx"],
modules: [...(config.resolve.modules || []), resolve(__dirname, "../src")],
fallback: {
...(config.resolve || {}).fallback,
fs: false,
stream: false,
os: false,
},
plugins: [
...(config.resolve.plugins || []),
new TsconfigPathsPlugin({
extensions: config.resolve.extensions,
}),
],
};

return config;
},
}
export const docs = {
autodocs: true,
};
14 changes: 7 additions & 7 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const parameters = {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/,
},
},
},
}
};
Loading

0 comments on commit a08e2eb

Please sign in to comment.