Skip to content

Commit 9bade1c

Browse files
authored
NPM scripts: serve using Hugo, and normalize format cmd names (open-telemetry#2694)
1 parent 0feb514 commit 9bade1c

File tree

5 files changed

+31
-24
lines changed

5 files changed

+31
-24
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
name: Check formatting
1+
name: Check file format
22

33
on:
44
pull_request:
55

66
jobs:
77
check-formatting:
8-
name: Check formatting
8+
name: Check file format
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v3
1212

1313
- run: npm install
1414

15-
- name: Check formatting
16-
run: npm run check:formatting
15+
- name: Check file format
16+
run: npm run check:format

CONTRIBUTING.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,18 @@ To **serve** the site run:
7272
$ npm run serve
7373
```
7474

75-
> **Note 1**: The Netlify CLI will locally serve the site at [localhost:8888][].
75+
The site will be served at [localhost:1313][].
7676

77-
> **Note 2**: The serve command serves files from memory, not from disk.
77+
If you need to test Netlify redirects, use the following command, and visit the
78+
site at [localhost:8888][]:
7879

79-
> **Note 3**: See an error like `too many open files` or `pipe failed` under
80+
```console
81+
$ npm run serve:netlify
82+
```
83+
84+
> **Note 1**: The serve command serves files from memory, not from disk.
85+
>
86+
> **Note 2**: See an error like `too many open files` or `pipe failed` under
8087
> macOS? You may need to increase the file descriptor limit. See
8188
> [Hugo issue #6109](https://github.com/gohugoio/hugo/issues/6109).
8289
@@ -114,19 +121,19 @@ reported issues:
114121
$ npm run test
115122
```
116123

117-
If you only want to check formatting run:
124+
If you only want to check the format of files, run:
118125

119126
```console
120-
$ npm run check:formatting
127+
$ npm run check:format
121128
...
122129
Checking formatting...
123130
All matched files use Prettier code style!
124131
```
125132

126-
To _fix_ formatting run:
133+
To _fix_ the format of files, run:
127134

128135
```console
129-
$ npm run prettier:write
136+
$ npm run format
130137
```
131138

132139
### Submodule changes
@@ -170,6 +177,7 @@ required.
170177
[gitpod.io]: https://gitpod.io
171178
[gitpod.io/workspaces]: https://gitpod.io/workspaces
172179
[hugo]: https://gohugo.io
180+
[localhost:1313]: http://localhost:1313
173181
[localhost:8888]: http://localhost:8888
174182
[netlify]: https://netlify.com
175183
[new-issue]:

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ endif
3333
refcache-save: $(LINK_CACHE_FILE_SRC_DIR)/$(LINK_CACHE_FILE)
3434
ifeq (refcache, $(REFCACHE))
3535
cp $(LINK_CACHE_FILE_SRC_DIR)/$(LINK_CACHE_FILE) $(LINK_CACHE_FILE_DEST_DIR)/
36-
npm run prettier:no-ignore -- \
37-
--write $(LINK_CACHE_FILE_DEST_DIR)/$(LINK_CACHE_FILE)
36+
npm run format $(LINK_CACHE_FILE_DEST_DIR)/$(LINK_CACHE_FILE)
3837
else
3938
@echo "SKIPPING refcache-save"
4039
endif

archetypes/blog.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ author: >- # If you have only one author, then add the single name on this line
77
...
88
[AuthorX Name](https://github.com/authorX_GH_ID) (Organization Name X)
99
draft: true # TODO: remove this line once your post is ready to be published
10-
# canonical_url: http://somewhere.else/ # TODO: if this blog post has been posted somewhere else already, uncomment & provide the conancial URL here.
10+
# canonical_url: http://somewhere.else/ # TODO: if this blog post has been posted somewhere else already, uncomment & provide the canonical URL here.
1111
body_class: otel-with-contributions-from # TODO: remove this line if there are no secondary contributing authors
1212
---
1313

@@ -37,10 +37,10 @@ can reference them like the following:
3737

3838
## Markdown formatter
3939

40-
Before submitting a new commit run the Prettier command over your file:
40+
Before submitting a new commit run the formatter over your file:
4141

4242
```sh
43-
npm run prettier:write
43+
npm run format
4444
```
4545

4646
Happy writing!

package.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"scripts": {
99
"__check:links": "make --keep-going check-links",
1010
"_build": "hugo --cleanDestinationDir -e dev -DFE",
11-
"_check:formatting": "npx prettier --check .",
11+
"_check:format": "npx prettier --check .",
12+
"_check:format:any": "npx prettier --check --ignore-path ''",
1213
"_check:links": "HTMLTEST_ARGS='--log-level 1' npm run __check:links",
1314
"_check:links:internal": "npm run __check:links",
1415
"_check:links--warn": "npm run _check:links || (echo; echo 'WARNING: see link-checker output for issues.'; echo)",
@@ -18,39 +19,38 @@
1819
"_prebuild": "run-s get:submodule cp:spec",
1920
"_prepare:docsy": "cd themes/docsy && npm install",
2021
"_serve:hugo": "hugo serve -DFE --minify",
21-
"_serve": "netlify dev -c \"npm run _serve:hugo\"",
22+
"_serve:netlify": "netlify dev -c \"npm run _serve:hugo\"",
2223
"all": "npm-run-all",
2324
"build:preview": "set -x && npm run _build -- --minify --baseURL \"${DEPLOY_PRIME_URL:-/}\"",
2425
"build:production": "hugo --cleanDestinationDir --minify",
2526
"build": "npm run _build",
2627
"cd:public": "cd public &&",
2728
"check": "npm run all -- check:*",
28-
"check:formatting": "npm run _check:formatting || (echo '[help] Run: npm run prettier:write'; exit 1)",
29+
"check:format": "npm run _check:format || (echo '[help] Run: npm run format'; exit 1)",
2930
"check:links": "npm run _check:links",
3031
"check:links:internal": "npm run _check:links:internal",
3132
"clean": "make clean",
3233
"cp:spec": "./scripts/content-modules/cp-pages.sh",
3334
"diff:check": "git diff --name-only --exit-code || (echo; echo 'WARNING: the files above have not been committed'; echo)",
3435
"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)",
35-
"format": "npm run _check:formatting -- --write",
36+
"format": "npm run _check:format -- --write",
3637
"get:submodule": "npm run _get:${GET:-submodule}",
3738
"make:public": "make public ls-public",
3839
"postbuild:preview": "npm run _check:links--warn",
3940
"postbuild:production": "npm run _check:links--warn",
4041
"prebuild:preview": "run-s _prebuild",
41-
"prebuild:production": "run-s _prebuild check:formatting",
42+
"prebuild:production": "run-s _prebuild _check:format",
4243
"prebuild": "npm run _prebuild",
4344
"precheck:links": "npm run build",
4445
"precheck:links:internal": "npm run build",
4546
"prepare": "run-s get:submodule _prepare:docsy",
4647
"preserve:hugo": "npm run _prebuild",
47-
"prettier:no-ignore": "npx prettier --ignore-path ''",
48-
"prettier:write": "npm run _check:formatting -- --write",
4948
"preserve": "npm run _prebuild",
5049
"s": "run-s",
5150
"schemas:update": "npm run update:submodule content-modules/opentelemetry-specification",
5251
"serve:hugo": "npm run _serve:hugo",
53-
"serve": "npm run _serve",
52+
"serve:netlify": "npm run _serve:netlify",
53+
"serve": "npm run serve:hugo",
5454
"test": "run-s check:*",
5555
"update:pkg:docsy-dep": "npm install --save-dev autoprefixer@latest postcss@latest postcss-cli@latest",
5656
"update:pkg:hugo": "npm install --save-dev --save-exact hugo-extended@latest",

0 commit comments

Comments
 (0)