diff --git a/.eslintrc.yaml b/.eslintrc.yaml index 06b284bd..a06f1d76 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -22,3 +22,10 @@ rules: # For overloads. no-dupe-class-members: off "@typescript-eslint/no-use-before-define": off + "@typescript-eslint/no-non-null-assertion": off + +settings: + # Does not work with CommonJS unfortunately. + import/ignore: + - env-paths + - xdg-basedir diff --git a/ci/README.md b/ci/README.md index a20c00bd..b0954524 100644 --- a/ci/README.md +++ b/ci/README.md @@ -78,6 +78,8 @@ You can disable minification by setting `MINIFY=`. - Used to configure [nfpm](https://github.com/goreleaser/nfpm) to generate .deb and .rpm - [./build/code-server-nfpm.sh](./build/code-server-nfpm.sh) - Entrypoint script for code-server for .deb and .rpm +- [./build/code-server.service](./build/code-server.service) + - systemd user service packaged into the debs and rpms - [./build/release-github-draft.sh](./build/release-github-draft.sh) (`yarn release:github-draft`) - Uses [hub](https://github.com/github/hub) to create a draft release with a template description - [./build/release-github-assets.sh](./build/release-github-assets.sh) (`yarn release:github-assets`) diff --git a/ci/build/code-server.service b/ci/build/code-server.service new file mode 100644 index 00000000..414f5451 --- /dev/null +++ b/ci/build/code-server.service @@ -0,0 +1,11 @@ +[Unit] +Description=code-server +After=network.target + +[Service] +Type=exec +ExecStart=/usr/bin/code-server +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/ci/build/nfpm.yaml b/ci/build/nfpm.yaml index efea4ece..c290eb18 100644 --- a/ci/build/nfpm.yaml +++ b/ci/build/nfpm.yaml @@ -13,4 +13,5 @@ license: "MIT" bindir: "/usr/bin" files: ./ci/build/code-server-nfpm.sh: /usr/bin/code-server + ./ci/build/code-server.service: /usr/lib/systemd/user/code-server.service ./release-static/**/*: "/usr/lib/code-server/" diff --git a/ci/dev/vscode.patch b/ci/dev/vscode.patch index cfab2db0..ac70e7bf 100644 --- a/ci/dev/vscode.patch +++ b/ci/dev/vscode.patch @@ -11,16 +11,88 @@ index e73dd4d9e8..e3192b3a0d 100644 build/node_modules coverage/ diff --git a/.yarnrc b/.yarnrc -index d86b284e83..a7300dbfb9 100644 +deleted file mode 100644 +index d86b284e83..0000000000 --- a/.yarnrc -+++ b/.yarnrc -@@ -1,3 +1,3 @@ ++++ /dev/null +@@ -1,3 +0,0 @@ -disturl "https://atom.io/download/electron" -target "7.2.4" -runtime "electron" -+disturl "http://nodejs.org/dist" -+target "12.16.3" -+runtime "node" +diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js +index f2ea1bd370..2dc6da34fb 100644 +--- a/build/gulpfile.reh.js ++++ b/build/gulpfile.reh.js +@@ -52,6 +52,7 @@ gulp.task('vscode-reh-web-linux-x64-min', noop); + gulp.task('vscode-reh-web-linux-alpine-min', noop); + + function getNodeVersion() { ++ return process.versions.node + const yarnrc = fs.readFileSync(path.join(REPO_ROOT, 'remote', '.yarnrc'), 'utf8'); + const target = /^target "(.*)"$/m.exec(yarnrc)[1]; + return target; +diff --git a/build/lib/electron.js b/build/lib/electron.js +index abf6baab41..8a1d1bad13 100644 +--- a/build/lib/electron.js ++++ b/build/lib/electron.js +@@ -17,6 +17,7 @@ const root = path.dirname(path.dirname(__dirname)); + const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8')); + const commit = util.getVersion(root); + function getElectronVersion() { ++ return process.versions.node; + const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8'); + const target = /^target "(.*)"$/m.exec(yarnrc)[1]; + return target; +diff --git a/build/lib/electron.ts b/build/lib/electron.ts +index 86c7afcf31..0663b4c28d 100644 +--- a/build/lib/electron.ts ++++ b/build/lib/electron.ts +@@ -20,6 +20,7 @@ const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf + const commit = util.getVersion(root); + + export function getElectronVersion(): string { ++ return process.versions.node + const yarnrc = fs.readFileSync(path.join(root, '.yarnrc'), 'utf8'); + const target = /^target "(.*)"$/m.exec(yarnrc)![1]; + return target; +diff --git a/build/lib/node.js b/build/lib/node.js +index 403ae3d965..738ee8cee0 100644 +--- a/build/lib/node.js ++++ b/build/lib/node.js +@@ -5,11 +5,8 @@ + *--------------------------------------------------------------------------------------------*/ + Object.defineProperty(exports, "__esModule", { value: true }); + const path = require("path"); +-const fs = require("fs"); + const root = path.dirname(path.dirname(__dirname)); +-const yarnrcPath = path.join(root, 'remote', '.yarnrc'); +-const yarnrc = fs.readFileSync(yarnrcPath, 'utf8'); +-const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)[1]; ++const version = process.versions.node; + const node = process.platform === 'win32' ? 'node.exe' : 'node'; + const nodePath = path.join(root, '.build', 'node', `v${version}`, `${process.platform}-${process.arch}`, node); + console.log(nodePath); +diff --git a/build/lib/node.ts b/build/lib/node.ts +index 6439703446..c53dccf4dc 100644 +--- a/build/lib/node.ts ++++ b/build/lib/node.ts +@@ -4,13 +4,10 @@ + *--------------------------------------------------------------------------------------------*/ + + import * as path from 'path'; +-import * as fs from 'fs'; + + const root = path.dirname(path.dirname(__dirname)); +-const yarnrcPath = path.join(root, 'remote', '.yarnrc'); +-const yarnrc = fs.readFileSync(yarnrcPath, 'utf8'); +-const version = /^target\s+"([^"]+)"$/m.exec(yarnrc)![1]; ++const version = process.versions.node; + const node = process.platform === 'win32' ? 'node.exe' : 'node'; + const nodePath = path.join(root, '.build', 'node', `v${version}`, `${process.platform}-${process.arch}`, node); + +-console.log(nodePath); +\ No newline at end of file ++console.log(nodePath); diff --git a/build/npm/postinstall.js b/build/npm/postinstall.js index 7a2320d828..5768890636 100644 --- a/build/npm/postinstall.js @@ -166,6 +238,15 @@ index 91b3b92678..f76f2c1548 100644 "urlProtocol": "code-oss", "extensionAllowedProposedApi": [ "ms-vscode.vscode-js-profile-table", +diff --git a/remote/.yarnrc b/remote/.yarnrc +deleted file mode 100644 +index 1e16cde724..0000000000 +--- a/remote/.yarnrc ++++ /dev/null +@@ -1,3 +0,0 @@ +-disturl "http://nodejs.org/dist" +-target "12.4.0" +-runtime "node" diff --git a/src/vs/base/common/network.ts b/src/vs/base/common/network.ts index e4546b2cf6..9df12239fb 100644 --- a/src/vs/base/common/network.ts diff --git a/ci/steps/publish-npm.sh b/ci/steps/publish-npm.sh index cbad679d..10865a61 100755 --- a/ci/steps/publish-npm.sh +++ b/ci/steps/publish-npm.sh @@ -10,6 +10,8 @@ main() { fi download_artifact npm-package ./release + # https://github.com/actions/upload-artifact/issues/38 + chmod +x $(grep -rl '^#!/.\+' release) yarn publish --non-interactive release } diff --git a/doc/FAQ.md b/doc/FAQ.md index ec0acf93..a4357560 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -168,10 +168,10 @@ code-server crashes can be helpful. ### Where is the data directory? If the `XDG_DATA_HOME` environment variable is set the data directory will be -`$XDG_DATA_HOME/code-server`. Otherwise the default is: +`$XDG_DATA_HOME/code-server`. Otherwise: -1. Linux: `~/.local/share/code-server`. -2. Mac: `~/Library/Application\ Support/code-server`. +1. Unix: `~/.local/share/code-server` +1. Windows: `%APPDATA%\Local\code-server\Data` ## Enterprise diff --git a/package.json b/package.json index d27eff82..87696289 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "@types/adm-zip": "^0.4.32", "@types/fs-extra": "^8.0.1", "@types/http-proxy": "^1.17.4", + "@types/js-yaml": "^3.12.3", "@types/mocha": "^5.2.7", "@types/node": "^12.12.7", "@types/parcel-bundler": "^1.12.1", @@ -55,8 +56,7 @@ "stylelint": "^13.0.0", "stylelint-config-recommended": "^3.0.0", "ts-node": "^8.4.1", - "typescript": "3.7.2", - "yarn": "^1.22.4" + "typescript": "3.7.2" }, "resolutions": { "@types/node": "^12.12.7", @@ -66,16 +66,20 @@ "dependencies": { "@coder/logger": "1.1.11", "adm-zip": "^0.4.14", + "env-paths": "^2.2.0", "fs-extra": "^8.1.0", "http-proxy": "^1.18.0", "httpolyglot": "^0.1.2", + "js-yaml": "^3.13.1", "limiter": "^1.1.5", "pem": "^1.14.2", "safe-compare": "^1.1.4", "semver": "^7.1.3", "tar": "^6.0.1", "tar-fs": "^2.0.0", - "ws": "^7.2.0" + "ws": "^7.2.0", + "xdg-basedir": "^4.0.0", + "yarn": "^1.22.4" }, "bin": { "code-server": "out/node/entry.js" diff --git a/src/browser/pages/login.html b/src/browser/pages/login.html index 6f8ce250..37d51f20 100644 --- a/src/browser/pages/login.html +++ b/src/browser/pages/login.html @@ -26,7 +26,7 @@

Welcome to code-server

-
Please log in below. Check code-server's logs for the generated password.
+
Please log in below. {{PASSWORD_MSG}}