Skip to content

Latest commit

 

History

History
75 lines (56 loc) · 2.35 KB

development.md

File metadata and controls

75 lines (56 loc) · 2.35 KB

Development

Supplemental development notes.

Codeveloping Dependencies

It's often useful to codevelop dependencies by linking them because it doesn't require publishing. The workflow is usually:

  1. npm install (if not already done).
  2. npm link <local dep1> <local dep2> <local dep3>... (must specify all linkage in one command). @devvit/previews is required. Verify symbolic links to your local folders with ls -l node_modules/@devvit.
  3. npm start development server.
  4. Edit and build dependencies as needed.
  5. Cleanup; unlink all play dependencies by re-running npm install. npm link --save if you want links to persist past install.
@devvit polyrepo example…
npm link \
  ~/work/reddit/src/devvit/packages/previews \
  ~/work/reddit/src/devvit/packages/protos \
  ~/work/reddit/src/devvit/packages/public-api \
  ~/work/reddit/src/devvit/packages/runtime-lite \
  ~/work/reddit/src/devvit/packages/shared-types \
  ~/work/reddit/src/devvit/packages/ui-renderer

Bundle Size

All JavaScript and CSS build product gzipped sizes are tracked and tested with filesize. Keep the threshold (configured in package.json) just above the actual size so that it's easy to track commit cost.

The contents of each bundle generated can be evaluated through its source map. source-map-explorer and Lighthouse can be used to generate reports for bundle breakdowns.

npx source-map-explorer --gzip --no-border-checks dist/play-pen.js

Ignoring OS Cache Files

Unwanted environment-specific files such as .DS_Store and Thumbs.db should be excluded by the user's global Git configuration. They're unwanted in every repository and not specific to play. See gitignore documentation for details.

`.DS_Store` example…
  1. Add a global exclusions file by executing git config --global core.excludesfile '~/.gitignore' or updating your ~/.gitconfig manually:
excludesfile = ~/.gitignore
  1. Always ignore .DS_Store files by executing echo .DS_Store >> ~/.gitignore or updating your ~/.gitignore manually:
.DS_Store