diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26bf56263..889a86157 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -46,9 +46,9 @@ The Optimism Documentation team has created a complete style guide for you to ma To set up the Nextra project on your machine, perform the following steps from a terminal instance: -1. Install pnpm [install pnpm](https://pnpm.io/installation). -2. First, run `pnpm i` to install the dependencies. -3. Then, run `pnpm dev` to start the development server and +1. [Install just](https://github.com/casey/just) +2. First, run `just i` to install the dependencies. +3. Then, run `just dev` to start the development server and 4. Visit [localhost:3000](http://localhost:3000) in your browser to view the website. You can now start changing content and see the website updated live each time you save a new file. 🤓 @@ -57,13 +57,13 @@ You can now start changing content and see the website updated live each time yo **Important prerequisite** -To prevent building issues upstream, you should build the content locally before submitting a pull request: stop or delete the terminal server if it's running, then run `pnpm dev`. +To prevent building issues upstream, you should build the content locally before submitting a pull request: stop or delete the terminal server if it's running, then run `just dev`. - Use the information reported by the terminal to fix any issues (e.g., broken links). -- Run `pnpm fix` to automatically fix most linting issues (e.g., formatting and style guide). -- Run `pnpm spellcheck:lint` to test your content against the dictionary. Add new words to the dictionary by appending them to `words.txt`. -- Run `pnpm spellcheck:fix` to add new words to the dictionary automatically. -- Try another `pnpm dev` and repeat until no issues are reported ("client" and "server compiled successfully"). +- Run `just fix` to automatically fix most linting issues (e.g., formatting and style guide). +- Run `just spellcheck:lint` to test your content against the dictionary. Add new words to the dictionary by appending them to `words.txt`. +- Run `just spellcheck:fix` to add new words to the dictionary automatically. +- Try another `just dev` and repeat until no issues are reported ("client" and "server compiled successfully"). Your pull request should usually target the `main` branch, though the Optimism Documentation team might sometimes ask you to target another branch. diff --git a/README.md b/README.md index 62aeb0d12..212aa85d9 100644 --- a/README.md +++ b/README.md @@ -4,11 +4,11 @@ This repo houses the Optimism Docs located at [docs.optimism.io](https://docs.op ## Local Development -How to [install pnpm](https://pnpm.io/installation) +How to [Install just](https://github.com/casey/just) -First, run `pnpm i` to install the dependencies. +First, run `just i` to install the dependencies. -Then, run `pnpm dev` to start the development server and visit localhost:3000. +Then, run `just dev` to start the development server and visit localhost:3000. ## Contributions diff --git a/justfile b/justfile new file mode 100644 index 000000000..03ea0c3df --- /dev/null +++ b/justfile @@ -0,0 +1,53 @@ +# List available recipes +default: + @just --list + +# Lint +lint: spellcheck-lint + pnpm eslint . --ext mdx --max-warnings 0 + +# Fix +fix: spellcheck-fix + pnpm eslint . --ext mdx --fix + +# Spellcheck lint +spellcheck-lint: + pnpm cspell lint "**/*.mdx" + +# Spellcheck fix +spellcheck-fix: + pnpm cspell --words-only --unique "**/*.mdx" | sort --ignore-case | uniq > words.txt + +# Link check +linkcheck: + pnpm lychee --config ./lychee.toml --quiet "./pages" + +# Index docs +index-docs: + pnpm ts-node --skip-project utils/algolia-indexer.ts + +# Dev server +dev: + pnpm next dev + +# Build +build: + pnpm next build + +# Start +start: + pnpm next start + +# Post-build (sitemap generation) +sitemap: + pnpm next-sitemap + +# Full build process +full-build: build sitemap + +# Install dependencies +install: + pnpm install + +# Run all checks +check: lint linkcheck \ No newline at end of file diff --git a/notes/actions.md b/notes/actions.md index b30c595c7..90b5c4eb2 100644 --- a/notes/actions.md +++ b/notes/actions.md @@ -3,7 +3,7 @@ ## Linting The `lint.yml` workflow checks that all Markdown and JavaScript files conform to the linting standards we apply. -Run `pnpm lint` to lint locally and run `pnpm fix` to fix issues that the linter can fix automatically. +Run `just lint` to lint locally and run `just fix` to fix issues that the linter can fix automatically. All PRs must pass this check. Also includes spellchecking via [cspell](https://cspell.org/). diff --git a/notes/algolia-search.md b/notes/algolia-search.md index c895704f6..f9c35b9bb 100644 --- a/notes/algolia-search.md +++ b/notes/algolia-search.md @@ -4,7 +4,7 @@ Indexes for Algolia can be generated and uploaded by running: -`pnpm index:docs` +`just index:docs` This will generate the appropriate indexes based on the repo's content and upload them to Algolia. diff --git a/notes/remark.md b/notes/remark.md index 8dc5a1193..f53eabf56 100644 --- a/notes/remark.md +++ b/notes/remark.md @@ -8,7 +8,7 @@ Remark is a flexible Markdown processor with a [vibrant plugin ecosystem](https: ### Adding Rules -To add a linting rule, simply install your desired linting rule via `pnpm` and add the rule to the [`.remarkrc.mjs`](/.remarkrc.mjs) configuration file at the root of this repository. +To add a linting rule, simply install your desired linting rule via `just` and add the rule to the [`.remarkrc.mjs`](/.remarkrc.mjs) configuration file at the root of this repository. You can find a list of rules maintained by the Remark team on the [`remark-lint`](https://github.com/remarkjs/remark-lint#rules) repository. If you need to write your own custom plugin, place the plugin inside of [`utils/plugins/remark`](/utils/plugins/remark/) diff --git a/package.json b/package.json index 7ea954ca7..77f824f45 100644 --- a/package.json +++ b/package.json @@ -2,18 +2,6 @@ "name": "op-docs", "version": "0.0.1", "description": "Optimism Docs", - "scripts": { - "lint": "eslint . --ext mdx --max-warnings 0 && pnpm spellcheck:lint", - "fix": "eslint . --ext mdx --fix && pnpm spellcheck:fix", - "spellcheck:lint": "cspell lint \"**/*.mdx\"", - "spellcheck:fix": "cspell --words-only --unique \"**/*.mdx\" | sort --ignore-case | uniq > words.txt", - "linkcheck": "lychee --config ./lychee.toml --quiet \"./pages\"", - "index:docs": "npx ts-node --skip-project utils/algolia-indexer.ts", - "dev": "next dev", - "build": "next build", - "start": "next start", - "postbuild": "next-sitemap" - }, "dependencies": { "@eth-optimism/contracts-ts": "^0.17.0", "@eth-optimism/tokenlist": "^9.0.9", @@ -65,4 +53,4 @@ "nextra@2.13.2": "patches/nextra@2.13.2.patch" } } -} +} \ No newline at end of file diff --git a/pages/builders/app-developers/tutorials/cross-dom-solidity.mdx b/pages/builders/app-developers/tutorials/cross-dom-solidity.mdx index b846658c1..10a4984c5 100644 --- a/pages/builders/app-developers/tutorials/cross-dom-solidity.mdx +++ b/pages/builders/app-developers/tutorials/cross-dom-solidity.mdx @@ -139,7 +139,7 @@ cd op-sample-project {