Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add workspace aliases #493

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ These issues may need more input before becoming dev-ready and will be labelled

Once you have have found an issue you feel comfortable working on, leave a comment in that issue that you'd like to tackle it. We'll label the issue as being in progress to make sure others don't work on it as well.

If this is your first time contributing to open-source or you need a refresher, see this [great guide](https://github.com/firstcontributions/first-contributions#first-contributions] that goes through the steps of contributing to an open-source project.
If this is your first time contributing to open-source or you need a refresher, see this [contributing guide](https://github.com/firstcontributions/first-contributions#first-contributions) that goes through the steps of contributing to an open-source project.

## 3. Create a Pull Request (PR)

Expand Down
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,20 @@ To run the same command in _all_ workspaces, use `yarn workspaces`. For instance
yarn workspaces run test
```

Typing out the full workspace name can get tedious. You can place aliases in your `.bashrc` or `.profile` to save time:
Typing out the full workspace name can get tedious. We've added some convenient scripts to run commands on a specific package:

- `yarn common`: runs the command in the common package
- `yarn server`: runs the command in the server package
- `yarn types`: runs the command in the types package
- `yarn web`: runs the command in the web package

For example, to run tests only for the web package, you can run:

```console
alias @uw="yarn workspace @upswyng/web "
yarn web test
```

Now you only need `@uw start` to start the web dev server.
The above is the equivalent of `yarn workspace @upswyng/web test`.

### Running tests

Expand Down
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,19 +80,23 @@
"name": "upswyng",
"private": true,
"scripts": {
"build:local-packages": "yarn workspace @upswyng/types build && yarn workspace @upswyng/common build",
"build:server": "yarn build:local-packages && yarn workspace @upswyng/server build",
"build:web": "yarn build:local-packages && yarn workspace @upswyng/web build",
"build:local-packages": "yarn types build && yarn common build",
"build:server": "yarn build:local-packages && yarn server build",
"build:web": "yarn build:local-packages && yarn web build",
"build:local-db": "docker-compose up --build -d && npm run restore:db",
"restore:db": "mongorestore --port 27018 --username upswyng-dev-user --password upswyng123 -d upswyng-dev ./packages/server/localdb/mongodump",
"clean": "node clean.js",
"common": "yarn workspace @upswyng/common",
"reset": "node clean.js --reset && docker compose down -v",
"heroku-postbuild": "yarn build:web && yarn build:server",
"lint": "tsc --noEmit && eslint \"packages/**/src/**/*.{js,jsx,ts,tsx}\" --fix",
"lint:ci": "tsc --noEmit && eslint \"packages/**/src/**/*.{js,jsx,ts,tsx}\" --quiet",
"test": "concurrently -n common,server -c yellow,blue \"yarn workspace @upswyng/common test:unit\" \"yarn workspace @upswyng/server test\" && yarn workspace @upswyng/web test",
"test:ci": "concurrently -n common,server -c yellow,blue \"yarn workspace @upswyng/common test:unit\" \"yarn workspace @upswyng/server test\" --kill-others-on-fail && yarn workspace @upswyng/web test",
"start:local": "./start_local.sh"
"test": "concurrently -n common,server -c yellow,blue \"yarn common test:unit\" \"yarn server test\" && yarn web test",
"test:ci": "concurrently -n common,server -c yellow,blue \"yarn common test:unit\" \"yarn server test\" --kill-others-on-fail && yarn web test",
"start:local": "./start_local.sh",
"server": "yarn workspace @upswyng/server",
"types": "yarn workspace @upswyng/types",
"web": "yarn workspace @upswyng/web"
},
"version": "0.1.0",
"workspaces": [
Expand Down