johanneswuerbach / backstage-plugin-techdocs-addon-mermaid

Backstage TechDocs Mermaid Addon
MIT License
43 stars 18 forks source link

bug: installing plugin causes `yarn tsc:full` to fail #18

Closed mspiegel31 closed 1 year ago

mspiegel31 commented 1 year ago

FWIW, the plugin seems to work great locally, but it appears to break CI when added. Thanks for the great work!

Description

The Backstage docs recommend running yarn tsc:full as part of the CI process. After installing this plugin, that step fails for a backstage deploy.

Steps to reproduce

  1. create new backstage app with npx @backstage/create-app
  2. add this package: yarn add --cwd packages/app backstage-plugin-techdocs-addon-mermaid
  3. add the README snippet to the TechDocsAddons section of App.tsx:
    
      <TechDocsAddons>
        <Mermaid
          config={{
            theme: 'forest',
            themeVariables: { lineColor: '#666', arrowheadColor: '#666' },
          }}
        />
        <ReportIssue />
      </TechDocsAddons>
4. run `yarn tsc:full` from the root of the new backstage install
5. observe error (below)

[build 7/9] RUN yarn tsc:full:

0 0.285 yarn run v1.22.19

0 0.301 warning Skipping preferred cache folder "/home/node/.cache/yarn" because it is not writable.

0 0.301 warning Selected the next writable cache folder in the list, will be "/tmp/.yarn-cache-1000".

0 0.311 $ tsc --skipLibCheck false --incremental false

0 18.82 node_modules/mermaid/dist/utils.d.ts:1:30 - error TS7016: Could not find a declaration file for module 'd3'. '/app/node_modules/d3/src/index.js' implicitly has an 'any' type.

0 18.82 Try npm i --save-dev @types/d3 if it exists or add a new declaration (.d.ts) file containing declare module 'd3';

0 18.82

0 18.82 1 import { CurveFactory } from 'd3';

0 18.82 ~~~~

0 18.82

0 18.82 node_modules/mermaid/dist/utils.d.ts:83:66 - error TS1016: A required parameter cannot follow an optional parameter.

0 18.82

0 18.82 83 export declare function interpolateToCurve(interpolate?: string, defaultCurve: CurveFactory): CurveFactory;

0 18.82 ~~~~

0 18.82

0 18.82

0 18.82 Found 2 errors in the same file, starting at: node_modules/mermaid/dist/utils.d.ts:1

0 18.82

0 19.18 error Command failed with exit code 2.

0 19.18 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


failed to solve: executor failed running [/bin/sh -c yarn tsc:full]: exit code: 2

johanneswuerbach commented 1 year ago

This seems to be a problem with inside https://github.com/mermaid-js/mermaid as I get the failure only for the latest v9.3.0 release. Could you create an issue with them?