dappbooster 0.0.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.
Files changed (2) hide show
  1. package/index.js +54 -0
  2. package/package.json +20 -0
package/index.js ADDED
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require("child_process");
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+ const readline = require("readline");
7
+
8
+ const repoUrl = "https://github.com/bootnodedev/dappbooster.git";
9
+
10
+ const rl = readline.createInterface({
11
+ input: process.stdin,
12
+ output: process.stdout,
13
+ });
14
+
15
+ rl.question("Enter the project name: ", (projectName) => {
16
+ rl.close();
17
+
18
+ // Sanitize the project name to create a valid directory name
19
+ const sanitizedProjectName = projectName.replace(/[^a-zA-Z0-9-_]/g, "-");
20
+ const projectDir = path.join(process.cwd(), sanitizedProjectName);
21
+
22
+ try {
23
+ console.log(`Cloning DappBooster repository into ${projectDir}...`);
24
+
25
+ // Clone the repository with minimum history
26
+ execSync(`git clone --depth 1 --no-checkout "${repoUrl}" "${projectDir}"`, {
27
+ stdio: "inherit",
28
+ });
29
+
30
+ // Change to the project directory
31
+ process.chdir(projectDir);
32
+
33
+ // Fetch all tags
34
+ execSync("git fetch --tags", { stdio: "inherit" });
35
+
36
+ // Get the latest tag
37
+ const latestTag = execSync(
38
+ "git describe --tags $(git rev-list --tags --max-count=1)"
39
+ )
40
+ .toString()
41
+ .trim();
42
+
43
+ // Checkout the latest tag
44
+ execSync(`git checkout "${latestTag}"`, { stdio: "inherit" });
45
+
46
+ // Print the checked out tag
47
+ console.log(`Cloned DappBooster repository at tag: ${latestTag}`);
48
+
49
+ console.log(`DappBooster repository cloned in ${projectDir}`);
50
+ } catch (error) {
51
+ console.error("An error occurred:", error.message);
52
+ process.exit(1);
53
+ }
54
+ });
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "dappbooster",
3
+ "version": "0.0.1",
4
+ "description": "Script to easily start your project with dAppBooster",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "dappbooster": "./index.js"
8
+ },
9
+ "scripts": {
10
+ "test": "echo \"Error: no test specified\" && exit 1"
11
+ },
12
+ "keywords": [
13
+ "dappbooster",
14
+ "bootnode",
15
+ "installer",
16
+ "dapp"
17
+ ],
18
+ "author": "",
19
+ "license": "ISC"
20
+ }