Skip to content

Commit 9aaac90

Browse files
Migrate shelljs to execa (#12) (#17)
1 parent df62e64 commit 9aaac90

File tree

3 files changed

+212
-206
lines changed

3 files changed

+212
-206
lines changed

init.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
const shell = require("shelljs");
2+
const { execaSync } = require("execa");
33
const fs = require("fs");
44
const path = require("path");
55

@@ -11,18 +11,24 @@ if (!projectName) {
1111
}
1212

1313
// Clone the repository
14-
shell.exec(
15-
`git clone git@github.com:mattfsourcecode/fastify-swc-typescript-server.git ${projectName}`
14+
execaSync(
15+
"git",
16+
[
17+
"clone",
18+
"git@github.com:mattfsourcecode/fastify-swc-typescript-server.git",
19+
projectName,
20+
],
21+
{ stdio: "inherit" }
1622
);
1723

1824
// Navigate to the cloned directory
19-
shell.cd(projectName);
25+
process.chdir(projectName);
2026

2127
// Remove the original .git directory
22-
shell.rm("-rf", ".git");
28+
fs.rmSync(".git", { recursive: true, force: true });
2329

2430
// Initialize a new git repository
25-
shell.exec("git init");
31+
execaSync("git", ["init"], { stdio: "inherit" });
2632

2733
// Update package.json
2834
const packageJsonPath = path.join(process.cwd(), "package.json");

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@
3939
"prepare": "husky install"
4040
},
4141
"dependencies": {
42-
"shelljs": "^0.8.5"
42+
"execa": "^9.5.2"
4343
},
4444
"devDependencies": {
45-
"chai": "^4.5.0",
46-
"husky": "^8.0.3",
47-
"mocha": "^10.7.3",
48-
"rimraf": "^5.0.10"
45+
"chai": "^5.1.2",
46+
"husky": "^9.1.7",
47+
"mocha": "^11.1.0",
48+
"rimraf": "^6.0.1"
4949
},
5050
"bin": {
5151
"fastify-swc-server": "init.js"

0 commit comments

Comments
 (0)