Skip to content

Commit

Permalink
Upgrades from yarn 1.x to yarn berry (4.x) (#147)
Browse files Browse the repository at this point in the history
* chore(yarn): deletes reference to `packages/*` directory

This directory does not exist.

* chore(yarn): completes migration steps

Ref: https://yarnpkg.com/migration/guide

* chore(web): replaces `setup` script with README instructions

[`yarn global` is deprecated in Yarn 2.x](https://yarnpkg.com/migration/guide#use-yarn-dlx-instead-of-yarn-global), instead `yarn dlx` is recommended for temporary installs.

* docs(firebase): adds setup instructions in README

* chore(yarn): updates `.yarn` files

* chore(web): fixes build error, originating in `@types/react` version mismatch

The version was downgraded in a previous commit on master.

* chore(husky): replaces `prepare` with `postinstall` script

That's how `husky` is installed with yarn 2.
Ref: https://typicode.github.io/husky/getting-started.html#automatic-recommended

* chore(firebase): removes unused `husky` dependency

`husky` is already a dependency at the top-level.
  • Loading branch information
arthurgousset authored Jan 23, 2024
1 parent 57cb29e commit fe2797d
Show file tree
Hide file tree
Showing 8 changed files with 13,819 additions and 10,082 deletions.
Binary file added .yarn/install-state.gz
Binary file not shown.
893 changes: 893 additions & 0 deletions .yarn/releases/yarn-4.0.2.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
1 change: 0 additions & 1 deletion apps/firebase/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-unicorn": "^46.0.0",
"firebase-bolt": "^0.8.4",
"husky": "^8.0.3",
"ts-node": "^10.9.1",
"typescript": "^5.0.3",
"yargs": "17.7.2"
Expand Down
7 changes: 3 additions & 4 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.1.0",
"private": true,
"scripts": {
"setup": "vercel env pull",
"dev": "next dev",
"build": "next build",
"start": "next start",
Expand All @@ -22,11 +21,11 @@
"react-use-async-callback": "^2.1.2"
},
"devDependencies": {
"eslint": "8.54.0",
"eslint-config-next": "13.2.4",
"@types/node": "20.11.5",
"@types/react": "18.2.3",
"@types/react": "18.2.48",
"@types/react-dom": "18.2.18",
"eslint": "8.54.0",
"eslint-config-next": "13.2.4",
"typescript": "5.0.3"
},
"engines": {
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
"license": "Apache-2.0",
"private": true,
"workspaces": [
"apps/*",
"packages/*"
"apps/*"
],
"scripts": {
"dev": "yarn --cwd apps/web dev",
"lint": "yarn --cwd apps/web lint --fix && yarn --cwd apps/firebase lint --fix",
"setup": "yarn global add vercel@latest",
"prepare": "husky install",
"postinstall": "husky install",
"prettify": "yarn prettier --write \"apps/**/*.{ts,tsx}\" --ignore-path=./.gitignore"
},
"devDependencies": {
Expand All @@ -28,5 +26,6 @@
},
"engines": {
"node": "20"
}
},
"packageManager": "[email protected]"
}
85 changes: 84 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,90 @@ This Repo contains the code for the alfajores faucet. This is contained in 2 app

The web app deploys automatically to vercel.

To setup the web app to run locally set the vercel project to clabs/faucet and the env variables from vercel with `vercel env pull` then run `yarn dev`
## Setup

### Wep app

To set up the web app to run locally:

1. navigate to the `apps/web` folder

```sh
$ cd apps/web
```

1. link your local repository to the `faucet` project on Vercel

```sh
$ yarn dlx vercel@latest link
```

You'll be asked to authenticate with your Vercel account. Once you've done that, you'll be
guided through a series of prompts to link your local project to the `faucet` Vercel project.
```
? Set up “~/Documents/celo-org/faucet/apps/web”? [Y/n] y
? Which scope should contain your project? Celo Ecosystem Project Hosting
? Link to existing project? [y/N] y
? What’s the name of your existing project? faucet
✅ Linked to c-labs/faucet (created .vercel)
```
1. fetch environment variables from Vercel
```sh
$ yarn dlx vercel@latest env pull
```
If you get an error like `Error! No project found`, you may need to run `vercel link` again.
If everything worked, you should see a message like this:
```sh
> Downloading `development` Environment Variables for Project faucet
✅ Created .env.local file [249ms]
```
1. run the app locally
```sh
$ yarn dev
```
You should see a message like this:
```sh
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info - Loaded env from /Users/arthur/Documents/celo-org/faucet/apps/web/.env.local
```
You can now view the app in your browser at http://localhost:3000.
## Firebase app
To set up the firebase app to run locally:
1. navigate to the `apps/firebase` folder
```sh
$ cd apps/firebase
```
1. login to firebase
```sh
$ yarn dlx firebase-tools@latest login
```
You'll be asked to authenticate with your Firebase account.
1. build the firebase app
```sh
$ yarn run preserve
```
1. ensure that you are on required node version specified in `engines.node` in
`firebase/package.json`. Currently this is Node 20 at the time of writing.
```sh
$ nvm use <the-required-node-version>
```
1. run the firebase app locally
```sh
$ yarn run serve
```

## Adding chains

Expand Down
Loading

1 comment on commit fe2797d

@vercel
Copy link

@vercel vercel bot commented on fe2797d Jan 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.