Supplemental development notes.
It's often useful to codevelop dependencies by linking them because it doesn't require publishing. The workflow is usually:
npm install
(if not already done).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 withls -l node_modules/@devvit
.npm start
development server.- Edit and build dependencies as needed.
- 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
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
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…
- Add a global exclusions file by executing
git config --global core.excludesfile '~/.gitignore'
or updating your~/.gitconfig
manually:
excludesfile = ~/.gitignore
- Always ignore
.DS_Store
files by executingecho .DS_Store >> ~/.gitignore
or updating your~/.gitignore
manually:
.DS_Store