fallow 0.1.0 → 0.1.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.
- package/bin/fallow +22 -17
- package/package.json +16 -7
- package/scripts/postinstall.js +20 -13
package/bin/fallow
CHANGED
|
@@ -5,17 +5,17 @@ const { join } = require('path');
|
|
|
5
5
|
const { existsSync } = require('fs');
|
|
6
6
|
|
|
7
7
|
const PLATFORMS = {
|
|
8
|
-
'darwin-arm64': '@
|
|
9
|
-
'darwin-x64': '@
|
|
10
|
-
'linux-x64': '@
|
|
11
|
-
'linux-arm64': '@
|
|
12
|
-
'win32-x64': '@
|
|
8
|
+
'darwin-arm64': ['@fallow-cli/darwin-arm64'],
|
|
9
|
+
'darwin-x64': ['@fallow-cli/darwin-x64'],
|
|
10
|
+
'linux-x64': ['@fallow-cli/linux-x64-gnu', '@fallow-cli/linux-x64-musl'],
|
|
11
|
+
'linux-arm64': ['@fallow-cli/linux-arm64-gnu', '@fallow-cli/linux-arm64-musl'],
|
|
12
|
+
'win32-x64': ['@fallow-cli/win32-x64-msvc'],
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
const platformKey = `${process.platform}-${process.arch}`;
|
|
16
|
-
const
|
|
16
|
+
const candidates = PLATFORMS[platformKey];
|
|
17
17
|
|
|
18
|
-
if (!
|
|
18
|
+
if (!candidates) {
|
|
19
19
|
console.error(`Unsupported platform: ${platformKey}`);
|
|
20
20
|
console.error(`Supported platforms: ${Object.keys(PLATFORMS).join(', ')}`);
|
|
21
21
|
process.exit(1);
|
|
@@ -23,18 +23,23 @@ if (!pkg) {
|
|
|
23
23
|
|
|
24
24
|
let binaryPath;
|
|
25
25
|
|
|
26
|
-
// Try
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
// Try each candidate package (gnu first, then musl fallback)
|
|
27
|
+
for (const pkg of candidates) {
|
|
28
|
+
try {
|
|
29
|
+
const pkgDir = require.resolve(`${pkg}/package.json`);
|
|
30
|
+
const binaryName = process.platform === 'win32' ? 'fallow.exe' : 'fallow';
|
|
31
|
+
const candidate = join(pkgDir, '..', binaryName);
|
|
32
|
+
if (existsSync(candidate)) {
|
|
33
|
+
binaryPath = candidate;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
} catch {
|
|
37
|
+
// Package not installed, try next candidate
|
|
38
|
+
}
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
if (!
|
|
37
|
-
console.error(`
|
|
41
|
+
if (!binaryPath) {
|
|
42
|
+
console.error(`Could not find fallow binary for ${platformKey}. Run 'npm install' to install platform-specific binary.`);
|
|
38
43
|
process.exit(1);
|
|
39
44
|
}
|
|
40
45
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fallow",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Find unused files, exports, and dependencies in JavaScript/TypeScript projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/
|
|
8
|
+
"url": "https://github.com/bartwaardenburg/fallow"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/bartwaardenburg/fallow",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/bartwaardenburg/fallow/issues"
|
|
9
13
|
},
|
|
10
14
|
"keywords": [
|
|
11
15
|
"dead-code",
|
|
@@ -17,6 +21,9 @@
|
|
|
17
21
|
"typescript",
|
|
18
22
|
"javascript"
|
|
19
23
|
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=16"
|
|
26
|
+
},
|
|
20
27
|
"bin": {
|
|
21
28
|
"fallow": "bin/fallow"
|
|
22
29
|
},
|
|
@@ -28,10 +35,12 @@
|
|
|
28
35
|
"postinstall": "node scripts/postinstall.js"
|
|
29
36
|
},
|
|
30
37
|
"optionalDependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"@
|
|
35
|
-
"@
|
|
38
|
+
"@fallow-cli/darwin-arm64": "0.1.0",
|
|
39
|
+
"@fallow-cli/darwin-x64": "0.1.0",
|
|
40
|
+
"@fallow-cli/linux-x64-gnu": "0.1.0",
|
|
41
|
+
"@fallow-cli/linux-arm64-gnu": "0.1.0",
|
|
42
|
+
"@fallow-cli/linux-x64-musl": "0.1.0",
|
|
43
|
+
"@fallow-cli/linux-arm64-musl": "0.1.0",
|
|
44
|
+
"@fallow-cli/win32-x64-msvc": "0.1.0"
|
|
36
45
|
}
|
|
37
46
|
}
|
package/scripts/postinstall.js
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
1
|
// Verify the correct platform-specific package was installed
|
|
2
2
|
const PLATFORMS = {
|
|
3
|
-
'darwin-arm64': '@
|
|
4
|
-
'darwin-x64': '@
|
|
5
|
-
'linux-x64': '@
|
|
6
|
-
'linux-arm64': '@
|
|
7
|
-
'win32-x64': '@
|
|
3
|
+
'darwin-arm64': ['@fallow-cli/darwin-arm64'],
|
|
4
|
+
'darwin-x64': ['@fallow-cli/darwin-x64'],
|
|
5
|
+
'linux-x64': ['@fallow-cli/linux-x64-gnu', '@fallow-cli/linux-x64-musl'],
|
|
6
|
+
'linux-arm64': ['@fallow-cli/linux-arm64-gnu', '@fallow-cli/linux-arm64-musl'],
|
|
7
|
+
'win32-x64': ['@fallow-cli/win32-x64-msvc'],
|
|
8
8
|
};
|
|
9
9
|
|
|
10
10
|
const platformKey = `${process.platform}-${process.arch}`;
|
|
11
|
-
const
|
|
11
|
+
const candidates = PLATFORMS[platformKey];
|
|
12
12
|
|
|
13
|
-
if (!
|
|
13
|
+
if (!candidates) {
|
|
14
14
|
console.warn(
|
|
15
15
|
`fallow: No prebuilt binary for ${platformKey}. ` +
|
|
16
|
-
`You can build from source: https://github.com/
|
|
16
|
+
`You can build from source: https://github.com/bartwaardenburg/fallow`
|
|
17
17
|
);
|
|
18
18
|
process.exit(0);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
21
|
+
const found = candidates.some((pkg) => {
|
|
22
|
+
try {
|
|
23
|
+
require.resolve(`${pkg}/package.json`);
|
|
24
|
+
return true;
|
|
25
|
+
} catch {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
if (!found) {
|
|
24
31
|
console.warn(
|
|
25
|
-
`fallow:
|
|
32
|
+
`fallow: No platform package installed for ${platformKey}. ` +
|
|
26
33
|
`This may happen if you used --no-optional. ` +
|
|
27
|
-
`Run 'npm install
|
|
34
|
+
`Run 'npm install' to fix.`
|
|
28
35
|
);
|
|
29
36
|
}
|