fop-cli 3.9.7 → 3.9.9
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 +4 -0
- package/install.js +48 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -102,6 +102,10 @@ fop -n ~/easylist ~/easyprivacy ~/fanboy-addon
|
|
|
102
102
|
| `--disable-ignored` | Disable hardcoded ignored files and folders for testing |
|
|
103
103
|
| `--no-sort` | Don't sort rulse, just combine |
|
|
104
104
|
| `--alt-sort` | More correct sorting method |
|
|
105
|
+
| `--localhost` | Sort hosts file entries (0.0.0.0/127.0.0.1 domain) |
|
|
106
|
+
| `--ignorefiles=` | Additional files to ignore (comma-separated, partial names) |
|
|
107
|
+
| `--config-file=` | Custom config file path |
|
|
108
|
+
| `--no-color` | Disable colored output |
|
|
105
109
|
| `-h, --help` | Show help message |
|
|
106
110
|
| `-V, --version` | Show version number |
|
|
107
111
|
|
package/install.js
CHANGED
|
@@ -7,33 +7,16 @@ const path = require('path');
|
|
|
7
7
|
const { execSync } = require('child_process');
|
|
8
8
|
|
|
9
9
|
// Configuration - UPDATE THESE FOR YOUR RELEASE
|
|
10
|
-
const VERSION = '3.9.
|
|
10
|
+
const VERSION = '3.9.9';
|
|
11
11
|
const GITHUB_REPO = 'ryanbr/fop-rs'; // Change to your repo
|
|
12
12
|
const BINARY_NAME = 'fop';
|
|
13
13
|
|
|
14
14
|
// Platform mapping
|
|
15
15
|
const PLATFORMS = {
|
|
16
|
-
'darwin-x64': `-macos-x86_64`,
|
|
17
|
-
'darwin-arm64': `-macos-arm64`,
|
|
18
16
|
'linux-x64': `-linux-x86_64`,
|
|
19
|
-
'
|
|
17
|
+
'win32-x64': `-windows-x86_64.exe`,
|
|
20
18
|
};
|
|
21
19
|
|
|
22
|
-
function getPlatformBinary() {
|
|
23
|
-
const platform = process.platform;
|
|
24
|
-
const arch = process.arch;
|
|
25
|
-
const key = `${platform}-${arch}`;
|
|
26
|
-
|
|
27
|
-
const suffix = PLATFORMS[key];
|
|
28
|
-
if (!suffix) {
|
|
29
|
-
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
30
|
-
console.error('Supported platforms:', Object.keys(PLATFORMS).join(', '));
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return `fop-${VERSION}${suffix}`;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
20
|
function getDownloadUrl(binaryName) {
|
|
38
21
|
// GitHub releases URL pattern
|
|
39
22
|
return `https://github.com/${GITHUB_REPO}/releases/download/v${VERSION}/${binaryName}`;
|
|
@@ -79,6 +62,35 @@ function download(url, dest) {
|
|
|
79
62
|
});
|
|
80
63
|
}
|
|
81
64
|
|
|
65
|
+
function buildFromSource(binaryPath) {
|
|
66
|
+
console.log('Building from source...');
|
|
67
|
+
console.log('This requires Rust to be installed (https://rustup.rs)');
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
execSync('cargo --version', { stdio: 'ignore' });
|
|
71
|
+
} catch (e) {
|
|
72
|
+
console.error('Error: Rust/Cargo not found.');
|
|
73
|
+
console.error('Please install Rust from https://rustup.rs and try again.');
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
try {
|
|
78
|
+
const tempDir = path.join(__dirname, 'build-temp');
|
|
79
|
+
execSync(`git clone --depth 1 https://github.com/${GITHUB_REPO}.git "${tempDir}"`, { stdio: 'inherit' });
|
|
80
|
+
execSync('cargo build --release', { cwd: tempDir, stdio: 'inherit' });
|
|
81
|
+
|
|
82
|
+
const builtBinary = path.join(tempDir, 'target', 'release', process.platform === 'win32' ? 'fop.exe' : 'fop');
|
|
83
|
+
fs.copyFileSync(builtBinary, binaryPath);
|
|
84
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
85
|
+
|
|
86
|
+
console.log('Build completed successfully!');
|
|
87
|
+
return true;
|
|
88
|
+
} catch (e) {
|
|
89
|
+
console.error('Build failed:', e.message);
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
82
94
|
async function install() {
|
|
83
95
|
const binDir = path.join(__dirname, 'bin');
|
|
84
96
|
const binaryPath = path.join(binDir, 'fop-binary');
|
|
@@ -94,10 +106,24 @@ async function install() {
|
|
|
94
106
|
return;
|
|
95
107
|
}
|
|
96
108
|
|
|
97
|
-
const
|
|
98
|
-
const
|
|
109
|
+
const platform = process.platform;
|
|
110
|
+
const arch = process.arch;
|
|
111
|
+
const key = `${platform}-${arch}`;
|
|
112
|
+
const suffix = PLATFORMS[key];
|
|
99
113
|
|
|
100
|
-
console.log(`Installing FOP v${VERSION} for ${
|
|
114
|
+
console.log(`Installing FOP v${VERSION} for ${platform}-${arch}...`);
|
|
115
|
+
|
|
116
|
+
if (!suffix) {
|
|
117
|
+
console.log(`No pre-built binary for ${platform}-${arch}, building from source...`);
|
|
118
|
+
if (buildFromSource(binaryPath)) {
|
|
119
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
120
|
+
}
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const platformBinary = `fop-${VERSION}${suffix}`;
|
|
125
|
+
const url = getDownloadUrl(platformBinary);
|
|
126
|
+
|
|
101
127
|
|
|
102
128
|
try {
|
|
103
129
|
await download(url, binaryPath);
|