Skip to content

Commit

Permalink
Remove yarn references
Browse files Browse the repository at this point in the history
Remove all yarn references in code and documentation and replace it
with appropriate npm versions in the latter.
  • Loading branch information
gilligan committed Nov 24, 2020
1 parent 21df99d commit 7f1973b
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 33 deletions.
4 changes: 0 additions & 4 deletions .gitattributes
@@ -1,7 +1,3 @@
# yarn.nix generated files
marlowe-playground-client/yarn.nix linguist-generated=true
plutus-playground-client/yarn.nix linguist-generated=true
plutus-scb-client/yarn.nix linguist-generated=true
# sources.nix is generated by niv
nix/sources.nix linguist-generated=true
# haskell.nix materialized files
Expand Down
1 change: 0 additions & 1 deletion .ignore
@@ -1,5 +1,4 @@
nix/stack.materialized/*.nix
nix/sources.nix
**/spago-packages.nix
**/yarn.nix
**/packages.nix
1 change: 0 additions & 1 deletion marlowe-playground-client/.gitignore
@@ -1,7 +1,6 @@
/node_modules/
/output/
/generated/
/yarn-error.log
/.psci_modules/
/generated-docs/
/.psc-package/
Expand Down
20 changes: 13 additions & 7 deletions marlowe-playground-client/README.md
Expand Up @@ -16,20 +16,26 @@ $(nix-build -A marlowe-playground.server-invoker)/bin/marlowe-playground psgener
# Now we will build and run the client on localhost
cd marlowe-playground-client
# Download javascript dependencies
yarn
npm install
# Install purescript depdendencies
yarn purs:compile
npm run purs:compile
```

Then run `yarn run webpack:server` for an auto-reloading dev build on https://localhost:8009
Then run `npm run webpack:server` for an auto-reloading dev build on https://localhost:8009

## Adding dependencies

* Javascript dependencies are managed with yarn, so add them to [package.json](./package.json)
* purescript dependencies are managed with spago, so add them to [spago.dhall](./spago.dhall)
* spago uses the concept of package sets, so if a particular package is not on the set, or you want to override the version, you can add it to [packages.dhall](./packages.dhall)
* Javascript dependencies are managed with npm, so add them to [package.json](./package.json)
* purescript dependencies are managed with psc-package so add them to [psc-package.json](./psc-package.json)
* purescript uses package sets managed by spago so if the package set doesn't contain a dependency you can add it to [packages.dhall](./packages.dhall)

Whenever you change any of these files you should run `$(nix-build -A dev.scripts.updateClientDeps ../default.nix)/bin/update-client-deps` to make sure they are available to things that build purescript (such as webpack). Additionally running this script will make changes to various files that will need to be committed for CI to work.
Whenever you change `psc-package.json` or `packages.dhall` you need to make sure that all dependencies can still properly be resolved and built.
You can do so using the `update-client-deps` script:

- Inside the nix-shell environment: `update-client-deps`
- Outside of the nix-shell environment (from the client directory): `$(nix-build -A plutus.updateClientDeps ../)/bin/update-client-deps`

The `update-client-deps` script will generate/update `.nix` files which have to be committed and are required for a successful CI run.

## Code formatting

Expand Down
12 changes: 2 additions & 10 deletions nix/pkgs/update-client-deps/default.nix
Expand Up @@ -10,8 +10,6 @@
, gnused
, nodejs
, nodePackages
, yarn
, yarn2nix-moretea
, purs
, psc-package
, spago
Expand All @@ -31,25 +29,19 @@ lib.meta.addMetaAttrs { platforms = lib.platforms.linux; } (writeScriptBin "upda
gnused
nodejs
nodePackages.node-gyp
yarn
yarn2nix-moretea.yarn2nix
purs
psc-package
spago
spago2nix
] ++ lib.optionals stdenv.isDarwin [ clang ])}
if [ ! -f package.json ]
if [ ! -f spago.dhall ]
then
echo "package.json not found. Please run this script from the client directory." >&2
echo "spago.dhall not found. Please run this script from the client directory." >&2
exit 1
fi
echo Installing JavaScript Dependencies
yarn
echo Generating nix configs.
yarn2nix > yarn.nix
spago2nix generate
echo Done
Expand Down
1 change: 0 additions & 1 deletion plutus-playground-client/.gitignore
@@ -1,7 +1,6 @@
/node_modules/
/output/
/generated/
/yarn-error.log
/.psci_modules/
/generated-docs/
/.psc-package/
Expand Down
18 changes: 12 additions & 6 deletions plutus-playground-client/README.md
Expand Up @@ -12,23 +12,29 @@ $(nix-build -A plutus-playground.server-invoker)/bin/plutus-playground psgenerat
# Now we will build and run the client on localhost
cd plutus-playground-client
# Download javascript dependencies
yarn
npm install
# Install purescript depdendencies
yarn purs:compile
npm run purs:compile
```

Then run `yarn run webpack:server` for an auto-reloading dev build on https://localhost:8009
Then run `npm run webpack:server` for an auto-reloading dev build on https://localhost:8009

You may also want to run `yarn run purs:ide` to start `psc-ide`
You may also want to run `npm run purs:ide` to start `psc-ide`
support running with the correct paths.

## Adding dependencies

* Javascript dependencies are managed with yarn, so add them to [package.json](./package.json)
* Javascript dependencies are managed with npm, so add them to [package.json](./package.json)
* purescript dependencies are managed with psc-package so add them to [psc-package.json](./psc-package.json)
* purescript uses package sets managed by spago so if the package set doesn't contain a dependency you can add it to [packages.dhall](./packages.dhall)

Whenever you change any of these files you should rerun `$(nix-build -A dev.scripts.updateClientDeps ../default.nix)` to make sure they are available to things that build purescript (such as webpack). Additionally running this script will make changes to various files that will need to be committed for CI to work.
Whenever you change `psc-package.json` or `packages.dhall` you need to make sure that all dependencies can still properly be resolved and built.
You can do so using the `update-client-deps` script:

- Inside the nix-shell environment: `update-client-deps`
- Outside of the nix-shell environment (from the client directory): `$(nix-build -A plutus.updateClientDeps ../)/bin/update-client-deps`

The `update-client-deps` script will generate/update `.nix` files which have to be committed and are required for a successful CI run.

## nix

Expand Down
1 change: 0 additions & 1 deletion plutus-scb-client/.gitignore
@@ -1,7 +1,6 @@
/node_modules/
/output/
/generated/
/yarn-error.log
/.psci_modules/
/generated-docs/
/.psc-package/
Expand Down
3 changes: 1 addition & 2 deletions shell.nix
Expand Up @@ -32,7 +32,7 @@ let
# While nixpkgs-fmt does exclude patterns specified in `.ignore` this
# does not appear to work inside the hook. For now we have to thus
# maintain excludes here *and* in `./.ignore` and *keep them in sync*.
excludes = [ ".*nix/stack.materialized/.*" ".*nix/sources.nix$" ".*/spago-packages.nix$" ".*/yarn.nix$" ".*/packages.nix$" ];
excludes = [ ".*nix/stack.materialized/.*" ".*nix/sources.nix$" ".*/spago-packages.nix$" ".*/packages.nix$" ];
};
shellcheck.enable = true;
};
Expand All @@ -52,7 +52,6 @@ let
sqlite-interactive
stack
terraform_0_12
yarn
yubikey-manager
z3
zlib
Expand Down

0 comments on commit 7f1973b

Please sign in to comment.