Skip to content

Commit

Permalink
Fix bug with new init
Browse files Browse the repository at this point in the history
  • Loading branch information
skymen committed Jan 19, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 2e50ef9 commit 767be67
Showing 2 changed files with 17 additions and 10 deletions.
25 changes: 16 additions & 9 deletions build/init.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import fs from "fs";
import open from "open";
import { execSync } from "child_process";
import { exec } from "child_process";
import * as chalkUtils from "./chalkUtils.js";
import fromConsole from "./fromConsole.js";

export default function initialiseProject() {
console.log(execSync("npm install"));
console.log(execSync("npm run updateProjectData"));
if (!fs.existsSync(".git")) {
console.log(execSync("git init"));
console.log(execSync("git add -A"));
console.log(execSync('git commit -m "Initial commit"'));
open("https://github.com/new");
}
let process = exec("npm install && npm run updateProjectData");
process.stdout.pipe(process.stdout);
process.stderr.pipe(process.stderr);
process.on("exit", () => {
if (!fs.existsSync(".git")) {
let process2 = exec(
"git init && git add -A && git commit -m 'Initial commit'"
);
process2.stdout.pipe(process2.stdout);
process2.stderr.pipe(process2.stderr);
process2.on("exit", () => {
open("https://github.com/new");
});
}
});
}

if (fromConsole(import.meta.url)) {
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
"build": "cd build && node build.js",
"dev": "cd build && node dev.js",
"updateProjectData": "cd build && node updateProjectData.js",
"init": "npm install && cd build && node init.js",
"init": "node init.js",
"generateDocs": "cd build && node generateDocumentation.js",
"publish": "cd build && node publish.js"
},

0 comments on commit 767be67

Please sign in to comment.