0.0.0-pr.384.1.4d8ab8f • Published 6 years ago

nexus-future v0.0.0-pr.384.1.4d8ab8f

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

Documentation

https://nexusjs.org

Internal Development

Code Architecture

Overview

  • Roughly speaking we have three distinct levels of code:

    1. src/{cli, framework} Top level modules coded directly against their respective domain.

    2. src/utils/* Mid level modules that might provide some conveniences or encapsulate concerns shared across framework and cli.

    3. src/lib/* Discrete modules that stand alone conceptually and technically.

  • Each level builds on the one below it.

  • One can think of code as evolving from level 1 down toward level 3.

    Of course the natural place for some code is level 1. On the other hand we often don't know at first what a generic solution looks like. So level 3 tends to be grown into, rather than started from.

  • You could see a level 4 here as npm registry, where we fully extract a library. That is not an explicit goal, just a tip for the mental model.

  • Overall status of the codebase is in a state of refactoring. utils, watcher, and more are undergoing source restructuring in the near future.

Layout Overview

/docs         -- The website
/test         -- Integration tests
/src
  /cli        -- CLI codebase
  /framework  -- Runtime codebase
  /utils      -- Non-discrete modules (may have state, tight coupling)
  /lib        -- Discrete modules

lib

The layout of a typical lib module looks like so:

/lib
  /<module-name>
    /index.ts        -- Export-only module, the public interface
    /index.spec.ts   -- Tests against the public interface. Integration in the sense
                        that it is agnostic to the unit or units making up the lib.
    /*.ts            -- The modules making up the lib
    /*.spec.ts       -- Optional tests. Please prioritize `index.spec.ts`

Be careful about lib modules depending upon one another excessively. The more complex the dependency graph the harder it can become to reason about the modules. But if there is non-trivial re-use to be had and/or just a simple/clean and logical dependency then go for it.

The built-in exception to this heuristic is lib/utils which can be thought of as a bespoke lodash for our lib components. Use it for small utilities, which might be shared, are very generic, and are not numerous enough to justify their own dedicated lib module. For example there is a utility to make text span a given length using given pad character.

Testing

We use GitHub Actions.

Unit

yarn test:unit
yarn dev:test      # watch mode
  • Live under /src separated by and colocated with the respective module they test.

  • Unit tests run in CI against every commit.

E2E

yarn test:e2e
  • Live under /test

  • E2E tests run in CI against every commit after the package has been published. These are preview and pr releases so its acceptable, and doing it this way provides a true smoke test of if the real user journey works end to end.

  • E2E tests can be run on your machine. They default to working with latest dist-tag. Use NEXUS_VERSION env var to set the desired version to test against.

Continuous Delivery

  • We use dripip to make releases.

  • Every PR commit results in:

    1. Pre-Release of pattern:

      0.0.0-pr.<pr-num>.<build-num>.<short-sha>`
    2. Update to an npm dist tag of pattern

      pr.<pr-num>`
  • Every trunk commit results in a

    1. Pre-Release of pattern:

      <next-version>-next.<build-num>
    2. Update to an npm dist tag of pattern

      next
  • Stable releases are cut manually.

  • Any release type can be run manually:

    yarn release:preview
    yarn release:stable
    yarn release:pr

Website

  • We use docsifyjs/docsify.
  • There is no build step
  • Commits to master will trigger deployment (via gh-pages, no ci/cd on our part)
  • Navigation is manually managed in _sidebar.md
  • Cover page is managed in _coverpage.md
  • Configuration and significant styling customizations are kept in index.html

Getting started

  1. Install docsify-cli

    There is currently a bug with docsify-cli requiring the following manual fix after installation. To make this less painful, install globally so you should only have to do this once.

    yarn global add docsify
    vim /usr/local/bin/docsify
    :se ff=unix
    :wq
  2. Boot docs dev to preview your changes locally

    yarn docs:dev

Workflow Tips

Working With Example Apps via Linking

Refer to https://github.com/prisma-labs/nexus-future-examples

Working with create command

In any example you can use this workflow:

rm -rf test-create && mcd test-create && ../node_modules/.bin/nexus create
0.13.0-next.17

6 years ago

0.13.0-next.14

6 years ago

0.13.0-next.13

6 years ago

0.13.0-next.16

6 years ago

0.13.0-next.15

6 years ago

0.13.0-next.12

6 years ago

0.13.0-next.11

6 years ago

0.13.0-next.10

6 years ago

0.13.0-next.9

6 years ago

0.13.0-next.8

6 years ago

0.13.0-next.7

6 years ago

0.13.0-next.6

6 years ago

0.13.0-next.5

6 years ago

0.13.0-next.4

6 years ago

0.13.0-next.3

6 years ago

0.12.1-next.2

6 years ago

0.12.1-next.1

6 years ago

0.12.0

6 years ago

0.12.0-next.5

6 years ago

0.12.0-next.4

6 years ago

0.12.0-next.3

6 years ago

0.11.2-next.4

6 years ago

0.11.2-next.5

6 years ago

0.11.2

6 years ago

0.11.3-next.2

6 years ago

0.11.3-next.1

6 years ago

0.11.2-next.3

6 years ago

0.11.2-next.2

6 years ago

0.11.2-next.1

6 years ago

0.11.1

6 years ago

0.11.0

6 years ago

0.11.0-next.2

6 years ago

0.10.1-next.1

6 years ago

0.10.0

6 years ago

0.10.0-next.28

6 years ago

0.10.0-next.27

6 years ago

0.10.0-next.26

6 years ago

0.10.0-next.25

6 years ago

0.10.0-next.24

6 years ago

0.10.0-next.23

6 years ago

0.10.0-next.22

6 years ago

0.10.0-next.21

6 years ago

0.10.0-next.17

6 years ago

0.10.0-next.16

6 years ago

0.10.0-next.19

6 years ago

0.10.0-next.18

6 years ago

0.10.0-next.20

6 years ago

0.10.0-next.15

6 years ago

0.10.0-next.14

6 years ago

0.10.0-next.13

6 years ago

0.10.0-next.12

6 years ago

0.10.0-next.11

6 years ago

0.10.0-next.10

6 years ago

0.10.0-next.9

6 years ago

0.10.0-next.7

6 years ago

0.10.0-next.8

6 years ago

0.10.0-next.6

6 years ago

0.10.0-next.5

6 years ago

0.10.0-next.4

6 years ago

0.10.0-next.3

6 years ago

0.10.0-next.2

6 years ago

0.10.0-next.1

6 years ago

0.0.1-next.1

6 years ago

0.9.0

6 years ago

0.9.0-next.9

6 years ago

0.9.0-next.8

6 years ago

0.9.0-next.7

6 years ago

0.9.0-next.6

6 years ago

0.9.0-next.5

6 years ago

0.9.0-next.4

6 years ago

0.9.0-next.3

6 years ago

0.9.0-next.2

6 years ago

0.9.0-next.1

6 years ago

0.8.0-next.1

6 years ago

0.8.0

6 years ago

0.7.0

6 years ago

0.7.0-next.3

6 years ago

0.7.0-next.2

6 years ago

0.7.0-next.1

6 years ago

0.6.0

6 years ago

0.5.1-next.3

6 years ago

0.5.1-next.2

6 years ago

0.5.1-next.1

6 years ago

0.5.0

6 years ago

0.4.0

6 years ago