deduplicate name/version
This commit is contained in:
parent
8cf96c4282
commit
d2aae92692
4 changed files with 9 additions and 11 deletions
|
|
@ -28,15 +28,10 @@ npm run check
|
||||||
|
|
||||||
## Renaming
|
## Renaming
|
||||||
|
|
||||||
To rename the CLI from `name-placeholder` to your desired name:
|
To rename the CLI, edit the `name` field in `package.json`. Both the Nix package and the CLI will update automatically.
|
||||||
|
|
||||||
```bash
|
|
||||||
sed -i 's/name-placeholder/your-new-name/g' package.json src/index.ts flake.nix
|
|
||||||
```
|
|
||||||
|
|
||||||
Then rebuild:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Edit package.json, then rebuild:
|
||||||
nix build .
|
nix build .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,13 @@
|
||||||
|
|
||||||
perSystem = { config, system, pkgs, lib, ... }:
|
perSystem = { config, system, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
|
packageJson = builtins.fromJSON (builtins.readFile ./package.json);
|
||||||
runtimeDeps = [ ]; # e. g. pkgs.jq
|
runtimeDeps = [ ]; # e. g. pkgs.jq
|
||||||
runtimePath = lib.makeSearchPath "bin" runtimeDeps;
|
runtimePath = lib.makeSearchPath "bin" runtimeDeps;
|
||||||
|
|
||||||
basePackage = {
|
basePackage = {
|
||||||
pname = "name-placeholder";
|
pname = packageJson.name;
|
||||||
version = "0.1.0";
|
version = packageJson.version;
|
||||||
src = ./.;
|
src = ./.;
|
||||||
npmDepsHash = "sha256-EvM5ZyNQEW8RYFCfI7Bkju1qL+1y8nleXPAX3IKce78=";
|
npmDepsHash = "sha256-EvM5ZyNQEW8RYFCfI7Bkju1qL+1y8nleXPAX3IKce78=";
|
||||||
npmBuildScript = "build";
|
npmBuildScript = "build";
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
import packageJson from "../package.json" with { type: "json" };
|
||||||
import {
|
import {
|
||||||
buildApplication,
|
buildApplication,
|
||||||
buildCommand,
|
buildCommand,
|
||||||
|
|
@ -107,7 +108,7 @@ const root = buildRouteMap({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const app = buildApplication(root, { name: "name-placeholder" });
|
const app = buildApplication(root, { name: packageJson.name });
|
||||||
|
|
||||||
await run(app, process.argv.slice(2), {
|
await run(app, process.argv.slice(2), {
|
||||||
process:
|
process:
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
"verbatimModuleSyntax": true,
|
"verbatimModuleSyntax": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"moduleDetection": "force",
|
"moduleDetection": "force",
|
||||||
"skipLibCheck": true
|
"skipLibCheck": true,
|
||||||
|
"resolveJsonModule": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue