aboutsummaryrefslogtreecommitdiffhomepage
path: root/justfile
blob: 0ac180f1c0562f7a4182ea71a74f27587dc4a385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
commit-upgrade PKG VERSION:
    git commit -m 'feat({{PKG}}): upgrade to {{VERSION}}'

update-claude-code:
    #!/usr/bin/env bash
    set -eu

    export NIXPKGS_ALLOW_UNFREE=1
    LATEST_VERSION=$(npm view @anthropic-ai/claude-code version)

    sed -i 's|version = ".*"|version = "'"$LATEST_VERSION"'"|' pkgs/claude-code/default.nix
    sed -i 's|hash = ".*"|hash = ""|' pkgs/claude-code/default.nix
    sed -i 's|npmDepsHash = ".*"|npmDepsHash = ""|' pkgs/claude-code/default.nix

    sed -i '1,10s|"version": ".*"|"version": "'"$LATEST_VERSION"'"|' pkgs/claude-code/package-lock.json

    HASH="$(nix build --impure ".#claude-code" 2>&1 | grep "got:" | awk '{ print $2 }')"
    sed -i 's|hash = ""|hash = "'"$HASH"'"|' pkgs/claude-code/default.nix

    NPM_DEPS_HASH="$(nix build --impure ".#claude-code" 2>&1 | grep "got:" | awk '{ print $2 }')"
    sed -i 's|npmDepsHash = ""|npmDepsHash = "'"$NPM_DEPS_HASH"'"|' pkgs/claude-code/default.nix

    nix build --impure ".#claude-code"