@xuranxys/cli 1.0.2 → 1.0.3
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 +20 -1
- package/package.json +2 -3
package/dist/index.js
CHANGED
|
@@ -12779,7 +12779,7 @@ async function createProject(projectName) {
|
|
|
12779
12779
|
//#endregion
|
|
12780
12780
|
//#region bin/index.ts
|
|
12781
12781
|
const program = new Command();
|
|
12782
|
-
program.version("1.0.
|
|
12782
|
+
program.version("1.0.3").description("A CLI for xuran").name("xuran");
|
|
12783
12783
|
program.command("list").description("List all available templates").action(() => {
|
|
12784
12784
|
console.log("Available templates:");
|
|
12785
12785
|
Object.entries(templates).forEach(([_, { name, description }]) => {
|
|
@@ -12795,6 +12795,25 @@ program.command("create").description("Create a new xuran project").argument("<p
|
|
|
12795
12795
|
process.exit(1);
|
|
12796
12796
|
}
|
|
12797
12797
|
});
|
|
12798
|
+
program.command("upgrade").description("Upgrade CLI to the latest version").action(async () => {
|
|
12799
|
+
console.log(source_default.blue.bold(`\n🔄 Checking for updates...\n`));
|
|
12800
|
+
try {
|
|
12801
|
+
const { execSync } = await import("child_process");
|
|
12802
|
+
const currentVersion = "1.0.3";
|
|
12803
|
+
const pkgName = "@xuranxys/cli";
|
|
12804
|
+
const latestVersion = execSync(`npm view ${pkgName} version`, { encoding: "utf-8" }).trim();
|
|
12805
|
+
if (latestVersion > currentVersion) {
|
|
12806
|
+
console.log(source_default.yellow.bold(`📦 Current version: ${currentVersion}`));
|
|
12807
|
+
console.log(source_default.green.bold(`✨ Latest version: ${latestVersion}`));
|
|
12808
|
+
console.log(source_default.blue.bold(`\n⬆️ Upgrading...\n`));
|
|
12809
|
+
execSync(`npm install -g ${pkgName}`, { stdio: "inherit" });
|
|
12810
|
+
console.log(source_default.green.bold("\n✅ Upgrade completed!"));
|
|
12811
|
+
} else console.log(source_default.green.bold("✅ Already on the latest version!"));
|
|
12812
|
+
} catch (error) {
|
|
12813
|
+
console.error(source_default.red.bold("\n❌ Upgrade failed:"), error.message);
|
|
12814
|
+
process.exit(1);
|
|
12815
|
+
}
|
|
12816
|
+
});
|
|
12798
12817
|
program.parse();
|
|
12799
12818
|
|
|
12800
12819
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xuranxys/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"author": "xuran",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
|
-
"url": "https://github.com/the-xuran/cli.git"
|
|
7
|
+
"url": "git+https://github.com/the-xuran/cli.git"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@changesets/cli": "^2.30.0",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
"build": "tsdown -c tsdown.config.ts",
|
|
48
48
|
"watch": "tsdown -c tsdown.config.ts -w",
|
|
49
49
|
"format": "prettier \"./src/**/*.{js,jsx,ts,tsx,vue}\" --write",
|
|
50
|
-
"publish": "bun publish --access=public",
|
|
51
50
|
"prepare": "husky",
|
|
52
51
|
"changeset": "changeset",
|
|
53
52
|
"version": "changeset version",
|