complexity-guard 0.1.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.
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require('child_process');
4
+ const { join } = require('path');
5
+
6
+ // Map process.platform + process.arch to package names
7
+ const PLATFORM_MAP = {
8
+ 'darwin-arm64': '@complexity-guard/darwin-arm64',
9
+ 'darwin-x64': '@complexity-guard/darwin-x64',
10
+ 'linux-arm64': '@complexity-guard/linux-arm64',
11
+ 'linux-x64': '@complexity-guard/linux-x64',
12
+ 'win32-x64': '@complexity-guard/windows-x64',
13
+ };
14
+
15
+ const platformKey = `${process.platform}-${process.arch}`;
16
+ const packageName = PLATFORM_MAP[platformKey];
17
+
18
+ if (!packageName) {
19
+ console.error(
20
+ `Unsupported platform: ${process.platform}-${process.arch}\n` +
21
+ `Supported platforms: ${Object.keys(PLATFORM_MAP).join(', ')}`
22
+ );
23
+ process.exit(1);
24
+ }
25
+
26
+ let binaryPath;
27
+ try {
28
+ const packageJsonPath = require.resolve(`${packageName}/package.json`);
29
+ const packageDir = join(packageJsonPath, '..');
30
+ const binaryName = process.platform === 'win32' ? 'complexity-guard.exe' : 'complexity-guard';
31
+ binaryPath = join(packageDir, binaryName);
32
+ } catch (err) {
33
+ console.error(
34
+ `Failed to find ${packageName}.\n` +
35
+ `This usually means the platform-specific binary was not installed.\n` +
36
+ `Try running: npm install --force\n\n` +
37
+ `Error: ${err.message}`
38
+ );
39
+ process.exit(1);
40
+ }
41
+
42
+ const result = spawnSync(binaryPath, process.argv.slice(2), {
43
+ stdio: 'inherit',
44
+ });
45
+
46
+ process.exit(result.status ?? 1);
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "complexity-guard",
3
+ "author": {
4
+ "name": "Ben van de Sande",
5
+ "email": "info@getlean.digital"
6
+ },
7
+ "version": "0.1.7",
8
+ "description": "Fast complexity analysis for TypeScript/JavaScript — single static binary",
9
+ "bin": {
10
+ "complexity-guard": "bin/complexity-guard.js"
11
+ },
12
+ "files": [
13
+ "bin/"
14
+ ],
15
+ "optionalDependencies": {
16
+ "@complexity-guard/darwin-arm64": "0.1.7",
17
+ "@complexity-guard/darwin-x64": "0.1.7",
18
+ "@complexity-guard/linux-arm64": "0.1.7",
19
+ "@complexity-guard/linux-x64": "0.1.7",
20
+ "@complexity-guard/windows-x64": "0.1.7"
21
+ },
22
+ "license": "MIT",
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/benvds/complexity-guard.git"
26
+ },
27
+ "keywords": [
28
+ "complexity",
29
+ "cyclomatic",
30
+ "typescript",
31
+ "javascript",
32
+ "analysis",
33
+ "metrics"
34
+ ]
35
+ }