cueme 0.1.10 → 0.1.11
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/package.json +1 -1
- package/src/cli.js +25 -29
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -159,6 +159,7 @@ async function main() {
|
|
|
159
159
|
const { execSync } = require('child_process');
|
|
160
160
|
const os = require('os');
|
|
161
161
|
const path = require('path');
|
|
162
|
+
const fs = require('fs');
|
|
162
163
|
|
|
163
164
|
try {
|
|
164
165
|
// Get PowerShell profile path
|
|
@@ -176,36 +177,31 @@ async function main() {
|
|
|
176
177
|
'$OutputEncoding = $utf8NoBom',
|
|
177
178
|
].join('\n');
|
|
178
179
|
|
|
179
|
-
//
|
|
180
|
-
const
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
'
|
|
190
|
-
''
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
''
|
|
196
|
-
|
|
197
|
-
'if ($content -notlike "*utf8NoBom*") {',
|
|
198
|
-
' Add-Content -Path $profilePath -Value "`n$encodingConfig"',
|
|
199
|
-
' Write-Host "Added UTF-8 encoding to PowerShell profile"',
|
|
200
|
-
' Write-Host "Please restart PowerShell for changes to take effect"',
|
|
201
|
-
'} else {',
|
|
202
|
-
' Write-Host "UTF-8 encoding already configured"',
|
|
203
|
-
'}',
|
|
204
|
-
].join('; ');
|
|
180
|
+
// Ensure profile directory exists
|
|
181
|
+
const profileDir = path.dirname(profilePath);
|
|
182
|
+
if (!fs.existsSync(profileDir)) {
|
|
183
|
+
fs.mkdirSync(profileDir, { recursive: true });
|
|
184
|
+
process.stdout.write('Created PowerShell profile directory\n');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Check if profile exists and if encoding is already configured
|
|
188
|
+
let needsUpdate = true;
|
|
189
|
+
if (fs.existsSync(profilePath)) {
|
|
190
|
+
const content = fs.readFileSync(profilePath, 'utf8');
|
|
191
|
+
if (content.includes('utf8NoBom')) {
|
|
192
|
+
process.stdout.write('UTF-8 encoding already configured\n');
|
|
193
|
+
needsUpdate = false;
|
|
194
|
+
}
|
|
195
|
+
} else {
|
|
196
|
+
process.stdout.write('Created PowerShell profile\n');
|
|
197
|
+
}
|
|
205
198
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
199
|
+
// Add encoding configuration if needed
|
|
200
|
+
if (needsUpdate) {
|
|
201
|
+
fs.appendFileSync(profilePath, '\n' + encodingConfig + '\n');
|
|
202
|
+
process.stdout.write('Added UTF-8 encoding to PowerShell profile\n');
|
|
203
|
+
process.stdout.write('Please restart PowerShell for changes to take effect\n');
|
|
204
|
+
}
|
|
209
205
|
|
|
210
206
|
} catch (err) {
|
|
211
207
|
process.stderr.write(`Failed to fix PowerShell encoding: ${err.message}\n`);
|