Skip to content
Open
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: 4 additions & 1 deletion packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
"main": "dist/esnext/index.js",
"types": "dist/esnext/index.d.ts",
"scripts": {
"clean": "rimraf dist",
"clean": "rimraf dist && rimraf public/chartifact",
"copy-assets": "node scripts/copy-assets.js",
"dev": "vite --config vite.config.js",
"tsc": "tsc -p .",
"predev": "npm run copy-assets",
"postbundle": "npm run copy-assets",
"bundle": "vite build --config vite.bundle.config.js",
"build": "npm run tsc",
"build:06": "npm run build"
Expand Down
31 changes: 31 additions & 0 deletions packages/editor/scripts/copy-assets.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import fs from 'fs';
import path from 'path';

const sourceDir = '../../docs/dist/v1';
const targetDir = 'public/chartifact/dist/v1';

// Check if source exists
if (!fs.existsSync(sourceDir)) {
console.log('Assets not found, run npm run build in workspace root first');
process.exit(0);
}

// Create target directory
fs.mkdirSync(targetDir, { recursive: true });

// Copy all files (skip directories)
const files = fs.readdirSync(sourceDir);
let copiedCount = 0;

files.forEach(file => {
const sourcePath = path.join(sourceDir, file);
const targetPath = path.join(targetDir, file);

// Only copy if it's a file (not a directory)
if (fs.statSync(sourcePath).isFile()) {
fs.copyFileSync(sourcePath, targetPath);
copiedCount++;
}
});

console.log(`Copied ${copiedCount} assets to ${targetDir}`);