mirror of
https://github.com/ryan4yin/nixos-and-flakes-book
synced 2024-11-21 19:53:06 +00:00
feat: add perttier to format the markdown files (#124)
This commit is contained in:
parent
a9f4bb9233
commit
af650be728
5 changed files with 25 additions and 5 deletions
5
.github/CONTRIBUTING.md
vendored
5
.github/CONTRIBUTING.md
vendored
|
@ -46,10 +46,13 @@ Boot up the documentation site locally, with live reloading of the source code:
|
|||
$ pnpm run docs:dev
|
||||
```
|
||||
|
||||
If you made a lot of changes, run the following command to check for typos before submitting a pull request:
|
||||
If you made a lot of changes, run the following command to check for typos & format the docs before submitting a pull request:
|
||||
|
||||
> Generally, `nix develop` will add a pre-commit hook to run the following command before you commit.
|
||||
|
||||
```sh
|
||||
$ typos -w
|
||||
$ prettier --write .
|
||||
```
|
||||
|
||||
After executing the above command, visit <http://localhost:5173> and try modifying the source code. You'll get live update.
|
||||
|
|
8
.prettierignore
Normal file
8
.prettierignore
Normal file
|
@ -0,0 +1,8 @@
|
|||
LICENSE.md
|
||||
dist
|
||||
pnpm-lock.yaml
|
||||
flake.lock
|
||||
vercel.json
|
||||
cache
|
||||
temp
|
||||
.temp
|
5
.prettierrc.yaml
Normal file
5
.prettierrc.yaml
Normal file
|
@ -0,0 +1,5 @@
|
|||
# https://prettier.io/docs/en/options
|
||||
semi: false
|
||||
singleQuote: false
|
||||
printWidth: 80
|
||||
trailingComma: es5
|
|
@ -11,10 +11,9 @@ An unofficial and opinionated NixOS & Flakes :book: for beginners: https://nixos
|
|||
> If you're using macOS, [ryan4yin/nix-darwin-kickstarter](https://github.com/ryan4yin/nix-darwin-kickstarter) may be a good starting point for you,
|
||||
> you can learn how to use Nix with this book and take nix-darwin-kickstarter as a start point to build your own Nix configuration.
|
||||
|
||||
|
||||
## Feedback and Discussion
|
||||
|
||||
I’m not an expert on NixOS, and I’ve only been using NixOS for less than 9 months until now(2024-02),
|
||||
I’m not an expert on NixOS, and I’ve only been using NixOS for less than 9 months until now(2024-02),
|
||||
so there must be some misconceptions or inappropriate examples in the book.
|
||||
If anyone finds anything incorrect or have any questions / suggestions, just let me know about it by open an issue or join the discussion on [GitHub Discussions](https://github.com/ryan4yin/nixos-and-flakes-book/discussions), I'm glad continue to optimize the content of this book.
|
||||
|
||||
|
@ -24,7 +23,6 @@ Even though I knew I could make mistakes, it's much better than do nothing.
|
|||
My hope is that this book can help more people, enabling them to experience the joys of NixOS.
|
||||
Hope you like it!
|
||||
|
||||
|
||||
## Introduction to Flakes
|
||||
|
||||
The flakes experimental feature is a major development for Nix, it introduces a policy for managing dependencies between Nix expressions, it improves reproducibility, composability and usability in the Nix ecosystem. Although it's still an experimental feature, flakes have been widely used by the Nix community.[^1]
|
||||
|
@ -58,7 +56,6 @@ Thank you to [all the people](https://github.com/ryan4yin/nixos-and-flakes-book/
|
|||
|
||||
[NixOS & Flakes Book](https://github.com/ryan4yin/nixos-and-flakes-book) © 2023 by Ryan Yin is licensed under [CC BY-SA 4.0](./LICENSE.md)
|
||||
|
||||
|
||||
[^1]: [Flakes - NixOS Wiki](https://nixos.wiki/index.php?title=Flakes)
|
||||
[^2]: [Flakes are such an obviously good thing](https://grahamc.com/blog/flakes-are-an-obviously-good-thing/)
|
||||
[^3]: [Draft: 1 year roadmap - NixOS Foundation](https://nixos-foundation.notion.site/1-year-roadmap-0dc5c2ec265a477ea65c549cd5e568a9)
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
nodejs = super.nodejs_20;
|
||||
pnpm = super.nodePackages.pnpm;
|
||||
yarn = super.yarn.override {inherit nodejs;};
|
||||
prettier = super.nodePackages.prettier;
|
||||
})
|
||||
];
|
||||
pkgs = import nixpkgs {inherit overlays system;};
|
||||
|
@ -28,6 +29,7 @@
|
|||
nodejs
|
||||
pnpm
|
||||
yarn
|
||||
prettier
|
||||
|
||||
git
|
||||
typos
|
||||
|
@ -40,12 +42,17 @@
|
|||
hooks = {
|
||||
typos.enable = true; # Source code spell checker
|
||||
alejandra.enable = true; # Nix linter
|
||||
prettier.enable = true; # Markdown & TS formatter
|
||||
};
|
||||
settings = {
|
||||
typos = {
|
||||
write = true; # Automatically fix typos
|
||||
ignored-words = [];
|
||||
};
|
||||
prettier = {
|
||||
write = true; # Automatically format files
|
||||
configPath = "./.prettierrc.yaml";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue