Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

WIP: fix Storybook#587

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
ShMcK wants to merge3 commits intomaster
base:master
Choose a base branch
Loading
fromfix/storybook
Open
Show file tree
Hide file tree
Changes fromall 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
67 changes: 67 additions & 0 deletionsweb-app/.babelrc.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
{
"sourceType": "unambiguous",
"presets": [
[
"@babel/preset-env",
{
"shippedProposals": true,
"loose": true
}
],
"@babel/preset-typescript"
],
"plugins": [
"@babel/plugin-transform-shorthand-properties",
"@babel/plugin-transform-block-scoping",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
[
"@babel/plugin-proposal-class-properties",
{
"loose": true
}
],
[
"@babel/plugin-proposal-private-property-in-object",
{
"loose": true
}
],
[
"@babel/plugin-proposal-private-methods",
{
"loose": true
}
],
"@babel/plugin-proposal-export-default-from",
"@babel/plugin-syntax-dynamic-import",
[
"@babel/plugin-proposal-object-rest-spread",
{
"loose": true,
"useBuiltIns": true
}
],
"@babel/plugin-transform-classes",
"@babel/plugin-transform-arrow-functions",
"@babel/plugin-transform-parameters",
"@babel/plugin-transform-destructuring",
"@babel/plugin-transform-spread",
"@babel/plugin-transform-for-of",
"babel-plugin-macros",
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
[
"babel-plugin-polyfill-corejs3",
{
"method": "usage-global",
"absoluteImports": "core-js",
"version": "3.21.1"
}
]
]
}
3 changes: 0 additions & 3 deletionsweb-app/.storybook/addons.ts
View file
Open in desktop

This file was deleted.

19 changes: 0 additions & 19 deletionsweb-app/.storybook/config.ts
View file
Open in desktop

This file was deleted.

21 changes: 21 additions & 0 deletionsweb-app/.storybook/main.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
// import '../src/styles/reset.css'

// setup acquireVsCodeApi mock
// @ts-ignore
global.acquireVsCodeApi = () => ({
postMessage(event) {
console.log('ERROR: VSCode did not load properly in CodeRoad extension', event)
},
})

module.exports = {
core: {
builder: 'webpack5',
},
stories: ['../stories/Temp.stories.tsx'],
addons: ['@storybook/addon-actions', '@storybook/addon-knobs', '@storybook/addon-links'],
babel: async (options) => ({
...options,
presets: [...options.presets, '@emotion/babel-preset-css-prop', '@babel/preset-react'],
}),
}
25 changes: 7 additions & 18 deletionsweb-app/.storybook/webpack.config.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,27 +12,16 @@ module.exports = ({ config }) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: require.resolve('babel-loader'),
options: {
plugins: [
new MiniCssExtractPlugin(),
[
'babel-plugin-import',
{
libraryName: '@alifd/next',
style: true,
},
],
],
presets: [
// react-app
['react-app', { flow: false, typescript: true }],
// allow emotion css prop on html
['@emotion/babel-preset-css-prop'],
],
},
})

config.plugins.push(new MiniCssExtractPlugin({ filename: '[name].css' }))
// config.plugins.push([
// 'babel-plugin-import',
// {
// libraryName: '@alifd/next',
// style: true,
// },
// ])
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I worry some components may not work without @alifd/next and emotion support. But I may be wrong!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I've updated my branch. I've also enabled the plugin. Seems to be working.


config.resolve.extensions.push('.ts', '.tsx')

Expand Down
17 changes: 11 additions & 6 deletionsweb-app/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -45,12 +45,16 @@
},
"devDependencies": {
"@babel/core": "7.14.0",
"@storybook/addon-actions": "6.4.0",
"@babel/helper-environment-visitor": "7.16.7",
"@babel/preset-react": "7.16.7",
"@storybook/addon-actions": "6.4.19",
"@storybook/addon-knobs": "6.4.0",
"@storybook/addon-links": "6.4.0",
"@storybook/addons": "6.4.0",
"@storybook/preset-create-react-app": "3.2.0",
"@storybook/react": "6.4.0",
"@storybook/addon-links": "6.4.19",
"@storybook/addons": "6.4.19",
"@storybook/builder-webpack5": "6.4.19",
"@storybook/manager-webpack5": "6.4.19",
"@storybook/preset-create-react-app": "4.1.0",
"@storybook/react": "6.4.19",
"@types/git-url-parse": "9.0.1",
"@types/graphql": "14.5.0",
"@types/highlight.js": "10.1.0",
Expand All@@ -72,6 +76,7 @@
"react-scripts": "4.0.3",
"sass-loader": "12.3.0",
"source-map-explorer": "2.5.2",
"typescript": "4.4.4"
"typescript": "4.4.4",
"webpack": "5"
}
}
16 changes: 16 additions & 0 deletionsweb-app/stories/Temp.stories.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
// Button.stories.js|jsx

import React from 'react'

const Button = ({ primary, children }) => <button>{children}</button>

export default {
/* 👇 The title prop is optional.
* See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
* to learn how to generate automatic titles
*/
title: 'Button',
component: Button,
}

export const Primary = () => <Button primary>Button</Button>
Loading

[8]ページ先頭

©2009-2025 Movatter.jp