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

Negating globs stopped working in ^6.4.0 #16964

Closed
ciclentfort opened this issue Dec 9, 2021 · 11 comments
Closed

Negating globs stopped working in ^6.4.0 #16964

ciclentfort opened this issue Dec 9, 2021 · 11 comments
Assignees

Comments

@ciclentfort
Copy link

Describe the bug

Using !(breaks) to negate matching stopped working with storybook 6.4.0 (still present in 6.5.0-alpha.3). This still worked in 6.3.12.

According to picomatch this should be supported

Storybook will throw an error during both start-storybook and build-storybook.

Attached a log of the output of build-storybook.

info @storybook/react v6.5.0-alpha.3
info 
info => Cleaning outputDir: /Users/clentfort/Code/sb-repo/react/storybook-static
info => Loading presets
info => Compiling preview..
info => Using implicit CSS loaders
info => Using default Webpack4 setup
<s> [webpack.Progress] 0% compiling
<s> [webpack.Progress] 10% building 0/0 modules 0 active 
<s> [webpack.Progress] 10% building 0/1 modules 1 active multi /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/polyfills.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js /Users/clentfort/Code/sb-repo/react/storybook-init-framework-entry.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/react/config.js-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/react/dist/esm/client/preview/config-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-links/dist/esm/preset/addDecorator.js-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-actions/dist/esm/preset/addDecorator.js-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-actions/dist/esm/preset/addArgs.js-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-backgrounds/dist/esm/preset/addDecorator.js-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-backgrounds/dist/esm/preset/addParameter.js-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-measure/dist/esm/preset/addDecorator.js-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-outline/dist/esm/preset/addDecorator.js-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/.storybook/preview.js-generated-config-entry.js /Users/clentfort/Code/sb-repo/react/generated-stories-entry.js
<s> [webpack.Progress] 10% building 1/1 modules 0 active 
(node:24350) DeprecationWarning: Default PostCSS plugins are deprecated. When switching to '@storybook/addon-postcss',
you will need to add your own plugins, such as 'postcss-flexbugs-fixes' and 'autoprefixer'.

