Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:NYCPlanning/labs-zap-search into…
Browse files Browse the repository at this point in the history
… task/12835-upgrade-node-ember-versions
  • Loading branch information
bmarchena committed Aug 4, 2023
2 parents f3ca807 + 75badd7 commit 7f87f89
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 35 deletions.
9 changes: 5 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -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
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion server/.nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.15.1
18.16.0
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"author": "",
"license": "MIT",
"engines": {
"node": "^16.*"
"node": "18"
},
"scripts": {
"build": "rimraf dist && tsc -p tsconfig.build.json",
Expand Down
4 changes: 2 additions & 2 deletions server/src/project/project.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 7f87f89

Please sign in to comment.