Skip to content

Commit fc5e920

Browse files
committed
added removal of extra files along with optimized code
1 parent 005151e commit fc5e920

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

index.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,26 @@ if (!repo) {
1414
const repoUrl = `https://github.com/pr4j3sh/${repo}.git`;
1515
const projectName = args[1] || repo;
1616

17+
const rm = [
18+
".git",
19+
".github",
20+
"LICENSE",
21+
"CODE_OF_CONDUCT.md",
22+
"CONTRIBUTING.md",
23+
"Dockerfile",
24+
];
25+
1726
try {
1827
execSync(`git clone ${repoUrl} ${projectName}`, { stdio: "inherit" });
1928
if (projectName !== ".") {
2029
chdir(projectName);
2130
}
2231

23-
rmSync(".git", { recursive: true, force: true });
24-
if (existsSync(".github")) {
25-
rmSync(".github", { recursive: true, force: true });
26-
}
27-
if (existsSync("LICENSE")) {
28-
rmSync("LICENSE", { recursive: true, force: true });
29-
}
32+
rm.forEach((item) => {
33+
if (existsSync(item)) {
34+
rmSync(item, { recursive: true, force: true });
35+
}
36+
});
3037

3138
if (existsSync("package.json")) {
3239
console.log("");
@@ -47,5 +54,6 @@ try {
4754
}
4855
console.log(" npm run dev");
4956
} catch (error) {
57+
console.error(error);
5058
exit(1);
5159
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pr4j3sh/create-frames",
3-
"version": "1.0.11",
3+
"version": "1.0.12",
44
"description": "frames CLI tool for cloning templates",
55
"main": "dist/bundle.js",
66
"bin": {

0 commit comments

Comments
 (0)