website: add linter tooling and documentation
- Added package.json and lockfile - Added npm and npx scripts - Updated README Change-Id: Ib01c09d943bb607c51544189d3dbbf1c42444921 Reviewed-on: https://go-review.googlesource.com/c/website/+/376301 Run-TryBot: Jamal Carvalho <jamal@golang.org> Trust: Jamal Carvalho <jamalcarvalho@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Alex Rakoczy <alex@golang.org>
This commit is contained in:
Родитель
5dfff35f77
Коммит
769f579886
38
README.md
38
README.md
|
@ -4,32 +4,54 @@
|
|||
|
||||
This repo holds content and serving programs for the go.dev and golang.org web sites.
|
||||
|
||||
Content is in _content/ (go.dev) and tour/ (go.dev/tour).
|
||||
Content is in \_content/ (go.dev) and tour/ (go.dev/tour).
|
||||
Server code is in cmd/ and internal/.
|
||||
|
||||
To run the combined go.dev+golang.org server to preview local content changes, use:
|
||||
|
||||
go run ./cmd/golangorg
|
||||
go run ./cmd/golangorg
|
||||
|
||||
The supporting programs cmd/admingolangorg and cmd/googlegolangorg
|
||||
are the servers for admin.golang.org and google.golang.org.
|
||||
(They do not use the _content/ directories.)
|
||||
(They do not use the \_content/ directories.)
|
||||
|
||||
Each command directory has its own README.md explaining deployment.
|
||||
|
||||
## JS/CSS Formatting
|
||||
## JS/TS/CSS Formatting
|
||||
|
||||
This repository uses [prettier](https://prettier.io/) to format JS and CSS files.
|
||||
This repository uses [eslint](https://eslint.org/) to format JS and TS files,
|
||||
and [stylelint](https://stylelint.io/) to format CSS files.
|
||||
|
||||
See also:
|
||||
|
||||
- [CSS](https://go.dev/wiki/CSSStyleGuide)
|
||||
- [JavaScript](https://google.github.io/styleguide/jsguide.html)
|
||||
- [TypeScript](https://google.github.io/styleguide/tsguide.html)
|
||||
|
||||
The version of `prettier` used is 1.18.2.
|
||||
It is encouraged that all JS, TS, and CSS code be run through formatters before
|
||||
submitting a change. However, it is not a strict requirement enforced by CI.
|
||||
|
||||
It is encouraged that all JS and CSS code be run through this before submitting
|
||||
a change. However, it is not a strict requirement enforced by CI.
|
||||
### Installing npm Dependencies:
|
||||
|
||||
1. Install [docker](https://docs.docker.com/get-docker/)
|
||||
2. Create a .gitignore file at repo root
|
||||
3. Add .gitignore and node_modules to .gitignore
|
||||
4. Run `./npm install`
|
||||
|
||||
### Run ESlint
|
||||
|
||||
./npx eslint [options] [file] [dir]
|
||||
|
||||
### Run Stylelint
|
||||
|
||||
./npx stylelint [input] [options]
|
||||
|
||||
## TypeScript Support
|
||||
|
||||
TypeScript files served from _content are transformed into JavaScript.
|
||||
Reference .ts files in html templates as module code.
|
||||
|
||||
`<script type="module" src="/ts/filename.ts">`
|
||||
|
||||
## Deploying
|
||||
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2022 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
docker run \
|
||||
--rm \
|
||||
--volume $(pwd):/workspace \
|
||||
--workdir /workspace \
|
||||
--entrypoint npm \
|
||||
node:16.13.1-alpine3.14 \
|
||||
$@
|
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2022 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
|
||||
docker run \
|
||||
--rm \
|
||||
--volume $(pwd):/workspace \
|
||||
--workdir /workspace \
|
||||
--entrypoint npx \
|
||||
node:16.13.1-alpine3.14 \
|
||||
$@
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^5.9.0",
|
||||
"@typescript-eslint/parser": "5.9.0",
|
||||
"eslint": "8.6.0",
|
||||
"eslint-config-google": "0.14.0",
|
||||
"eslint-config-prettier": "8.3.0",
|
||||
"eslint-plugin-prettier": "4.0.0",
|
||||
"prettier": "2.5.1",
|
||||
"stylelint-config-prettier": "9.0.3",
|
||||
"stylelint-config-standard": "24.0.0",
|
||||
"stylelint-order": "5.0.0",
|
||||
"stylelint-prettier": "2.0.0",
|
||||
"typescript": "4.5.4"
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче