Skip to content

Commit

Permalink
chore: upgrade to latest SB
Browse files Browse the repository at this point in the history
- fix docs not showing per package
  • Loading branch information
yoavniran committed Nov 7, 2024
1 parent 47cfe17 commit d9a15ad
Show file tree
Hide file tree
Showing 36 changed files with 687 additions and 3,723 deletions.
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
.*/node_modules/.pnpm/hermes-estree.*/.*
.*/lib/.*


[include]
./packages/**/*.js.flow

Expand Down Expand Up @@ -45,3 +46,4 @@ module.name_mapper='^@rpldy/life-events$' -> '<PROJECT_ROOT>/packages/core/life-

#tricking flow so it doesnt complain about not able to import README files in storybook
module.name_mapper='README.md$' -> '<PROJECT_ROOT>/node_modules/react/index.js'
module.name_mapper='.*storydoc.mdx$' -> '<PROJECT_ROOT>/node_modules/react/index.js'
11 changes: 6 additions & 5 deletions .storybook/cypressAddon/cypressDecorator.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import React from "react";
import { makeDecorator } from "@storybook/addons";
import { makeDecorator } from "@storybook/preview-api";

export default makeDecorator({
name: "cypressDecorator",
name: "cypressDecorator",
wrapper: (getStory, context) => {
const win = (window.parent && window.parent.Cypress) ?
window.parent :
Expand All @@ -21,5 +20,7 @@ export default makeDecorator({
}

return getStory(context);
}
})
},
parameterName: "cypressDecorator",
skipIfNoParametersOrOptions: false,
});
35 changes: 25 additions & 10 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,39 @@ import type { StorybookConfig } from "@storybook/react-webpack5";
const config: StorybookConfig = {
stories: [
"../packages/**/*.stories.js",
"./welcome.stories.mdx"
],
addons: [
path.resolve("./.storybook/uploadyPreset"),
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
// "./welcome.stories.mdx"
],
addons: [path.resolve("./.storybook/uploadyPreset"), "@storybook/addon-links", {
name: "@storybook/addon-docs", //path.dirname(require.resolve("@storybook/addon-docs/package.json")),
options: { transcludeMarkdown: true },
}, {
name: "@storybook/addon-essentials",
options: {
actions: true,
backgrounds: false,
controls: true,
docs: false,
viewport: false,
// toolbars: false
}
}, "@storybook/addon-interactions", "@storybook/addon-webpack5-compiler-babel"],
framework: {
name: "@storybook/react-webpack5",
options: {},
},
docs: {
autodocs: "tag",
},
// docs: {
// autodocs: true,
// },
core: {
disableTelemetry: true
},
typescript: {
// Overrides the default Typescript configuration to allow multi-package components to be documented via Autodocs.
reactDocgen: "react-docgen-typescript",
check: false,
// skipCompiler: true,
// skipBabel: true,
},
};

export default config;
2 changes: 1 addition & 1 deletion .storybook/manager.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { addons } from "@storybook/addons";
import { addons } from "@storybook/manager-api";
import theme from "./theme";
import VersionBadge from "./VersionBadge";

