react-native-storybook-loader icon indicating copy to clipboard operation
react-native-storybook-loader copied to clipboard

Pattern to ignore

Open stvmachine opened this issue 2 years ago • 0 comments

Hi, i would like to know if it's possible to ignore certain patterns. i'm trying to use this library with Expo. So, i have some logic to name certain files that are able to run exclusively for native as *.native.stories and other exclusively on web as *.web.stories.

Can you add support to glob.sync internally?. That function has an ignore feature. Due, i'm using two storybook instances, the web instance uses something like the following and it works like a charm:

const glob = require("glob");
const path = require("path");
const appDirectory = path.resolve(__dirname, "../");

const getStories = () =>
  glob.sync(`${appDirectory}/components/**/*.stories.tsx`, {
    ignore: `${appDirectory}/components/**/*.native.stories.tsx`,
  });

Then, we would be able to dynamically ignore with something like:

//package.json
{
  "config": {
    "react-native-storybook-loader": {
      "searchDir": [ "./components" ],
      "pattern": "**/*.stories.tsx",
      "ignore": "**/*.web.stories.tsx",
      "outputFile": "storybook/storyLoader.js"
    }
  },
}

stvmachine avatar Mar 17 '22 04:03 stvmachine