Skip to content

Commit 7cddd1e

Browse files
committed
Add copy assets script and unpublishing local package
1 parent 583b959 commit 7cddd1e

File tree

2 files changed

+47
-1
lines changed

2 files changed

+47
-1
lines changed

packages/frappe-ui-react/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
"./tailwind/preset": "./src/utils/tailwind.config.js"
2424
},
2525
"scripts": {
26-
"build": "tsc -b",
26+
"build": "tsc -b && npm run copy-assets",
27+
"copy-assets": "node scripts/copy-assets.js",
2728
"publish:local": "npm publish --registry http://localhost:4873",
29+
"unpublish:local": "npm unpublish --registry http://localhost:4873",
2830
"publish:remote": "npm publish"
2931
},
3032
"dependencies": {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const fs = require('fs');
2+
const path = require('path');
3+
4+
function copyAssets() {
5+
const srcDir = 'src';
6+
const distDir = 'dist';
7+
8+
function copyFile(src, dest) {
9+
const destDir = path.dirname(dest);
10+
if (!fs.existsSync(destDir)) {
11+
fs.mkdirSync(destDir, { recursive: true });
12+
}
13+
fs.copyFileSync(src, dest);
14+
console.log(`Copied: ${src} -> ${dest}`);
15+
}
16+
17+
function walkDir(dir) {
18+
if (!fs.existsSync(dir)) {
19+
console.log(`Source directory ${dir} does not exist`);
20+
return;
21+
}
22+
23+
const files = fs.readdirSync(dir);
24+
25+
files.forEach(file => {
26+
const filePath = path.join(dir, file);
27+
const stat = fs.statSync(filePath);
28+
29+
if (stat.isDirectory()) {
30+
walkDir(filePath);
31+
} else if (file.endsWith('.css') || file.endsWith('.svg')) {
32+
const relativePath = path.relative(srcDir, filePath);
33+
const destPath = path.join(distDir, relativePath);
34+
copyFile(filePath, destPath);
35+
}
36+
});
37+
}
38+
39+
console.log('Copying CSS and SVG assets...');
40+
walkDir(srcDir);
41+
console.log('Asset copying complete!');
42+
}
43+
44+
copyAssets();

0 commit comments

Comments
 (0)