create-portfoliable 1.0.3
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/create-portfoliable.mjs +425 -0
- package/cli/portfoliable.mjs +836 -0
- package/index.html +18 -0
- package/package.json +102 -0
- package/public/favicon.ico +0 -0
- package/public/favicon.png +0 -0
- package/scripts/check-updates.mjs +31 -0
- package/scripts/ensure-valence-index-css.mjs +245 -0
- package/scripts/generate-password-hash.mjs +25 -0
- package/scripts/release-orchestrator.mjs +363 -0
- package/scripts/scaffold-case.mjs +460 -0
- package/scripts/scaffold-consumer.mjs +87 -0
- package/scripts/smoke-homeview.mjs +133 -0
- package/scripts/smoke-initializer.mjs +129 -0
- package/scripts/smoke-packed.mjs +184 -0
- package/scripts/switch-valence-source.mjs +162 -0
- package/scripts/sync-template-shared.mjs +136 -0
- package/scripts/terminal-ui.mjs +274 -0
- package/scripts/verify-integration.mjs +72 -0
- package/src/App.js +10015 -0
- package/src/header-visibility.contract.js +31 -0
- package/src/header-visibility.contract.test.js +41 -0
- package/src/main.js +12 -0
- package/src/parser/markdown.js +855 -0
- package/src/style.css +88 -0
- package/templates/README.md +242 -0
- package/templates/configs/i18n/i18n.config.js +230 -0
- package/templates/configs/i18n/i18n.labels.js +188 -0
- package/templates/configs/portfoliable.a11y.config.js +262 -0
- package/templates/configs/portfoliable.design.config.js +651 -0
- package/templates/gitignore +9 -0
- package/templates/index.html +20 -0
- package/templates/public/api/.htaccess +4 -0
- package/templates/public/api/README.md +27 -0
- package/templates/public/api/password.config.example.json +16 -0
- package/templates/public/api/password.config.json +16 -0
- package/templates/public/api/unlock-case.php +56 -0
- package/templates/public/favicon.ico +0 -0
- package/templates/public/favicon.png +0 -0
- package/templates/public/portfoliable-logo.svg +3 -0
- package/templates/scripts/add-language.mjs +253 -0
- package/templates/scripts/convert-video-to-mp4.mjs +207 -0
- package/templates/scripts/convert-wav-to-mp3.mjs +184 -0
- package/templates/scripts/delete-case.mjs +320 -0
- package/templates/scripts/delete-language.mjs +195 -0
- package/templates/scripts/generate-password-hash.mjs +98 -0
- package/templates/scripts/i18n-config-utils.mjs +123 -0
- package/templates/scripts/scaffold-case.mjs +444 -0
- package/templates/scripts/sync-locales.mjs +1048 -0
- package/templates/scripts/validate-content.mjs +257 -0
- package/templates/scripts/validate-protection.mjs +187 -0
- package/templates/src/cases/index.js +188 -0
- package/templates/src/content/about/ABOUTME.md +202 -0
- package/templates/src/content/cases/template-case/case.md +479 -0
- package/templates/src/content/cases/template-case/cover.png +0 -0
- package/templates/src/content/cases/template-case/he-cover.png +0 -0
- package/templates/src/content/cases/template-case/template-audio.mp3 +0 -0
- package/templates/src/content/cases/template-case/template-video.mp4 +0 -0
- package/templates/src/content/thumbnail-options.generated.json +1044 -0
- package/templates/src/main.js +23 -0
- package/templates/src/parser/markdown.js +805 -0
- package/vite.config.js +111 -0
package/vite.config.js
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// File: create-portfoliable/vite.config.js
|
|
2
|
+
// Purpose: Configure Vite build behavior and deterministic chunk splitting rules.
|
|
3
|
+
// Author: Lio Schimanko
|
|
4
|
+
|
|
5
|
+
// === IMPORTS ===
|
|
6
|
+
import fs from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { defineConfig } from 'vite';
|
|
9
|
+
|
|
10
|
+
// Detects when @portfoliablejs/valence is installed as a local symlink.
|
|
11
|
+
function isLocalLinkedValence() {
|
|
12
|
+
const valencePath = path.resolve(process.cwd(), 'node_modules', '@portfoliable', 'valence');
|
|
13
|
+
try {
|
|
14
|
+
return fs.lstatSync(valencePath).isSymbolicLink();
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// === CHUNK SPLITTING STRATEGY ===
|
|
21
|
+
// Maps dependency module IDs to manual chunk names for stable build output organization.
|
|
22
|
+
function getManualChunk(id) {
|
|
23
|
+
// Returns undefined for application code so only vendor modules are manually chunked.
|
|
24
|
+
if (!id.includes('/node_modules/')) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Routes Mermaid code into a dedicated async vendor chunk.
|
|
29
|
+
if (id.includes('/node_modules/mermaid/')) {
|
|
30
|
+
return 'vendor-mermaid';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Routes KaTeX rendering libraries into a dedicated vendor chunk.
|
|
34
|
+
if (id.includes('/node_modules/katex/')) {
|
|
35
|
+
return 'vendor-katex';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Routes Cytoscape graph libraries into a dedicated vendor chunk.
|
|
39
|
+
if (id.includes('/node_modules/cytoscape/')) {
|
|
40
|
+
return 'vendor-cytoscape';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Groups dagre and graphlib under one graph utility chunk.
|
|
44
|
+
if (id.includes('/node_modules/dagre/') || id.includes('/node_modules/graphlib/')) {
|
|
45
|
+
return 'vendor-graph';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Groups D3 family modules into a dedicated analytics/visualization chunk.
|
|
49
|
+
if (id.includes('/node_modules/d3-')) {
|
|
50
|
+
return 'vendor-d3';
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Routes roughjs drawing utilities into a dedicated chunk.
|
|
54
|
+
if (id.includes('/node_modules/roughjs/')) {
|
|
55
|
+
return 'vendor-roughjs';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// === VITE CONFIG EXPORT ===
|
|
62
|
+
// Exports build settings used across dev/build/preview workflows.
|
|
63
|
+
export default defineConfig(({ command }) => {
|
|
64
|
+
const usingLocalValence = isLocalLinkedValence();
|
|
65
|
+
const phpApiProxy = String(process.env.PORTFOLIABLE_PHP_API_PROXY || '').trim();
|
|
66
|
+
|
|
67
|
+
const serverConfig = (command === 'serve' && usingLocalValence)
|
|
68
|
+
? {
|
|
69
|
+
fs: {
|
|
70
|
+
allow: [
|
|
71
|
+
process.cwd(),
|
|
72
|
+
path.resolve(process.cwd(), '..', '..', 'valence')
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
watch: {
|
|
76
|
+
ignored: ['!**/node_modules/@portfoliablejs/valence/**']
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
: {};
|
|
80
|
+
|
|
81
|
+
if (phpApiProxy) {
|
|
82
|
+
serverConfig.proxy = {
|
|
83
|
+
'/api/unlock-case.php': {
|
|
84
|
+
target: phpApiProxy,
|
|
85
|
+
changeOrigin: true
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return {
|
|
91
|
+
// In local-link mode, avoid prebundling Valence so edits in the linked package
|
|
92
|
+
// are reflected immediately during development.
|
|
93
|
+
optimizeDeps: (command === 'serve' && usingLocalValence)
|
|
94
|
+
? { exclude: ['@portfoliablejs/valence'] }
|
|
95
|
+
: undefined,
|
|
96
|
+
|
|
97
|
+
// Allow and watch linked workspace files so HMR sees local Valence changes.
|
|
98
|
+
server: Object.keys(serverConfig).length > 0 ? serverConfig : undefined,
|
|
99
|
+
|
|
100
|
+
build: {
|
|
101
|
+
// Mermaid and diagram ecosystems are intentionally code-split and loaded on demand.
|
|
102
|
+
// Keep warnings useful while avoiding noisy false alarms for optional async chunks.
|
|
103
|
+
chunkSizeWarningLimit: 3000,
|
|
104
|
+
rollupOptions: {
|
|
105
|
+
output: {
|
|
106
|
+
manualChunks: getManualChunk
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
});
|