Skip to content

Latest commit

 

History

History
66 lines (39 loc) · 3.34 KB

CONTRIBUTING.md

File metadata and controls

66 lines (39 loc) · 3.34 KB

Links

Sometimes links are placed into the README or in logs that we want to make as stable as possible and friendly to read. To achieve both we use short links like pris.ly/foo. We manage these for Nexus Prisma in the prisma/pris.ly repo here.

Tests

Running

Remarks

Link-Like Development

Sometimes it is useful to use a link workflow. This means working on a local checkout of the Nexus Prisma source code, while trying it out in a project as local on your machine. This can be great for feeling out ideas.

Linking with Nexus Prisma is problematic because some modules in the Nexus Prisma source do file path lookups relative to where they are on disk. These lookups expect to be in the project that is using Nexus Prisma. Regular link workflows violate this assumptions.

The solution is to use Yalc.

Instructions

Definitions:

  • Nexus Prisma: Your local checkout of the source code.
  • Project: Some project that you are trying out your local version of Nexus Prisma on.

One-time:

  1. Install yalc on your machine npm -g add yalc.
  2. Install nodemon on your machine npm -g add nodemon.

Usually-one-time:

  1. In Project run yalc add nexus-prisma.

Every-time:

  1. In Nexus Prisma run the VSCode task dev:link.
  2. In Project run nodemon --watch '.yalc/**/*' --exec 'yarn -s prisma generate'

With all this in place, the chain reaction goes like this:

  1. You change Nexus Prisma
  2. Nexus Prisma TS in watch mode emits into dist-esm and dist-cjs
  3. Nexus Prisma nodemon reacts to this, runs yalc push, Yalc emits into Project's .yalc dir
  4. Project nodemon reacts to this, runs prisma generate
  5. You try things out with newly generated Nexus Prisma in Project!

One issue is being worked out related to bin and chmod: wclr/yalc#156

If you change a dependency in Nexus Prisma while working (especially adding a new one) you will need to remove the node_modules in Project and re-install e.g. yarn install.

Debugging

  • We use debug. Enable by setting envar DEBUG=nexus-prisma*
  • If you set envar NP_DEBUG=true then Nexus Prisma will write dmmf.json to CWD at generation time.