Skip to content

Commit

Permalink
shadcn: init at 2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
GetPsyched committed Sep 13, 2024
1 parent dba9a47 commit 6eae42e
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions pkgs/by-name/sh/shadcn/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
lib,
stdenvNoCC,
fetchFromGitHub,
makeBinaryWrapper,
nodejs,
pnpm_9,
testers,
shadcn,
}:

stdenvNoCC.mkDerivation (finalAttrs: {
pname = "shadcn";
version = "2.0.3";

src = fetchFromGitHub {
owner = "shadcn-ui";
repo = "ui";
rev = "shadcn@${finalAttrs.version}";
hash = "sha256-OBLKCj+v5KgYslJGuwLgJHjgcrxLPiiyO5/ucrJ14Ws=";
};

pnpmWorkspace = "shadcn";
pnpmDeps = pnpm_9.fetchDeps {
inherit (finalAttrs)
pname
version
src
pnpmWorkspace
;
hash = "sha256-OcoZfbB04CFHpAM/fW3IhIMXtas6x8H3+lvk7nTN8Tg=";
};

nativeBuildInputs = [
makeBinaryWrapper
nodejs
pnpm_9.configHook
];

buildPhase = ''
runHook preBuild
pnpm run shadcn:build
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir -p $out/{bin,lib}
cp -r {packages,node_modules} $out/lib
# cleanup
rm -r $out/lib/packages/{cli,shadcn/src}
find $out/lib/packages/shadcn -name '*.ts' -delete
makeWrapper ${lib.getExe nodejs} $out/bin/shadcn \
--inherit-argv0 \
--add-flags $out/lib/packages/shadcn/dist/index.js
runHook postInstall
'';

passthru.tests.version = testers.testVersion {
package = shadcn;
command = "shadcn --version";
version = finalAttrs.version;
};

meta = {
changelog = "https://github.com/shadcn-ui/ui/blob/${finalAttrs.src.rev}/packages/shadcn/CHANGELOG.md#${
builtins.replaceStrings [ "." ] [ "" ] finalAttrs.version
}";
description = "Beautifully designed components that you can copy and paste into your apps";
homepage = "https://ui.shadcn.com/docs/cli";
license = lib.licenses.mit;
mainProgram = "shadcn";
maintainers = with lib.maintainers; [ getpsyched ];
platforms = lib.platforms.all;
};
})

0 comments on commit 6eae42e

Please sign in to comment.