ni / nimble

The NI Nimble Design System
https://nimble.ni.dev
MIT License
29 stars 9 forks source link

Storybook build intermittent #2179

Closed rajsite closed 2 weeks ago

rajsite commented 3 weeks ago

🧹 Tech Debt

The storybook build from a clean build is intermittent. It seems to have started after the lint changes in https://github.com/ni/nimble/pull/2168 but the causality isn't clear.

Workaround is to retry the build / re-ruun the CI job.

Example builds: https://github.com/ni/nimble/actions/runs/9422583281/job/25959187261 https://github.com/ni/nimble/actions/runs/9421548135/job/25955858939

The build errors look like the following:

Module build failed (from ../../node_modules/ts-loader/index.js):
Error: TypeScript emitted no output for ./src/docs/component-status.stories.ts.
    at makeSourceMapAndFinish (/home/runner/work/nimble/nimble/node_modules/ts-loader/dist/index.js:55:18)
    at successLoader (/home/runner/work/nimble/nimble/node_modules/ts-loader/dist/index.js:42:5)
    at Object.loader (/home/runner/work/nimble/nimble/node_modules/ts-loader/dist/index.js:23:5)
Module build failed (from ../../node_modules/ts-loader/index.js):
Error: TypeScript emitted no output for ./src/nimble/anchor-button/anchor-button-matrix.stories.ts.
    at makeSourceMapAndFinish (/home/runner/work/nimble/nimble/node_modules/ts-loader/dist/index.js:55:18)
    at successLoader (/home/runner/work/nimble/nimble/node_modules/ts-loader/dist/index.js:42:5)
    at Object.loader (/home/runner/work/nimble/nimble/node_modules/ts-loader/dist/index.js:23:5)

[... repeated for each story]

Error: TypeScript emitted no output for ./src/utilities/states.ts.
    at makeSourceMapAndFinish (/home/runner/work/nimble/nimble/node_modules/ts-loader/dist/index.js:55:18)
    at successLoader (/home/runner/work/nimble/nimble/node_modules/ts-loader/dist/index.js:42:5)
    at Object.loader (/home/runner/work/nimble/nimble/node_modules/ts-loader/dist/index.js:23:5)
[tsl] ERROR in /home/runner/work/nimble/nimble/packages/nimble-components/src/utilities/unit-format/default-unit-format.ts(38,9)
      TS2322: Type '{ maximumSignificantDigits: number; maximumFractionDigits: number; roundingPriority: string; signDisplay: "auto" | "never" | "always" | "exceptZero" | undefined; }' is not assignable to type 'NumberFormatOptions'.
  Object literal may only specify known properties, and 'roundingPriority' does not exist in type 'NumberFormatOptions'.
=> Failed to build the preview
SB_BUILDER-WEBPACK5_0003 (WebpackCompilationError): There were problems when compiling your code with Webpack.
Run Storybook with --debug-webpack for more information.
    at /home/runner/work/nimble/nimble/node_modules/@storybook/builder-webpack5/dist/index.js:1:9328
    at /home/runner/work/nimble/nimble/node_modules/webpack/lib/HookWebpackError.js:68:3
    at Hook.eval [as callAsync] (eval at create (/home/runner/work/nimble/nimble/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/runner/work/nimble/nimble/node_modules/tapable/lib/Hook.js:18:14)
    at Cache.shutdown (/home/runner/work/nimble/nimble/node_modules/webpack/lib/Cache.js:156:23)
    at /home/runner/work/nimble/nimble/node_modules/webpack/lib/Compiler.js:1358:15
    at Hook.eval [as callAsync] (eval at create (/home/runner/work/nimble/nimble/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/runner/work/nimble/nimble/node_modules/tapable/lib/Hook.js:18:14)
    at Compiler.close (/home/runner/work/nimble/nimble/node_modules/webpack/lib/Compiler.js:1351:23)
    at /home/runner/work/nimble/nimble/node_modules/@storybook/builder-webpack5/dist/index.js:1:9313
rajsite commented 3 weeks ago

I think it may be related to the addition of https://github.com/ni/nimble/blob/main/packages/storybook/.storybook/blocks/tsconfig.json

theory is sb build intermittently finds that file and causes the noEmit setting to impact the full build instead of just that file

m-akinc commented 2 weeks ago

It looks like TypeScript 5.5 will include roundingPriority in the definition of NumberFormatOptions, so we can remove our monkey-patched declaration. It's scheduled to be released a week from now (6/18). I wonder if there will be a subsequent patch release of Angular 17 that supports it. If not, we'll have to find another fix or hurry up and get on Angular 18.

rajsite commented 2 weeks ago

While the rounding priority shows up in related logs I don't think it's the crux of this issue. but seems like something we can track separately.