diff --git a/.github/workflows/canary-release-pr.yml b/.github/workflows/canary-release-pr.yml index 4b1504cfd1bf..827f24a2c5f8 100644 --- a/.github/workflows/canary-release-pr.yml +++ b/.github/workflows/canary-release-pr.yml @@ -58,8 +58,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '16' - + node-version-file: '.nvmrc' - name: Cache dependencies uses: actions/cache@v3 with: diff --git a/.github/workflows/danger-js.yml b/.github/workflows/danger-js.yml index f83519953b4b..eddb5dee1fe7 100644 --- a/.github/workflows/danger-js.yml +++ b/.github/workflows/danger-js.yml @@ -21,10 +21,10 @@ jobs: name: Danger JS runs-on: ubuntu-latest steps: + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16' - - uses: actions/checkout@v3 + node-version-file: '.nvmrc' - name: Danger JS uses: danger/danger-js@11.2.6 env: diff --git a/.github/workflows/prepare-patch-release.yml b/.github/workflows/prepare-patch-release.yml index c88022c7ea01..e4f8e38df502 100644 --- a/.github/workflows/prepare-patch-release.yml +++ b/.github/workflows/prepare-patch-release.yml @@ -33,7 +33,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '16' + node-version-file: '.nvmrc' - name: Cache dependencies uses: actions/cache@v3 diff --git a/.github/workflows/prepare-prerelease.yml b/.github/workflows/prepare-prerelease.yml index 1250aedcfaa3..e68a7e1ef63a 100644 --- a/.github/workflows/prepare-prerelease.yml +++ b/.github/workflows/prepare-prerelease.yml @@ -54,7 +54,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '16' + node-version-file: '.nvmrc' - name: Cache dependencies uses: actions/cache@v3 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 18e23c174162..863b4e9ae7e2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -45,7 +45,7 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v3 with: - node-version: '16' + node-version-file: '.nvmrc' - name: Cache dependencies uses: actions/cache@v3 diff --git a/.gitignore b/.gitignore index 29c025aadf26..63f9445af854 100644 --- a/.gitignore +++ b/.gitignore @@ -37,7 +37,6 @@ coverage/ /**/LICENSE code/docs/public package-lock.json -.nvmrc storybook-static .jest-test-results.json *.jar diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000000..59ea99ee63cb --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +16.20 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cc26a6bff211..78993afd8386 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,13 +1,24 @@ # Getting started -Storybook is developed against a specific node version. We recommend using [Volta](https://volta.sh/) as it will automatically install the correct node and yarn version when you first use the repo. If you chose not to use Volta please ensure you you have node version 16 installed (suggestion: v16.5) +Storybook is developed against a specific node version which is defined in an `.nvmrc` file. You can use any Node version manager that uses the `.nvmrc` configuration file (we recommend [fnm](https://fnm.vercel.app/)). + +## Using fnm as a Node version manager + +- Install fnm [as per instructions](https://github.com/Schniz/fnm/tree/master#installation) +- In your shell setup include the `use-on-cd`, `corepack-enabled` and `version-file-strategy recursive` parameters in the `fnm env` command, e.g. + + ```sh + eval "$(fnm env --use-on-cd --corepack-enabled --version-file-strategy recursive)" + ``` + +## Running the local development environment - Ensure if you are using Windows to use the Windows Subsystem for Linux (WSL). - Run `yarn start` in the root directory to run a basic test Storybook "sandbox". The `yarn start` script will generate a React Vite TypeScript sandbox with a set of test stories inside it, as well as taking all steps required to get it running (building the various packages we need etc). There is no need to run `yarn` or `yarn install` as `yarn start` will do this for you. -## Issues +### Issues If you run `yarn start` and encounter the following error, try rerunning `yarn start` a second time: diff --git a/package.json b/package.json index 7c606bfbed07..562cce14091e 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,5 @@ "test": "cd code; yarn test", "upload-bench": "cd scripts; yarn upload-bench" }, - "packageManager": "yarn@3.5.1", - "volta": { - "node": "16.20.1", - "yarn": "3.5.1" - } + "packageManager": "yarn@3.5.1" }