Spaces:
Runtime error
Runtime error
const { execSync } = require("child_process"); | |
const path = require("path"); | |
const token = process.env["sc4sc_token"]; | |
if (!token) { | |
console.error("環境変数 'sc4sc_token' が設定されていません。"); | |
process.exit(1); | |
} | |
const repoPath = path.join(__dirname, "dist"); | |
const remoteUrl = `https://user:${token}@huggingface.co/spaces/soiz1/simple-editor`; | |
console.log("接続完了!..."); | |
try { | |
console.log("Git リポジトリを初期化..."); | |
execSync("git init", { cwd: repoPath, shell: true }); | |
execSync(`git remote add origin ${remoteUrl}`, { cwd: repoPath, shell: true }); | |
execSync("git add .", { cwd: repoPath, shell: true }); | |
execSync('git commit -m "Automated deploy"', { cwd: repoPath, shell: true }); | |
execSync("git push -f origin master", { cwd: repoPath, shell: true }); | |
console.log("✅ アップロードが完了しました!"); | |
} catch (err) { | |
console.error("❌ アップロードに失敗しました:", err.message); | |
} | |