Expand Down
23 changes: 16 additions & 7 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import type { Preview } from "@storybook/react";
import { Description } from "@storybook/addon-docs";
import React from "react";
//import { DocsContainer } from "@storybook/blocks";
import cypressDecorator from "./cypressAddon/cypressDecorator";
import UploadyStoryDecorator from "./UploadyStoryDecorator";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
options: {
storySort: {
method: "alphabetical",
Expand All @@ -19,11 +19,20 @@ const preview: Preview = {
},
},
docs: {
page: () => (
<>
<Description/>
</>
),
// container: ({ children, ...props }) => {
// console.log("RENDERING DOCS CONTAINER !!!! !@#!@#!@#@#");
// return (
// <DocsContainer {...props}>{children}</DocsContainer>
// )
// },
page: () => {
// console.log("RENDERING DOCS PAGE !!!! !@#!@#!#@!#");
return (
<>
<Description/>
</>
)
},
},
},
decorators: [UploadyStoryDecorator, cypressDecorator],
Expand Down
22 changes: 13 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,17 @@
"@commitlint/config-conventional": "^19.4.1",
"@commitlint/config-lerna-scopes": "^19.0.0",
"@monorepo-utils/package-utils": "^2.10.4",
"@storybook/addon-essentials": "^7.6.16",
"@storybook/addon-interactions": "^7.6.16",
"@storybook/addon-links": "^7.6.16",
"@storybook/blocks": "^7.6.16",
"@storybook/react": "^7.6.16",
"@storybook/react-webpack5": "^7.6.16",
"@storybook/testing-library": "^0.2.2",
"@storybook/addon-docs": "^8.4.2",
"@storybook/addon-essentials": "^8.4.2",
"@storybook/addon-interactions": "^8.4.2",
"@storybook/addon-links": "^8.4.2",
"@storybook/addon-webpack5-compiler-babel": "^3.0.3",
"@storybook/blocks": "^8.4.2",
"@storybook/preview-api": "^8.4.2",
"@storybook/react": "^8.4.2",
"@storybook/react-webpack5": "^8.4.2",
"@storybook/test": "^8.4.2",
"@storybook/theming": "^8.4.2",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.5.2",
Expand Down Expand Up @@ -116,7 +120,7 @@
"eslint-plugin-no-async": "^1.1.0",
"eslint-plugin-react": "^7.35.0",
"eslint-plugin-react-hooks": "^4.6.2",
"eslint-plugin-storybook": "^0.8.0",
"eslint-plugin-storybook": "^0.11.0",
"eslint-plugin-vitest": "^0.3.22",
"execa": "^9.3.0",
"filesize": "^10.1.4",
Expand All @@ -142,7 +146,7 @@
"rimraf": "^5.0.5",
"semver-utils": "^1.1.4",
"shelljs": "^0.8.5",
"storybook": "^7.6.16",
"storybook": "^8.4.2",
"styled-components": "^6.1.12",
"typescript": "^5.3.3",
"vite": "^5.3.4",
Expand Down
4 changes: 2 additions & 2 deletions packages/core/chunked-sender/ChunkedSender.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
type UploadyStory,
} from "../../../story-helpers";
import getChunkedEnhancer, { CHUNK_EVENTS } from "./src";
import readme from "./README.md";
import Readme from "./ChunkedSender.storydoc.mdx";

export const WithChunkedSender: UploadyStory = createUploadyStory(
({ destination, chunkSize }): Node => {
Expand Down Expand Up @@ -86,7 +86,7 @@ export const WithChunkedSender: UploadyStory = createUploadyStory(
);
});

