create-portfoliable 1.2.16 → 1.2.18

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.
@@ -28,6 +28,14 @@ import {
28
28
  } from '../scripts/terminal-ui.mjs';
29
29
  import { resolveConsumerRuntimeAliases } from '../scripts/consumer-runtime-aliases.mjs';
30
30
 
31
+ function resolveMermaidDevAliases(runtimeAliases) {
32
+ return [
33
+ ...runtimeAliases,
34
+ { find: /^dayjs$/, replacement: path.resolve(process.cwd(), 'node_modules/dayjs/esm/index.js') },
35
+ { find: 'dayjs/dayjs.min.js', replacement: path.resolve(process.cwd(), 'node_modules/dayjs/esm/index.js') }
36
+ ];
37
+ }
38
+
31
39
  // MARK: TERMINAL STYLES
32
40
  // ANSI color code used for success-status text.
33
41
  const green = '\x1b[32m';
@@ -456,6 +464,37 @@ function runThumbnailOptions(flags) {
456
464
  return 0;
457
465
  }
458
466
 
467
+ // Emits case media files so authored src/content URLs survive production builds.
468
+ function createCaseContentAssetPlugin() {
469
+ return {
470
+ name: 'portfoliable-case-content-assets',
471
+ generateBundle() {
472
+ const casesRoot = path.resolve(process.cwd(), 'src', 'content', 'cases');
473
+ if (!fs.existsSync(casesRoot)) return;
474
+
475
+ const emitDirectory = (directory) => {
476
+ for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
477
+ const entryPath = path.join(directory, entry.name);
478
+ if (entry.isDirectory()) {
479
+ emitDirectory(entryPath);
480
+ continue;
481
+ }
482
+ if (entry.name.toLowerCase().endsWith('.md')) continue;
483
+
484
+ const relativePath = path.relative(process.cwd(), entryPath).replace(/\\/g, '/');
485
+ this.emitFile({
486
+ type: 'asset',
487
+ fileName: relativePath,
488
+ source: fs.readFileSync(entryPath)
489
+ });
490
+ }
491
+ };
492
+
493
+ emitDirectory(casesRoot);
494
+ }
495
+ };
496
+ }
497
+
459
498
  // Prints startup summary box for dev server sessions.
460
499
  function printStartupBox({ localUrl, networkUrl, localVersion, latestVersion }) {
461
500
  const lines = [
@@ -564,13 +603,13 @@ async function runDevServer(flags, options = {}) {
564
603
  }
565
604
 
566
605
  const runtimeAliases = resolveConsumerRuntimeAliases(process.cwd());
606
+ const mermaidDevAliases = resolveMermaidDevAliases(runtimeAliases);
567
607
 
568
608
  // Creates Vite development server instance.
569
609
  const server = await createServer({
570
- resolve: runtimeAliases.length > 0
571
- ? { alias: runtimeAliases }
572
- : undefined,
610
+ resolve: { alias: mermaidDevAliases },
573
611
  optimizeDeps: {
612
+ include: ['mermaid', 'mermaid > dayjs'],
574
613
  exclude: ['create-portfoliable']
575
614
  },
576
615
  server: {
@@ -649,9 +688,10 @@ async function runBuild() {
649
688
  printRailSegment({ dot: true, label: `${cyan}${bold}Starting build...${reset}` });
650
689
  console.log(`${cyan}${bold}Building Portfoliable...${reset}`);
651
690
  const runtimeAliases = resolveConsumerRuntimeAliases(process.cwd());
652
- await viteBuild(runtimeAliases.length > 0
653
- ? { resolve: { alias: runtimeAliases } }
654
- : undefined);
691
+ await viteBuild({
692
+ ...(runtimeAliases.length > 0 ? { resolve: { alias: runtimeAliases } } : {}),
693
+ plugins: [createCaseContentAssetPlugin()]
694
+ });
655
695
  console.log(`${green}Build complete.${reset}`);
656
696
  printRailSegment({ dot: true, label: `${green}${bold}Build complete.${reset}` });
657
697
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-portfoliable",
3
- "version": "1.2.16",
3
+ "version": "1.2.18",
4
4
  "description": "Unified Portfoliable package with initializer and runtime CLI",
5
5
  "private": false,
6
6
  "type": "module",
package/src/App.js CHANGED
@@ -35,6 +35,7 @@ import {
35
35
  A11Y_THEME_TOKEN_KEYS,
36
36
  Header,
37
37
  HomeView,
38
+ MermaidDiagram,
38
39
  Summary,
39
40
  Thumbnail,
40
41
  Toast,
@@ -49,6 +50,7 @@ void Summary;
49
50
  void Thumbnail;
50
51
  void Toast;
51
52
  void VideoPlayer;
53
+ void MermaidDiagram;
52
54
 
53
55
  // MARK: HEADER DEFAULTS
54
56
  // Resolves runtime defaults and persistence keys used across navigation and resume flows.
package/vite.config.js CHANGED
@@ -94,8 +94,8 @@ export default defineConfig(({ command }) => {
94
94
  ? { alias: runtimeAliases }
95
95
  : undefined,
96
96
 
97
- // In local-link mode, avoid prebundling Valence so edits in the linked package
98
- // are reflected immediately during development.
97
+ // Keep Mermaid's CommonJS dependencies in Vite's normalized dev graph while
98
+ // avoiding prebundling Valence so linked-package edits remain observable.
99
99
  optimizeDeps: (command === 'serve' && usingLocalValence)
100
100
  ? { exclude: ['@portfoliablejs/valence'] }
101
101
  : undefined,