features-cli 0.4.2 → 0.4.7

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 CHANGED
@@ -1,33 +1,17 @@
1
1
  # Features CLI
2
2
 
3
- A CLI tool for discovering and managing features in a feature-based architecture project.
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
- npx features-cli /path/to/features # list all the features in the directory
8
+ pnpm install -g features-cli
10
9
  ```
11
10
 
12
- Commands and their descriptions are listed below:
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
- cargo build --release
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: "@features-cli/feature-cli-win32-x64/features.exe",
24
+ arm64: "@features-cli/feature-cli-win32-arm64/features.exe",
25
+ },
26
+ darwin: {
27
+ x64: "@features-cli/feature-cli-darwin-x64/features",
28
+ arm64: "@features-cli/feature-cli-darwin-arm64/features",
29
+ },
30
+ linux: {
31
+ x64: "@features-cli/feature-cli-linux-x64/features",
32
+ arm64: "@features-cli/feature-cli-linux-arm64/features",
33
+ },
34
+ "linux-musl": {
35
+ x64: "@features-cli/feature-cli-linux-x64-musl/features",
36
+ arm64: "@features-cli/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,33 +1,37 @@
1
1
  {
2
2
  "name": "features-cli",
3
- "version": "0.4.2",
3
+ "version": "0.4.7",
4
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"
5
+ "license": "MIT",
6
+ "bin": {
7
+ "features": "bin/features"
13
8
  },
14
9
  "repository": {
15
10
  "type": "git",
16
- "url": "https://github.com/interaction-dynamics/features/tree/master/tools/cli.git"
17
- },
18
- "keywords": [],
19
-
20
- "license": "MIT",
21
- "bugs": {
22
- "url": "https://github.com/interaction-dynamics/features/tree/master/tools/cli/issues"
11
+ "url": "https://github.com/interaction-dynamics/features"
23
12
  },
24
13
  "homepage": "https://github.com/interaction-dynamics/features",
14
+ "keywords": [
15
+ "features",
16
+ "cli",
17
+ "documentation",
18
+ "analysis"
19
+ ],
25
20
  "files": [
26
- "pre-install.js",
27
- "start.js",
28
- "uninstall.js",
29
- "README.md",
30
- "LICENSE"
31
- ]
32
- }
33
-
21
+ "bin/features",
22
+ "README.md"
23
+ ],
24
+ "engines": {
25
+ "node": ">=14.0.0"
26
+ },
27
+ "optionalDependencies": {
28
+ "@features-cli/feature-cli-win32-x64": "0.4.7",
29
+ "@features-cli/feature-cli-win32-arm64": "0.4.7",
30
+ "@features-cli/feature-cli-darwin-x64": "0.4.7",
31
+ "@features-cli/feature-cli-darwin-arm64": "0.4.7",
32
+ "@features-cli/feature-cli-linux-x64": "0.4.7",
33
+ "@features-cli/feature-cli-linux-arm64": "0.4.7",
34
+ "@features-cli/feature-cli-linux-x64-musl": "0.4.7",
35
+ "@features-cli/feature-cli-linux-arm64-musl": "0.4.7"
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.2 ${features} ...`);
33
- exec(`cargo install features-cli --vers 0.4.2 ${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
-