47366 Commits

Author SHA1 Message Date
Ian VanSchooten
994a26df8f
Vite: Allow specifying path to vite.config file (#20681)
Issue: #20552

## What I did

I added a new builder option for the Vite builder named `viteConfigPath`, which is a path to a custom config relative to the cwd.  If the path does not resolve, a clear error will be thrown with the absolute path being checked.

I also added a new utility, `getBuilderOptions()`, which is helpful because these options can be specified two different ways, with `core.builder.options` or `framework.options.builder`.  The utility gives an easy way to check both.  It gives preference to ~`core.builder.options`~ `framework.options.builder`, since that's the newer way to define the options.

## How to test

1. `yarn task --task sandbox --start-from auto --template react-vite/default-ts`
2. Move the `vite.config.ts` file into `.storybook`
3. Add an alias, like:
```ts
export default defineConfig({
  plugins: [react()],
  resolve: {
    alias: {
      stories: path.resolve(__dirname, '../src/stories'),
    },
  },
});
```
4. Change one of the stories to use this alias, such as the Button story:
```ts
import { Button } from 'stories/Button';
```
5. Start Storybook, it will fail
6. Add `viteConfigPath: ".storybook/vite.config.ts"` to the builder options in `.storybook/main.ts`
7. Restart storybook, and it should work.


## Checklist

<!-- Please check (put an "x" inside the "[ ]") the applicable items below to make sure your PR is ready to be reviewed. -->

- [ ] Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
- [X] Make sure to add/update documentation regarding your changes
- [ ] If you are deprecating/removing a feature, make sure to update
      [MIGRATION.MD](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md)

Is there a way to create an automated test for this?  I couldn't think of a good way to do it.

#### Maintainers

- [ ] If this PR should be tested against many or all sandboxes,
      make sure to add the `ci:merged` or `ci:daily` GH label to it.
- [X] Make sure this PR contains **one** of the labels below.

`["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]`

<!--

Everybody: Please submit all PRs to the `next` branch unless they are specific to the current release. Storybook maintainers cherry-pick bug and documentation fixes into the `main` branch as part of the release process, so you shouldn't need to worry about this. For additional guidance: https://storybook.js.org/docs/react/contribute/how-to-contribute

-->
2023-01-20 09:17:29 -05:00
Norbert de Langen
3f1ece92ef
Merge pull request #20671 from storybookjs/norbert/fix-20580
Fix the d.ts file of addon-links, mark LinkTo in index as deprecated
2023-01-20 14:17:25 +01:00
Norbert de Langen
0dac4c4114
Merge branch 'next' into norbert/fix-20580 2023-01-20 13:55:50 +01:00
Norbert de Langen
2a370ff769
Merge pull request #20411 from literalpie/qwik-init
CLI: Add init support for qwik projects
2023-01-20 13:49:03 +01:00
Norbert de Langen
a7fe25daf0
Merge pull request #20707 from storybookjs/norbert/fix-windows-test-snapshot
fix snapshot
2023-01-20 13:39:42 +01:00
Norbert de Langen
785ab0a9b0
I'm not sure where this change came from 2023-01-20 13:31:28 +01:00
Norbert de Langen
ee9b7a80cd
remove need for snapshots at all, and check for actual syntax validity 2023-01-20 13:22:40 +01:00
Valentin Palkovic
b8ed843bf7
Merge pull request #20708 from storybookjs/valentin/fix-package-execution
CLI: Fix package execution for npm package manager
2023-01-20 13:22:39 +01:00
Norbert de Langen
8ffe82e12b
remove the need for platform specific snapshots 2023-01-20 12:36:11 +01:00
Norbert de Langen
a29056b8d4
fix 2023-01-20 12:19:25 +01:00
Yann Braga
d419c08500
Merge pull request #20693 from storybookjs/feat/improve-automigration-checks
CLI: Upgrade automigrations to use new safe helpers
2023-01-20 11:52:15 +01:00
Yann Braga
3ce32ec15c
Merge pull request #20691 from storybookjs/feat/csf-tools-name-helpers
Csf-tools: Add helpers to get name from node path
2023-01-20 11:50:57 +01:00
Norbert de Langen
10e5f5f682
add trim 2023-01-20 11:32:32 +01:00
Norbert de Langen
684362e61f
make snapshots easier to read 2023-01-20 11:30:44 +01:00
Valentin Palkovic
b1b872debc Fix package execution for npm package manager 2023-01-20 11:18:05 +01:00
Norbert de Langen
fb566dee2b
fix snapshot 2023-01-20 10:48:10 +01:00
Yann Braga
f380b27244 small tweaks on babelrc automigration 2023-01-20 10:31:45 +01:00
Yann Braga
fd5bd13dcb replace getFieldValue with getNameFromPath where applicable
- This makes the code safer as it does not evaluate properties, just looks for string literals that identify that property
2023-01-20 10:25:39 +01:00
Yann Braga
a11bcbe35a return undefined when node does not exist 2023-01-20 10:24:05 +01:00
Yann Braga
04b691e443 throw an error with unexpected node value 2023-01-20 10:21:14 +01:00
Yann Braga
a044e18ad5 csf-tools: add helpers to get name from node path 2023-01-20 10:21:14 +01:00
Norbert de Langen
f385bd4a89
Merge branch 'next' into qwik-init 2023-01-20 10:20:40 +01:00
Yann Braga
52dae06ec9
Merge pull request #20706 from storybookjs/fix/remove-preact-webpack5-from-babelrc
Build: remove preact-webpack5 from babelrc automigration
2023-01-20 10:19:04 +01:00
Yann Braga
7be3f8376e remove preact-webpack5 from babelrc automigration 2023-01-20 09:56:53 +01:00
Norbert de Langen
aa8b691013
do not include non-working stories for now 2023-01-20 09:42:30 +01:00
Norbert de Langen
fc3b221569
Merge branch 'next' into qwik-init 2023-01-20 09:15:41 +01:00
Michael Shilman
fe32ad3aae 7.0.0-beta.31 next.json version file [skip ci] 2023-01-20 13:29:20 +08:00
Michael Shilman
457694a15a Update git head to 7.0.0-beta.31, update yarn.lock [ci skip] 2023-01-20 13:24:01 +08:00
Michael Shilman
6d1ea7647f v7.0.0-beta.31 v7.0.0-beta.31 2023-01-20 13:22:31 +08:00
Michael Shilman
bc018cf157 Update root, peer deps, version.ts/json to 7.0.0-beta.31 [ci skip] 2023-01-20 13:16:28 +08:00
Michael Shilman
a4edcfa661 7.0.0-beta.31 changelog 2023-01-20 13:09:25 +08:00
Michael Shilman
838da74e97
Merge pull request #20603 from storybookjs/tom/sb-1147-update-api-of-source-block
Docs: Added source stories and updated API
2023-01-20 12:59:08 +08:00
Mostafa Sherif
49d730f20f
Merge pull request #20700 from sheriffMoose/next
docs: add documentation for story indexers
2023-01-19 22:31:04 -05:00
Mostafa Sherif
675c0b479a run pretty-docs 2023-01-20 03:17:34 +00:00
Mostafa Sherif
61233bf5ef Merge branch 'next' of https://github.com/sheriffMoose/storybook into next 2023-01-20 03:16:07 +00:00
Mostafa Sherif
52afb7fb93 update docs with @shilman comments 2023-01-20 03:16:04 +00:00
Mostafa Sherif
608a4b94de
Merge branch 'storybookjs:next' into next 2023-01-19 22:03:40 -05:00
Michael Shilman
882f864003
Merge pull request #20688 from storybookjs/shilman/20421-split-docs-storysource
Source-loader: Fix export default variable references
2023-01-20 10:56:54 +08:00
Mostafa Sherif
8018413e83
run docs:prettier:write 2023-01-19 20:43:16 -05:00
Mostafa Sherif
8660f62a30
update .mdx files with prettier 2023-01-19 20:37:26 -05:00
Mostafa Sherif
487c94ff98
docs: add documentation for story indexers
Closes #20478
2023-01-19 20:12:56 -05:00
Tom Coleman
7eaa9c43c8
Merge pull request #20683 from storybookjs/tom/sb-1152-implement-controls-block
Docs: Implement Controls block
2023-01-20 11:01:52 +11:00
Tom Coleman
00a64b45a8
Merge pull request #20664 from storybookjs/tom/sb-1149-implement-argtypes-block
Docs: Created `ArgTypes` component and stories
2023-01-20 11:01:44 +11:00
Tom Coleman
5f2a98ffce Merge branch 'tom/sb-1149-implement-argtypes-block' into tom/sb-1152-implement-controls-block 2023-01-20 10:00:20 +11:00
Tom Coleman
05ff649346 Merge branch 'next' into tom/sb-1149-implement-argtypes-block 2023-01-20 09:59:43 +11:00
Tom Coleman
3f1154ee2c Update to use resolveOf 2023-01-20 09:26:19 +11:00
Tom Coleman
7fa20f2316 Merge branch 'next' into tom/sb-1147-update-api-of-source-block 2023-01-20 09:25:24 +11:00
Tom Coleman
c564a166e1 Remove log 2023-01-20 09:24:57 +11:00
Tom Coleman
471cf96e3a Merge branch 'tom/sb-1149-implement-argtypes-block' into tom/sb-1152-implement-controls-block 2023-01-20 09:19:36 +11:00
Tom Coleman
a919466694 Merge branch 'tom/sb-1149-implement-argtypes-block' of https://github.com/storybookjs/storybook into tom/sb-1149-implement-argtypes-block 2023-01-20 09:19:15 +11:00