Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
result
result-*
78 changes: 77 additions & 1 deletion flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
# keep-sorted start block=true
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:nixos/nixpkgs/nixos-26.05";
package-lock2nix = {
url = "github:anteriorcore/package-lock2nix";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-parts.follows = "flake-parts";
inputs.treefmt-nix.follows = "treefmt-nix";
};
systems.url = "systems";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
Expand All @@ -25,15 +31,20 @@
{
packages =
let
package-lock2nix = pkgs.callPackage inputs.package-lock2nix.lib.package-lock2nix {
inherit (pkgs) nodejs;
};
all = lib.packagesFromDirectoryRecursive {
inherit (pkgs) callPackage newScope;
newScope = self: pkgs.newScope (self // { inherit package-lock2nix; });
inherit (pkgs) callPackage;
directory = ./packages;
};
in
{
inherit (all)
# keep-sorted start
conventional-commit
docsync
nix-flake-check-changed
nix-grep-to-build
npm-list
Expand Down
146 changes: 146 additions & 0 deletions packages/docsync/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions packages/docsync/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"name": "docsync",
"type": "module",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"start": "node src/index.ts",
"test": "tsc"
},
"bin": {
"docsync-check": "src/docsync-check.ts",
"docsync-get": "src/docsync-get.ts"
},
"keywords": [],
"author": "",
"license": "AGPL-3.0-only",
"dependencies": {
"tree-sitter": "^0.22.4",
"tree-sitter-python": "^0.23.6",
"tree-sitter-typescript": "^0.23.2"
},
"devDependencies": {
"@types/node": "^24.1.0",
"typescript": "^6.0.3"
},
"overrides": {
"tree-sitter-typescript": {
"tree-sitter": "^0.22.4"
}
}
}
39 changes: 39 additions & 0 deletions packages/docsync/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
diffutils,
gnused,
jq,
lib,
package-lock2nix,
runCommand,
}:

package-lock2nix.mkNpmModule {
src = ./.;
doInstallCheck = true;
nativeBuildInputs = [
diffutils
jq
];
postBuild = ''
npm explore tree-sitter -- npm run install
'';
meta.license = lib.licenses.agpl3Only;
installCheckPhase =
let
fixtures = {
CmdCheck = "docsync-check checks if two directories' doc tags are in sync.";
CmdGet = "docsync-get extracts all docsync nodes under a path.";
};
fixture = builtins.toFile "fixture" (builtins.toJSON fixtures);
in
''
$out/bin/docsync-get ${./src} > full-out
diff -u <(jq --sort-keys . ${fixture}) <(jq --sort-keys . full-out)

$out/bin/docsync-get ${./src} CmdGet > single-out
diff -u ${builtins.toFile "test" (fixtures.CmdGet + "\n")} single-out

! $out/bin/docsync-get ${./src} KeyWhichDoesntExistForTestingSake
! $out/bin/docsync-get ${./src} CmdGet extra-arg
'';
}
Loading
Loading