Skip to content

Commit

Permalink
wip5
Browse files Browse the repository at this point in the history
  • Loading branch information
nrdxp committed May 24, 2022
1 parent 5c916c5 commit d05e01d
Showing 1 changed file with 28 additions and 26 deletions.
54 changes: 28 additions & 26 deletions flake.nix
Expand Up @@ -27,17 +27,17 @@
if lib.hasPrefix "@" n
then
{
add-inputs.buildInputs = old: old ++ [self.packages.x86_64-linux.cardano-sdk.dependencies.typescript];
copy-tsconfig.preBuild = ''
cp ${./tsconfig.json} $nodeModules/tsconfig.json
chmod +w -R node_modules
${pkgs.fd}/bin/fd tsconfig.tsbuildinfo node_modules -x ${pkgs.gnused}/bin/sed -i 's|../../../node_modules|../../..|g'
copy-tsconfig.postPatch = ''
substituteInPlace ./src/tsconfig.json --replace \
'"extends": "../../../tsconfig.json"' \
'"extends": "./tsconfig-copy.json"'
cp ${./.}/tsconfig.json \
./src/tsconfig-copy.json
'';

install-symlinks = {
installPhase = ''
mkdir -p $out/bin
ln -s $out/lib/node_modules/${n}/node_modules/ts-node/dist $out/dist
ln -s $out/lib/node_modules/${n}/dist $out/dist
ln -s $out/dist/bin.js $out/bin/ts-node
'';
};
Expand All @@ -46,31 +46,25 @@
add-type-notation = {
prePatch = ''
echo -e "import _ from \"@cardano-sdk/core/node_modules/@cardano-ogmios/schema\";\n$(cat src/Cardano/types/TxSubmissionErrors.ts)" > src/Cardano/types/TxSubmissionErrors.ts
substituteInPlace ./src/Cardano/util/subtractValueQuantities.ts \
--replace "../types" "@cardano-sdk/core/src/Cardano/types"
'';
};

}
// lib.optionalAttrs (builtins.match ''@cardano-sdk/(util-dev|cardano-services|ogmios|cardano-services-client)'' n != null) {
add-type-notation = {
update-references = {
prePatch = ''
old=${n}
ln -s "''${old##*/}/node_modules/@cardano-sdk/core" "$nodeModules/@cardano-sdk/core"
unset old
'';
}; # //
# lib.optionalAttrs (n == "@cardano-sdk/util-dev") { buildPhase = old: ''
# rm -rf ../core
# # echo 'export _' >> node_modules/@cardano-sdk/core/src/Cardano/types/Value
# cp -Lr node_modules/@cardano-sdk/core ../core
# chmod u+w -R ../core
# # sed -i 's|import { Value } from .\.\./types.|import { Value } from "@cardano-sdk/util-dev/node_modules/@cardano-sdk/core/src/Cardano/types/Value"|g' ../core/src/Cardano/util/subtractValueQuantities.ts
# echo -e "import { Lovelace as _ } from \"@cardano-sdk/util-dev/node_modules/@cardano-sdk/core/src/Cardano/types/Value\";\n$(cat ../core/src/Cardano/util/subtractValueQuantities.ts)" > ../core/src/Cardano/util/subtractValueQuantities.ts
# rm -rf node_modules/@cardano-sdk/core
# cp -r ../core node_modules/@cardano-sdk/core
substituteInPlace ./src/tsconfig.json --replace \
'"path": "../../core/src"' \
'"path": "${self.packages.x86_64-linux."@cardano-sdk/core"}/lib/node_modules/@cardano-sdk/core/src"'
# '' + old;
# };
'';
};
add-type-notation = {
prePatch = ''
echo -e "import _ from \"@cardano-sdk/core/node_modules/@cardano-ogmios/schema\";\n$(cat src/Cardano/types/TxSubmissionErrors.ts)" > src/Cardano/types/TxSubmissionErrors.ts
'';
};
}
else {}
)
Expand All @@ -80,6 +74,14 @@
"@cardano-sdk/util-dev"."0.2.0" = [
["jest" "27.5.1"]
["@types/jest" "26.0.24"]
["typescript" "4.6.3"]
];
"@cardano-sdk/cardano-services-client"."0.2.0" = [
["typescript" "4.6.3"]
["@cardano-sdk/cardano-services" "0.2.0"]
];
"@cardano-sdk/ogmios"."0.2.0" = [
["typescript" "4.6.3"]
];
};

Expand Down

0 comments on commit d05e01d

Please sign in to comment.