features-cli 0.4.1 → 0.4.6
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 +7 -23
- package/bin/features +70 -0
- package/package.json +31 -19
- package/pre-install.js +0 -42
- package/start.js +0 -23
- package/uninstall.js +0 -44
package/README.md
CHANGED
|
@@ -1,33 +1,17 @@
|
|
|
1
1
|
# Features CLI
|
|
2
2
|
|
|
3
|
-
A CLI tool for discovering
|
|
4
|
-
|
|
5
|
-
## Getting Started
|
|
3
|
+
A CLI tool for discovering the features in a folder.
|
|
6
4
|
|
|
5
|
+
## Installation
|
|
7
6
|
|
|
8
7
|
```bash
|
|
9
|
-
|
|
8
|
+
pnpm install -g features-cli
|
|
10
9
|
```
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
| Command | Description |
|
|
15
|
-
| ------- | ----------- |
|
|
16
|
-
| `--json` | Output features as JSON |
|
|
17
|
-
| `--flat` | Output features as a flat array instead of nested structure |
|
|
18
|
-
| `--description` | Include feature descriptions in the output |
|
|
19
|
-
| `--list-owners` | Display only unique list of owners |
|
|
20
|
-
| `--check` | Run validation checks on features (e.g., duplicate names) |
|
|
21
|
-
| `--serve` | Start an HTTP server to serve features and the web dashboard UI |
|
|
22
|
-
| `--serve --port 8080` | Start an HTTP server on specified port |
|
|
23
|
-
| `--build` | Build a static version of the web dashboard UI |
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
## Contributing
|
|
28
|
-
|
|
29
|
-
From the CLI directory:
|
|
11
|
+
## Usage
|
|
30
12
|
|
|
31
13
|
```bash
|
|
32
|
-
|
|
14
|
+
features [directory] [options]
|
|
33
15
|
```
|
|
16
|
+
|
|
17
|
+
For more information, see the [GitHub repository](https://github.com/interaction-dynamics/features).
|
package/bin/features
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { platform, arch, env } = process;
|
|
3
|
+
const { execSync } = require("child_process");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
function isMusl() {
|
|
7
|
+
let stderr;
|
|
8
|
+
try {
|
|
9
|
+
stderr = execSync("ldd --version", {
|
|
10
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
11
|
+
});
|
|
12
|
+
} catch (err) {
|
|
13
|
+
stderr = err.stderr;
|
|
14
|
+
}
|
|
15
|
+
if (stderr && stderr.indexOf("musl") > -1) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const PLATFORMS = {
|
|
22
|
+
win32: {
|
|
23
|
+
x64: "@interaction-dynamics/feature-cli-win32-x64/features.exe",
|
|
24
|
+
arm64: "@interaction-dynamics/feature-cli-win32-arm64/features.exe",
|
|
25
|
+
},
|
|
26
|
+
darwin: {
|
|
27
|
+
x64: "@interaction-dynamics/feature-cli-darwin-x64/features",
|
|
28
|
+
arm64: "@interaction-dynamics/feature-cli-darwin-arm64/features",
|
|
29
|
+
},
|
|
30
|
+
linux: {
|
|
31
|
+
x64: "@interaction-dynamics/feature-cli-linux-x64/features",
|
|
32
|
+
arm64: "@interaction-dynamics/feature-cli-linux-arm64/features",
|
|
33
|
+
},
|
|
34
|
+
"linux-musl": {
|
|
35
|
+
x64: "@interaction-dynamics/feature-cli-linux-x64-musl/features",
|
|
36
|
+
arm64: "@interaction-dynamics/feature-cli-linux-arm64-musl/features",
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const binPath = env.FEATURES_BINARY ||
|
|
41
|
+
(platform === "linux" && isMusl()
|
|
42
|
+
? PLATFORMS?.["linux-musl"]?.[arch]
|
|
43
|
+
: PLATFORMS?.[platform]?.[arch]
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (binPath) {
|
|
47
|
+
const result = require("child_process").spawnSync(
|
|
48
|
+
require.resolve(binPath),
|
|
49
|
+
process.argv.slice(2),
|
|
50
|
+
{
|
|
51
|
+
shell: false,
|
|
52
|
+
stdio: "inherit",
|
|
53
|
+
env: {
|
|
54
|
+
...env,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (result.error) {
|
|
60
|
+
throw result.error;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
process.exitCode = result.status;
|
|
64
|
+
} else {
|
|
65
|
+
console.error(
|
|
66
|
+
"The Features CLI package doesn't ship with prebuilt binaries for your platform yet. " +
|
|
67
|
+
"You can build from source by cloning the repository and following the build instructions.",
|
|
68
|
+
);
|
|
69
|
+
process.exitCode = 1;
|
|
70
|
+
}
|
package/package.json
CHANGED
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "features-cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "A CLI tool for discovering the features in a folder",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"features": "bin/features"
|
|
8
8
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"uninstall": "node ./uninstall.js"
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/interaction-dynamics/features"
|
|
13
12
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
"homepage": "https://github.com/interaction-dynamics/features",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"features",
|
|
16
|
+
"cli",
|
|
17
|
+
"documentation",
|
|
18
|
+
"analysis"
|
|
19
|
+
],
|
|
17
20
|
"files": [
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
"bin/features",
|
|
22
|
+
"README.md"
|
|
23
|
+
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=14.0.0"
|
|
26
|
+
},
|
|
27
|
+
"optionalDependencies": {
|
|
28
|
+
"@interaction-dynamics/feature-cli-win32-x64": "0.4.6",
|
|
29
|
+
"@interaction-dynamics/feature-cli-win32-arm64": "0.4.6",
|
|
30
|
+
"@interaction-dynamics/feature-cli-darwin-x64": "0.4.6",
|
|
31
|
+
"@interaction-dynamics/feature-cli-darwin-arm64": "0.4.6",
|
|
32
|
+
"@interaction-dynamics/feature-cli-linux-x64": "0.4.6",
|
|
33
|
+
"@interaction-dynamics/feature-cli-linux-arm64": "0.4.6",
|
|
34
|
+
"@interaction-dynamics/feature-cli-linux-x64-musl": "0.4.6",
|
|
35
|
+
"@interaction-dynamics/feature-cli-linux-arm64-musl": "0.4.6"
|
|
36
|
+
}
|
|
37
|
+
}
|
package/pre-install.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
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.4.1 ${features} ...`);
|
|
33
|
-
exec(`cargo install features-cli --vers 0.4.1 ${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
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
|