Skip to content

Commit 834c24a

Browse files
authored
Merge pull request #66 from rtCamp/feat/copy-assets
Fix: Add copy assets script and unpublish local packages
2 parents 583b959 + cb798e5 commit 834c24a

File tree

4 files changed

+52
-1
lines changed

4 files changed

+52
-1
lines changed

package-lock.json

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"lint:types": "tsc ",
1919
"lint:js:fix": "eslint --fix .",
2020
"publish:local": "npm run publish:local -w @rtcamp/frappe-ui-react",
21+
"unpublish:local": "npm run unpublish:local -w @rtcamp/frappe-ui-react",
2122
"build:publish:local": "npm run build && npm run publish:local",
2223
"publish:remote": "npm run publish:remote -w @rtcamp/frappe-ui-react",
2324
"build:publish:remote": "npm run build && npm run publish:remote",

packages/frappe-ui-react/package.json

Lines changed: 5 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 --force",
2830
"publish:remote": "npm publish"
2931
},
3032
"dependencies": {
@@ -36,6 +38,7 @@
3638
"@radix-ui/react-toast": "^1.2.15",
3739
"@radix-ui/react-tooltip": "^1.2.7",
3840
"@tailwindcss/vite": "^4.1.11",
41+
"clsx": "^2.1.1",
3942
"dayjs": "^1.11.13",
4043
"dompurify": "^3.2.6",
4144
"echarts": "^5.6.0",
@@ -51,6 +54,7 @@
5154
"react-dom": "^19.1.0",
5255
"react-grid-layout": "^1.5.2",
5356
"react-quill-new": "^3.6.0",
57+
"react-resizable": "^3.0.5",
5458
"styled-components": "^6.1.19",
5559
"tailwindcss": "^4.1.11"
5660
},
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)