Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(storybook): normalize win32 paths for storybook globs #93

Merged
merged 2 commits into from
Aug 20, 2020
Merged

fix(storybook): normalize win32 paths for storybook globs #93

merged 2 commits into from
Aug 20, 2020

Conversation

lihbr
Copy link

@lihbr lihbr commented Aug 19, 2020

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

Changes

Added upath to normalize paths to POSIX specs (same strategy as here nuxt/nuxt#7796) and used it when resolving glob patterns for stories array.

Explanation

With 2.1.0, generated .nuxt-storybook/storybook/main.js looks like this on Windows:

module.exports = {
  webpackFinal(config, options) {
    return options.nuxtStorybookConfig.webpackFinal(config, options)
  },
  stories: ['..\../components/**/*.stories.@(ts|js)'],
}

The above is not a valid glob pattern and will lead to a fatal error while running Storybook. Since glob patterns are expected to use the POSIX separator this use upath to normalize them and will fix globs array:

module.exports = {
  webpackFinal(config, options) {
    return options.nuxtStorybookConfig.webpackFinal(config, options)
  },
  stories: ['../../components/**/*.stories.@(ts|js)'],
}

Let me know if you need further explanation, if you want me to fill a proper issue, or prefer another implementation 🙂

Cheers~

win92

ps: I also checked/tested a bit for similar errors but found none, not sure what could be a more efficient strategy at ensuring things are win32 friendly in the long run 🤔

@farnabaz
Copy link
Collaborator

farnabaz commented Aug 20, 2020

LGTM, Thank you windows friend
Cheers win92

@farnabaz farnabaz changed the title fix: normalize win32 paths for storybook globs fix(storybook): normalize win32 paths for storybook globs Aug 20, 2020
@farnabaz farnabaz merged commit 658229f into nuxt-modules:master Aug 20, 2020
This was referenced Aug 20, 2020
farnabaz pushed a commit that referenced this pull request Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants