Skip to content

Commit cfcd863

Browse files
change version bpmn
1 parent a78eebc commit cfcd863

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

build.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,76 @@ if (fs.existsSync(bpmnDir)) {
580580
console.warn('BPMN directory not found!');
581581
}
582582

583+
// Copy BPMN.io directly from node_modules to ensure version consistency
584+
console.log('Copying BPMN.io from node_modules...');
585+
const bpmnJsDir = path.join(distDir, 'js', 'bpmn-js');
586+
if (!fs.existsSync(bpmnJsDir)) {
587+
fs.mkdirSync(bpmnJsDir, { recursive: true });
588+
}
589+
590+
// Copy the specific bpmn-js distributable files from node_modules
591+
const bpmnJsNodeModule = path.join('node_modules', 'bpmn-js', 'dist');
592+
if (fs.existsSync(bpmnJsNodeModule)) {
593+
// Copy the minified version
594+
fs.copyFileSync(
595+
path.join(bpmnJsNodeModule, 'bpmn-navigated-viewer.production.min.js'),
596+
path.join(bpmnJsDir, 'bpmn-navigated-viewer.min.js')
597+
);
598+
console.log('Copied bpmn-js library from node_modules');
599+
600+
// Also copy the development version for better debugging
601+
fs.copyFileSync(
602+
path.join(bpmnJsNodeModule, 'bpmn-navigated-viewer.development.js'),
603+
path.join(bpmnJsDir, 'bpmn-navigated-viewer.js')
604+
);
605+
console.log('Copied bpmn-js development version for debugging');
606+
607+
// Copy the CSS file if it exists
608+
const bpmnCssPath = path.join(bpmnJsNodeModule, 'assets', 'bpmn-js.css');
609+
if (fs.existsSync(bpmnCssPath)) {
610+
const cssDir = path.join(distDir, 'css');
611+
if (!fs.existsSync(cssDir)) {
612+
fs.mkdirSync(cssDir, { recursive: true });
613+
}
614+
fs.copyFileSync(bpmnCssPath, path.join(cssDir, 'bpmn-js.css'));
615+
console.log('Copied bpmn-js CSS');
616+
}
617+
} else {
618+
console.warn('bpmn-js not found in node_modules! Using bundled version instead.');
619+
}
620+
621+
// Create directories for static assets
622+
console.log('Creating directories for static assets...');
623+
const imagesDir = path.join(distDir, 'images');
624+
625+
// Create directories if they don't exist
626+
if (!fs.existsSync(imagesDir)) fs.mkdirSync(imagesDir, { recursive: true });
627+
628+
// Copy images to dist directory
629+
console.log('Copying images to dist directory...');
630+
const sourceImagesDir = path.join(__dirname, 'images');
631+
if (fs.existsSync(sourceImagesDir)) {
632+
const imageFiles = fs.readdirSync(sourceImagesDir);
633+
console.log(`Found ${imageFiles.length} images to copy`);
634+
635+
imageFiles.forEach(file => {
636+
const sourcePath = path.join(sourceImagesDir, file);
637+
const destPath = path.join(imagesDir, file);
638+
639+
// Check if source is a file (not a directory)
640+
if (fs.statSync(sourcePath).isFile()) {
641+
fs.copyFileSync(sourcePath, destPath);
642+
console.log(`Copied ${file} to ${destPath}`);
643+
} else {
644+
console.log(`Skipping directory ${file}`);
645+
}
646+
});
647+
} else {
648+
console.warn('Images directory not found in source!');
649+
console.log('Creating empty images directory in dist...');
650+
fs.mkdirSync(imagesDir, { recursive: true });
651+
}
652+
583653
// Main build process
584654
async function build() {
585655
try {

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
88
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/styles/github.min.css">
99
<link rel="stylesheet" href="styles.css">
10+
<link rel="stylesheet" href="css/bpmn-js.css">
1011
</head>
1112
<body>
1213
<div class="container-fluid">
@@ -41,6 +42,7 @@ <h3>AI Ethics Policy</h3>
4142
<script src="https://cdn.jsdelivr.net/npm/[email protected]/highlight.min.js"></script>
4243
<!-- Load BPMN.js directly to ensure it's available -->
4344
<script src="https://unpkg.com/[email protected]/dist/bpmn-viewer.development.js"></script>
45+
<script src="js/bpmn-js/bpmn-navigated-viewer.min.js"></script>
4446
<script src="wiki.js"></script>
4547
</body>
4648
</html>

0 commit comments

Comments
 (0)