-
Notifications
You must be signed in to change notification settings - Fork 0
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
Improvements #13
Improvements #13
Conversation
This reverts commit 98748b8
package-templates/react/package.json
Outdated
"start": "start-storybook -p 3000 --ci --config-dir ../../.storybook", | ||
"start:ssr-preview": "SSR=true start-storybook -p 3000 --ci --preview-url=/ssr-iframe --config-dir ../../.storybook", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idea: Extract to ../../scripts/start-storybook
and ../../scripts/start-ssr-storybook
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or start from root and serve all storybooks?
packages/components/package.json
Outdated
"start": "start-storybook -p 3000 --ci --config-dir ../../.storybook", | ||
"start:ssr-preview": "SSR=true start-storybook -p 3000 --ci --preview-url=/ssr-iframe --config-dir ../../.storybook", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -2,9 +2,10 @@ const path = require('path'); | |||
const sassFunctions = require('sass-functions'); | |||
const sass = require('sass'); | |||
|
|||
const ROOT_PKG_PATH = path.join(__dirname, '../../../'); | |||
const ROOT_PKG_PATH = path.join(__dirname, '../'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will we run storybook from root or from packages? ⚖️ about the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost yes but I think it would make a difference in load times. SSR-preview is already pretty slow because it has to load all stories of ONE package but we load all stories in all packages it could get worse.
I think it's ok for subpackages to have their own start
, lint
, build
scripts
.storybook/ssr/src/index.jsx
Outdated
@@ -23,7 +23,7 @@ const forceServerSideRender = (story) => { | |||
|
|||
const api = start(render); | |||
|
|||
require(`${PKG_PATH}/.storybook/preview-ssr`); | |||
require(`root-pkg/.storybook/preview-ssr`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do same as in core app? @
or @root
and @package
?
@@ -1,7 +1,7 @@ | |||
const path = require('path'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we placed .eslintrc.js/babel/mocha at the root wouldn't it work without package configs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes it works, I removed the 'extend' part.
But still, we need those custom rules for no-extraneous-dependencies until there is a better solution for that problem.
import-js/eslint-plugin-import#1174
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there seem to be several options within the thread you posted, none work? or maybe disable package checking altogether for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- tried eslint-import-resolver-lerna with little success
- Didn't want to do the crazy stuff this user did Enhancement: Monorepos and no-extraneous-dependencies import-js/eslint-plugin-import#1174 (comment) Would rather have subpackage specific eslintrc.js for now
package-templates/react/package.json
Outdated
"start": "start-storybook -p 3000 --ci --config-dir ../../.storybook", | ||
"start:ssr-preview": "SSR=true start-storybook -p 3000 --ci --preview-url=/ssr-iframe --config-dir ../../.storybook", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or start from root and serve all storybooks?
.storybook/ssr/src/index.jsx
Outdated
@@ -23,7 +23,7 @@ const forceServerSideRender = (story) => { | |||
|
|||
const api = start(render); | |||
|
|||
require(`${PKG_PATH}/.storybook/preview-ssr`); | |||
require(`@root/.storybook/preview-ssr`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require(`@root/.storybook/preview-ssr`); | |
require('@root/.storybook/preview-ssr'); |
.storybook/ssr/utils.js
Outdated
const matchWebpackTest = (file, test) => ( | ||
test instanceof RegExp | ||
? test.test(file) | ||
: test === file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string? perhaps use .includes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this line is actually needed at all. Almost all rules use a regex test
(at least the ones we want to target here).
A string test
may need a more complex check because file path could be relative or something like that? Not sure?
I suggest: Always return false for strings and add a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure myself, leave a comment yes
@@ -1,3 +1,6 @@ | |||
const PKG_PATH = process.cwd(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not .babelrc
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like .babelrc.js doesn't get resolved.
.babelrc -> json, .babelrc.js -> not working
mocha.config.js
Outdated
module.exports = { | ||
require: '@babel/register', | ||
require: path.join(__dirname, '.mocha/babel-require.js'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we do the .mocha/babel-require.js
right in this file and then let it require itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what you mean. Had to extract the whole require part to babel-require.js because I have to pass options to babel. Found no other way to do that
@@ -1,7 +1,7 @@ | |||
const path = require('path'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there seem to be several options within the thread you posted, none work? or maybe disable package checking altogether for now?
package-templates/react/.mocharc.js
Outdated
@@ -1 +1 @@ | |||
module.exports = require("../../presets/mocha.config.js"); | |||
module.exports = require("../../mocha.config.js"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
module.exports = require("../../mocha.config.js"); | |
module.exports = require('../../mocha.config.js'); |
i think this file shouldn't be needed, any reason to have it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, you are right. Should be removed. Thought mocha doesn't have config lookup like babel does but after renaming mocha.config.js to .mocharc.js it worked
"start": "start-storybook -p 3000 --ci", | ||
"start:ssr-preview": "SSR=true start-storybook -p 3000 --ci --preview-url=/ssr-iframe", | ||
"start": "../../scripts/start-storybook", | ||
"start:ssr-preview": "../../scripts/start-storybook --ssr-preview", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we default to SSR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, SSR is much slower.
@@ -1 +1 @@ | |||
module.exports = require("../../presets/mocha.config.js"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
packages/map/.mocharc.js
Outdated
@@ -1 +1 @@ | |||
module.exports = require("../../presets/mocha.config.js"); | |||
module.exports = require("../../mocha.config.js"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
https://favro.com/organization/aee06c3fe6503c804f507dd9/22c630cc02b09f2d6f98b8b3?card=Goo-30301