From 7c7350748ba2efe0e105a9f86268686495e89591 Mon Sep 17 00:00:00 2001 From: jacobvenable Date: Mon, 11 Oct 2021 20:17:09 -0600 Subject: [PATCH 1/5] docs: fix link in contributing document --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ee2f7094a..e690111cd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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) From e57d7bad9b20fbaf0fce672f9a765964fbda94d4 Mon Sep 17 00:00:00 2001 From: jacobvenable Date: Mon, 11 Oct 2021 20:30:33 -0600 Subject: [PATCH 2/5] chore: add workspace aliases --- README.md | 13 ++++++++++--- package.json | 12 ++++++++---- packages/server/Procfile | 4 ++-- packages/server/src/bin/e2e_setup.sh | 4 ++-- start_local.sh | 2 +- 5 files changed, 23 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 93bc95f30..4890fbf52 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/package.json b/package.json index 6ec3af76d..4ea7006e4 100644 --- a/package.json +++ b/package.json @@ -83,16 +83,20 @@ "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-db": "docker-compose up --build -d && npm run restore:db", + "build:local-db": "docker compose up --build -d && mongorestore --port 27018 --username upswyng-dev-user --password upswyng123 -d upswyng-dev ./packages/server/localdb/mongodump", "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": [ diff --git a/packages/server/Procfile b/packages/server/Procfile index a77b3b7f2..ecdc2aba5 100644 --- a/packages/server/Procfile +++ b/packages/server/Procfile @@ -1,3 +1,3 @@ # https://github.com/heroku/heroku-buildpack-multi-procfile -web: yarn workspace @upswyng/server start:server -worker: yarn workspace @upswyng/server start:worker +web: yarn server start:server +worker: yarn server start:worker diff --git a/packages/server/src/bin/e2e_setup.sh b/packages/server/src/bin/e2e_setup.sh index f184610d3..87a77078b 100755 --- a/packages/server/src/bin/e2e_setup.sh +++ b/packages/server/src/bin/e2e_setup.sh @@ -18,7 +18,7 @@ SETUP_SCRIPT="${DIR}/../../__build__/bin/setup_categories" # see if the category setup script exists, if not, build it if ! test -f "$SETUP_SCRIPT"; then - TARGETS=setupCategories yarn workspace @upswyng/server build:bin + TARGETS=setupCategories yarn server build:bin fi # setup categories @@ -35,4 +35,4 @@ read -r REDIS_PID <"${DIR}/../../cypress/.redispid" read -r REDIS_URI <"${DIR}/../../cypress/.redisuri" REDIS_URL=$REDIS_URI DATABASE_URL=$MONGODB_URI DATABASE_NAME="" DATABASE_USER="" DATABASE_PASSWORD="" PORT=43637 \ - yarn workspace @upswyng/server dev + yarn server dev diff --git a/start_local.sh b/start_local.sh index a8142ccaa..93cdcf1e7 100755 --- a/start_local.sh +++ b/start_local.sh @@ -30,4 +30,4 @@ fi docker top upswyng-dev-db > /dev/null 2>&1 || yarn build:local-db # Start development servers for server and web packages concurrently -concurrently -n server,web -c yellow,blue "yarn workspace @upswyng/server dev" "yarn workspace @upswyng/web start" +concurrently -n server,web -c yellow,blue "yarn server dev" "yarn web start" From 3128802a45d51baf31330eeba1e9c3deb3d4bbb3 Mon Sep 17 00:00:00 2001 From: jacobvenable Date: Mon, 11 Oct 2021 20:32:56 -0600 Subject: [PATCH 3/5] chore: revert procfile updates --- packages/server/Procfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/Procfile b/packages/server/Procfile index ecdc2aba5..a77b3b7f2 100644 --- a/packages/server/Procfile +++ b/packages/server/Procfile @@ -1,3 +1,3 @@ # https://github.com/heroku/heroku-buildpack-multi-procfile -web: yarn server start:server -worker: yarn server start:worker +web: yarn workspace @upswyng/server start:server +worker: yarn workspace @upswyng/server start:worker From d7b80d6a33f1152b833031eb6f26f821d6033de5 Mon Sep 17 00:00:00 2001 From: jacobvenable Date: Mon, 11 Oct 2021 20:35:55 -0600 Subject: [PATCH 4/5] chore: revert e2e_setup and start_local changes --- packages/server/src/bin/e2e_setup.sh | 4 ++-- start_local.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/server/src/bin/e2e_setup.sh b/packages/server/src/bin/e2e_setup.sh index 87a77078b..f184610d3 100755 --- a/packages/server/src/bin/e2e_setup.sh +++ b/packages/server/src/bin/e2e_setup.sh @@ -18,7 +18,7 @@ SETUP_SCRIPT="${DIR}/../../__build__/bin/setup_categories" # see if the category setup script exists, if not, build it if ! test -f "$SETUP_SCRIPT"; then - TARGETS=setupCategories yarn server build:bin + TARGETS=setupCategories yarn workspace @upswyng/server build:bin fi # setup categories @@ -35,4 +35,4 @@ read -r REDIS_PID <"${DIR}/../../cypress/.redispid" read -r REDIS_URI <"${DIR}/../../cypress/.redisuri" REDIS_URL=$REDIS_URI DATABASE_URL=$MONGODB_URI DATABASE_NAME="" DATABASE_USER="" DATABASE_PASSWORD="" PORT=43637 \ - yarn server dev + yarn workspace @upswyng/server dev diff --git a/start_local.sh b/start_local.sh index 93cdcf1e7..a8142ccaa 100755 --- a/start_local.sh +++ b/start_local.sh @@ -30,4 +30,4 @@ fi docker top upswyng-dev-db > /dev/null 2>&1 || yarn build:local-db # Start development servers for server and web packages concurrently -concurrently -n server,web -c yellow,blue "yarn server dev" "yarn web start" +concurrently -n server,web -c yellow,blue "yarn workspace @upswyng/server dev" "yarn workspace @upswyng/web start" From 61789b94b277446d4f16a980bb4e31a20dd19e3b Mon Sep 17 00:00:00 2001 From: jacobvenable Date: Mon, 11 Oct 2021 20:45:57 -0600 Subject: [PATCH 5/5] fix: rebase conflict mistakes --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4ea7006e4..38b6526b9 100644 --- a/package.json +++ b/package.json @@ -80,10 +80,10 @@ "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-db": "docker compose up --build -d && mongorestore --port 27018 --username upswyng-dev-user --password upswyng123 -d upswyng-dev ./packages/server/localdb/mongodump", + "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",