Skip to content

Commit 332d02f

Browse files
committed
Format and lint
1 parent 80b1b1b commit 332d02f

30 files changed

+224
-130
lines changed

.eslintrc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
parser: "@typescript-eslint/parser"
22
env:
33
browser: true
4-
es6: true # Map, etc.
4+
es6: true # Map, etc.
55
mocha: true
66
node: true
77

.github/workflows/ci.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,33 @@ name: ci
22
on: [push, pull_request]
33

44
jobs:
5+
fmt:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v1
9+
10+
- name: Get yarn cache directory path
11+
id: yarn-cache-dir-path
12+
run: echo "::set-output name=dir::$(yarn cache dir)"
13+
- uses: actions/cache@v1
14+
id: yarn-cache
15+
with:
16+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
17+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
18+
restore-keys: |
19+
${{ runner.os }}-yarn-
20+
21+
- name: yarn fmt
22+
uses: ./ci/image
23+
with:
24+
args: yarn && yarn fmt
25+
526
lint:
627
runs-on: ubuntu-latest
728
steps:
829
- uses: actions/checkout@v1
930

10-
- name: get yarn cache directory path
31+
- name: Get yarn cache directory path
1132
id: yarn-cache-dir-path
1233
run: echo "::set-output name=dir::$(yarn cache dir)"
1334
- uses: actions/cache@v1

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ reset VS Code then run `yarn patch:apply`.
7474
## Security
7575

7676
### Authentication
77+
7778
By default `code-server` enables password authentication using a randomly
7879
generated password. You can set the `PASSWORD` environment variable to use your
7980
own instead or use `--auth none` to disable password authentication.
@@ -82,6 +83,7 @@ Do not expose `code-server` to the open internet without some form of
8283
authentication.
8384

8485
### Encrypting traffic with HTTPS
86+
8587
If you aren't doing SSL termination elsewhere you can directly give
8688
`code-server` a certificate with `code-server --cert` followed by the path to
8789
your certificate. Additionally, you can use certificate keys with `--cert-key`

ci/build.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Builder {
2626
this.ensureArgument("rootPath", this.rootPath)
2727
this.codeServerVersion = this.ensureArgument(
2828
"codeServerVersion",
29-
process.env.VERSION || require(path.join(this.rootPath, "package.json")).version
29+
process.env.VERSION || require(path.join(this.rootPath, "package.json")).version,
3030
)
3131
}
3232

@@ -208,7 +208,7 @@ class Builder {
208208
await Promise.all([
209209
fs.move(
210210
path.join(this.vscodeSourcePath, `out-vscode${process.env.MINIFY ? "-min" : ""}`),
211-
path.join(vscodeBuildPath, "out")
211+
path.join(vscodeBuildPath, "out"),
212212
),
213213
fs.copy(path.join(this.vscodeSourcePath, ".build/extensions"), path.join(vscodeBuildPath, "extensions")),
214214
])
@@ -225,7 +225,7 @@ class Builder {
225225
return Promise.all(
226226
["node_modules", "package.json", "yarn.lock"].map((fileName) => {
227227
return fs.copy(path.join(sourcePath, fileName), path.join(buildPath, fileName))
228-
})
228+
}),
229229
)
230230
})
231231

@@ -240,8 +240,8 @@ class Builder {
240240
...merge,
241241
},
242242
null,
243-
2
244-
)
243+
2,
244+
),
245245
)
246246
})
247247

