codeweaver 1.0.13 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -2
- package/command.js +17 -18
- package/package.json +1 -1
package/LICENSE
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2024 Ehsan-Afzali-2024
|
|
4
|
-
|
|
5
3
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
4
|
of this software and associated documentation files (the "Software"), to deal
|
|
7
5
|
in the Software without restriction, including without limitation the rights
|
package/command.js
CHANGED
|
@@ -4,6 +4,7 @@ const fs = require("fs");
|
|
|
4
4
|
const { exec } = require("child_process");
|
|
5
5
|
const path = require("path");
|
|
6
6
|
const { version } = require("os");
|
|
7
|
+
const { object } = require("zod");
|
|
7
8
|
|
|
8
9
|
// Get the project name from command-line arguments or use a default name
|
|
9
10
|
const projectName = process.argv[2] || "my-app";
|
|
@@ -29,16 +30,16 @@ exec(`git clone ${repoUrl} ${projectName}`, (error) => {
|
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
// Parse the package.json content and update the name
|
|
32
|
-
const {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
33
|
+
const { bin, ...packageJson } = JSON.parse(data);
|
|
34
|
+
|
|
35
|
+
Object.assign(packageJson, {
|
|
36
|
+
name: projectName,
|
|
37
|
+
version: "1.0.0",
|
|
38
|
+
description: "",
|
|
39
|
+
keywords: "",
|
|
40
|
+
author: "",
|
|
41
|
+
license: "",
|
|
42
|
+
});
|
|
42
43
|
|
|
43
44
|
// Write the updated package.json back to the file
|
|
44
45
|
fs.writeFile(
|
|
@@ -50,25 +51,23 @@ exec(`git clone ${repoUrl} ${projectName}`, (error) => {
|
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
// Remove the .
|
|
54
|
-
exec(`rm -
|
|
54
|
+
// Remove the command.js file
|
|
55
|
+
exec(`rm -f ${path.join(projectName, "command.js")}`, (rmError) => {
|
|
55
56
|
if (rmError) {
|
|
56
|
-
console.error(`Error removing .
|
|
57
|
+
console.error(`Error removing command.js file: ${rmError.message}`);
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
// Remove the .git folder
|
|
62
|
+
exec(`rm -rf ${path.join(projectName, ".git")}`, (rm2Error) => {
|
|
61
63
|
if (rm2Error) {
|
|
62
|
-
console.error(
|
|
63
|
-
`Error removing command.js file: ${rm2Error.message}`
|
|
64
|
-
);
|
|
64
|
+
console.error(`Error removing .git folder: ${rm2Error.message}`);
|
|
65
65
|
return;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
console.log(
|
|
69
69
|
`Successfully cloned codeweaver into ${path.resolve(projectName)}`
|
|
70
70
|
);
|
|
71
|
-
console.log(`The project name is set to "${projectName}".`);
|
|
72
71
|
});
|
|
73
72
|
});
|
|
74
73
|
}
|