fuzzrunx 0.1.2 → 0.1.4

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
@@ -14,7 +14,7 @@ Install (npm):
14
14
  npm i -g fuzzrunx
15
15
  ```
16
16
 
17
- On global install, FuzzRun auto-enables shell hooks and will print:
17
+ On install, FuzzRun auto-enables shell hooks and will print:
18
18
  `FuzzRun is automatically enabled. Run "fuzzrun disable" to deactivate.`
19
19
 
20
20
  If you want to skip auto-enable, set `FUZZRUN_SKIP_ENABLE=1` during install.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fuzzrunx",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Auto-correct mistyped commands and subcommands and re-run them safely.",
5
5
  "bin": {
6
6
  "fuzzrun": "bin/fuzzrun.js"
@@ -3,12 +3,8 @@
3
3
  const installer = require('../src/installer');
4
4
 
5
5
  const skip = process.env.FUZZRUN_SKIP_ENABLE === '1';
6
- const isGlobal =
7
- process.env.npm_config_global === 'true' ||
8
- process.env.npm_config_global === '1' ||
9
- process.env.npm_config_location === 'global';
10
6
 
11
- if (skip || !isGlobal) {
7
+ if (skip) {
12
8
  process.stdout.write('fuzzrun: auto-enable skipped\n');
13
9
  process.exit(0);
14
10
  }
package/src/installer.js CHANGED
@@ -27,10 +27,21 @@ function getBinPath(packageRoot) {
27
27
  function getProfileTargets() {
28
28
  const home = os.homedir();
29
29
  if (process.platform === 'win32') {
30
- return [
31
- path.join(home, 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1'),
32
- path.join(home, 'Documents', 'WindowsPowerShell', 'Microsoft.PowerShell_profile.ps1')
33
- ];
30
+ const roots = new Set([path.join(home, 'Documents')]);
31
+ const oneDriveRoots = [
32
+ process.env.OneDrive,
33
+ process.env.OneDriveConsumer,
34
+ process.env.OneDriveCommercial
35
+ ].filter(Boolean);
36
+ for (const root of oneDriveRoots) {
37
+ roots.add(path.basename(root).toLowerCase() === 'documents' ? root : path.join(root, 'Documents'));
38
+ }
39
+ const targets = [];
40
+ for (const root of roots) {
41
+ targets.push(path.join(root, 'PowerShell', 'Microsoft.PowerShell_profile.ps1'));
42
+ targets.push(path.join(root, 'WindowsPowerShell', 'Microsoft.PowerShell_profile.ps1'));
43
+ }
44
+ return [...new Set(targets)];
34
45
  }
35
46
  return [path.join(home, '.bashrc'), path.join(home, '.zshrc')];
36
47
  }