Skip to content

Commit 342f2e8

Browse files
Replace execa with Node.js' built-in execSync (#19) (#20)
1 parent 73dea2b commit 342f2e8

File tree

3 files changed

+13
-119
lines changed

3 files changed

+13
-119
lines changed

init.js

+6-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
const { execaSync } = require("execa");
2+
const { execSync } = require("child_process");
33
const fs = require("fs");
44
const path = require("path");
55

@@ -11,13 +11,8 @@ if (!projectName) {
1111
}
1212

1313
// Clone the repository
14-
execaSync(
15-
"git",
16-
[
17-
"clone",
18-
"[email protected]:mattfsourcecode/fastify-swc-typescript-server.git",
19-
projectName,
20-
],
14+
execSync(
15+
`git clone [email protected]:mattfsourcecode/fastify-swc-typescript-server.git ${projectName}`,
2116
{ stdio: "inherit" }
2217
);
2318

@@ -28,7 +23,7 @@ process.chdir(projectName);
2823
fs.rmSync(".git", { recursive: true, force: true });
2924

3025
// Initialize a new git repository
31-
execaSync("git", ["init"], { stdio: "inherit" });
26+
execSync("git init", { stdio: "inherit" });
3227

3328
// Update package.json
3429
const packageJsonPath = path.join(process.cwd(), "package.json");
@@ -37,3 +32,5 @@ packageJson.name = projectName; // Update the project name
3732
packageJson.author = ""; // Clear the author
3833

3934
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2)); // Write back to package.json
35+
36+
console.log(`Project "${projectName}" has been successfully bootstrapped.`);

package.json

-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@
3838
"test": "mocha 'tests/**/*.js'",
3939
"prepare": "husky install"
4040
},
41-
"dependencies": {
42-
"execa": "^9.5.2"
43-
},
4441
"devDependencies": {
4542
"chai": "^5.1.2",
4643
"husky": "^9.1.7",

pnpm-lock.yaml

+7-107
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)