Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup nix dev shell #28

Merged
merged 5 commits into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# dependencies
**/node_modules/

# environment variables
**/.envrc

# secrets
secrets/*
!secrets/README.md
Expand Down
19 changes: 0 additions & 19 deletions .husky/pre-commit

This file was deleted.

14 changes: 0 additions & 14 deletions .husky/pre-push

This file was deleted.

27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Monorepo for my [Eleventy](https://www.11ty.dev/) plugins.

> 📦 **CJS only:**
>
>
> All libraries of this monorepo are published to npmjs as CommonJS.
>
> At the moment none of these packages has a ESM build.
Expand All @@ -23,14 +23,22 @@ Clone the repo:

```shell
git clone [email protected]:jackdbd/undici.git
```

This project defines a virtual environment with all the necessary dependencies. This environment is declared by the `mkShell` function in the `flake.nix` file you can find in the root directory of this monorepo. Thanks to nix, direnv and the `.envrc` file, you can activate this environment just by entering this monorepo (e.g. with `cd undici`).

If you don't use nix, ensure you have a Node.js version supported by this project. You could use a Node.js version manager like [nvm](https://github.com/nvm-sh/nvm), [asdf](https://github.com/asdf-vm/asdf-nodejs) or [volta](https://volta.sh/).

cd undici
Install all dependencies from npm.js (by passing `--include dev` we can be sure that we are installing `devDependencies` even when `NODE_ENV` is set to `production`):

```sh
npm install --include dev --include prod
```

Install all dependencies from npm.js and setup git hooks with [husky](https://typicode.github.io/husky/):
If you don't use nix, install [zx](https://github.com/google/zx) globally.

```sh
npm install
npm install --global zx
```

## Development
Expand Down Expand Up @@ -69,6 +77,12 @@ npm run dev

Note: you will still need to refresh the browser (this might change when [Eleventy 2.0 will add a dev server](https://www.11ty.dev/docs/watch-serve/)).

If you want to [update your git hooks](https://github.com/toplenboren/simple-git-hooks?tab=readme-ov-file#update-git-hooks-command) edit the `simple-git-hooks` section in `package.json`, then run:

```sh
npx simple-git-hooks
```

## Test

Run all tests on all packages:
Expand All @@ -81,10 +95,15 @@ Run tests on a single package:

```sh
npm run test -w packages/eleventy-plugin-content-security-policy

npm run test -w packages/eleventy-plugin-ensure-env-vars

npm run test -w packages/eleventy-plugin-permissions-policy

npm run test -w packages/eleventy-plugin-plausible

npm run test -w packages/eleventy-plugin-telegram

npm run test -w packages/eleventy-plugin-text-to-speech
```

Expand Down
Loading
Loading