NPM scripts: serve using Hugo, and normalize format cmd names (#2694)
This commit is contained in:
parent
0feb514764
commit
9bade1cce4
|
|
@ -1,16 +1,16 @@
|
|||
name: Check formatting
|
||||
name: Check file format
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
check-formatting:
|
||||
name: Check formatting
|
||||
name: Check file format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- run: npm install
|
||||
|
||||
- name: Check formatting
|
||||
run: npm run check:formatting
|
||||
- name: Check file format
|
||||
run: npm run check:format
|
||||
|
|
@ -72,11 +72,18 @@ To **serve** the site run:
|
|||
$ npm run serve
|
||||
```
|
||||
|
||||
> **Note 1**: The Netlify CLI will locally serve the site at [localhost:8888][].
|
||||
The site will be served at [localhost:1313][].
|
||||
|
||||
> **Note 2**: The serve command serves files from memory, not from disk.
|
||||
If you need to test Netlify redirects, use the following command, and visit the
|
||||
site at [localhost:8888][]:
|
||||
|
||||
> **Note 3**: See an error like `too many open files` or `pipe failed` under
|
||||
```console
|
||||
$ npm run serve:netlify
|
||||
```
|
||||
|
||||
> **Note 1**: The serve command serves files from memory, not from disk.
|
||||
>
|
||||
> **Note 2**: See an error like `too many open files` or `pipe failed` under
|
||||
> macOS? You may need to increase the file descriptor limit. See
|
||||
> [Hugo issue #6109](https://github.com/gohugoio/hugo/issues/6109).
|
||||
|
||||
|
|
@ -114,19 +121,19 @@ reported issues:
|
|||
$ npm run test
|
||||
```
|
||||
|
||||
If you only want to check formatting run:
|
||||
If you only want to check the format of files, run:
|
||||
|
||||
```console
|
||||
$ npm run check:formatting
|
||||
$ npm run check:format
|
||||
...
|
||||
Checking formatting...
|
||||
All matched files use Prettier code style!
|
||||
```
|
||||
|
||||
To _fix_ formatting run:
|
||||
To _fix_ the format of files, run:
|
||||
|
||||
```console
|
||||
$ npm run prettier:write
|
||||
$ npm run format
|
||||
```
|
||||
|
||||
### Submodule changes
|
||||
|
|
@ -170,6 +177,7 @@ required.
|
|||
[gitpod.io]: https://gitpod.io
|
||||
[gitpod.io/workspaces]: https://gitpod.io/workspaces
|
||||
[hugo]: https://gohugo.io
|
||||
[localhost:1313]: http://localhost:1313
|
||||
[localhost:8888]: http://localhost:8888
|
||||
[netlify]: https://netlify.com
|
||||
[new-issue]:
|
||||
|
|
|
|||
3
Makefile
3
Makefile
|
|
@ -33,8 +33,7 @@ endif
|
|||
refcache-save: $(LINK_CACHE_FILE_SRC_DIR)/$(LINK_CACHE_FILE)
|
||||
ifeq (refcache, $(REFCACHE))
|
||||
cp $(LINK_CACHE_FILE_SRC_DIR)/$(LINK_CACHE_FILE) $(LINK_CACHE_FILE_DEST_DIR)/
|
||||
npm run prettier:no-ignore -- \
|
||||
--write $(LINK_CACHE_FILE_DEST_DIR)/$(LINK_CACHE_FILE)
|
||||
npm run format $(LINK_CACHE_FILE_DEST_DIR)/$(LINK_CACHE_FILE)
|
||||
else
|
||||
@echo "SKIPPING refcache-save"
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ author: >- # If you have only one author, then add the single name on this line
|
|||
...
|
||||
[AuthorX Name](https://github.com/authorX_GH_ID) (Organization Name X)
|
||||
draft: true # TODO: remove this line once your post is ready to be published
|
||||
# canonical_url: http://somewhere.else/ # TODO: if this blog post has been posted somewhere else already, uncomment & provide the conancial URL here.
|
||||
# canonical_url: http://somewhere.else/ # TODO: if this blog post has been posted somewhere else already, uncomment & provide the canonical URL here.
|
||||
body_class: otel-with-contributions-from # TODO: remove this line if there are no secondary contributing authors
|
||||
---
|
||||
|
||||
|
|
@ -37,10 +37,10 @@ can reference them like the following:
|
|||
|
||||
## Markdown formatter
|
||||
|
||||
Before submitting a new commit run the Prettier command over your file:
|
||||
Before submitting a new commit run the formatter over your file:
|
||||
|
||||
```sh
|
||||
npm run prettier:write
|
||||
npm run format
|
||||
```
|
||||
|
||||
Happy writing!
|
||||
|
|
|
|||
16
package.json
16
package.json
|
|
@ -8,7 +8,8 @@
|
|||
"scripts": {
|
||||
"__check:links": "make --keep-going check-links",
|
||||
"_build": "hugo --cleanDestinationDir -e dev -DFE",
|
||||
"_check:formatting": "npx prettier --check .",
|
||||
"_check:format": "npx prettier --check .",
|
||||
"_check:format:any": "npx prettier --check --ignore-path ''",
|
||||
"_check:links": "HTMLTEST_ARGS='--log-level 1' npm run __check:links",
|
||||
"_check:links:internal": "npm run __check:links",
|
||||
"_check:links--warn": "npm run _check:links || (echo; echo 'WARNING: see link-checker output for issues.'; echo)",
|
||||
|
|
@ -18,39 +19,38 @@
|
|||
"_prebuild": "run-s get:submodule cp:spec",
|
||||
"_prepare:docsy": "cd themes/docsy && npm install",
|
||||
"_serve:hugo": "hugo serve -DFE --minify",
|
||||
"_serve": "netlify dev -c \"npm run _serve:hugo\"",
|
||||
"_serve:netlify": "netlify dev -c \"npm run _serve:hugo\"",
|
||||
"all": "npm-run-all",
|
||||
"build:preview": "set -x && npm run _build -- --minify --baseURL \"${DEPLOY_PRIME_URL:-/}\"",
|
||||
"build:production": "hugo --cleanDestinationDir --minify",
|
||||
"build": "npm run _build",
|
||||
"cd:public": "cd public &&",
|
||||
"check": "npm run all -- check:*",
|
||||
"check:formatting": "npm run _check:formatting || (echo '[help] Run: npm run prettier:write'; exit 1)",
|
||||
"check:format": "npm run _check:format || (echo '[help] Run: npm run format'; 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; git diff | head -100; exit 1)",
|
||||
"format": "npm run _check:formatting -- --write",
|
||||
"format": "npm run _check:format -- --write",
|
||||
"get:submodule": "npm run _get:${GET:-submodule}",
|
||||
"make:public": "make public ls-public",
|
||||
"postbuild:preview": "npm run _check:links--warn",
|
||||
"postbuild:production": "npm run _check:links--warn",
|
||||
"prebuild:preview": "run-s _prebuild",
|
||||
"prebuild:production": "run-s _prebuild check:formatting",
|
||||
"prebuild:production": "run-s _prebuild _check:format",
|
||||
"prebuild": "npm run _prebuild",
|
||||
"precheck:links": "npm run build",
|
||||
"precheck:links:internal": "npm run build",
|
||||
"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",
|
||||
"serve:hugo": "npm run _serve:hugo",
|
||||
"serve": "npm run _serve",
|
||||
"serve:netlify": "npm run _serve:netlify",
|
||||
"serve": "npm run serve:hugo",
|
||||
"test": "run-s check:*",
|
||||
"update:pkg:docsy-dep": "npm install --save-dev autoprefixer@latest postcss@latest postcss-cli@latest",
|
||||
"update:pkg:hugo": "npm install --save-dev --save-exact hugo-extended@latest",
|
||||
|
|
|
|||
Loading…
Reference in New Issue