Skip to content

Commit

Permalink
chore: make create-dapp compatible with yarn4 (#9976)
Browse files Browse the repository at this point in the history
closes: #XXXX
refs: #9852

## Description
As described in the issue linked above, currently, if a user has yarn4 and they run `yarn create @agoric/dapp demo` the command fails because it uses pnp as the linker by default. 

The correct way to go about it imo is to properly document that if a user is using yarn4, they have to configure it to use `node-modules` as its `nodeLinker`.  This can either be done by creating a `.yarnrc.yml` in the directory they are supposedly running the `yarn create` command, or by globally configuring it via `yarn config set nodeLinker node-modules`

bumping the agoric package is needed for yarn4 otherwise it throws an [error](#9852 (comment)) 

## Steps to Test
### Publishing to a local, private registry
1. install and start verdaccio
2. set npm registry server to the localhost address exposed by verdaccio 
```
npm config set registry http://localhost:4873/
```
3. inside the create-dapp folder, run
```
npm publish 
``` 
you may have to auth a user. You can use `npm adduser` and provide test username, password (for verdaccio).
You can also explicitly publish to your private registry using `npm publish --registry=http://localhost:4873`
### Downloading the package from local registry
1. Set nodeLinker to node-modules:
```
yarn config set nodeLinker node-modules
```
2. point npmRegistryServer to localhost:
```
yarn config get npmRegistryServer
```
3. add localhost to unsafe http whitelist:
```
yarn config set unsafeHttpWhitelist 'localhost'
```
4. pull the package using 
```
yarn create @agoric/dapp demo
```
Ensure the package being pulled is the one you published by matching the package version. 

P.S. the above can be achieved by using a `.yarnrc.yml` with the same configuration as well. But for the above instructions, please don't forget to set them to their defaults after testing :) 
### Security Considerations


### Scaling Considerations


### Documentation Considerations

Add a section on docs site while setting up yarn to properly configure nodeLinker

### Testing Considerations

TODO: add CI step to test package download using different yarn versions via [verdaccio](https://verdaccio.org/)

### Upgrade Considerations
  • Loading branch information
mergify[bot] committed Aug 29, 2024
2 parents 3573033 + 5df02f5 commit 394a500
Show file tree
Hide file tree
Showing 3 changed files with 496 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/create-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"c8": "^9.1.0"
},
"dependencies": {
"agoric": "^0.21.1"
"agoric": "^0.22.0-u16.2"
},
"keywords": [],
"repository": {
Expand Down
1 change: 1 addition & 0 deletions packages/create-dapp/test/sanity.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ test('sanity', async t => {
t.is(await myMain(['--help']), 0, '--help exits zero');
t.is(await myMain(['--version']), 0, '--version exits zero');
t.is(await myMain(['--zorgar']), 1, 'unknown flag fails');
t.is(await myMain(['demo']), 0, 'create-dapp demo exits 0');
});
Loading

0 comments on commit 394a500

Please sign in to comment.