See https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#deprecated-default-postcss-plugins for details.
(Use `node --trace-deprecation ...` to show where the warning was created)
<s> [webpack.Progress] 10% building 1/2 modules 1 active /Users/clentfort/Code/sb-repo/react/node_modules/babel-loader/lib/index.js??ref--4-0!/Users/clentfort/Code/sb-repo/react/storybook-init-framework-entry.js
<s> [webpack.Progress] 10% building 1/3 modules 2 active /Users/clentfort/Code/sb-repo/react/node_modules/babel-loader/lib/index.js??ref--4-0!/Users/clentfort/Code/sb-repo/react/generated-stories-entry.js
<s> [webpack.Progress] 10% building 1/4 modules 3 active /Users/clentfort/Code/sb-repo/react/node_modules/babel-loader/lib/index.js??ref--4-0!/Users/clentfort/Code/sb-repo/react/.storybook/preview.js-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/5 modules 4 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-links/dist/esm/preset/addDecorator.js-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/6 modules 5 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-actions/dist/esm/preset/addDecorator.js-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/7 modules 6 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-actions/dist/esm/preset/addArgs.js-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/8 modules 7 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-backgrounds/dist/esm/preset/addDecorator.js-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/9 modules 8 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-backgrounds/dist/esm/preset/addParameter.js-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/10 modules 9 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-outline/dist/esm/preset/addDecorator.js-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/11 modules 10 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-measure/dist/esm/preset/addDecorator.js-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/12 modules 11 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/13 modules 12 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/react/config.js-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/14 modules 13 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/react/dist/esm/client/preview/config-generated-config-entry.js
<s> [webpack.Progress] 10% building 1/15 modules 14 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/polyfills.js
<s> [webpack.Progress] 10% building 1/16 modules 15 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 10% building 2/16 modules 14 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 10% building 3/16 modules 13 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 10% building 4/16 modules 12 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 10% building 5/16 modules 11 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 10% building 6/16 modules 10 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 10% building 7/16 modules 9 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 10% building 8/16 modules 8 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 11% building 9/16 modules 7 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 11% building 10/16 modules 6 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 11% building 11/16 modules 5 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/core-client/dist/esm/globals/globals.js
<s> [webpack.Progress] 11% building 11/17 modules 6 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-links/dist/esm/preset/addDecorator.js
<s> [webpack.Progress] 11% building 11/18 modules 7 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-actions/dist/esm/preset/addDecorator.js
<s> [webpack.Progress] 11% building 11/19 modules 8 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-actions/dist/esm/preset/addArgs.js
<s> [webpack.Progress] 11% building 11/20 modules 9 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-backgrounds/dist/esm/preset/addDecorator.js
<s> [webpack.Progress] 11% building 11/21 modules 10 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-backgrounds/dist/esm/preset/addParameter.js
<s> [webpack.Progress] 11% building 11/22 modules 11 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-outline/dist/esm/preset/addDecorator.js
<s> [webpack.Progress] 11% building 11/23 modules 12 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-measure/dist/esm/preset/addDecorator.js
<s> [webpack.Progress] 11% building 11/24 modules 13 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/react/config.js
<s> [webpack.Progress] 11% building 11/25 modules 14 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 11% building 12/25 modules 13 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 11% building 13/25 modules 12 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 11% building 14/25 modules 11 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 11% building 15/25 modules 10 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 11% building 16/25 modules 9 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 12% building 17/25 modules 8 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 12% building 18/25 modules 7 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 12% building 19/25 modules 6 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 12% building 20/25 modules 5 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 12% building 21/25 modules 4 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 12% building 22/25 modules 3 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 12% building 23/25 modules 2 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 12% building 24/25 modules 1 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/addon-docs/dist/esm/frameworks/common/config.js
<s> [webpack.Progress] 13% building 25/25 modules 0 active 
<s> [webpack.Progress] 13% building 25/26 modules 1 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/react/dist/esm/client/preview/config.js
<s> [webpack.Progress] 70% building 25/26 modules 1 active /Users/clentfort/Code/sb-repo/react/node_modules/@storybook/react/dist/esm/client/preview/config.js
ERR! => Failed to build the preview
ERR! Module not found: Error: Can't resolve '(breaks)' in '/Users/clentfort/Code/sb-repo/react'
ERR! ModuleNotFoundError: Module not found: Error: Can't resolve '(breaks)' in '/Users/clentfort/Code/sb-repo/react'
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/webpack/lib/Compilation.js:925:10
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/webpack/lib/ContextModuleFactory.js:143:23
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/neo-async/async.js:2830:7
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/neo-async/async.js:6877:13
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/webpack/lib/ContextModuleFactory.js:118:26
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/Resolver.js:213:14
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (/Users/clentfort/Code/sb-repo/react/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (/Users/clentfort/Code/sb-repo/react/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (/Users/clentfort/Code/sb-repo/react/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (/Users/clentfort/Code/sb-repo/react/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:43:1)
ERR!  ModuleNotFoundError: Module not found: Error: Can't resolve '(breaks)' in '/Users/clentfort/Code/sb-repo/react'
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/webpack/lib/Compilation.js:925:10
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/webpack/lib/ContextModuleFactory.js:143:23
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/neo-async/async.js:2830:7
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/neo-async/async.js:6877:13
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/webpack/lib/ContextModuleFactory.js:118:26
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/Resolver.js:213:14
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (/Users/clentfort/Code/sb-repo/react/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:44:7
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (/Users/clentfort/Code/sb-repo/react/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (/Users/clentfort/Code/sb-repo/react/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:67:43
ERR!     at /Users/clentfort/Code/sb-repo/react/node_modules/enhanced-resolve/lib/Resolver.js:285:5
ERR!     at eval (eval at create (/Users/clentfort/Code/sb-repo/react/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:43:1)
ERR! resolve '(breaks)' in '/Users/clentfort/Code/sb-repo/react'
ERR!   Parsed request is a module
ERR!   using description file: /Users/clentfort/Code/sb-repo/react/package.json (relative path: .)
ERR!     Field 'browser' doesn't contain a valid alias configuration
ERR!     resolve as module
ERR!       /Users/clentfort/Code/sb-repo/node_modules doesn't exist or is not a directory
ERR!       /Users/clentfort/Code/node_modules doesn't exist or is not a directory
ERR!       /Users/clentfort/node_modules doesn't exist or is not a directory
ERR!       /Users/node_modules doesn't exist or is not a directory
ERR!       /node_modules doesn't exist or is not a directory
ERR!       looking for modules in /Users/clentfort/Code/sb-repo/react/node_modules
ERR!         using description file: /Users/clentfort/Code/sb-repo/react/package.json (relative path: ./node_modules)
ERR!           Field 'browser' doesn't contain a valid alias configuration
ERR!           using description file: /Users/clentfort/Code/sb-repo/react/package.json (relative path: ./node_modules/(breaks))
ERR!             as directory
ERR!               /Users/clentfort/Code/sb-repo/react/node_modules/(breaks) doesn't exist

To Reproduce

See https://github.com/ciclentfort/storybook-negate-match/tree/next for a reproduction against 6.5.0-alpha.3 (build will fail)
See https://github.com/ciclentfort/storybook-negate-match/tree/6.3.12 for a reproduction against 6.3.12 (build works)

System

Environment Info:
  System:
    OS: macOS 10.15.7
    CPU: (8) x64 Intel(R) Core(TM) i5-8279U CPU @ 2.40GHz
  Binaries:
    Node: 14.16.0 - ~/.nvm/versions/node/v14.16.0/bin/node
    Yarn: 3.1.1 - /usr/local/bin/yarn
    npm: 6.14.11 - ~/.nvm/versions/node/v14.16.0/bin/npm
  npmPackages:
    @storybook/addon-actions: ^6.5.0-alpha.3 => 6.5.0-alpha.3
    @storybook/addon-docs: ^6.5.0-alpha.3 => 6.5.0-alpha.3
    @storybook/addon-essentials: ^6.5.0-alpha.3 => 6.5.0-alpha.3
    @storybook/addon-links: ^6.5.0-alpha.3 => 6.5.0-alpha.3
    @storybook/react: ^6.5.0-alpha.3 => 6.5.0-alpha.3

I also tested this against node 16.11.0, errors are still the same.

@stale
Copy link

stale bot commented Jan 9, 2022

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

@stale stale bot added the inactive label Jan 9, 2022
@ciclentfort
Copy link
Author

I'd be happy to look into this but I don't know where to start

@stale stale bot removed the inactive label Jan 14, 2022
@tmeasday tmeasday self-assigned this Jan 17, 2022
@tmeasday
Copy link
Member

Thanks @ciclentfort, I am looking into this alongside some other glob related issues. Will circle back round once I have the big picture sorted out.

@tmeasday
Copy link
Member

Ok, it was a pretty simple fix to all three issues at once: #17252. Appreciate the offer of help though!

@shilman
Copy link
Member

shilman commented Jan 17, 2022

Yee-haw!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.19 containing PR #17252 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

@shilman shilman closed this as completed Jan 17, 2022
@shilman
Copy link
Member

shilman commented Jan 21, 2022

Olé!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.14 containing PR #17252 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade

@ciclentfort
Copy link
Author

@tmeasday I tried with storybook 6.5.0-alpha.22 but I'm still seeing the same error on the example I shared above.

@ciclentfort
Copy link
Author

ciclentfort commented Jan 24, 2022

I think the issue might be that my glob pattern doesn't include a *. If I look at the output of normalizeStoryEntry, directory is set to './stories/!(breaks)'.

I think there should be a check for ! in the entry as well. When doing so, the value of directory is directory: './stories'.

Alternatively, the call to picomatch.scan could be moved to the top and the isGlob flag could then be used for any further decision making.

@tmeasday
Copy link
Member

Oh, I see. Sorry I thought your use case had fitted my examples, but I suppose it didn't! I think your suggestion to move scan() up makes sense, would you consider sending a PR? I think our test cases are reasonably comprehensive against this file.

clentfort added a commit to clentfort/storybook that referenced this issue Jan 25, 2022
# Summary:

Support negated globs like `../!(negation)/*.stories.mdx` in storybook
config.

**Related issues:**

Closes storybookjs#16964
@shilman
Copy link
Member

shilman commented Jan 28, 2022

Ta-da!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.24 containing PR #17328 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

@shilman
Copy link
Member

shilman commented Jan 28, 2022

Good golly!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.15 containing PR #17328 that references this issue. Upgrade today to the @latest NPM tag to try it out!

npx sb upgrade

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants