install-rynude 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/index.js +12 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -113,16 +113,20 @@ async function run() {
113
113
  // Auto add to PATH for Mac/Linux
114
114
  const bashrcPath = path.join(os.homedir(), '.bashrc');
115
115
  const zshrcPath = path.join(os.homedir(), '.zshrc');
116
+ const zprofilePath = path.join(os.homedir(), '.zprofile');
116
117
  const pathExport = `\nexport PATH="$HOME/.local/bin:$PATH"\n`;
117
118
 
118
- if (fs.existsSync(bashrcPath)) {
119
- const content = fs.readFileSync(bashrcPath, 'utf8');
120
- if (!content.includes('.local/bin')) fs.appendFileSync(bashrcPath, pathExport);
121
- }
122
- if (fs.existsSync(zshrcPath)) {
123
- const content = fs.readFileSync(zshrcPath, 'utf8');
124
- if (!content.includes('.local/bin')) fs.appendFileSync(zshrcPath, pathExport);
125
- }
119
+ [bashrcPath, zshrcPath, zprofilePath].forEach(profilePath => {
120
+ try {
121
+ fs.ensureFileSync(profilePath);
122
+ const content = fs.readFileSync(profilePath, 'utf8');
123
+ if (!content.includes('.local/bin')) {
124
+ fs.appendFileSync(profilePath, pathExport);
125
+ }
126
+ } catch (err) {
127
+ // ignore if permission denied
128
+ }
129
+ });
126
130
  }
127
131
  globalSpinner.succeed('Global command berhasil diatur.');
128
132
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "install-rynude",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Auto-installer for Rynude AI",
5
5
  "main": "index.js",
6
6
  "type": "module",