nfl-pro-client-gateway-service
v1.0.18
Published
GraphQL backend client gateway for NFLPro
Downloads
6
Readme
Client-Gateway Service
Compile Typescript
Run yarn compile
which will run the typescript compiler (tsc
) using the tsconfig.build.json
file for compiler settings. This compile is for the build pipeline. It does not include sourcemaps as part of its output.
Run with Debug port open
Run yarn start:debug
, which uses nodemon
to run the server and detect changes in any .ts
and .json
files. This can be configured through a nodemonConfig
key in package.json
or by creating a nodemon.json
file in the root of the project. The command is run with exec
because there were some issues with properly clearing the port being used for development when the server would auto-restart.
Run tests
The command yarn test
is the base command for running tests. If you want to run with coverage or have tests re-run as you change code, use yarn test:coverage
or yarn test:watch
respectively. Additional commands can be passed to jest
in the normal method. For example, yarn test --watch
and yarn test:watch
accomplish the same thing. This is one of the things run on pre-commit.
Linting
Your editor should be set up to enable auto linting and fix on save. If you don't like a rule then use .eslintrc.js
to modify it in some way.
Typings
TypeScript typings are in the ./typings
directory and will be picked up by the tsconfig.json
file. These files are how you provide typings and declarations for libraries that may not have them included. It is also how you extend existing types from libraries like Express
. A Request example is included.
VSCode and WebStorm
The .idea
and .vscode
folders have been intentionally committed. For WebStorm, it is set up to watch files and fix linting errors as well as format with prettier. There is also a run command set up tied to yarn start:debug
, debugging and breakpoints work with this if you're on the latest version of WebStorm. VSCode is set up with a debug task to connect to the service when run via yarn start:debug
, with breakpoints functioning properly.
Docker
If you want to run the dev container locally you can use a command such as docker run --env-file .env -p 127.0.0.1:8081:8081 -p 127.0.0.1:9229:9229 --name nfl-service-template -v "$(pwd)/src:/usr/app/src" nfl-service-template
You can run all nfl services locally using docker-compose. See the README in the project's root for more details.
Pre-commit Hooks
There are three precommit commands that run via the yarn precommit
command: yarn lint:check
, yarn test
, and yarn format:check
. When committing changes to a given folder within the mono-repo this command will be run via lerna, and use Husky to make sure the precommit hook is run.
They can be bypassed with git commit -m "My scumbag commit" --no-verify
. To add your own inconvenience into the commit process you can run ./node_modules/.bin/husky add .husky/pre-commit "command"
, for example ./node_modules/.bin/husky add .husky/pre-commit "yarn remove-large-files"
.
If you commit from the service directory it will skip precommit hooks. Make sure you're doing your commits from the top level to avoid introducing linting or formatting errors, or failing tests.