const chunkedSenderStories: CsfExport = getCsfExport(undefined, "Chunked Sender", readme, {
const chunkedSenderStories: CsfExport = getCsfExport(undefined, "Chunked Sender", Readme, {
pkg: "chunked-sender",
section: "Core",
parameters: {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/chunked-sender/ChunkedSender.storydoc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Markdown } from "@storybook/blocks";
import readme from "./README.md?raw";

<Markdown>{readme}</Markdown>
4 changes: 2 additions & 2 deletions packages/core/mock-sender/MockSender.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import createUploader, { type UploadyUploaderType } from "@rpldy/uploader";
import { getMockSenderEnhancer } from "./src";

import readme from "./README.md";
import Readme from "./MockSender.storydoc.mdx";
import type { Node } from "react";

const mockSenderEnhancer = getMockSenderEnhancer({
Expand Down Expand Up @@ -60,7 +60,7 @@ export const WithMockProgress = (): Node => {
);
};

const mockSenderStories: CsfExport = getCsfExport(undefined, "Mock Sender", readme, {
const mockSenderStories: CsfExport = getCsfExport(undefined, "Mock Sender", Readme, {
pkg: "mock-sender",
section: "Core",
parameters: {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/mock-sender/MockSender.storydoc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Markdown } from "@storybook/blocks";
import readme from "./README.md?raw";

<Markdown>{readme}</Markdown>
4 changes: 2 additions & 2 deletions packages/core/tus-sender/TusSender.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
type UploadyStory,
} from "../../../story-helpers";
import getTusEnhancer from "./src";
import readme from "./README.md";
import Readme from "./TusSender.storydoc.mdx";

import type { Node } from "react";
import type { UploadyUploaderType, UploaderEnhancer } from "@rpldy/uploader";
Expand Down Expand Up @@ -182,7 +182,7 @@ export const WithFeatureDetection: UploadyStory = createUploadyStory((props): No
);
});

const tusSenderStories: CsfExport = getCsfExport(undefined, "TUS Sender", readme, {
const tusSenderStories: CsfExport = getCsfExport(undefined, "TUS Sender", Readme, {
pkg: "tus-sender",
section: "Core",
parameters: {
Expand Down
4 changes: 4 additions & 0 deletions packages/core/tus-sender/TusSender.storydoc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Markdown } from "@storybook/blocks";
import readme from "./README.md?raw";

<Markdown>{readme}</Markdown>
4 changes: 2 additions & 2 deletions packages/core/uploader/Uploader.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
} from "../../../story-helpers";
import createUploader, { UPLOADER_EVENTS } from "./src";

import readme from "./README.md";
import Readme from "./Uploader.storydoc.mdx";
import type { UploadyUploaderType } from "./src";
import type { Node } from "react";

Expand Down Expand Up @@ -260,7 +260,7 @@ export const UMD_Core: UploadyStory = createUploadyStory(
);
});

const uploaderStories: CsfExport = getCsfExport(undefined, "Uploader", readme, {
const uploaderStories: CsfExport = getCsfExport(undefined, "Uploader", Readme, {
pkg: "uploader",
section: "Core",
});
Expand Down
4 changes: 4 additions & 0 deletions packages/core/uploader/Uploader.storydoc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Markdown } from "@storybook/blocks";
import readme from "./README.md?raw";

<Markdown>{readme}</Markdown>
4 changes: 2 additions & 2 deletions packages/native/native-uploady/NativeUploady.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
type UploadyStory
} from "../../../story-helpers";
import NativeUploady, { UploadyContext } from "./src";
import readme from "./README.md";
import Readme from "./NativeUploady.storydoc.mdx";

import type { Node } from "react";

Expand Down Expand Up @@ -56,7 +56,7 @@ export const Simple: UploadyStory = createUploadyStory(
);
});

const nativeUploadyStories: CsfExport = getCsfExport(NativeUploady, "Native Uploady", readme, {
const nativeUploadyStories: CsfExport = getCsfExport(NativeUploady, "Native Uploady", Readme, {
pkg: "native-uploady",
section: "React-Native"
});
Expand Down
4 changes: 4 additions & 0 deletions packages/native/native-uploady/NativeUploady.storydoc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Markdown } from "@storybook/blocks";
import readme from "./README.md?raw";

<Markdown>{readme}</Markdown>
4 changes: 2 additions & 2 deletions packages/ui/chunked-uploady/ChunkedUploady.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
type UploadyStory,
type UploadyStoryParams,
} from "../../../story-helpers";
import readme from "./README.md";
import Readme from "./ChunkedUploady.storydoc.mdx";

import type { Node } from "react";

Expand Down Expand Up @@ -215,7 +215,7 @@ export const UMD_CoreChunkedUI: UploadyStory = createUploadyStory(
);
});

const chunkedUploadyStories: CsfExport = getCsfExport(ChunkedUploady, "Chunked Uploady", readme, {
const chunkedUploadyStories: CsfExport = getCsfExport(ChunkedUploady, "Chunked Uploady", Readme, {
pkg: "chunked-uploady",
section: "UI",
parameters: {
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/chunked-uploady/ChunkedUploady.storydoc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Markdown } from "@storybook/blocks";
import readme from "./README.md?raw";

<Markdown>{readme}</Markdown>
4 changes: 2 additions & 2 deletions packages/ui/retry-hooks/RetryHooks.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import retryEnhancer, {
useRetryListener,
RETRY_EVENT,
} from "./src";
import readme from "./README.md";
import Readme from "./RetryHooks.storydoc.mdx";

import type { Node } from "react";
import type { RefObject } from "@rpldy/shared-ui";
Expand Down Expand Up @@ -395,7 +395,7 @@ export const WithRetryAndPreview: UploadyStory = createUploadyStory(
);
});

const retryHooksStories: CsfExport = getCsfExport(undefined, "Retry Hooks", readme, {
const retryHooksStories: CsfExport = getCsfExport(undefined, "Retry Hooks", Readme, {
pkg: "retry-hooks",
section: "UI"
});
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/retry-hooks/RetryHooks.storydoc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Markdown } from "@storybook/blocks";
import readme from "./README.md?raw";

<Markdown>{readme}</Markdown>
4 changes: 2 additions & 2 deletions packages/ui/tus-uploady/TusUploady.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import TusUploady, {
useTusResumeStartListener,
} from "./src";

import readme from "./README.md";
import Readme from "./TusUploady.storydoc.mdx";
import type { Node } from "react";

const AbortButton = () => {
Expand Down Expand Up @@ -303,7 +303,7 @@ export const WithResumeStartHandler: UploadyStory = createUploadyStory(
);
});

const tusUploadyStories: CsfExport = getCsfExport(TusUploady, "Tus Uploady", readme, {
const tusUploadyStories: CsfExport = getCsfExport(TusUploady, "Tus Uploady", Readme, {
pkg: "tus-uploady",
section: "UI",
parameters: {
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/tus-uploady/TusUploady.storydoc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Markdown } from "@storybook/blocks";
import readme from "./README.md?raw";

<Markdown>{readme}</Markdown>
4 changes: 2 additions & 2 deletions packages/ui/upload-button/UploadButton.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import {
} from "../../../story-helpers";
import UploadButton, { asUploadButton } from "./src";

import readme from "./README.md";
import Readme from "./UploadButton.storydoc.mdx";

import type { Node } from "react";
import type { Batch, BatchItem, UploadyContextType } from "@rpldy/uploady";
Expand Down Expand Up @@ -511,7 +511,7 @@ export const WithForm: UploadyStory = createUploadyStory(
);
});

const UploadButtonStories: CsfExport = getCsfExport(UploadButton, "Upload Button", readme, {
const UploadButtonStories: CsfExport = getCsfExport(UploadButton, "Upload Button", Readme, {
pkg: "upload-button",
section: "UI"
});
Expand Down
4 changes: 4 additions & 0 deletions packages/ui/upload-button/UploadButton.storydoc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Markdown } from "@storybook/blocks";
import readme from "./README.md?raw";

<Markdown>{readme}</Markdown>
4 changes: 2 additions & 2 deletions packages/ui/upload-drop-zone/UploadDropZone.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
type CsfExport,
type UploadyStory,
} from "../../../story-helpers";
import readme from "./README.md";
import Readme from "./UploadDropZone.storydoc.mdx";

import type { Node, Ref } from "react";
import type { UploadButtonProps } from "@rpldy/upload-button";
Expand Down Expand Up @@ -517,7 +517,7 @@ export const WithChildElement: UploadyStory = createUploadyStory(
);
});

const dropzoneStories: CsfExport = getCsfExport(UploadDropZone, "Upload Drop Zone", readme, {
const dropzoneStories: CsfExport = getCsfExport(UploadDropZone, "Upload Drop Zone", Readme, {
pkg: "upload-drop-zone",
section: "UI",
});
Expand Down
Loading

0 comments on commit d9a15ad

Please sign in to comment.