dappbooster 0.2.0 → 0.2.1
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/index.js +17 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -30,6 +30,17 @@ function execQuiet(command) {
|
|
|
30
30
|
return execSync(command, options);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
function getLatestTag() {
|
|
34
|
+
// Get all tags, sorted by version
|
|
35
|
+
const tags = execSync("git tag -l --sort=-v:refname")
|
|
36
|
+
.toString()
|
|
37
|
+
.trim()
|
|
38
|
+
.split("\n");
|
|
39
|
+
|
|
40
|
+
// Return the first (latest) tag
|
|
41
|
+
return tags[0];
|
|
42
|
+
}
|
|
43
|
+
|
|
33
44
|
function cloneRepo(projectName) {
|
|
34
45
|
const sanitizedProjectName = projectName.replace(/[^a-zA-Z0-9-_]/g, "-");
|
|
35
46
|
const projectDir = path.join(process.cwd(), sanitizedProjectName);
|
|
@@ -47,11 +58,11 @@ function cloneRepo(projectName) {
|
|
|
47
58
|
execQuiet("git fetch --tags");
|
|
48
59
|
|
|
49
60
|
// Get the latest tag
|
|
50
|
-
const latestTag =
|
|
51
|
-
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
61
|
+
const latestTag = getLatestTag();
|
|
62
|
+
|
|
63
|
+
if (!latestTag) {
|
|
64
|
+
throw new Error("No tags found in the repository");
|
|
65
|
+
}
|
|
55
66
|
|
|
56
67
|
// Checkout the latest tag
|
|
57
68
|
execQuiet(`git checkout "${latestTag}"`);
|
|
@@ -63,6 +74,7 @@ function cloneRepo(projectName) {
|
|
|
63
74
|
execQuiet("git init");
|
|
64
75
|
|
|
65
76
|
console.log(`DappBooster repository cloned in ${projectDir}`);
|
|
77
|
+
console.log(`Latest version: ${latestTag}`);
|
|
66
78
|
} catch (error) {
|
|
67
79
|
console.error("An error occurred:", error.message);
|
|
68
80
|
process.exit(1);
|