features-cli 0.2.0
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/README.md +31 -0
- package/package.json +25 -0
- package/pre-install.js +42 -0
- package/start.js +23 -0
- package/uninstall.js +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Features CLI
|
|
2
|
+
|
|
3
|
+
A CLI tool for discovering and managing features in a feature-based architecture project.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
From the CLI directory:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
cargo build --release
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
cargo run -- /path/to/features # list all the features in the directory
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Commands and their descriptions are listed below:
|
|
21
|
+
|
|
22
|
+
| Command | Description |
|
|
23
|
+
| ------- | ----------- |
|
|
24
|
+
| `--json` | Output features as JSON |
|
|
25
|
+
| `--flat` | Output features as a flat array instead of nested structure |
|
|
26
|
+
| `--description` | Include feature descriptions in the output |
|
|
27
|
+
| `--list-owners` | Display only unique list of owners |
|
|
28
|
+
| `--check` | Run validation checks on features (e.g., duplicate names) |
|
|
29
|
+
| `--serve` | Start an HTTP server to serve features and the web dashboard UI |
|
|
30
|
+
| `--serve --port 8080` | Start an HTTP server on specified port |
|
|
31
|
+
| `--build` | Build a static version of the web dashboard UI |
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "features-cli",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "A CLI tool for discovering the features in a folder",
|
|
5
|
+
"main": "start.js",
|
|
6
|
+
"directories": {
|
|
7
|
+
"test": "tests"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"postinstall": "node ./pre-install.js",
|
|
12
|
+
"uninstall": "node ./uninstall.js"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [],
|
|
15
|
+
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"files": [
|
|
18
|
+
"pre-install.js",
|
|
19
|
+
"start.js",
|
|
20
|
+
"uninstall.js",
|
|
21
|
+
"README.md",
|
|
22
|
+
"LICENSE"
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
|
package/pre-install.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { exec } = require("child_process");
|
|
6
|
+
const { homedir } = require("os");
|
|
7
|
+
|
|
8
|
+
const cargoDir = path.join(homedir(), ".cargo");
|
|
9
|
+
|
|
10
|
+
// check if directory exists
|
|
11
|
+
if (fs.existsSync(cargoDir)) {
|
|
12
|
+
// console.log("Cargo found.");
|
|
13
|
+
} else {
|
|
14
|
+
const setCargo = 'PATH="/$HOME/.cargo/bin:${PATH}"';
|
|
15
|
+
console.log("Installing deps [cargo].");
|
|
16
|
+
|
|
17
|
+
exec(
|
|
18
|
+
`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && ${setCargo}`,
|
|
19
|
+
(error) => {
|
|
20
|
+
if (error) {
|
|
21
|
+
console.log(
|
|
22
|
+
"curl failed! Curl may not be installed on the OS. View https://curl.se/download.html to install."
|
|
23
|
+
);
|
|
24
|
+
console.log(error);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const features = process.env.npm_config_features ? `--features ${process.env.npm_config_features.replace(",", " ")}` : "";
|
|
31
|
+
|
|
32
|
+
console.log(`Installing and compiling features-cli 0.2.0 ${features} ...`);
|
|
33
|
+
exec(`cargo install features-cli --vers 0.2.0 ${features}`, (error, stdout, stderr) => {
|
|
34
|
+
console.log(stdout);
|
|
35
|
+
if (error || stderr) {
|
|
36
|
+
console.log(error || stderr);
|
|
37
|
+
} else {
|
|
38
|
+
console.log("install finished!");
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
|
package/start.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { exec } = require("child_process");
|
|
4
|
+
|
|
5
|
+
const controller = typeof AbortController !== "undefined" ? new AbortController() : { abort: () => {}, signal: typeof AbortSignal !== "undefined" ? new AbortSignal() : undefined };
|
|
6
|
+
const { signal } = controller;
|
|
7
|
+
|
|
8
|
+
exec("features-cli", { signal }, (error, stdout, stderr) => {
|
|
9
|
+
stdout && console.log(stdout);
|
|
10
|
+
stderr && console.error(stderr);
|
|
11
|
+
if (error !== null) {
|
|
12
|
+
console.log(`exec error: ${error}`);
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
process.on("SIGTERM", () => {
|
|
17
|
+
controller && controller.abort();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
process.on("SIGINT", () => {
|
|
21
|
+
controller && controller.abort();
|
|
22
|
+
});
|
|
23
|
+
|
package/uninstall.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
const { exec } = require("child_process");
|
|
6
|
+
const { homedir } = require("os");
|
|
7
|
+
|
|
8
|
+
const cargoDir = path.join(homedir(), ".cargo");
|
|
9
|
+
|
|
10
|
+
// check if directory exists
|
|
11
|
+
if (fs.existsSync(cargoDir)) {
|
|
12
|
+
// console.log("Cargo found.");
|
|
13
|
+
} else {
|
|
14
|
+
const setCargo = 'PATH="/$HOME/.cargo/bin:${PATH}"';
|
|
15
|
+
console.log("Installing deps [cargo].");
|
|
16
|
+
|
|
17
|
+
exec(
|
|
18
|
+
`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && ${setCargo}`,
|
|
19
|
+
(error) => {
|
|
20
|
+
if (error) {
|
|
21
|
+
console.log(
|
|
22
|
+
"curl failed! Curl may not be installed on the OS. View https://curl.se/download.html to install."
|
|
23
|
+
);
|
|
24
|
+
console.log(error);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const binp = path.join(cargoDir, "bin", "features-cli");
|
|
31
|
+
|
|
32
|
+
if (fs.existsSync(binp)) {
|
|
33
|
+
console.log("Uninstalling features-cli...");
|
|
34
|
+
exec(`cargo uninstall features-cli`, (error, stdout, stderr) => {
|
|
35
|
+
console.log(stdout);
|
|
36
|
+
if (error || stderr) {
|
|
37
|
+
console.log(error || stderr);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
} else {
|
|
41
|
+
console.log("features-cli not found skipping!");
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|