Skip to content

Commit 282024d

Browse files
committedJun 15, 2022
feat: added justfile and nvm for aliasing and using same node version
1 parent 7f21fc4 commit 282024d

File tree

8 files changed

+18144
-13287
lines changed

8 files changed

+18144
-13287
lines changed
 

‎.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/node_modules
55
/.pnp
66
.pnp.js
7+
.yarn
78

89
# testing
910
/coverage

‎.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v16.15.1

‎.yarnrc.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nodeLinker: node-modules

‎README.md

+31-10
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,51 @@
1919
- [React Router 6](https://reactrouter.com/docs/en/v6/api)
2020
- Sentry
2121

22-
### First steps
22+
### Prerequisites
23+
24+
This project uses the following packages
2325

24-
**Set node version**
26+
- [nvm](https://github.com/nvm-sh/nvm) (Node version manager)
27+
- [Just](https://just.systems/man/en/chapter_4.html) (For justfile usage)
2528

29+
Run the following command to install the node version declared in the `.nvmrc`
30+
file fo this project:
31+
32+
```shell
33+
nvm install
2634
```
27-
nvm use
35+
36+
Finally, enable [corepack](https://github.com/nodejs/corepack) so the correct
37+
version of yarn is used.
38+
39+
```shell
40+
just corepack-enable
2841
```
2942

43+
### First steps
44+
3045
**Install dependencies**
3146

32-
```
33-
yarn
47+
```shell
48+
just install-deps
3449
```
3550

36-
**Create Graphql schema**
51+
**Run project**
3752

38-
```
39-
yarn graphql
53+
```shell
54+
just dev
4055
```
4156

42-
**Run project**
57+
**See a list of available commands**
4358

59+
```shell
60+
just
4461
```
45-
yarn start
62+
63+
**Proxy commands through nvm**
64+
65+
```shell
66+
just nvm-exec "yarn add @front_web_mrmilu/hooks"
4667
```
4768

4869
### Environment variables

‎justfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
default:
2+
just --list
3+
4+
# Enables corepack in node
5+
corepack-enable:
6+
./nvm_exec.sh corepack enable
7+
8+
# Installs project package.json dependencies
9+
install-deps:
10+
./nvm_exec.sh yarn
11+
12+
# Starts React development server
13+
dev:
14+
./nvm_exec.sh yarn start
15+
16+
# Builds React application
17+
build:
18+
./nvm_exec.sh yarn build
19+
20+
# Downloads schema and generates corresponding ts types
21+
graphql-codegen:
22+
./nvm_exec.sh yarn graphql
23+
24+
# Runs E2E tests
25+
e2e-run:
26+
./nvm_exec.sh yarn e2e:run
27+
28+
# Opens E2E tests UI
29+
e2e-open:
30+
./nvm_exec.sh yarn e2e:open
31+
32+
# Proxy comand through nvm
33+
nvm-exec command:
34+
./nvm_exec.sh {{command}}

‎nvm_exec.sh

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
. ~/.nvm/nvm.sh
3+
nvm exec $@

‎package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@
2828
},
2929
"dependencies": {
3030
"@apollo/client": "3.6.6",
31-
"@front_web_mrmilu/hooks": "mrmilu/front_web_mrmilu#@front_web_mrmilu/hooks-v1.2.0",
32-
"@front_web_mrmilu/network": "mrmilu/front_web_mrmilu#@front_web_mrmilu/network-v1.2.0",
33-
"@front_web_mrmilu/services": "mrmilu/front_web_mrmilu#@front_web_mrmilu/services-v1.2.0",
34-
"@front_web_mrmilu/utils": "mrmilu/front_web_mrmilu#@front_web_mrmilu/utils-v1.2.0",
31+
"@front_web_mrmilu/hooks": "^1.4.0",
32+
"@front_web_mrmilu/network": "1.4.0",
33+
"@front_web_mrmilu/services": "1.4.0",
34+
"@front_web_mrmilu/utils": "1.4.0",
3535
"@reduxjs/toolkit": "1.8.2",
3636
"@sentry/react": "7.1.1",
3737
"@sentry/tracing": "7.1.1",
@@ -97,5 +97,6 @@
9797
},
9898
"resolutions": {
9999
"@types/react": "18.x"
100-
}
100+
},
101+
"packageManager": "yarn@3.2.1"
101102
}

0 commit comments

Comments
 (0)