Repository navigation
Commit 1dab5c2
authored
refactor(nix): derive package metadata from the npm manifest (#1506)
`package.nix` restated the name, description, homepage, license, and
`mainProgram` that `apps/ccusage/package.json` already declares, so the
two drifted: the manifest describes the CLI as "Analyze coding (agent)
CLI token usage and costs from local data" while Nix dropped the
parentheses, and nothing tied the Nix `mainProgram` to the manifest's
`bin` entry.
Import the published manifest and derive all of it, following the
pattern in yusukebe/ax: `lib.getLicenseFromSpdxId` turns the SPDX string
into a nixpkgs license, and `mainProgram` comes from the sole `bin` key.
`ccusage-static` and `ccusage-darwin-x64` already build their `meta`
from `config.packages.ccusage.meta`, so they inherit this too.
`version` still comes from the root manifest. `rust/crates/ccusage/
build.rs` falls back to reading it when `CCUSAGE_VERSION` is unset, and
`compiled_version_matches_release_package` asserts the compiled version
matches it, so moving the Nix source would split the version's origin
between the Nix and plain-cargo builds. tagpr bumps both manifests
together.
`meta.homepage` gains the `#readme` fragment the manifest carries. The
URL resolves to the same page.
Verified with `nix eval`: `pname`, `version`, `license.spdxId`, and
`mainProgram` are unchanged, and `ccusage-darwin-x64` still inherits the
license and `mainProgram`.1 parent caf89e8 commit 1dab5c2
1 file changed
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
| |||
30 | 36 | | |
31 | 37 | | |
32 | 38 | | |
33 | | - | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| |||
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
139 | 144 | | |
140 | 145 | | |
141 | 146 | | |
0 commit comments