@3sln/deck 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/build.js CHANGED
@@ -4,7 +4,7 @@ import {build as viteBuild} from 'vite';
4
4
  import fs from 'fs-extra';
5
5
  import path from 'path';
6
6
  import {createRequire} from 'module';
7
- import { sha256, loadDeckConfig, getProjectFiles, getHtmlTemplate } from '../src/config.js';
7
+ import { sha256, loadDeckConfig, getProjectFiles, getCardFiles, getHtmlTemplate } from '../src/config.js';
8
8
 
9
9
  const require = createRequire(import.meta.url);
10
10
 
@@ -72,7 +72,7 @@ async function build() {
72
72
  }
73
73
 
74
74
  // Find card paths and hash content for the index
75
- const cardFiles = filesToCopy.filter(file => file.endsWith('.md') || file.endsWith('.html'));
75
+ const cardFiles = getCardFiles(userRoot, buildConfig);
76
76
  const initialCardsData = await Promise.all(cardFiles.map(async (file) => {
77
77
  const content = await fs.readFile(path.resolve(outDir, file), 'utf-8');
78
78
  const hash = await sha256(content);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3sln/deck",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "A Vite plugin for building scalable, zero-config, Markdown-based component playgrounds and documentation sites.",
5
5
  "type": "module",
6
6
  "author": "Ray Stubbs",
package/src/config.js CHANGED
@@ -49,6 +49,15 @@ export function getProjectFiles(root, config) {
49
49
  });
50
50
  }
51
51
 
52
+ export function getCardFiles(root, config) {
53
+ return globSync(config.include, {
54
+ cwd: root,
55
+ ignore: config.exclude,
56
+ nodir: true,
57
+ dot: true,
58
+ }).filter(s => s.endsWith('.md') || s.endsWith('.html'));
59
+ }
60
+
52
61
  export function getHtmlTemplate({ title, importMap, initialCardsData, pinnedCardPaths, entryFile, cssFiles = [] }) {
53
62
  return `
54
63
  <!doctype html>
package/vite-plugin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import fs from 'fs-extra';
2
2
  import path from 'path';
3
- import { sha256, loadDeckConfig, getProjectFiles, getHtmlTemplate } from './src/config.js';
3
+ import { sha256, loadDeckConfig, getProjectFiles, getCardFiles, getHtmlTemplate } from './src/config.js';
4
4
 
5
5
  export default function deckPlugin() {
6
6
  let resolvedConfig;
@@ -122,7 +122,7 @@ export default function deckPlugin() {
122
122
 
123
123
  server.middlewares.use(async (req, res, next) => {
124
124
  if (req.url.endsWith('/')) {
125
- const cardPaths = getProjectFiles(resolvedConfig.root, devConfig).map(p => `/${p}`);
125
+ const cardPaths = getCardFiles(resolvedConfig.root, devConfig).map(p => `/${p}`);
126
126
  const initialCardsData = await Promise.all(cardPaths.map(async (p) => {
127
127
  const content = await fs.readFile(path.join(resolvedConfig.root, p), 'utf-8');
128
128
  const hash = await sha256(content);