ccontrols / component-controls Goto Github PK
View Code? Open in Web Editor NEWA next-generation tool to create blazing-fast documentation sites.
Home Page: https://component-controls.com/
A next-generation tool to create blazing-fast documentation sites.
Home Page: https://component-controls.com/
Describe the bug
Refresh fileInfo when saving a component
To Reproduce
Steps to reproduce the behavior:
TODO
sloc
object specifically) doesn't update to account for the additional TODExpected behavior
FileInfo should be refreshed when saving a component
My storybook crashed after I started using absolute importa on my app.
My app run fine and test ok too. Butt storybook fails to find absolute imnports
working config without absolute imports
module.exports = {
stories: ['./src/**/*.stories.(tsx|mdx)'],
addons: [
'@storybook/addon-viewport/register',
{
name: '@component-controls/storybook',
options: {
webpack: ['instrument', 'react-docgen-typescript'],
},
},
],
}
trying to make it work with absolute imports
const path = require('path')
module.exports = {
stories: ['./src/**/*.stories.(tsx|mdx)'],
addons: [
'@storybook/addon-viewport/register',
{
name: '@component-controls/storybook',
options: {
webpack: ['instrument', 'react-docgen-typescript'],
},
},
],
webpackFinal: async (config, { configType }) => {
// `configType` has a value of 'DEVELOPMENT' or 'PRODUCTION'
// You can change the configuration based on that.
// 'PRODUCTION' is used when building the static version of storybook.
config.resolve = {
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
}
// Return the altered config
return config
},
}
Using craco in a create-react-app project I'm getting the following error
Failed to compile.
./node_modules/@component-controls/base-integration/dist/store.js
Module not found: Can't resolve 'component-controls-bundle' in '/mnt/c/wsl/audience/client/node_modules/@component-controls/base-integration/dist'
My craco config file
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin')
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
const path = require('path')
const fs = require('fs')
const CracoLessPlugin = require('craco-less')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')
const sharedFiles = fs.readdirSync(path.resolve(__dirname, '..', 'shared'))
const {
withComponentControls
} = require('@component-controls/react-router-integration/webpack-build')
const publicFolder = process.env.PUBLIC_PATH || 'public'
const publicPath = path.join(__dirname, publicFolder)
const distFolder = process.env.BUILD_PATH || 'build'
const distPath = path.join(__dirname, distFolder)
process.env.REACT_APP_ENV = process.env.NODE_ENV || 'development'
process.env.PUBLIC_URL = '/'
const config = {
devServer: {
contentBase: publicPath,
historyApiFallback: true,
open: true,
hot: true
},
plugins: [
{
plugin: CracoLessPlugin,
options: {
lessLoaderOptions: {
lessOptions: {
modifyVars: { '@primary-color': '#97d700' },
javascriptEnabled: true
}
}
}
}
],
webpack: {
plugins: {
add: [
new HtmlWebpackPlugin({
template: 'public/index.html'
}),
new webpack.HotModuleReplacementPlugin()
]
},
configure: (webpackConfig) => {
if (process.env.RUN_ANALYZER) {
webpackConfig.plugins.push(new BundleAnalyzerPlugin())
}
webpackConfig.devtool = 'inline-source-map'
// Remove multiple different bn.js in bundle
webpackConfig.resolve.alias['bn.js'] = path.resolve(
__dirname,
'node_modules/bn.js'
)
webpackConfig.output = {
path: distPath,
publicPath: '/',
jsonpFunction: 'wpJson'
}
webpackConfig.entry = './src/index.js'
webpackConfig.resolve.extensions = ['.js']
return webpackConfig
}
}
}
module.exports = withComponentControls({
config,
options: { configPath: '.config', distFolder: publicFolder }
})
Hey @atanasster! Hope you're doing well.
Sorry for bothering, but I have news that might be important for you:
react-colorful v5 was just released and it doesn't require importing CSS-file.
It means that you can remove all CSS code you copied from the original repo.
Just use the CSS-in-JS solution of your choice to override the styles you need.
Error: [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\donbo\Documents\GitHub\bibwoe.com\node_modules@mdx-js\mdx\index
.js from C:\Users\donbo\Documents\GitHub\bibwoe.com\node_modules@component-controls\instrument\dist\index.js not supporte
d.
Instead change the require of C:\Users\donbo\Documents\GitHub\bibwoe.com\node_modules@mdx-js\mdx\index.js in C:\Users\don
bo\Documents\GitHub\bibwoe.com\node_modules@component-controls\instrument\dist\index.js to a dynamic import() which is av
ailable in all CommonJS modules.
index.js:7 Object.
[bibwoe.com]/[@component-controls]/instrument/dist/index.js:7:11
index.js:14 Object.
[bibwoe.com]/[@component-controls]/config/dist/index.js:14:18
index2.js:8 Object.
[bibwoe.com]/[@component-controls]/webpack-compile/dist/index2.js:8:14
index.js:7 Object.
[bibwoe.com]/[@component-controls]/webpack-compile/dist/index.js:7:13
webpack-build.js:13 Object.
[bibwoe.com]/[@component-controls]/base-integration/dist/webpack-build.js:13:22
webpack-build.js:1 Object.
[bibwoe.com]/[@component-controls]/base-integration/webpack-build.js:1:18
gatsby-node.js:8 Object.
[bibwoe.com]/[@component-controls]/gatsby-theme-stories/dist/gatsby-node.js:8:20
gatsby-node.js:1 Object.
[bibwoe.com]/[@component-controls]/gatsby-theme-stories/gatsby-node.js:1:18
Hi! Thanks for the amzing library.
I am having some issues implementing this on a project I currently working on.
// .storybook/src/stories/test.stories.tsx
import React from "react";
export default {
title: "Storybook Controls",
};
export const controlsStory = ({ disabled, text }) => (
<button disabled={disabled}>
{text}
</button>
);
controlsStory.story = {
controls: {
disabled: { type: 'boolean', value: false },
text: { type: 'text', value: 'Hello Storybook' },
}
}
module.exports = {
addons: ['@storybook/addon-docs', '@component-controls/storybook'],
}
// .storybook/config.js
import { configure } from '@storybook/react';
// automatically import all files ending in *.stories.tsx
configure(require.context('./src/stories', true, /\.stories\.tsx?$/), module);
// .storybook/main.js
module.exports = {
addons: ['@storybook/addon-docs', '@component-controls/storybook'],
}
// .storybook/webpack.config.js
module.exports = ({ config }) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
loader: require.resolve('babel-loader'),
options: {
presets: [require.resolve('babel-preset-react-app')],
},
});
config.resolve.extensions.push('.ts', '.tsx');
return config;
};
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.