new structure
18
.github/actions/init-env/action.yaml
vendored
@ -4,7 +4,7 @@ inputs:
|
||||
runs-on:
|
||||
description: |
|
||||
Filter by project type, must be named filter from step `changes`
|
||||
default: 'all'
|
||||
default: "all"
|
||||
outputs:
|
||||
frontend:
|
||||
description: "Change affects front end"
|
||||
@ -13,7 +13,7 @@ outputs:
|
||||
description: "Change affects back end"
|
||||
value: ${{ steps.backend.outputs.value }}
|
||||
runs:
|
||||
using: 'composite'
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: Getting changes
|
||||
id: changes
|
||||
@ -21,16 +21,14 @@ runs:
|
||||
with:
|
||||
filters: |
|
||||
backend:
|
||||
- 'src-tauri/**'
|
||||
- 'butler/**'
|
||||
- 'packages/tauri/**'
|
||||
- 'packages/butler/**'
|
||||
- 'Cargo.lock'
|
||||
frontend:
|
||||
- 'src/**'
|
||||
- 'packages/ui/**'
|
||||
- '.github/**'
|
||||
- 'package.json'
|
||||
- '*.config.*'
|
||||
- 'tsconfig.json'
|
||||
- '.npmrc'
|
||||
- '.env.*'
|
||||
- 'pnpm-lock.yaml'
|
||||
|
||||
- id: frontend
|
||||
run: echo "value=${{ steps.changes.outputs.frontend}}" >> $GITHUB_OUTPUT
|
||||
@ -51,7 +49,7 @@ runs:
|
||||
name: Setup node
|
||||
if: ${{ inputs.runs-on == 'all' || steps.changes.outputs[inputs.runs-on] == 'true' }}
|
||||
with:
|
||||
node-version: '18'
|
||||
node-version: "18"
|
||||
cache: pnpm
|
||||
|
||||
- name: Get pnpm store directory
|
||||
|
5
.github/workflows/push.yaml
vendored
@ -68,7 +68,6 @@ jobs:
|
||||
|
||||
- run: cargo fmt --check
|
||||
if: ${{ steps.init.outputs.backend == 'true' }}
|
||||
working-directory: src-tauri
|
||||
|
||||
|
||||
story:
|
||||
@ -108,8 +107,6 @@ jobs:
|
||||
- name: Cache rust dependencies
|
||||
if: ${{ steps.init.outputs.backend == 'true' }}
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri
|
||||
|
||||
- run: sudo apt-get update
|
||||
if: ${{ steps.init.outputs.backend == 'true' && runner.os == 'Linux' }}
|
||||
@ -130,9 +127,7 @@ jobs:
|
||||
|
||||
- run: cargo clippy --all-features
|
||||
if: ${{ steps.init.outputs.backend == 'true' }}
|
||||
working-directory: src-tauri
|
||||
|
||||
- name: Test rust
|
||||
if: ${{ steps.init.outputs.backend == 'true' }}
|
||||
working-directory: src-tauri
|
||||
run: cargo test --locked
|
||||
|
41
.gitignore
vendored
@ -1,41 +1,10 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
# will have compiled rust files and executables
|
||||
/target/
|
||||
/node_modules/
|
||||
|
||||
node_modules
|
||||
dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
# editors
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
/build
|
||||
/.svelte-kit
|
||||
/package
|
||||
!.env.example
|
||||
vite.config.js.timestamp-*
|
||||
vite.config.ts.timestamp-*
|
||||
|
||||
# gitbutler
|
||||
.git/gb-*
|
||||
src-tauri/data.txt
|
||||
|
||||
|
||||
/.histoire
|
||||
|
||||
# Written to disk when using `act`
|
||||
.pnpm-store
|
851
butler/Cargo.lock → Cargo.lock
generated
10
Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"packages/butler",
|
||||
"packages/tauri",
|
||||
]
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1 # Compile crates one after another so the compiler can optimize better
|
||||
lto = true # Enables link to optimizations
|
||||
opt-level = "s" # Optimize for binary size
|
@ -47,7 +47,6 @@ $ pnpm format
|
||||
Rust:
|
||||
|
||||
```bash
|
||||
$ cd ./src-tauri
|
||||
$ cargo clippy # see linting errors
|
||||
$ cargo fmt # format code
|
||||
```
|
||||
@ -83,7 +82,7 @@ We are also collecting tokio's runtime tracing information that could be viewed
|
||||
To build the app in production mode, run:
|
||||
|
||||
```bash
|
||||
$ pnpm tauri build --features devtools --config src-tauri/tauri.conf.nightly.json
|
||||
$ pnpm tauri build --features devtools --config packages/tauri/tauri.conf.nightly.json
|
||||
```
|
||||
|
||||
This will make an asset similar to our nightly build.
|
||||
|
104
package.json
@ -1,102 +1,20 @@
|
||||
{
|
||||
"name": "git-butler-tauri",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite dev",
|
||||
"test": "vitest run --mode development",
|
||||
"build": "vite build",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "pnpm check --watch",
|
||||
"lint": "prettier --plugin-search-dir . --check . && eslint .",
|
||||
"format": "prettier --plugin-search-dir . --write .",
|
||||
"dev": "pnpm --filter @gitbutler/ui run dev",
|
||||
"test": "pnpm --filter @gitbutler/ui run test",
|
||||
"build": "pnpm --filter @gitbutler/ui run build",
|
||||
"check": "pnpm --filter @gitbutler/ui run check",
|
||||
"lint": "pnpm --filter @gitbutler/ui run lint",
|
||||
"format": "pnpm --filter @gitbutler/ui run format",
|
||||
"tauri": "tauri",
|
||||
"story:dev": "histoire dev --open",
|
||||
"prepare": "svelte-kit sync",
|
||||
"story:build": "histoire build",
|
||||
"story:preview": "histoire preview --open"
|
||||
"prepare": "pnpm --filter @gitbutler/ui run prepare",
|
||||
"story:dev": "pnpm --filter @gitbutler/ui run story:dev",
|
||||
"story:build": "pnpm --filter @gitbutler/ui run story:build",
|
||||
"story:preview": "pnpm --filter @gitbutler/ui run story:preview"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@codemirror/lang-cpp": "^6.0.2",
|
||||
"@codemirror/lang-css": "^6.2.1",
|
||||
"@codemirror/lang-html": "^6.4.6",
|
||||
"@codemirror/lang-java": "^6.0.1",
|
||||
"@codemirror/lang-javascript": "^6.2.1",
|
||||
"@codemirror/lang-json": "^6.0.1",
|
||||
"@codemirror/lang-markdown": "^6.2.0",
|
||||
"@codemirror/lang-php": "^6.0.1",
|
||||
"@codemirror/lang-python": "^6.1.3",
|
||||
"@codemirror/lang-rust": "^6.0.1",
|
||||
"@codemirror/lang-vue": "^0.1.2",
|
||||
"@codemirror/lang-wast": "^6.0.1",
|
||||
"@codemirror/lang-xml": "^6.0.2",
|
||||
"@codemirror/language": "^6.9.0",
|
||||
"@codemirror/state": "^6.2.1",
|
||||
"@codemirror/view": "^6.16.0",
|
||||
"@histoire/plugin-svelte": "^0.16.5",
|
||||
"@lezer/common": "^1.0.4",
|
||||
"@lezer/highlight": "^1.1.6",
|
||||
"@replit/codemirror-lang-svelte": "^6.0.0",
|
||||
"@sentry/sveltekit": "^7.64.0",
|
||||
"@square/svelte-store": "git+https://git@github.com/gitbutlerapp/svelte-store.git",
|
||||
"@sveltejs/adapter-static": "^2.0.3",
|
||||
"@sveltejs/kit": "^1.23.0",
|
||||
"@tauri-apps/api": "^1.4.0",
|
||||
"@tauri-apps/cli": "^1.4.0",
|
||||
"@types/crypto-js": "^4.1.1",
|
||||
"@types/diff": "^5.0.3",
|
||||
"@types/diff-match-patch": "^1.0.32",
|
||||
"@types/lscache": "^1.3.1",
|
||||
"@types/marked": "^5.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^6.4.1",
|
||||
"@typescript-eslint/parser": "^6.4.1",
|
||||
"autoprefixer": "^10.4.15",
|
||||
"class-transformer": "^0.5.1",
|
||||
"crypto-js": "^4.1.1",
|
||||
"date-fns": "^2.30.0",
|
||||
"diff-match-patch": "^1.0.5",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.0",
|
||||
"eslint-plugin-import": "^2.28.1",
|
||||
"eslint-plugin-square-svelte-store": "^1.0.0",
|
||||
"eslint-plugin-svelte": "^2.33.0",
|
||||
"histoire": "^0.16.5",
|
||||
"inter-ui": "^3.19.3",
|
||||
"leven": "^4.0.0",
|
||||
"lscache": "^1.3.2",
|
||||
"marked": "^7.0.4",
|
||||
"mm-jsr": "^3.0.2",
|
||||
"nanoevents": "^8.0.0",
|
||||
"nanoid": "^4.0.2",
|
||||
"postcss": "^8.4.28",
|
||||
"postcss-load-config": "^4.0.1",
|
||||
"posthog-js": "^1.77.2",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier-plugin-svelte": "^2.10.1",
|
||||
"prettier-plugin-tailwindcss": "^0.3.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"svelte": "^4.2.0",
|
||||
"svelte-check": "^3.5.0",
|
||||
"svelte-floating-ui": "^1.5.3",
|
||||
"svelte-french-toast": "^1.2.0",
|
||||
"svelte-loadable-store": "^2.0.1",
|
||||
"svelte-outclick": "^3.6.2",
|
||||
"svelte-resize-observer": "^2.0.0",
|
||||
"tailwindcss": "^3.3.3",
|
||||
"tauri-plugin-log-api": "git+https://git@github.com/tauri-apps/tauri-plugin-log.git",
|
||||
"tauri-plugin-websocket-api": "git+https://git@github.com/tauri-apps/tauri-plugin-websocket.git",
|
||||
"tinykeys": "^1.4.0",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.2.2",
|
||||
"vite": "^4.4.9",
|
||||
"vitest": "^0.34.3",
|
||||
"xterm": "^5.2.1",
|
||||
"xterm-addon-canvas": "^0.4.0",
|
||||
"xterm-addon-fit": "^0.7.0",
|
||||
"xterm-addon-ligatures": "^0.6.0",
|
||||
"xterm-addon-unicode11": "^0.5.0",
|
||||
"xterm-addon-webgl": "^0.15.0"
|
||||
"@tauri-apps/cli": "^1.4.0"
|
||||
}
|
||||
}
|
||||
|
@ -15,4 +15,4 @@ colored = "2.0.0"
|
||||
clap = { version = "4.0", features = ["derive"] }
|
||||
dialoguer = "0.10.4"
|
||||
anyhow = "1.0.71"
|
||||
git-butler-tauri = { path = "../src-tauri" }
|
||||
gitbutler = { path = "../tauri" }
|
@ -1,13 +1,13 @@
|
||||
use std::path;
|
||||
|
||||
use anyhow::{Context, Result};
|
||||
use git2::Repository;
|
||||
|
||||
use git_butler_tauri::{
|
||||
database, gb_repository, project_repository, projects, sessions, storage, users,
|
||||
};
|
||||
use gitbutler::{database, gb_repository, project_repository, projects, sessions, storage, users};
|
||||
|
||||
pub struct App {
|
||||
path: String,
|
||||
local_data_dir: String,
|
||||
local_data_dir: path::PathBuf,
|
||||
project: projects::Project,
|
||||
gb_repository: gb_repository::Repository,
|
||||
sessions_db: sessions::Database,
|
||||
@ -18,10 +18,10 @@ impl App {
|
||||
let path = find_git_directory().context("failed to find project directory")?;
|
||||
let local_data_dir = find_local_data_dir().context("could not find local data dir")?;
|
||||
|
||||
let storage = storage::Storage::from_path(local_data_dir.clone());
|
||||
let users_storage = users::Storage::new(storage.clone());
|
||||
let storage = storage::Storage::from(&local_data_dir);
|
||||
let users_storage = users::Storage::from(storage.clone());
|
||||
|
||||
let projects_storage = projects::Storage::new(storage);
|
||||
let projects_storage = projects::Storage::try_from(storage)?;
|
||||
let projects = projects_storage
|
||||
.list_projects()
|
||||
.context("failed to list projects")?;
|
||||
@ -32,16 +32,16 @@ impl App {
|
||||
.context("failed to find project")?;
|
||||
|
||||
let gb_repository = gb_repository::Repository::open(
|
||||
local_data_dir.clone(),
|
||||
project.id.clone(),
|
||||
&local_data_dir,
|
||||
&project.id,
|
||||
projects_storage,
|
||||
users_storage,
|
||||
)
|
||||
.context("failed to open repository")?;
|
||||
|
||||
let db_path = std::path::Path::new(&local_data_dir).join("database.sqlite3");
|
||||
let database = database::Database::open(db_path).context("failed to open database")?;
|
||||
let sessions_db = sessions::Database::new(database);
|
||||
let database = database::Database::try_from(&db_path).context("failed to open database")?;
|
||||
let sessions_db = sessions::Database::from(database);
|
||||
|
||||
Ok(Self {
|
||||
path,
|
||||
@ -56,7 +56,7 @@ impl App {
|
||||
&self.path
|
||||
}
|
||||
|
||||
pub fn local_data_dir(&self) -> &str {
|
||||
pub fn local_data_dir(&self) -> &path::PathBuf {
|
||||
&self.local_data_dir
|
||||
}
|
||||
|
||||
@ -91,8 +91,8 @@ fn find_git_directory() -> Option<String> {
|
||||
}
|
||||
}
|
||||
|
||||
fn find_local_data_dir() -> Option<String> {
|
||||
fn find_local_data_dir() -> Option<path::PathBuf> {
|
||||
let mut path = dirs::config_dir().unwrap();
|
||||
path.push("com.gitbutler.app.dev");
|
||||
Some(path.to_string_lossy().to_string())
|
||||
Some(path::PathBuf::from(path.to_string_lossy().to_string()))
|
||||
}
|
@ -2,7 +2,7 @@ use anyhow::{Context, Result};
|
||||
use clap::Args;
|
||||
use colored::Colorize;
|
||||
|
||||
use git_butler_tauri::virtual_branches;
|
||||
use gitbutler::virtual_branches;
|
||||
|
||||
use crate::app::App;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use anyhow::{Context, Result};
|
||||
use clap::Args;
|
||||
|
||||
use git_butler_tauri::{sessions, virtual_branches};
|
||||
use gitbutler::{sessions, virtual_branches};
|
||||
|
||||
use crate::app::App;
|
||||
|
@ -3,7 +3,7 @@ use clap::Args;
|
||||
use colored::Colorize;
|
||||
use dialoguer::{console::Term, theme::ColorfulTheme, Input, Select};
|
||||
|
||||
use git_butler_tauri::{reader, sessions, virtual_branches};
|
||||
use gitbutler::{reader, sessions, virtual_branches};
|
||||
|
||||
use crate::app::App;
|
||||
|
@ -2,7 +2,7 @@ use anyhow::{Context, Result};
|
||||
use clap::Args;
|
||||
use colored::Colorize;
|
||||
|
||||
use git_butler_tauri::{reader, sessions, virtual_branches};
|
||||
use gitbutler::{reader, sessions, virtual_branches};
|
||||
|
||||
use crate::app::App;
|
||||
|
||||
@ -15,7 +15,10 @@ impl super::RunCommand for Info {
|
||||
|
||||
// just print information for the project
|
||||
println!("path: {}", app.path().yellow());
|
||||
println!("data_dir: {}", app.local_data_dir().yellow());
|
||||
println!(
|
||||
"data_dir: {}",
|
||||
app.local_data_dir().display().to_string().yellow()
|
||||
);
|
||||
|
||||
// find the project in project storage that matches the cwd
|
||||
println!("{}", "project:".to_string().red());
|
@ -2,7 +2,7 @@ use anyhow::{Context, Result};
|
||||
use clap::Args;
|
||||
use dialoguer::{console::Term, theme::ColorfulTheme, MultiSelect, Select};
|
||||
|
||||
use git_butler_tauri::{reader, sessions, virtual_branches};
|
||||
use gitbutler::{reader, sessions, virtual_branches};
|
||||
|
||||
use crate::app::App;
|
||||
|
||||
@ -74,7 +74,7 @@ impl super::RunCommand for Move {
|
||||
ownership.put(
|
||||
&selected_files
|
||||
.join("\n")
|
||||
.try_into()
|
||||
.parse()
|
||||
.context("failed to convert to ownership")?,
|
||||
);
|
||||
|
@ -2,7 +2,7 @@ use anyhow::{Context, Result};
|
||||
use clap::Args;
|
||||
use dialoguer::{theme::ColorfulTheme, Input};
|
||||
|
||||
use git_butler_tauri::virtual_branches;
|
||||
use gitbutler::virtual_branches;
|
||||
|
||||
use crate::app::App;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use anyhow::{Context, Result};
|
||||
use clap::Args;
|
||||
|
||||
use git_butler_tauri::virtual_branches;
|
||||
use gitbutler::virtual_branches;
|
||||
|
||||
use crate::app::App;
|
||||
|
@ -1,7 +1,7 @@
|
||||
use anyhow::{Context, Result};
|
||||
use clap::Args;
|
||||
|
||||
use git_butler_tauri::{reader, sessions, virtual_branches};
|
||||
use gitbutler::{reader, sessions, virtual_branches};
|
||||
|
||||
use crate::app::App;
|
||||
|
@ -2,6 +2,7 @@ use anyhow::{Context, Result};
|
||||
use clap::Args;
|
||||
use colored::Colorize;
|
||||
use dialoguer::{console::Term, theme::ColorfulTheme, Select};
|
||||
use gitbutler::virtual_branches::set_base_branch;
|
||||
|
||||
use crate::app::App;
|
||||
|
||||
@ -35,8 +36,11 @@ impl super::RunCommand for Setup {
|
||||
match selection {
|
||||
Some(index) => {
|
||||
println!("Setting target to: {}", items[index].to_string().red());
|
||||
app.gb_repository()
|
||||
.set_base_branch(&app.project_repository(), &items[index].branch())
|
||||
set_base_branch(
|
||||
app.gb_repository(),
|
||||
&app.project_repository(),
|
||||
&items[index].branch().parse()?,
|
||||
)
|
||||
.context("failed to set target branch")?;
|
||||
}
|
||||
None => println!("User did not select anything"),
|
@ -2,7 +2,7 @@ use anyhow::{Context, Result};
|
||||
use clap::Args;
|
||||
use colored::Colorize;
|
||||
|
||||
use git_butler_tauri::virtual_branches;
|
||||
use gitbutler::virtual_branches;
|
||||
|
||||
use crate::app::App;
|
||||
|
@ -2,9 +2,9 @@ use std::process::ExitCode;
|
||||
|
||||
use clap::Parser;
|
||||
|
||||
mod commands;
|
||||
mod app;
|
||||
mod cli;
|
||||
mod commands;
|
||||
|
||||
fn main() -> ExitCode {
|
||||
cli::Cli::parse().run()
|
@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "git-butler-tauri"
|
||||
name = "gitbutler"
|
||||
version = "0.0.0"
|
||||
description = "A Tauri App"
|
||||
authors = ["you"]
|
||||
@ -61,6 +61,7 @@ backoff = "0.4.0"
|
||||
byteorder = "1.4.3"
|
||||
num_cpus = "1.16.0"
|
||||
resolve-path = "0.1.0"
|
||||
posthog-rs = "0.2.2"
|
||||
|
||||
[features]
|
||||
# by default Tauri runs in production mode
|
||||
@ -74,8 +75,3 @@ devtools = ["tauri/devtools"]
|
||||
# DO NOT remove this
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
|
||||
# https://tauri.app/v1/guides/building/app-size/#rust-build-time-optimizations
|
||||
[profile.release]
|
||||
codegen-units = 1 # Compile crates one after another so the compiler can optimize better
|
||||
lto = true # Enables link to optimizations
|
||||
opt-level = "s" # Optimize for binary size
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 57 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 7.5 KiB After Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 51 KiB |
Before Width: | Height: | Size: 151 KiB After Width: | Height: | Size: 151 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |