english-optimizer-cli 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.
- package/dist/index.js +38 -0
- package/package.json +6 -2
package/dist/index.js
CHANGED
|
@@ -39,6 +39,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
const commander_1 = require("commander");
|
|
41
41
|
const chalk_1 = __importDefault(require("chalk"));
|
|
42
|
+
const axios_1 = __importDefault(require("axios"));
|
|
42
43
|
const config_1 = require("./config/config");
|
|
43
44
|
const provider_1 = require("./ai/provider");
|
|
44
45
|
const optimizer_1 = require("./core/optimizer");
|
|
@@ -48,6 +49,7 @@ const batch_1 = require("./core/batch");
|
|
|
48
49
|
const logger_1 = require("./history/logger");
|
|
49
50
|
const custom_1 = require("./prompts/custom");
|
|
50
51
|
const display_1 = require("./utils/display");
|
|
52
|
+
const PACKAGE_NAME = 'english-optimizer-cli';
|
|
51
53
|
const program = new commander_1.Command();
|
|
52
54
|
program
|
|
53
55
|
.name('fuck-abc')
|
|
@@ -275,5 +277,41 @@ program
|
|
|
275
277
|
process.exit(1);
|
|
276
278
|
}
|
|
277
279
|
});
|
|
280
|
+
program
|
|
281
|
+
.command('update')
|
|
282
|
+
.description('Update to the latest version')
|
|
283
|
+
.action(async () => {
|
|
284
|
+
try {
|
|
285
|
+
console.log(chalk_1.default.cyan('\nš Checking for updates...\n'));
|
|
286
|
+
// Get current version
|
|
287
|
+
const { version: currentVersion } = require('../package.json');
|
|
288
|
+
// Fetch latest version from npm
|
|
289
|
+
try {
|
|
290
|
+
const response = await axios_1.default.get(`https://registry.npmjs.org/${PACKAGE_NAME}/latest`);
|
|
291
|
+
const latestVersion = response.data.version;
|
|
292
|
+
console.log(chalk_1.default.gray(`Current version: ${currentVersion}`));
|
|
293
|
+
console.log(chalk_1.default.gray(`Latest version: ${latestVersion}\n`));
|
|
294
|
+
if (currentVersion === latestVersion) {
|
|
295
|
+
console.log(chalk_1.default.green('ā
You are already using the latest version!\n'));
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
console.log(chalk_1.default.yellow('ā ļø A new version is available!\n'));
|
|
299
|
+
console.log(chalk_1.default.cyan('To update, run:'));
|
|
300
|
+
console.log(chalk_1.default.white.bold(' npm update -g english-optimizer-cli\n'));
|
|
301
|
+
console.log(chalk_1.default.gray('Or reinstall:'));
|
|
302
|
+
console.log(chalk_1.default.gray(' npm install -g english-optimizer-cli@latest\n'));
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
console.log(chalk_1.default.yellow('ā ļø Could not check for updates.\n'));
|
|
307
|
+
console.log(chalk_1.default.gray('Please check manually:'));
|
|
308
|
+
console.log(chalk_1.default.gray(' npm view english-optimizer-cli version\n'));
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
catch (error) {
|
|
312
|
+
(0, display_1.displayError)(error);
|
|
313
|
+
process.exit(1);
|
|
314
|
+
}
|
|
315
|
+
});
|
|
278
316
|
program.parse();
|
|
279
317
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "english-optimizer-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "CLI tool to help non-native English speakers improve their writing using AI",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
"start": "node dist/index.js",
|
|
12
12
|
"dev": "ts-node src/index.ts",
|
|
13
13
|
"watch": "tsc --watch",
|
|
14
|
-
"install-config": "node scripts/install-config.js"
|
|
14
|
+
"install-config": "node scripts/install-config.js",
|
|
15
|
+
"version": "node scripts/bump-version.js",
|
|
16
|
+
"release:patch": "npm version patch && git push && git push --tags",
|
|
17
|
+
"release:minor": "npm version minor && git push && git push --tags",
|
|
18
|
+
"release:major": "npm version major && git push && git push --tags"
|
|
15
19
|
},
|
|
16
20
|
"keywords": [
|
|
17
21
|
"cli",
|