-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.js
More file actions
33 lines (26 loc) · 883 Bytes
/
deploy.js
File metadata and controls
33 lines (26 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Simple deployment script for GitHub Pages
import { execSync } from "child_process";
import fs from "fs";
import path from "path";
// Run the build
console.log("Building the project...");
execSync("npm run build", { stdio: "inherit" });
// Create necessary files in the dist folder
console.log("Creating special files for GitHub Pages...");
// Create .nojekyll file
fs.writeFileSync(path.join("dist", ".nojekyll"), "");
// Ensure dist directory exists
if (!fs.existsSync("dist")) {
fs.mkdirSync("dist");
}
// Copy 404.html to dist if it exists in public
if (fs.existsSync(path.join("public", "404.html"))) {
fs.copyFileSync(
path.join("public", "404.html"),
path.join("dist", "404.html")
);
}
// Deploy to gh-pages branch
console.log("Deploying to GitHub Pages...");
execSync("npx gh-pages -d dist", { stdio: "inherit" });
console.log("Deployment complete!");