0.0.2 • Published 11 months ago

olly-docs-wrapper v0.0.2

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
11 months ago

Requirements:

  • Remove the template entry from package.json
  • Remove doczrc.js, gatsby-node.js, and gatsby-theme-docz inside src(if these are already available inside in the project, during postinstall these files will be auto generated)
  • Remove the webstudio copy command if it is mentioned in start script inside package.json

installation

step1

npm install olly-docs-wrapper --save-dev

Note: If you face any issue, make sure to have docz@2.4.0 version installed and run npm dedupe(deduplicate the node_modules)

step2

Make sure to verify files gatsby-config.js, doczrc.js and gatsby-node.js which are generated.

//gatsby-config.js

module.exports = {
  plugins: [
    // ...
    {
      resolve: `olly-docs-wrapper`,
    }
  ]
};
//doczrc.js

export default {
    title: "OllyStudio DLS: 3.1",
    description: "OllyStudio Design System components, Powered by: OLLY 3.1",
    typescript: true,
    dest: "/public",
    docgenConfig: {
    propFilter: (prop) =>
        prop.parent ? prop.parent.fileName.indexOf("@types/react") === -1 : true,
        searchPath:
        process.env.DOC_TYPE === "document" ? "node_modules/olly" : "src",
      },
    files: ["./src/**/*.mdx", "./documents/**/*.mdx"],
    ignore: ["README.md"],
    filterComponents: (files) =>
    files.filter((filepath) => /\w*\.(ts|tsx)$/.test(filepath)),
};
//gatsby-node.js

const path = require("path");

let { dependencies = {}, name, devDependencies = {} } = require(path.join(
    __dirname,
    `../package.json`
  ));
const depEntries = Object.keys({ ...dependencies, ...devDependencies })
    .filter((name) => name.indexOf("olly") !== -1)
    .reduce(
      (map, name) => {
        map[name + "/src"] = path.resolve(
          __dirname,
          `../node_modules/${name}/src`
        );
        return map;
      },
      { [name + "/src"]: path.resolve(__dirname, `../src`) }
    );
exports.onCreateWebpackConfig = (args) => {
    args.actions.setWebpackConfig({
      resolve: {
        alias: depEntries,
      },
    });
};