sr-search-replace 6.1.0
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/CHANGELOG.md +144 -0
- package/LICENSE +21 -0
- package/README.md +1951 -0
- package/bin/sr +37 -0
- package/package.json +61 -0
- package/scripts/install.js +40 -0
- package/sr.sh +4186 -0
package/bin/sr
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// sr-search-replace — npm CLI wrapper
|
|
4
|
+
// Author : Mikhail Deynekin <mid1977@gmail.com> | https://deynekin.com
|
|
5
|
+
// License: MIT
|
|
6
|
+
// =============================================================================
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const { execFileSync } = require('child_process');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const fs = require('fs');
|
|
12
|
+
const os = require('os');
|
|
13
|
+
|
|
14
|
+
if (os.platform() === 'win32') {
|
|
15
|
+
console.error(
|
|
16
|
+
'[sr] Windows is not supported directly. Please use WSL2 or Git Bash.\n' +
|
|
17
|
+
' See: https://github.com/paulmann/sr-search-replace#system-requirements'
|
|
18
|
+
);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const scriptPath = path.join(__dirname, '..', 'sr.sh');
|
|
23
|
+
|
|
24
|
+
if (!fs.existsSync(scriptPath)) {
|
|
25
|
+
console.error('[sr] sr.sh not found at:', scriptPath);
|
|
26
|
+
console.error(' Try reinstalling: npm install -g sr-search-replace');
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
try {
|
|
31
|
+
execFileSync('bash', [scriptPath, ...process.argv.slice(2)], {
|
|
32
|
+
stdio : 'inherit',
|
|
33
|
+
shell : false
|
|
34
|
+
});
|
|
35
|
+
} catch (err) {
|
|
36
|
+
process.exit(err.status ?? 1);
|
|
37
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sr-search-replace",
|
|
3
|
+
"version": "6.1.0",
|
|
4
|
+
"description": "Universal search-and-replace CLI for files — recursive processing, multi-layer binary detection, session-based rollback, and backup management.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"search",
|
|
7
|
+
"replace",
|
|
8
|
+
"find-replace",
|
|
9
|
+
"text-processing",
|
|
10
|
+
"refactoring",
|
|
11
|
+
"cli",
|
|
12
|
+
"bash",
|
|
13
|
+
"shell",
|
|
14
|
+
"rollback",
|
|
15
|
+
"backup",
|
|
16
|
+
"binary-detection",
|
|
17
|
+
"devtools",
|
|
18
|
+
"sed",
|
|
19
|
+
"grep",
|
|
20
|
+
"bulk-rename",
|
|
21
|
+
"code-refactoring",
|
|
22
|
+
"enterprise",
|
|
23
|
+
"sysadmin"
|
|
24
|
+
],
|
|
25
|
+
"author": {
|
|
26
|
+
"name": "Mikhail Deynekin",
|
|
27
|
+
"email": "mid1977@gmail.com",
|
|
28
|
+
"url": "https://deynekin.com"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"homepage": "https://github.com/paulmann/sr-search-replace#readme",
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "https://github.com/paulmann/sr-search-replace.git"
|
|
35
|
+
},
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/paulmann/sr-search-replace/issues"
|
|
38
|
+
},
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=14.0.0"
|
|
41
|
+
},
|
|
42
|
+
"os": [
|
|
43
|
+
"linux",
|
|
44
|
+
"darwin"
|
|
45
|
+
],
|
|
46
|
+
"bin": {
|
|
47
|
+
"sr": "./bin/sr"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"postinstall": "node scripts/install.js"
|
|
51
|
+
},
|
|
52
|
+
"files": [
|
|
53
|
+
"bin/",
|
|
54
|
+
"scripts/",
|
|
55
|
+
"sr.sh",
|
|
56
|
+
"LICENSE",
|
|
57
|
+
"README.md",
|
|
58
|
+
"CHANGELOG.md"
|
|
59
|
+
],
|
|
60
|
+
"sideEffects": false
|
|
61
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// sr-search-replace — postinstall script
|
|
4
|
+
// Author : Mikhail Deynekin <mid1977@gmail.com> | https://deynekin.com
|
|
5
|
+
// License: MIT
|
|
6
|
+
// =============================================================================
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
const fs = require('fs');
|
|
10
|
+
const path = require('path');
|
|
11
|
+
const os = require('os');
|
|
12
|
+
|
|
13
|
+
if (os.platform() === 'win32') {
|
|
14
|
+
// Skip silently on Windows — the wrapper already handles the error.
|
|
15
|
+
process.exit(0);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const srScript = path.join(__dirname, '..', 'sr.sh');
|
|
19
|
+
const binEntry = path.join(__dirname, '..', 'bin', 'sr');
|
|
20
|
+
|
|
21
|
+
// Ensure sr.sh is executable
|
|
22
|
+
if (fs.existsSync(srScript)) {
|
|
23
|
+
try {
|
|
24
|
+
fs.chmodSync(srScript, 0o755);
|
|
25
|
+
} catch {
|
|
26
|
+
// Best-effort; npm may lack permissions in some environments
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Ensure the bin wrapper is executable
|
|
31
|
+
if (fs.existsSync(binEntry)) {
|
|
32
|
+
try {
|
|
33
|
+
fs.chmodSync(binEntry, 0o755);
|
|
34
|
+
} catch {
|
|
35
|
+
// Best-effort
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.log('[sr] sr-search-replace v6.1.0 is ready.');
|
|
40
|
+
console.log('[sr] Run `sr --help` to get started.');
|