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

Refactoring & new features #1

Merged
merged 2 commits into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .babel/plugin-add-js-ext-to-css-modules-imports.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
import fs from 'node:fs';
import path from 'node:path';

export default function addJsExtToCssModulesImports() {
return {
visitor: {
Expand All @@ -25,7 +22,7 @@ export default function addJsExtToCssModulesImports() {
return;
}

if (!nodePath.node.source.value.endsWith('.m.css')) {
if (!nodePath.node.source.value.match(/(module|m)\.css$/i)) {
return;
}

Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ Currently only React is supported.

MDX also supported as a story module (if your bundler is configured).

### Key features

- any bundle supported
- ability to show extra source files for story
- ability to fully customize showcase page and sandbox page

## Installation

```bash
Expand Down Expand Up @@ -132,15 +138,15 @@ Create showcase entrypoint in your project, for example in `./src/showcase.jsx`:
// React bootstrap code
import { createRoot } from 'react-dom/client';

// "stories entrypoint" (this is an alias, more on that later)
import foundStories from '#found-stories';

// util for validate story-modules
import { filterValidStories } from '@krutoo/showcase/runtime';

// React component for showing documentation with all stories
// Standalone React component for showing documentation with all stories
import { ShowcaseApp } from '@krutoo/showcase/runtime-showcase';

// "stories entrypoint" (this is an alias, more on that later)
import foundStories from '#found-stories';

// import styles bundle
import '@krutoo/showcase/runtime-showcase/styles.css';

Expand Down Expand Up @@ -256,7 +262,7 @@ export default defineConfig(async () => {
},
resolve: {
alias: {
'#found-stories': path.resolve(process.cwd(), '.generated/entries.js'),
'#found-stories': path.resolve(process.cwd(), storiesConfig.filename),
},
},
plugins: [react()],
Expand Down
Loading
Loading