question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. Itย collects links to all the places you might be looking at while hunting down a tough bug.

And, if youโ€™re still stuck at the end, weโ€™re happy to hop on a call to see how we can help out.

Suggestions for improving maintainability

See original GitHub issue

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 code

ESLint and Prettier https://github.com/eirslett/storybook-builder-vite/pull/193

  • Move the Prettier configuration from package.json to .prettierrc.
  • Synchronize .editorconfig with the Prettier standard.
  • Add ESLint with Prettier config.
  • Add the TypeScript plugin to ESlint.
  • Run Prettier before ESLint

Testing

  • Add Jest for unit testing.
  • Add Cypress for E2E testing.
  • Running tests on a pull request and publish events.

Documentation https://github.com/eirslett/storybook-builder-vite/pull/200

  • Create a guide for developers in CONTRIBUTING.md.
  • Add scripts for running examples.

Docker https://github.com/eirslett/storybook-builder-vite/pull/202

  • Create docker-compose.yml with CI and Storybook services.
  • Add scripts for Docker compose services.

Minor changes to the package code: syntax and typing

Run lint https://github.com/eirslett/storybook-builder-vite/pull/196

  • Run lint on all codebase.
  • Fix code inspection warnings from a JetBrains IDE for the packages/storybook-builder-vite directory.
  • Create .git-blame-ignore-revs file.

TypeScript https://github.com/eirslett/storybook-builder-vite/pull/195

  • Use TypeScript (with right tsconfig.json for comfort debugging).
  • Convert all codebase from *.js to *.ts.
  • Typization.

Minor changes in examples package.json and Github Actions

@eirslett, @IanVS

May I create a one pull request with all suggested features?

Best wishes, Sergey.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
mrauhucommented, Jan 5, 2022

I think we need more information here about the issues with yarn.

@joshwooding basically, I canโ€™t run examples using Yarn.

Youโ€™ve only said that itโ€™s not working. Are you receiving errors with storybook, are you receiving errors with yarn?

Reproduction of the Yarn workspace related issue

Letโ€™s try running the Vue example in a clean environment:

git clone https://github.com/eirslett/storybook-builder-vite
cd storybook-builder-vite
yarn
yarn workspace example-vue storybook

System

Output
C:\Work\storybook\storybook-builder-vite>yarn workspace example-vue storybook
info @storybook/vue3 v6.4.3
info
info => Loading presets
Pre-bundling dependencies:
  @base2/pretty-print-object
  @emotion/core
  @emotion/is-prop-valid
  @emotion/styled
  @mdx-js/react
  (...and 77 more)
(this will be run only when your dependencies or config have changed)
info => Using prebuilt manager
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚                                                    โ”‚
โ”‚   Storybook 6.4.3 for Vue3 started                 โ”‚
โ”‚   14 s for preview                                 โ”‚
โ”‚                                                    โ”‚
โ”‚    Local:            http://localhost:51916/       โ”‚
โ”‚    On your network:  http://172.20.192.1:51916/    โ”‚
โ”‚                                                    โ”‚
โ”‚   A new version (6.4.9) is available!              โ”‚
โ”‚                                                    โ”‚
โ”‚   Upgrade now: npx sb@latest upgrade               โ”‚
โ”‚                                                    โ”‚
โ”‚   Read full changelog: https://git.io/fhFYe        โ”‚
โ”‚                                                    โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
18:20:13 [vite] Internal server error: Failed to resolve import "@vue/server-renderer" from "stories\Button.vue". Does the file exist?
  Plugin: vite:import-analysis
  File: C:/Work/storybook/storybook-builder-vite/packages/example-vue/stories/Button.vue
  65 |  import { ssrRenderAttrs as _ssrRenderAttrs, ssrInterpolate as _ssrInterpolate } from "@vue/server-renderer"
  66 |
  67 |  function _sfc_ssrRender(_ctx, _push, _parent, _attrs, $props, $setup, $data, $options) {
     |                                         ^
  68 |    _push(`<button${
  69 |      _ssrRenderAttrs(_mergeProps({
      at formatError (C:\Work\storybook\storybook-builder-vite\node_modules\vite\dist\node\chunks\dep-7e125991.js:42587:46)
      at TransformContext.error (C:\Work\storybook\storybook-builder-vite\node_modules\vite\dist\node\chunks\dep-7e125991.js:42583:19)
      at normalizeUrl (C:\Work\storybook\storybook-builder-vite\node_modules\vite\dist\node\chunks\dep-7e125991.js:80909:26)
      at async TransformContext.transform (C:\Work\storybook\storybook-builder-vite\node_modules\vite\dist\node\chunks\dep-7e125991.js:81049:57)
      at async Object.transform (C:\Work\storybook\storybook-builder-vite\node_modules\vite\dist\node\chunks\dep-7e125991.js:42803:30)
      at async doTransform (C:\Work\storybook\storybook-builder-vite\node_modules\vite\dist\node\chunks\dep-7e125991.js:57478:29)

Errors

Server-side

[vite] Internal server error: Failed to resolve import "@vue/server-renderer" from "stories\*.vue". Does the file exist?

image

Client-side

GET http://localhost:51916/stories/*.vue net::ERR_ABORTED 404 (Not Found) *.stories.js

image

Maybe itโ€™s an OS related issue?!

Letโ€™s go, try the same in a isolated environment.

Docker

Dockerfile

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}

docker-compose.yml

version: '3'

services:
  example:
    build: .
    ports:
      - "127.0.0.1:7007:7007"
docker-compose up --build example

Errors

Not changed at all:

Server-side

[vite] Internal server error: Failed to resolve import "@vue/server-renderer" from "stories/*.vue". Does the file exist?

image

Client-side

GET http://localhost:7007/stories/*.vue net::ERR_ABORTED 404 (Not Found) *.stories.js

image

So, after this experiments, I suggest to change the package manager.

1reaction
mrauhucommented, Feb 14, 2022

@Codex- thank you for suggestion, I will check out the Playwright solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

13 Ways to Improve Maintainability - Coveros
13 Ways to Improve Maintainability ยท Follow a clean and consistent coding standard ยท Use human readable and sensible names ยท Be clear...
Read more >
How to improve the maintainability of critical assets
Four ways to improve maintainability by improving data collection, organizational capabilities, proactive maintenance and using a CMMS.
Read more >
The Compact Guide to Web Maintainability: 200 Tips and ...
The 9 Pillars of Maintainability ยท Be Clear About Maintenance ยท Plan ยท Do It Yourself ยท Keep It Simple ยท Adhere to...
Read more >
Developing maintainable software
Design for maintainability from the outset; Iterative development and regular reviews help to improve quality - see the section below; Readable code is...
Read more >
Methods for Improving the Maintainability of Application ...
Improving software's maintainability not only reduces ... 3 Research questions: How to improve maintainability? ... 5.1.4 Ideas for improving audits .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found