mirror of
https://github.com/forketyfork/obsidian-youtrack-fetcher.git
synced 2026-07-22 05:46:13 +00:00
nix and just development environment
This commit is contained in:
parent
9f4f59fabe
commit
faf5b09394
7 changed files with 259 additions and 2 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
|
@ -0,0 +1 @@
|
|||
use flake
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -24,3 +24,6 @@ data.json
|
|||
|
||||
# Code coverage dir
|
||||
coverage/
|
||||
|
||||
# direnv
|
||||
.direnv
|
||||
|
|
|
|||
30
CLAUDE.md
30
CLAUDE.md
|
|
@ -2,7 +2,33 @@
|
|||
|
||||
This file provides guidance to AI agents when working with code in this repository.
|
||||
|
||||
## Build Commands
|
||||
## Development Environment
|
||||
|
||||
This project supports two development workflows:
|
||||
|
||||
### Just Commands (Recommended)
|
||||
|
||||
If you're using the Nix development environment (via `nix develop` or direnv), use these Just commands:
|
||||
|
||||
- `just` - List all available commands
|
||||
- `just clean` - Clean build artifacts and dependencies
|
||||
- `just install` - Install dependencies
|
||||
- `just build` - Full production build (includes tests, typecheck and formatting)
|
||||
- `just dev` - Development build
|
||||
- `just watch` - Development build with watch mode
|
||||
- `just prod` - Production build without tests or type checking
|
||||
- `just typecheck` - TypeScript typecheck
|
||||
- `just format` - Format code with Prettier
|
||||
- `just lint` - Check code style with ESLint
|
||||
- `just test` - Run Jest tests
|
||||
- `just test-dev` - Run development build and then tests
|
||||
- `just test-watch` - Run development build and then tests in watch mode
|
||||
- `just coverage` - Generate test coverage report
|
||||
- `just build-css` - Minify CSS with CSSO (from src/styles.src.css to styles.css)
|
||||
- `just version` - Bump version in manifest.json and versions.json
|
||||
- `just release` - Full release (version, push, tags)
|
||||
|
||||
### Yarn Commands (Alternative)
|
||||
|
||||
- `yarn dev` - Development build
|
||||
- `yarn dev:watch` - Development build with watch mode
|
||||
|
|
@ -19,7 +45,7 @@ This file provides guidance to AI agents when working with code in this reposito
|
|||
|
||||
## General guidelines
|
||||
|
||||
- IMPORTANT: After finishing your task, make sure to run `yarn build` and fix any introduced issues.
|
||||
- IMPORTANT: After finishing your task, make sure to run `just build` (if using Nix/Just) or `yarn build` and fix any introduced issues.
|
||||
- IMPORTANT: On finishing your task, make sure the README.md file is up to date with regards to the new features, usage, and development.
|
||||
- IMPORTANT: Always try to extract testable logic that can be independent of Obsidian plugins to separate classes or functions and write unit tests for it.
|
||||
- IMPORTANT: Do not write useless tests just to increase coverage, make them actually useful for catching issues in the code.
|
||||
|
|
|
|||
42
README.md
42
README.md
|
|
@ -83,6 +83,48 @@ The issue `summary` can also be used as a `${title}` placeholder.
|
|||
|
||||
## Development
|
||||
|
||||
### Using Nix and Just (Recommended)
|
||||
|
||||
This project includes a Nix flake and direnv configuration for reproducible development environments, along with Just commands for common tasks.
|
||||
|
||||
#### Prerequisites
|
||||
|
||||
- [Nix](https://nixos.org/download.html) with flakes enabled
|
||||
- [direnv](https://direnv.net/) (optional but recommended)
|
||||
|
||||
#### Setup
|
||||
|
||||
1. Clone the repository and enter the directory
|
||||
2. If using direnv, run `direnv allow` to automatically load the development environment
|
||||
3. If not using direnv, run `nix develop` to enter the development shell
|
||||
|
||||
#### Available Commands
|
||||
|
||||
```shell
|
||||
# List all available commands
|
||||
just
|
||||
|
||||
# Clean build artifacts
|
||||
just clean
|
||||
|
||||
# Install dependencies
|
||||
just install
|
||||
|
||||
# Full production build (includes tests, type checking, and formatting)
|
||||
just build
|
||||
|
||||
# Development build with watch mode
|
||||
just watch
|
||||
|
||||
# Run tests
|
||||
just test
|
||||
|
||||
# Run linter
|
||||
just lint
|
||||
```
|
||||
|
||||
### Using Yarn Directly
|
||||
|
||||
Run the development build with change watch:
|
||||
|
||||
```shell
|
||||
|
|
|
|||
61
flake.lock
Normal file
61
flake.lock
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1731533236,
|
||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1756542300,
|
||||
"narHash": "sha256-tlOn88coG5fzdyqz6R93SQL5Gpq+m/DsWpekNFhqPQk=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d7600c775f877cd87b4f5a831c28aa94137377aa",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
52
flake.nix
Normal file
52
flake.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
description = "Obsidian YouTrack Fetcher plugin development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, flake-utils }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
# Node.js and package manager
|
||||
nodejs_20
|
||||
yarn
|
||||
|
||||
# Development tools
|
||||
just
|
||||
typescript
|
||||
|
||||
# Build tools
|
||||
esbuild
|
||||
|
||||
# Optional tools
|
||||
git
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
echo "🚀 Obsidian YouTrack Fetcher development environment"
|
||||
echo "📦 Node.js $(node --version)"
|
||||
echo "🧶 Yarn $(yarn --version)"
|
||||
echo "⚡ TypeScript $(tsc --version)"
|
||||
echo ""
|
||||
echo "Available commands:"
|
||||
echo " just clean - Clean build artifacts"
|
||||
echo " just build - Full production build"
|
||||
echo " just test - Run tests"
|
||||
echo " just lint - Run linter"
|
||||
echo ""
|
||||
echo "Run 'just --list' for all available commands"
|
||||
'';
|
||||
};
|
||||
|
||||
# Optional: Add formatter for nix files
|
||||
formatter = pkgs.nixpkgs-fmt;
|
||||
}
|
||||
);
|
||||
}
|
||||
72
justfile
Normal file
72
justfile
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# Obsidian YouTrack Fetcher - Development Commands
|
||||
|
||||
# List all available commands
|
||||
default:
|
||||
@just --list
|
||||
|
||||
# Clean build artifacts and dependencies
|
||||
clean:
|
||||
rm -rf node_modules
|
||||
rm -rf main.js
|
||||
rm -rf styles.css
|
||||
rm -rf coverage
|
||||
|
||||
# Install dependencies
|
||||
install:
|
||||
yarn install
|
||||
|
||||
# Full production build (typecheck, lint, format, build, test)
|
||||
build:
|
||||
yarn build
|
||||
|
||||
# Development build
|
||||
dev:
|
||||
yarn dev
|
||||
|
||||
# Development build with watch mode
|
||||
watch:
|
||||
yarn dev:watch
|
||||
|
||||
# Production build without tests
|
||||
prod:
|
||||
yarn prod
|
||||
|
||||
# Run TypeScript type checking
|
||||
typecheck:
|
||||
yarn typecheck
|
||||
|
||||
# Run tests
|
||||
test:
|
||||
yarn test
|
||||
|
||||
# Run tests in development mode
|
||||
test-dev:
|
||||
yarn test:dev
|
||||
|
||||
# Run tests in watch mode
|
||||
test-watch:
|
||||
yarn test:watch
|
||||
|
||||
# Run tests with coverage
|
||||
coverage:
|
||||
yarn coverage
|
||||
|
||||
# Run ESLint
|
||||
lint:
|
||||
yarn lint
|
||||
|
||||
# Format code with Prettier
|
||||
format:
|
||||
yarn format
|
||||
|
||||
# Build CSS from source
|
||||
build-css:
|
||||
yarn build:css
|
||||
|
||||
# Bump version
|
||||
version:
|
||||
yarn version
|
||||
|
||||
# Full release (version, push, tags)
|
||||
release:
|
||||
yarn release
|
||||
Loading…
Reference in a new issue