diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a833d9ca..88d6582de 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -126,7 +126,7 @@ All matched files use Prettier code style! To _fix_ formatting run: ```console -$ npm run check:formatting -- --write +$ npm run prettier:write ``` ### Submodule changes diff --git a/netlify.toml b/netlify.toml index add10139c..9a59a2d7e 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,9 +1,9 @@ [build] publish = "public" -command = "npm run build:preview" +command = "npm run s build:preview diff:fail" [context.production] -command = "npm run build:production" +command = "npm run s build:production diff:fail" [[redirects]] from = "https://docs.opentelemetry.io/*" diff --git a/package.json b/package.json index f4eb162a7..637a0f44e 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "scripts": { "__check:links": "make --keep-going check-links", "_build": "hugo --cleanDestinationDir -e dev -DFE", + "_check:formatting": "npx prettier --check .", "_check:links": "HTMLTEST_ARGS='--log-level 1' npm run __check:links", "_check:links:internal": "npm run __check:links", "_get:no": "echo SKIPPING get operation", @@ -15,7 +16,7 @@ "_get:submodule": "set -x && git submodule update --init ${DEPTH:- --depth 1}", "_prebuild": "run-s get:submodule cp:spec", "_prepare:docsy": "cd themes/docsy && npm install", - "_serve:hugo": "hugo serve --disableFastRender -DFE --minify", + "_serve:hugo": "hugo serve -DFE --minify", "_serve": "netlify dev -c \"npm run _serve:hugo\"", "all": "npm-run-all", "build:preview": "set -x && npm run _build -- --minify --baseURL \"${DEPLOY_PRIME_URL:-/}\"", @@ -23,11 +24,13 @@ "build": "npm run _build", "cd:public": "cd public &&", "check": "npm run all -- check:*", - "check:formatting": "npx prettier --check .", + "check:formatting": "npm run _check:formatting || (echo '[help] Run: npm run prettier:write'; exit 1)", "check:links": "npm run _check:links", "check:links:internal": "npm run _check:links:internal", "clean": "make clean", "cp:spec": "./scripts/content-modules/cp-pages.sh", + "diff:check": "git diff --name-only --exit-code || (echo; echo 'WARNING: the files above have not been committed'; echo)", + "diff:fail": "git diff --name-only --exit-code || (echo; echo 'ERROR: the files above have changed. Locally rerun `npm run test` and commit changes'; echo; exit 1)", "get:submodule": "npm run _get:${GET:-submodule}", "make:public": "make public ls-public", "postbuild:preview": "npm run _check:links", @@ -40,6 +43,7 @@ "prepare": "run-s get:submodule _prepare:docsy", "preserve:hugo": "npm run _prebuild", "prettier:no-ignore": "npx prettier --ignore-path ''", + "prettier:write": "npm run _check:formatting -- --write", "preserve": "npm run _prebuild", "s": "run-s", "schemas:update": "npm run update:submodule content-modules/opentelemetry-specification",