-
Notifications
You must be signed in to change notification settings - Fork 106
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
Suggestions for improving maintainability #188
Comments
Thanks for the suggestions, @mrauhu, and for checking before submitting a PR. I think it's good to talk about this kind of thing before putting in the work. I can't speak for @eirslett, and this is his project, but I'm personally on board with most of your suggestions. One area I disagree in though is the use of TypeScript. Normally I am a big fan of TypeScript, and I tend to use it in my projects. However, the experimental nature of this builder means that I'm often mucking around with it inside my node_modules of the application I'm building, and many times I've appreciated that the source is not compiled, and I can work directly with the code rather than a minified or compiled output. For that reason, at least for now, I'd recommend sticking with plain old javascript without a build step. As for switching to a different package manager, yarn is used by Storybook itself, so if it's falling down on the job we're probably doing something wrong. Can you explain what you mean by not working as it should? For eslint & prettier, there are different ways to get them to work together. One is to run prettier through eslint, and the other is to disable all the eslint style rules, and then use prettier to do formatting and eslint for other linting. Which approach do you propose? Perhaps it's best to make some small PRs instead of one large one with all the changes. I think we could get some big wins from e2e cypress tests and/or chromatic snapshots on the examples. But so far @eirslett has not had a chance to sign up for Chromatic, and none of the rest of us have permissions to do so (#154). Again, thanks for the suggestions and for the offer to help. |
If we talking about simplification of debugging process, we can:
Right now, the Storybook project is using the TypeScript for builders, as example the Webpack 5 builder: So, I suggest use the same way.
I prefer use ESLint with Prettier plugin:
module.exports = {
// ...
extends: [
'plugin:@typescript-eslint/recommended',
'plugin:prettier/recommended',
],
};
I tried to run the Vue example multiple times with different conditions (with and without:
Okay, I made small PRs. |
This all sounds good to me! I share @IanVS's concerns about working with TypeScript in Node.js: the debugging experience is not ideal. But it looks like you have some good solutions for that! Maybe we need a "Contributing" section in the README (or a separate CONTRIBUTING.md) for how to set up the development environment, debug with Node/TypeScript etc. Looking forward to the PRs! |
I think my concerns about typescript are mostly that it's more annoying to work with compiled output in node_modules, rather than the raw source. But maybe it's fine as long as we don't compile down to es5, and we configure typescript to just strip out the types. |
I think we need more information here about the issues with yarn. You've only said that it's not working. Are you receiving errors with storybook, are you receiving errors with yarn? |
@joshwooding basically, I can't run examples using Yarn.
Reproduction of the Yarn workspace related issueLet's try running the Vue example in a clean environment:
SystemOutput
ErrorsServer-side
Client-side
Maybe it's an OS related issue?! Let's go, try the same in a isolated environment. Docker
FROM node:lts-alpine
ARG PORT=7007
ENV PORT=${PORT}
RUN apk add --no-cache git
WORKDIR /app
RUN git clone https://github.com/eirslett/storybook-builder-vite
WORKDIR /app/storybook-builder-vite
RUN yarn
RUN
EXPOSE ${PORT}/tcp
CMD yarn workspace example-vue storybook -p ${PORT}
version: '3'
services:
example:
build: .
ports:
- "127.0.0.1:7007:7007"
ErrorsNot changed at all: Server-side
Client-side
So, after this experiments, I suggest to change the package manager. |
Weird, this all worked for me previously. Maybe this is an issue with an updated dependency. I'm going to do a little investigation. |
Found this while looking for issues around using emotion with this builder, worth mentioning that we recently moved from cypress to playwright. It greatly simplified our tests, and removed a tonne of code needed to do basic tasks in cypress. Highly recommend checking it out, cypress is incredibly painful to develop on compared to playwright in my experience. |
@Codex- thank you for suggestion, I will check out the Playwright solution. |
Hello.
I want to implement best practices in tooling that inspired by Storybook and Vite repositories.
The goal is to make it easier for maintainers to participate in the project.
Related: #11
Checklist
Zero changes to the
storybook-builder-vite
package codeESLint and Prettier #193
package.json
to.prettierrc
..editorconfig
with the Prettier standard.Testing
Documentation #200
CONTRIBUTING.md
.Docker #202
docker-compose.yml
with CI and Storybook services.Minor changes to the package code: syntax and typing
Run
lint
#196lint
on all codebase.packages/storybook-builder-vite
directory..git-blame-ignore-revs
file.TypeScript #195
tsconfig.json
for comfort debugging).*.js
to*.ts
.Minor changes in examples
package.json
and Github ActionsWorkspaces: use NPM or Pnpm, because Yarn is not working out of the box like it should be.
Details: Suggestions for improving maintainability #188 (comment)
@eirslett, @IanVS
May I create a one pull request with all suggested features?
Best wishes,
Sergey.
The text was updated successfully, but these errors were encountered: