bootstrap/specs/nodejs/template
Joshua Potter d1d383a5a7 Fixup pre-commits to use `=~` where not. 2023-12-19 05:48:06 -07:00
..
.githooks Fixup pre-commits to use `=~` where not. 2023-12-19 05:48:06 -07:00
src Add spec for nodejs packages. 2023-12-01 15:53:50 -07:00
.envrc Add spec for nodejs packages. 2023-12-01 15:53:50 -07:00
.gitignore Add spec for nodejs packages. 2023-12-01 15:53:50 -07:00
README.md nodejs: Add instructions around building and chmod on pre-commit. 2023-12-13 15:49:55 -07:00
flake.lock Add spec for nodejs packages. 2023-12-01 15:53:50 -07:00
flake.nix nodejs: Add instructions around building and chmod on pre-commit. 2023-12-13 15:49:55 -07:00
package-lock.json Discourage dev dependencies in package.json. 2023-12-03 19:44:15 -07:00
package.json Discourage dev dependencies in package.json. 2023-12-03 19:44:15 -07:00
prettier.config.cjs Add default prettier configuration. 2023-12-03 11:20:21 -07:00
tsconfig.json Default to es2016. 2023-12-01 17:55:27 -07:00

README.md

NodeJS Flake Template

This is a template for constructing a working environment for Node.js development (version v18.18.2) with the npm (version 9.8.1) packaging tool. direnv can be used to launch a dev shell upon entering this directory (refer to .envrc). Otherwise run via:

$ nix develop

Building

If you make changes to the package-lock.json file, you'll need to update the npmDepsHash value in flake.nix. The easiest way to discover this value is by running the following:

$ prefetch-npm-deps package-lock.json

Alternatively, you can set the value of npmDepsHash to lib.fakeHash and run:

$ nix build

Nix will complain with the has value it actually expected.

Language Server

The typescript-language-server (version 4.1.2) is included in this flake.

Formatting

Formatting depends on prettier (version 3.1.0). A pre-commit hook is included in .githooks that can be used to format all *.jsx? and *.tsx? files prior to commit. Install via:

$ git config --local core.hooksPath .githooks/

If running direnv, this hook is installed automatically when entering the directory.