feat: add version argument
This commit is contained in:
commit
618e00b677
7 changed files with 1310 additions and 35 deletions
|
@ -20,6 +20,9 @@ jobs:
|
|||
pull-requests: write
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: oven-sh/setup-bun@v2
|
||||
with:
|
||||
bun-version: latest
|
||||
- name: Create Release
|
||||
uses: https://git.kjan.de/actions/semantic-release@v1.1.0
|
||||
with:
|
||||
|
|
30
CHANGELOG.md
30
CHANGELOG.md
|
@ -1,3 +1,33 @@
|
|||
## [0.3.3](https://git.kjan.de/jank/project-cli/compare/v0.3.2...v0.3.3) (2025-06-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Fix wrong config ([1f0d3aa](https://git.kjan.de/jank/project-cli/commit/1f0d3aa030d462b7f1df1646b7b4431a8ef43d2c))
|
||||
|
||||
## [0.3.2](https://git.kjan.de/jank/project-cli/compare/v0.3.1...v0.3.2) (2025-06-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Remove stupid toml ([a38aedc](https://git.kjan.de/jank/project-cli/commit/a38aedc2481930a9bc5ac4454e5b0b4b6fff5104))
|
||||
|
||||
## [0.3.1](https://git.kjan.de/jank/project-cli/compare/v0.3.0...v0.3.1) (2025-06-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Setup bun ([6a1b731](https://git.kjan.de/jank/project-cli/commit/6a1b7317308fdeb2719c258f6c2b62463d81ca3a))
|
||||
|
||||
## [0.3.0](https://git.kjan.de/jank/project-cli/compare/v0.2.2...v0.3.0) (2025-06-19)
|
||||
|
||||
### Features
|
||||
|
||||
* Add some compiling ([81ee09b](https://git.kjan.de/jank/project-cli/commit/81ee09b42fafa5300e384a236602ee22f838da00))
|
||||
|
||||
## [0.2.2](https://git.kjan.de/jank/project-cli/compare/v0.2.1...v0.2.2) (2025-06-19)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Fix releases ([8bfcadd](https://git.kjan.de/jank/project-cli/commit/8bfcadd11f346645eb79027349b791d016ca2b0d))
|
||||
|
||||
## [0.2.1](https://git.kjan.de/jank/project-cli/compare/v0.2.0...v0.2.1) (2025-06-19)
|
||||
|
||||
### Chores
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import fs from "fs";
|
||||
import os from "os";
|
||||
import * as toml from "@std/toml";
|
||||
|
||||
export const configPath = os.homedir() + "/.config/project-cli/";
|
||||
|
||||
|
@ -21,9 +20,9 @@ export function getProjects(): Project[] {
|
|||
}
|
||||
|
||||
export function getConfiguration(): Configuration {
|
||||
return toml.parse(
|
||||
fs.readFileSync(configPath + "config.toml").toString(),
|
||||
) as unknown as Configuration;
|
||||
return JSON.parse(
|
||||
fs.readFileSync(configPath + "config.json").toString(),
|
||||
) as Configuration;
|
||||
}
|
||||
|
||||
export function addProject(project: Project) {
|
||||
|
@ -45,10 +44,8 @@ export function generateDefaultConfig() {
|
|||
cloningCommand: "git clone %s %n",
|
||||
};
|
||||
|
||||
const configString = toml.stringify(
|
||||
defaultConfig as unknown as Record<string, unknown>,
|
||||
);
|
||||
fs.writeFileSync(configPath + "config.toml", configString);
|
||||
const configString = JSON.stringify(defaultConfig);
|
||||
fs.writeFileSync(configPath + "config.json", configString);
|
||||
|
||||
const projects: Project[] = [];
|
||||
saveProjects(projects);
|
||||
|
|
10
index.ts
10
index.ts
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import fs from "fs";
|
||||
import fs, { readFileSync } from "fs";
|
||||
import { confirm, select, input } from "@inquirer/prompts";
|
||||
import { exit } from "process";
|
||||
import {
|
||||
|
@ -13,14 +13,20 @@ import {
|
|||
} from "./configuration/configuration";
|
||||
import { execSync } from "child_process";
|
||||
import { program } from "commander";
|
||||
import { dirname, join } from "path";
|
||||
import { fileURLToPath } from "bun";
|
||||
|
||||
const packageJson = require("./package.json");
|
||||
export const VERSION = packageJson.version;
|
||||
|
||||
const CLI_NAME = "pcli";
|
||||
|
||||
program
|
||||
.name("project-cli")
|
||||
.description("A cli for managing projects")
|
||||
.version(VERSION)
|
||||
.action(async () => {
|
||||
if (!fs.existsSync(configPath + "config.toml")) {
|
||||
if (!fs.existsSync(configPath + "config.json")) {
|
||||
const createConfig = await confirm({
|
||||
message:
|
||||
"No cofig has been found. Would you like to generate a new one?",
|
||||
|
|
22
package-lock.json
generated
22
package-lock.json
generated
|
@ -1,18 +1,17 @@
|
|||
{
|
||||
"name": "proj-cli",
|
||||
"version": "0.2.1",
|
||||
"version": "0.3.3",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "proj-cli",
|
||||
"version": "0.2.1",
|
||||
"version": "0.3.3",
|
||||
"dependencies": {
|
||||
"@saithodev/semantic-release-gitea": "^2.1.0",
|
||||
"@semantic-release/changelog": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/release-notes-generator": "^14.0.3",
|
||||
"@std/toml": "npm:@jsr/std__toml",
|
||||
"@types/commander": "^2.12.5",
|
||||
"@types/inquirer": "^9.0.8",
|
||||
"commander": "^14.0.0",
|
||||
|
@ -21,6 +20,9 @@
|
|||
"inquirer": "^12.6.3",
|
||||
"semantic-release": "^24.2.5"
|
||||
},
|
||||
"bin": {
|
||||
"pcli": "dist/index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/bun": "latest"
|
||||
},
|
||||
|
@ -490,11 +492,6 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@jsr/std__collections": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://npm.jsr.io/~/11/@jsr/std__collections/1.1.1.tgz",
|
||||
"integrity": "sha512-bS4Y5f80IUeDUf+0BgVVWValgBeGcJ/UwFYTC5PBIJtrFqwEmU8IohDBwFLJILyUtiAB1jbJewl0K+REEQ9kQQ=="
|
||||
},
|
||||
"node_modules/@nodelib/fs.scandir": {
|
||||
"version": "2.1.5",
|
||||
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
|
||||
|
@ -1388,15 +1385,6 @@
|
|||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
}
|
||||
},
|
||||
"node_modules/@std/toml": {
|
||||
"name": "@jsr/std__toml",
|
||||
"version": "1.0.8",
|
||||
"resolved": "https://npm.jsr.io/~/11/@jsr/std__toml/1.0.8.tgz",
|
||||
"integrity": "sha512-rnMoiySl30TrsdnfKcroYEWIBlmPvdNoA8fn/Njy3rsZR9C8k5nUeo9kWP/D/PhxYlUaYPtmQ31YhNqGpmEZ3Q==",
|
||||
"dependencies": {
|
||||
"@jsr/std__collections": "^1.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@szmarczak/http-timer": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "proj-cli",
|
||||
"version": "0.2.1",
|
||||
"version": "0.3.3",
|
||||
"module": "index.ts",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
@ -25,7 +25,6 @@
|
|||
"@semantic-release/changelog": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"@semantic-release/release-notes-generator": "^14.0.3",
|
||||
"@std/toml": "npm:@jsr/std__toml",
|
||||
"@types/commander": "^2.12.5",
|
||||
"@types/inquirer": "^9.0.8",
|
||||
"commander": "^14.0.0",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue