abcdmku 3c2c46247d
fix(storybook): update version check (#27278)
Previously the check would see if the version of storybook is less than
7 and would throw an error. This causes an issue when testing canary
releases of storybook since they are labeled 0.0.0-[pr-info...]

Update pleaseUpgrade text

One of the checks is to see if storybook is less than 7. The text is
updated so it matches for the very unlikely scenario that someone with
version 5 or lower runs this plugin.

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
The storybook plugin throws and error if the storybook version [is less
than
7](239f47c8d0/packages/storybook/src/executors/storybook/storybook.impl.ts (L17-L20)).

```ts
const storybook7 = storybookMajorVersion() >= 7;
if (!storybook7) {
  throw pleaseUpgrade();
}
```

When testing a canary release for storybook the version is 0.0.0-[pr
info] so when spinning up storybook it will display:

```
> nx run component-lib:storybook

 NX   

    Storybook 6 is no longer maintained, and not supported in Nx. 
    Please upgrade to Storybook 7.

    Here is a guide on how to upgrade:
    https://nx.dev/nx-api/storybook/generators/migrate-7

```

## Expected Behavior
Storybook spins up when running a canary release. Modifying the version
check to not include v0 solves the problem:
```ts
const sbVersion = storybookMajorVersion();
const sbLessThan7 = sbVersion < 7 && sbVersion > 0;

if (sbLessThan7) {
  throw pleaseUpgrade();
}
```

then running Storybook with that modification:

```
╭──────────────────────────────────────────────────────────────────────╮
│                                                                      │
│   Storybook 0.0.0-pr-28752-sha-a65743e5 for react-webpack5 started   │
│   307 ms for manager and 7.73 s for preview                          │
│                                                                      │
│    Local:            http://localhost:4402/                          │
│    On your network:  http://192.168.4.41:4402/                       │
│                                                                      │
╰──────────────────────────────────────────────────────────────────────╯
```

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27277
2024-08-12 10:39:53 +01:00
2019-03-07 13:23:11 -05:00
2024-08-09 13:57:34 -04:00

Nx - Smart Monorepos · Fast CI

CircleCI License NPM Version Semantic Release Commitizen friendly Join the chat at https://gitter.im/nrwl-nx/community Join the Official Nx Discord Server


Smart Monorepos · Fast CI

Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.

Create a new Nx workspace with

npx create-nx-workspace

...or run

npx nx init

to add Nx to your existing workspace to get faster task scheduling, caching and more. More in the docs.

Learn about CI with Nx Cloud

Nx Cloud connects directly to your existing CI setup, helping you scale your monorepos on CI by leveraging remote caching, task distribution across multiple machines, automated e2e test splitting and automated task flakiness detection

Connect your existing Nx workspace with

npx nx connect

Learn more in the Nx CI docs »

Nx - Smart Monorepos · Fast CI

Want to help?

If you want to file a bug or submit a PR, read up on our guidelines for contributing and watch this video that will help you get started.

Nx - How to contribute video

Core Team

Victor Savkin Jason Jean Benjamin Cabanes Jack Hsu
Victor Savkin Jason Jean Benjamin Cabanes Jack Hsu
vsavkin FrozenPandaz bcabanes jaysoo
Jo Hanna Pearce Jon Cammisuli Isaac Mann Juri Strumpflohner
Jo Hanna Pearce Jon Cammisuli Isaac Mann Juri Strumpflohner
jdpearce cammisuli isaacplmann juristr
Philip Fulcher Caleb Ukle Katerina Skroumpelou Colum Ferry
Philip Fulcher Caleb Ukle Katerina Skroumpelou Colum Ferry
philipjfulcher barbados-clemens mandarini Coly010
Emily Xiong Miroslav Jonaš Leosvel Pérez Espinosa Zachary DeRose
Emily Xiong Miroslav Jonaš Leosvel Pérez Espinosa Zachary DeRose
xiongemi meeroslav leosvelperez ZackDeRose
Craigory Coppola Chau Tran Nicholas Cunningham Max Kless
Craigory Coppola Chau Tran Nicholas Cunningham Max Kless
AgentEnder nartc ndcunningham MaxKless
Description
No description provided
Readme 619 MiB
Languages
TypeScript 95%
Rust 2.9%
JavaScript 1.3%
Kotlin 0.3%
MDX 0.3%
Other 0.1%