Skip to content

Commit 65ad186

Browse files
authored
Cross-platform developement (Unix/Windows) (#167)
* Add shx (Unix-like shell commands) dependency and update package scripts for cross-platform compatibility (Unix & Windows) * Remove shx dependency from package.json and package-lock.json * Add shelljs dependency and replace shx commands with a custom script for file copying * use " instead of ' * fix formatting * Translate comments in cp-gp.js * Add error handling in cp-gp.js
1 parent 21a2d8b commit 65ad186

File tree

3 files changed

+146
-13
lines changed

3 files changed

+146
-13
lines changed

package-lock.json

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

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313
"build": "tsc -b && vite build",
1414
"preview": "vite preview",
1515
"test": "vitest",
16-
"cp-gp": "mkdir -p ./public && cp -r ./graypaper-archive/dist/* ./public/",
16+
"cp-gp": "node ./scripts/cp-gp.js",
1717
"prebuild": "git submodule update --init && npm run cp-gp",
18-
"predev": "npm run cp-gp"
18+
"predev": "npm run cp-gp",
19+
"serve": "vite preview"
1920
},
2021
"dependencies": {
2122
"@fluffylabs/migrate-selection": "^1.0.0",
@@ -36,6 +37,7 @@
3637
"@types/react-dom": "^18.3.0",
3738
"@types/react-modal": "^3.16.3",
3839
"@vitejs/plugin-react": "^4.3.1",
40+
"shelljs": "^0.8.5",
3941
"typescript": "^5.2.2",
4042
"vite": "^5.3.4",
4143
"vite-plugin-prefetch-chunk": "^0.1.2",

scripts/cp-gp.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import shell from "shelljs";
2+
3+
// Throw an error if any command fails
4+
shell.config.fatal = true;
5+
6+
// Creating the public directory if it doesn't exist
7+
shell.mkdir("-p", "public");
8+
9+
// Copying files from graypaper-archive/dist to public
10+
shell.cp("-r", "graypaper-archive/dist/*", "public");

0 commit comments

Comments
 (0)