From 060a1401a38ee368c257517b07df34c360a97b72 Mon Sep 17 00:00:00 2001 From: Timothy Miller Date: Tue, 20 Jun 2023 11:01:38 -0400 Subject: [PATCH 1/4] Task/13717 server node@18 (#1484) * upgrade server to node 18.16.0 * reckon with client and server node versions going out of sync * update readme with it is contraction --- .husky/pre-commit | 9 ++++---- .nvmrc | 1 - README.md | 52 ++++++++++++++++++++++----------------------- package.json | 15 +------------ server/.nvmrc | 2 +- server/package.json | 2 +- 6 files changed, 34 insertions(+), 47 deletions(-) delete mode 100644 .nvmrc diff --git a/.husky/pre-commit b/.husky/pre-commit index bef94ae6..c4e7a8b3 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,8 +1,9 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -cd client -yarn run lint-staged +echo "\033[0;31m Pre commit hooks are disabled. Please lint and test manually before pushing.\033[0m" +# cd client +# yarn run lint-staged -cd ../server -yarn run lint-staged +# cd ../server +# yarn run lint-staged diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 58656b78..00000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v14.19.1 diff --git a/README.md b/README.md index c6adc1ee..4a0f233c 100644 --- a/README.md +++ b/README.md @@ -4,51 +4,51 @@ An ambitious web app for filtering and viewing NYC land use application records stored in DCP's Zoning Application Portal (ZAP). -## Development Setup - -### 1. Install prerequisite tools +## Prerequisite Tools * [Git](https://git-scm.com/) -* [Node.js](https://nodejs.org/) (with npm) - - This installation was tested using Node v12.18.4, v14.15.0 +* [Node.js](https://nodejs.org/) * [Ember CLI](https://ember-cli.com/) +* [Yarn](https://yarnpkg.com/) + -### 2. Install frontend and backend packages +## Prerequisite SSL Setup for Local Development +In order for cookies to work across both the client and the server during local development, we must have SSL setup for our development environment. -``` -> git clone https://github.com/NYCPlanning/labs-zap-search -> cd labs-zap-search -> yarn -> cd labs-zap-search/client -> yarn -> cd labs-zap-search/server -> yarn -``` +### Why is this necessary? +Google Chrome is beginning to enforce some restrictions on particular uses of cookies in cross-origin contexts. In our case, our server provides a cookie from one domain and is expected to be sent across subsequent requests via another. The only way to simulate this behavior as it works on a production environment is to run our local development servers with SSL enabled. -### 3. Set up SSL and environment files +### Steps to setup SSL locally 1. Clone this repo and follow the steps in its README: https://github.com/NYCPlanning/local-cert-generator -2. Note that Step 1 generates two files in the `local-cert-generator` repo: `server.key` and `server.crt`. Later, you will need to copy/paste these files into the `labs-zap-search` repo to run the application. +2. Note that Step 1 generates two files in the `local-cert-generator` repo: `server.key` and `server.crt`. Later, you will need to copy/paste these files into the `labs-zap-search` repo to run the application (Steps 2 and 3 under "Running the App"). 3. Open up your hosts file on your machine with admin permissions: `/etc/hosts`. For example, `sudo vim /etc/hosts` 4. Add the following line: `127.0.0.1 local.planninglabs.nyc` ![image](https://user-images.githubusercontent.com/3311663/78998629-fc437e00-7b16-11ea-81ef-edb19b4b1d90.png) -5. Navigate into the `server` folder. +## Running the App +Once you have SSL enabled... +##### note: the client and server each run on their own node version, independent of each other. Refer to the .nvmrc of their respective folders to determine the appropriate node verion. +1. Clone `labs-zap-search` to your computer. +2. Navigate into the `server` folder. - Create the `development.env` file using variables stored on 1Password. - Copy the `server.key` and `server.crt` files from your `local-cert-generator` repo and paste both files into the `labs-zap-search/server/ssl/` folder. -6. Navigate into the `client` folder. + - Activate the compatible node version `nvm use` + - Run `yarn` to install dependencies for the server. + - Run `yarn run start:dev` to start a development server +3. Open a new terminal and navigate into the `client` folder. - Copy the `server.key` and `server.crt` files from your `local-cert-generator` repo and paste both files into the `labs-zap-search/client/ssl/` folder. + - Activate the compatible node version `nvm use` + - Run `yarn` to install dependencies for the client. + - Run `yarn start:ssl` to start a development server -## One-click startup - -At the root of this project, run +## Pre-commit linting and testing + The client and server application node versions have become out of sync with each other. Consequently, the pre-commit hooks have been turned off until both the server and client are on the same node version. -``` -yarn run start -``` + Husky is designed to use the node version set in the terminal PATH at the time the command is run. Whichever node version the developer chooses will be the one that the both the client and server are tested against. This can lead to weird cases where the client or server passes in the environment it's developed for but fails in the environment where its tests are run. -This will spin up both the frontend (in the `/client` folder) and the server API (in `/server`). +As the hooks have been disabled, please take care to run linting and testing scripts for the server and client before committing. These scripts are documented in their respective `package.json` files. ## Frontend and Backend Documentation - See [./client/](./client/) for more docs on running and modifying the frontend diff --git a/package.json b/package.json index 9b9127ca..b7578961 100644 --- a/package.json +++ b/package.json @@ -2,18 +2,5 @@ "name": "labs-zap-search", "version": "1.0.0", "repository": "git@github.com:NYCPlanning/labs-zap-search.git", - "license": "MIT", - "scripts": { - "start": "concurrently \"yarn run client\" \"yarn run server\"", - "server": "cd server && yarn run start:dev", - "client": "cd client && yarn run start:ssl" - }, - "devDependencies": { - "concurrently": "^6.2.0" - }, - "volta": { - "node": "14.19.1", - "yarn": "1.22.18" - }, - "dependencies": {} + "license": "MIT" } diff --git a/server/.nvmrc b/server/.nvmrc index d9289897..6d80269a 100644 --- a/server/.nvmrc +++ b/server/.nvmrc @@ -1 +1 @@ -16.15.1 +18.16.0 diff --git a/server/package.json b/server/package.json index 5f5a8c91..1d09f13b 100644 --- a/server/package.json +++ b/server/package.json @@ -5,7 +5,7 @@ "author": "", "license": "MIT", "engines": { - "node": "16.*" + "node": "18" }, "scripts": { "build": "rimraf dist && tsc -p tsconfig.build.json", From aff749c7b18cdaa68d05792f9ad21c353a824dc7 Mon Sep 17 00:00:00 2001 From: dhochbaum-dcp Date: Thu, 29 Jun 2023 16:18:24 -0400 Subject: [PATCH 2/4] Added parentheses around ZR filter to make the "or" work properly --- server/src/project/project.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/project/project.service.ts b/server/src/project/project.service.ts index 44d82157..f55b2b37 100644 --- a/server/src/project/project.service.ts +++ b/server/src/project/project.service.ts @@ -132,12 +132,12 @@ const QUERY_TEMPLATES = { }), "zoning-resolutions": queryParamValue => - queryParamValue + "(" + queryParamValue .map( value => `dcp_dcp_project_dcp_projectaction_project/any(o:o/_dcp_zoningresolution_value eq '${value}')` ) - .join(" or "), + .join(" or ") + ")", boroughs: queryParamValue => equalsAnyOf( From 40b11871ceed36ff391aa460f76e067d61bb0931 Mon Sep 17 00:00:00 2001 From: Tyler Matteo Date: Thu, 29 Jun 2023 16:47:48 -0400 Subject: [PATCH 3/4] Revert "Task/13717 server node@18 (#1484)" This reverts commit 060a1401a38ee368c257517b07df34c360a97b72. --- .husky/pre-commit | 9 ++++---- .nvmrc | 1 + README.md | 52 ++++++++++++++++++++++----------------------- package.json | 15 ++++++++++++- server/.nvmrc | 2 +- server/package.json | 2 +- 6 files changed, 47 insertions(+), 34 deletions(-) create mode 100644 .nvmrc diff --git a/.husky/pre-commit b/.husky/pre-commit index c4e7a8b3..bef94ae6 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,9 +1,8 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -echo "\033[0;31m Pre commit hooks are disabled. Please lint and test manually before pushing.\033[0m" -# cd client -# yarn run lint-staged +cd client +yarn run lint-staged -# cd ../server -# yarn run lint-staged +cd ../server +yarn run lint-staged diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 00000000..58656b78 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v14.19.1 diff --git a/README.md b/README.md index 4a0f233c..c6adc1ee 100644 --- a/README.md +++ b/README.md @@ -4,51 +4,51 @@ An ambitious web app for filtering and viewing NYC land use application records stored in DCP's Zoning Application Portal (ZAP). -## Prerequisite Tools +## Development Setup + +### 1. Install prerequisite tools * [Git](https://git-scm.com/) -* [Node.js](https://nodejs.org/) +* [Node.js](https://nodejs.org/) (with npm) + - This installation was tested using Node v12.18.4, v14.15.0 * [Ember CLI](https://ember-cli.com/) -* [Yarn](https://yarnpkg.com/) - -## Prerequisite SSL Setup for Local Development -In order for cookies to work across both the client and the server during local development, we must have SSL setup for our development environment. +### 2. Install frontend and backend packages -### Why is this necessary? -Google Chrome is beginning to enforce some restrictions on particular uses of cookies in cross-origin contexts. In our case, our server provides a cookie from one domain and is expected to be sent across subsequent requests via another. The only way to simulate this behavior as it works on a production environment is to run our local development servers with SSL enabled. +``` +> git clone https://github.com/NYCPlanning/labs-zap-search +> cd labs-zap-search +> yarn +> cd labs-zap-search/client +> yarn +> cd labs-zap-search/server +> yarn +``` -### Steps to setup SSL locally +### 3. Set up SSL and environment files 1. Clone this repo and follow the steps in its README: https://github.com/NYCPlanning/local-cert-generator -2. Note that Step 1 generates two files in the `local-cert-generator` repo: `server.key` and `server.crt`. Later, you will need to copy/paste these files into the `labs-zap-search` repo to run the application (Steps 2 and 3 under "Running the App"). +2. Note that Step 1 generates two files in the `local-cert-generator` repo: `server.key` and `server.crt`. Later, you will need to copy/paste these files into the `labs-zap-search` repo to run the application. 3. Open up your hosts file on your machine with admin permissions: `/etc/hosts`. For example, `sudo vim /etc/hosts` 4. Add the following line: `127.0.0.1 local.planninglabs.nyc` ![image](https://user-images.githubusercontent.com/3311663/78998629-fc437e00-7b16-11ea-81ef-edb19b4b1d90.png) -## Running the App -Once you have SSL enabled... -##### note: the client and server each run on their own node version, independent of each other. Refer to the .nvmrc of their respective folders to determine the appropriate node verion. -1. Clone `labs-zap-search` to your computer. -2. Navigate into the `server` folder. +5. Navigate into the `server` folder. - Create the `development.env` file using variables stored on 1Password. - Copy the `server.key` and `server.crt` files from your `local-cert-generator` repo and paste both files into the `labs-zap-search/server/ssl/` folder. - - Activate the compatible node version `nvm use` - - Run `yarn` to install dependencies for the server. - - Run `yarn run start:dev` to start a development server -3. Open a new terminal and navigate into the `client` folder. +6. Navigate into the `client` folder. - Copy the `server.key` and `server.crt` files from your `local-cert-generator` repo and paste both files into the `labs-zap-search/client/ssl/` folder. - - Activate the compatible node version `nvm use` - - Run `yarn` to install dependencies for the client. - - Run `yarn start:ssl` to start a development server -## Pre-commit linting and testing - The client and server application node versions have become out of sync with each other. Consequently, the pre-commit hooks have been turned off until both the server and client are on the same node version. +## One-click startup + +At the root of this project, run - Husky is designed to use the node version set in the terminal PATH at the time the command is run. Whichever node version the developer chooses will be the one that the both the client and server are tested against. This can lead to weird cases where the client or server passes in the environment it's developed for but fails in the environment where its tests are run. +``` +yarn run start +``` -As the hooks have been disabled, please take care to run linting and testing scripts for the server and client before committing. These scripts are documented in their respective `package.json` files. +This will spin up both the frontend (in the `/client` folder) and the server API (in `/server`). ## Frontend and Backend Documentation - See [./client/](./client/) for more docs on running and modifying the frontend diff --git a/package.json b/package.json index b7578961..9b9127ca 100644 --- a/package.json +++ b/package.json @@ -2,5 +2,18 @@ "name": "labs-zap-search", "version": "1.0.0", "repository": "git@github.com:NYCPlanning/labs-zap-search.git", - "license": "MIT" + "license": "MIT", + "scripts": { + "start": "concurrently \"yarn run client\" \"yarn run server\"", + "server": "cd server && yarn run start:dev", + "client": "cd client && yarn run start:ssl" + }, + "devDependencies": { + "concurrently": "^6.2.0" + }, + "volta": { + "node": "14.19.1", + "yarn": "1.22.18" + }, + "dependencies": {} } diff --git a/server/.nvmrc b/server/.nvmrc index 6d80269a..d9289897 100644 --- a/server/.nvmrc +++ b/server/.nvmrc @@ -1 +1 @@ -18.16.0 +16.15.1 diff --git a/server/package.json b/server/package.json index 1d09f13b..5f5a8c91 100644 --- a/server/package.json +++ b/server/package.json @@ -5,7 +5,7 @@ "author": "", "license": "MIT", "engines": { - "node": "18" + "node": "16.*" }, "scripts": { "build": "rimraf dist && tsc -p tsconfig.build.json", From dc673d2edd2fd35ec8a487e4ff9b22df8f435fcd Mon Sep 17 00:00:00 2001 From: Tyler Matteo Date: Thu, 20 Jul 2023 09:21:00 -0400 Subject: [PATCH 4/4] Revert "Revert "Task/13717 server node@18"" --- .husky/pre-commit | 9 ++++---- .nvmrc | 1 - README.md | 52 ++++++++++++++++++++++----------------------- package.json | 15 +------------ server/.nvmrc | 2 +- server/package.json | 2 +- 6 files changed, 34 insertions(+), 47 deletions(-) delete mode 100644 .nvmrc diff --git a/.husky/pre-commit b/.husky/pre-commit index bef94ae6..c4e7a8b3 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,8 +1,9 @@ #!/bin/sh . "$(dirname "$0")/_/husky.sh" -cd client -yarn run lint-staged +echo "\033[0;31m Pre commit hooks are disabled. Please lint and test manually before pushing.\033[0m" +# cd client +# yarn run lint-staged -cd ../server -yarn run lint-staged +# cd ../server +# yarn run lint-staged diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 58656b78..00000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v14.19.1 diff --git a/README.md b/README.md index c6adc1ee..4a0f233c 100644 --- a/README.md +++ b/README.md @@ -4,51 +4,51 @@ An ambitious web app for filtering and viewing NYC land use application records stored in DCP's Zoning Application Portal (ZAP). -## Development Setup - -### 1. Install prerequisite tools +## Prerequisite Tools * [Git](https://git-scm.com/) -* [Node.js](https://nodejs.org/) (with npm) - - This installation was tested using Node v12.18.4, v14.15.0 +* [Node.js](https://nodejs.org/) * [Ember CLI](https://ember-cli.com/) +* [Yarn](https://yarnpkg.com/) + -### 2. Install frontend and backend packages +## Prerequisite SSL Setup for Local Development +In order for cookies to work across both the client and the server during local development, we must have SSL setup for our development environment. -``` -> git clone https://github.com/NYCPlanning/labs-zap-search -> cd labs-zap-search -> yarn -> cd labs-zap-search/client -> yarn -> cd labs-zap-search/server -> yarn -``` +### Why is this necessary? +Google Chrome is beginning to enforce some restrictions on particular uses of cookies in cross-origin contexts. In our case, our server provides a cookie from one domain and is expected to be sent across subsequent requests via another. The only way to simulate this behavior as it works on a production environment is to run our local development servers with SSL enabled. -### 3. Set up SSL and environment files +### Steps to setup SSL locally 1. Clone this repo and follow the steps in its README: https://github.com/NYCPlanning/local-cert-generator -2. Note that Step 1 generates two files in the `local-cert-generator` repo: `server.key` and `server.crt`. Later, you will need to copy/paste these files into the `labs-zap-search` repo to run the application. +2. Note that Step 1 generates two files in the `local-cert-generator` repo: `server.key` and `server.crt`. Later, you will need to copy/paste these files into the `labs-zap-search` repo to run the application (Steps 2 and 3 under "Running the App"). 3. Open up your hosts file on your machine with admin permissions: `/etc/hosts`. For example, `sudo vim /etc/hosts` 4. Add the following line: `127.0.0.1 local.planninglabs.nyc` ![image](https://user-images.githubusercontent.com/3311663/78998629-fc437e00-7b16-11ea-81ef-edb19b4b1d90.png) -5. Navigate into the `server` folder. +## Running the App +Once you have SSL enabled... +##### note: the client and server each run on their own node version, independent of each other. Refer to the .nvmrc of their respective folders to determine the appropriate node verion. +1. Clone `labs-zap-search` to your computer. +2. Navigate into the `server` folder. - Create the `development.env` file using variables stored on 1Password. - Copy the `server.key` and `server.crt` files from your `local-cert-generator` repo and paste both files into the `labs-zap-search/server/ssl/` folder. -6. Navigate into the `client` folder. + - Activate the compatible node version `nvm use` + - Run `yarn` to install dependencies for the server. + - Run `yarn run start:dev` to start a development server +3. Open a new terminal and navigate into the `client` folder. - Copy the `server.key` and `server.crt` files from your `local-cert-generator` repo and paste both files into the `labs-zap-search/client/ssl/` folder. + - Activate the compatible node version `nvm use` + - Run `yarn` to install dependencies for the client. + - Run `yarn start:ssl` to start a development server -## One-click startup - -At the root of this project, run +## Pre-commit linting and testing + The client and server application node versions have become out of sync with each other. Consequently, the pre-commit hooks have been turned off until both the server and client are on the same node version. -``` -yarn run start -``` + Husky is designed to use the node version set in the terminal PATH at the time the command is run. Whichever node version the developer chooses will be the one that the both the client and server are tested against. This can lead to weird cases where the client or server passes in the environment it's developed for but fails in the environment where its tests are run. -This will spin up both the frontend (in the `/client` folder) and the server API (in `/server`). +As the hooks have been disabled, please take care to run linting and testing scripts for the server and client before committing. These scripts are documented in their respective `package.json` files. ## Frontend and Backend Documentation - See [./client/](./client/) for more docs on running and modifying the frontend diff --git a/package.json b/package.json index 9b9127ca..b7578961 100644 --- a/package.json +++ b/package.json @@ -2,18 +2,5 @@ "name": "labs-zap-search", "version": "1.0.0", "repository": "git@github.com:NYCPlanning/labs-zap-search.git", - "license": "MIT", - "scripts": { - "start": "concurrently \"yarn run client\" \"yarn run server\"", - "server": "cd server && yarn run start:dev", - "client": "cd client && yarn run start:ssl" - }, - "devDependencies": { - "concurrently": "^6.2.0" - }, - "volta": { - "node": "14.19.1", - "yarn": "1.22.18" - }, - "dependencies": {} + "license": "MIT" } diff --git a/server/.nvmrc b/server/.nvmrc index d9289897..6d80269a 100644 --- a/server/.nvmrc +++ b/server/.nvmrc @@ -1 +1 @@ -16.15.1 +18.16.0 diff --git a/server/package.json b/server/package.json index 5f5a8c91..1d09f13b 100644 --- a/server/package.json +++ b/server/package.json @@ -5,7 +5,7 @@ "author": "", "license": "MIT", "engines": { - "node": "16.*" + "node": "18" }, "scripts": { "build": "rimraf dist && tsc -p tsconfig.build.json",