forked from byronanthonymartinez-only/union
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathts-sdk.nix
More file actions
84 lines (84 loc) · 2.24 KB
/
Copy pathts-sdk.nix
File metadata and controls
84 lines (84 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
_: {
perSystem =
{
pkgs,
buildPnpmPackage,
self',
ensureAtRepositoryRoot,
...
}:
let
hash = "sha256-8fBgRR9gTZRsImkeRxVkzADjQb3DH7+KSi+MMvNdI00=";
in
{
packages = {
ts-sdk = buildPnpmPackage {
inherit hash;
packageJsonPath = ./package.json;
pnpmWorkspaces = [
"@unionlabs/sdk"
];
extraSrcs = [
../ts-sdk
];
doCheck = true;
buildPhase = ''
runHook preBuild
pnpm --filter=@unionlabs/sdk build
runHook postBuild
'';
installPhase = ''
mkdir -p $out
cp -r ./ts-sdk/dist/* $out
'';
checkPhase = ''
pnpm --filter=@unionlabs/sdk check
pnpm --filter=@unionlabs/sdk test
'';
};
ts-sdk-docs = buildPnpmPackage {
inherit hash;
packageJsonPath = ./package.json;
pnpmWorkspaces = [
"@unionlabs/sdk"
];
extraSrcs = [
../ts-sdk
];
buildPhase = ''
runHook preBuild
pnpm --filter=@unionlabs/sdk docgen
runHook postBuild
'';
installPhase = ''
mkdir -p $out
cp -r ./ts-sdk/docs/* $out
'';
};
};
apps = {
publish-ts-sdk = {
type = "app";
program = pkgs.writeShellApplication {
name = "publish-ts-sdk";
text = ''
cd ${self'.packages.ts-sdk}/
pnpm publish --access='public'
'';
};
};
ts-sdk-fetch-schema = {
type = "app";
program = pkgs.writeShellApplication {
name = "ts-sdk-fetch-schema";
text = ''
${ensureAtRepositoryRoot}
cd ts-sdk/
pnpm dlx gql.tada generate-schema --tsconfig ./tsconfig.json --output "./src/generated/schema.graphql" "https://graphql.union.build/v1/graphql"
pnpm dlx gql.tada generate-output --disable-preprocessing --tsconfig ./tsconfig.json --output ./src/generated/graphql-env.d.ts
'';
};
};
};
};
}