@@ -290,7 +290,7 @@ class Builder {
290290
await fs.copyFile(path.join(this.vscodeSourcePath, "LICENSE.txt"), path.join(archivePath, "LICENSE.txt"))
291291
await fs.copyFile(
292292
path.join(this.vscodeSourcePath, "ThirdPartyNotices.txt"),
293-
path.join(archivePath, "ThirdPartyNotices.txt")
293+
path.join(archivePath, "ThirdPartyNotices.txt"),
294294
)
295295

296296
if ((await this.target()) === "darwin") {

ci/fmt.sh

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,35 @@
33
set -euo pipefail
44

55
main() {
6-
shfmt -i 2 -w -s -sr $$(git ls-files "*.sh")
7-
prettier --write --loglevel=warn $$(git ls-files "*.js" "*.ts" "*.tsx" "*.html" "*.json" "*.css" "*.md" "*.toml" "*.yaml" "*.yml")
8-
if [[ "$CI" != "" && $$(git ls-files --other --modified --exclude-standard) != "" ]]; then
9-
echo "Files need generation or are formatted incorrectly:"
10-
git -c color.ui=always status | grep --color=no '\[31m'
11-
echo "Please run the following locally:"
12-
echo " make fmt"
13-
exit 1
14-
fi
6+
if [[ ${CI-} ]]; then
7+
cd "$(dirname "$0")/.."
8+
./ci/vscode.sh
9+
fi
10+
11+
shfmt -i 2 -w -s -sr $(git ls-files "*.sh")
12+
13+
local prettierExts
14+
prettierExts = (
15+
"*.js"
16+
"*.ts"
17+
"*.tsx"
18+
"*.html"
19+
"*.json"
20+
"*.css"
21+
"*.md"
22+
"*.toml"
23+
"*.yaml"
24+
"*.yml"
25+
)
26+
prettier --write --loglevel=warn $(git ls-files "${prettierExts[@]}")
27+
28+
if [[ ${CI-} != "" && $(git ls-files --other --modified --exclude-standard) != "" ]]; then
29+
echo "Files need generation or are formatted incorrectly:"
30+
git -c color.ui=always status | grep --color=no '\[31m'
31+
echo "Please run the following locally:"
32+
echo " yarn fmt"
33+
exit 1
34+
fi
1535
}
1636

1737
main "$@"

ci/lint.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
set -euo pipefail
44

55
main() {
6-
eslint --max-warnings=0 --fix $$(git ls-files "*.ts" "*.tsx" "*.js")
7-
stylelint --fix $$(git ls-files "*.css")
6+
if [[ ${CI-} ]]; then
7+
cd "$(dirname "$0")/.."
8+
./ci/vscode.sh
9+
fi
10+
11+
eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js")
12+
stylelint --fix $(git ls-files "*.css")
813
}
914

1015
main "$@"
File renamed without changes.

ci/tsconfig.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{
22
"extends": "../tsconfig.json",
3-
"include": [
4-
"./**/*.ts"
5-
]
3+
"include": ["./**/*.ts"]
64
}

ci/vscode.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ main() {
1010
git submodule update --init
1111

1212
# If the patch fails to apply, then it's likely already applied
13-
yarn vscode:patch &>/dev/null || true
13+
yarn vscode:patch &> /dev/null || true
1414

1515
# Install VS Code dependencies.
1616
(cd lib/vscode && yarn)

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
77
"vscode": "ci/vscode.sh",
88
"vscode:patch": "cd ./lib/vscode && git apply ../../ci/vscode.patch",
99
"vscode:diff": "cd ./lib/vscode && git diff HEAD > ../../ci/vscode.patch",
10-
1110
"test": "mocha -r ts-node/register ./test/*.test.ts",
12-
1311
"lint": "ci/lint.sh",
1412
"fmt": "ci/fmt.sh",
15-
1613
"runner": "cd ./scripts && NODE_OPTIONS=--max_old_space_size=32384 ts-node ./build.ts",
1714
"build": "yarn runner build",
1815
"watch": "yarn runner watch",

src/browser/media/manifest.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
"display": "fullscreen",
66
"background-color": "#fff",
77
"description": "Run editors on a remote server.",
8-
"icons": [{
9-
"src": "./code-server.png",
10-
"sizes": "384x384",
11-
"type": "image/png"
12-
}]
8+
"icons": [
9+
{
10+
"src": "./code-server.png",
11+
"sizes": "384x384",
12+
"type": "image/png"
13+
}
14+
]
1315
}

src/browser/pages/app.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
6-
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;">
5+
<meta
6+
name="viewport"
7+
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
8+
/>
9+
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;" />
710
<title>code-server — {{APP_NAME}}</title>
811
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
9-
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
12+
<link
13+
rel="manifest"
14+
href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json"
15+
crossorigin="use-credentials"
16+
/>
1017
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
11-
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
12-
<meta id="coder-options" data-settings="{{OPTIONS}}">
18+
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet" />
19+
<meta id="coder-options" data-settings="{{OPTIONS}}" />
1320
</head>
1421
<body>
1522
<script src="{{BASE}}/static-{{COMMIT}}/dist/app.js"></script>

src/browser/pages/error.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
6-
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;">
5+
<meta
6+
name="viewport"
7+
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
8+
/>
9+
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;" />
710
<title>code-server {{ERROR_TITLE}}</title>
811
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
9-
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
12+
<link
13+
rel="manifest"
14+
href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json"
15+
crossorigin="use-credentials"
16+
/>
1017
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
11-
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
18+
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet" />
1219
</head>
1320
<body>
1421
<div class="center-container">
@@ -18,7 +25,7 @@ <h2 class="header">{{ERROR_HEADER}}</h2>
1825
{{ERROR_BODY}}
1926
</div>
2027
<div class="links">
21-
<a class="link" href="{{BASE}}">go home</a
28+
<a class="link" href="{{BASE}}">go home</a>
2229
</div>
2330
</div>
2431
</div>

src/browser/pages/global.css

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ body {
1010
background: #272727;
1111
color: #f4f4f4;
1212
margin: 0;
13-
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
13+
font-family:
14+
-apple-system,
15+
BlinkMacSystemFont,
16+
"Segoe UI",
17+
Roboto,
18+
Helvetica,
19+
Arial,
20+
sans-serif,
21+
"Apple Color Emoji",
22+
"Segoe UI Emoji",
23+
"Segoe UI Symbol";
1424
overflow: hidden;
1525
}
1626

src/browser/pages/home.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,21 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
6-
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;">
5+
<meta
6+
name="viewport"
7+
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
8+
/>
9+
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; manifest-src 'self'; img-src 'self' data:;" />
710
<title>code-server</title>
811
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
9-
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
12+
<link
13+
rel="manifest"
14+
href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json"
15+
crossorigin="use-credentials"
16+
/>
1017
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
11-
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
12-
<meta id="coder-options" data-settings="{{OPTIONS}}">
18+
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet" />
19+
<meta id="coder-options" data-settings="{{OPTIONS}}" />
1320
</head>
1421
<body>
1522
<div class="center-container">

src/browser/pages/login.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,23 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
6-
<meta http-equiv="Content-Security-Policy" content="style-src 'self'; script-src 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:;">
5+
<meta
6+
name="viewport"
7+
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"
8+
/>
9+
<meta
10+
http-equiv="Content-Security-Policy"
11+
content="style-src 'self'; script-src 'unsafe-inline'; manifest-src 'self'; img-src 'self' data:;"
12+
/>
713
<title>code-server login</title>
814
<link rel="icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/favicon.ico" type="image/x-icon" />
9-
<link rel="manifest" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json" crossorigin="use-credentials">
15+
<link
16+
rel="manifest"
17+
href="{{BASE}}/static-{{COMMIT}}/src/browser/media/manifest.json"
18+
crossorigin="use-credentials"
19+
/>
1020
<link rel="apple-touch-icon" href="{{BASE}}/static-{{COMMIT}}/src/browser/media/code-server.png" />
11-
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet">
21+
<link href="{{BASE}}/static-{{COMMIT}}/dist/app.css" rel="stylesheet" />
1222
</head>
1323
<body>
1424
<div class="center-container">
@@ -22,15 +32,16 @@
2232
<div class="field">
2333
<!-- The onfocus code places the cursor at the end of the value. -->
2434
<input
25-
required autofocus
35+
required
36+
autofocus
2637
value="{{VALUE}}"
2738
onfocus="const value=this.value;this.value='';this.value=value;"
2839
class="password"
2940
type="password"
3041
placeholder="password"
3142
name="password"
3243
autocomplete="current-password"
33-
/>
44+
/>
3445
<button class="submit" type="submit">
3546
Log In
3647
</button>

0 commit comments

Comments
 (0)