diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 52f64fb..845ae26 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -2,7 +2,7 @@ name: Release on: push: branches: - - "main" + - "release" env: GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 640fcaa..f66ca82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,3 @@ -## [0.2.0](https://git.kjan.de/jank/project-cli/compare/v0.1.1...v0.2.0) (2025-06-19) - -### Features - -* Add basic project creation ([fb23f6f](https://git.kjan.de/jank/project-cli/commit/fb23f6fd8b5c4f625524a86e2378aa2b503458a8)) - -## [0.1.1](https://git.kjan.de/jank/project-cli/compare/v0.1.0...v0.1.1) (2025-06-19) - -### Chores - -* **deps:** add renovate.json ([9284088](https://git.kjan.de/jank/project-cli/commit/92840886290ed4796d16643f49b5c4d622814e55)) - ## [0.1.0](https://git.kjan.de/jank/project-cli/compare/v0.0.1...v0.1.0) (2025-06-19) ### Features @@ -19,3 +7,7 @@ ### Bug Fixes * Use newer version of the release action ([9c16070](https://git.kjan.de/jank/project-cli/commit/9c16070b54a634b78fffd341ac5b0190ae2fedbb)) + +### Chores + +* Create release branch ([ff50c29](https://git.kjan.de/jank/project-cli/commit/ff50c291a79050d76f7ca0af5450c7ddd845792e)) diff --git a/configuration/configuration.ts b/configuration/configuration.ts index 9219138..2c35e86 100644 --- a/configuration/configuration.ts +++ b/configuration/configuration.ts @@ -4,36 +4,8 @@ import * as toml from "@std/toml"; export const configPath = os.homedir() + "/.config/project-cli/"; -export interface Project { - name: string; -} - export interface Configuration { projectsDirectory: string; - cloningCommand: string; -} - -export function getProjects(): Project[] { - const projectsString = fs - .readFileSync(configPath + "projects.json") - .toString(); - return JSON.parse(projectsString) as Project[]; -} - -export function getConfiguration(): Configuration { - return toml.parse( - fs.readFileSync(configPath + "config.toml").toString(), - ) as unknown as Configuration; -} - -export function addProject(project: Project) { - let projects = getProjects(); - if (projects.length == undefined) { - saveProjects([project]); - } else { - projects.push(project); - saveProjects(projects); - } } export function generateDefaultConfig() { @@ -42,19 +14,10 @@ export function generateDefaultConfig() { const defaultConfig: Configuration = { projectsDirectory: os.homedir() + "/projects", - cloningCommand: "git clone %s %n", }; const configString = toml.stringify( defaultConfig as unknown as Record, ); fs.writeFileSync(configPath + "config.toml", configString); - - const projects: Project[] = []; - saveProjects(projects); -} - -function saveProjects(projects: Project[]) { - const projectsString = JSON.stringify(projects); - fs.writeFileSync(configPath + "projects.json", projectsString); } diff --git a/index.ts b/index.ts index d067790..62c0d0d 100644 --- a/index.ts +++ b/index.ts @@ -1,15 +1,10 @@ import fs from "fs"; -import { confirm, select, input } from "@inquirer/prompts"; +import { confirm } from "@inquirer/prompts"; import { exit } from "process"; import { - addProject, configPath, generateDefaultConfig, - getConfiguration, - getProjects, - type Project, } from "./configuration/configuration"; -import { execSync } from "child_process"; if (!fs.existsSync(configPath + "config.toml")) { const createConfig = await confirm({ @@ -26,50 +21,3 @@ if (!fs.existsSync(configPath + "config.toml")) { } } -if ( - !getProjects() || - getProjects().length == 0 || - getProjects().length == undefined -) { - const anwser = await select({ - message: "Create a new Project", - choices: ["Clone a project with git", "Create a new empty Project"], - }); - if (anwser == "Clone a project with git") { - const repoUrl = await input({ message: "What is the url of the repo?" }); - const wantsCustomName = await confirm({ - message: "Would you like to give this project a custom name?", - default: false, - }); - let customName = ""; - if (wantsCustomName) { - customName = await input({ - message: "What would you like the custom name to be?", - }); - } - - execSync( - "cd " + - getConfiguration().projectsDirectory + - " && " + - getConfiguration() - .cloningCommand.replace("%s", repoUrl) - .replace("%n", customName), - ); - - const newProject: Project = { - name: customName, - }; - addProject(newProject); - } else if (anwser == "Create a new empty Project") { - const name = await input({ - message: "What would you like to call the project?", - }); - fs.mkdirSync(getConfiguration().projectsDirectory + "/" + name); - const newProject: Project = { - name: name, - }; - addProject(newProject); - } -} -console.log(getProjects()); diff --git a/package-lock.json b/package-lock.json index f36ff4f..4967146 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "proj-cli", - "version": "0.2.0", + "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "proj-cli", - "version": "0.2.0", + "version": "0.1.0", "dependencies": { "@saithodev/semantic-release-gitea": "^2.1.0", "@semantic-release/changelog": "^6.0.3", diff --git a/package.json b/package.json index 4540066..7c586fa 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "proj-cli", - "version": "0.2.0", + "version": "0.1.0", "module": "index.ts", "type": "module", "devDependencies": { diff --git a/release.config.cjs b/release.config.cjs index 0bcf30a..4f30255 100644 --- a/release.config.cjs +++ b/release.config.cjs @@ -1,5 +1,5 @@ module.exports = { - branches: ["main"], + branches: ["release"], plugins: [ [ "@semantic-release/commit-analyzer", diff --git a/renovate.json b/renovate.json deleted file mode 100644 index c183f9d..0000000 --- a/renovate.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "local>Renovate/renovate-config" - ] -}