diff --git a/flake.nix b/flake.nix index c58774661..a01f68295 100644 --- a/flake.nix +++ b/flake.nix @@ -12,13 +12,13 @@ in { devShells.default = pkgs.mkShell { nativeBuildInputs = with pkgs; [ - nodejs yarn' python pkg-config git rsync jq moreutils + nodejs yarn' python pkg-config git rsync jq moreutils quilt bats ]; buildInputs = with pkgs; (lib.optionals (!stdenv.isDarwin) [ libsecret ] ++ (with xorg; [ libX11 libxkbfile ]) - ++ lib.optionals stdenv.isDarwin [ - AppKit Cocoa CoreServices Security cctools xcbuild - ]); + ++ lib.optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ + AppKit Cocoa CoreServices Security xcbuild + ])); }; } ); diff --git a/install.sh b/install.sh index f6d3274b9..026ee2f97 100755 --- a/install.sh +++ b/install.sh @@ -131,6 +131,11 @@ Or, if you don't want/need a background service you can run: EOF } +echo_coder_postinstall() { + echoh + echoh "Deploy code-server for your team with Coder: https://github.com/coder/coder" +} + main() { if [ "${TRACE-}" ]; then set -x @@ -243,6 +248,7 @@ main() { if [ "$METHOD" = standalone ]; then if has_standalone; then install_standalone + echo_coder_postinstall exit 0 else echoerr "There are no standalone releases for $ARCH" @@ -286,6 +292,8 @@ main() { npm_fallback install_standalone ;; esac + + echo_coder_postinstall } parse_arg() { diff --git a/patches/getting-started.diff b/patches/getting-started.diff index 247c3a311..fb6c0a882 100644 --- a/patches/getting-started.diff +++ b/patches/getting-started.diff @@ -10,7 +10,7 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts +++ code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/gettingStarted.ts -@@ -62,7 +62,7 @@ import { GettingStartedIndexList } from +@@ -62,7 +62,7 @@ import { GettingStartedIndexList } from import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent'; import { KeyCode } from 'vs/base/common/keyCodes'; import { getTelemetryLevel } from 'vs/platform/telemetry/common/telemetryUtils'; @@ -19,32 +19,106 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/bro import { OpenFolderViaWorkspaceAction } from 'vs/workbench/browser/actions/workspaceActions'; import { OpenRecentAction } from 'vs/workbench/browser/actions/windowActions'; import { Toggle } from 'vs/base/browser/ui/toggle/toggle'; -@@ -753,11 +753,24 @@ export class GettingStartedPage extends - onShowOnStartupChanged(); - })); - -- const header = $('.header', {}, -+ let header = $('.header', {}, - $('h1.product-name.caption', {}, this.productService.nameLong), +@@ -758,6 +758,72 @@ export class GettingStartedPage extends $('p.subtitle.description', {}, localize({ key: 'gettingStarted.editingEvolved', comment: ['Shown as subtitle on the Welcome page.'] }, "Editing evolved")) ); ++ let gettingStartedCoder: HTMLElement = $('.header', {}); + if (this.contextService.contextMatchesRules(IsEnabledCoderGettingStarted)) { -+ header = $('.header', {}, -+ $('h1.product-name.caption', {}, this.productService.nameLong), -+ $('p.subtitle.description.coder', {}, -+ "Using code-server on a team?", -+ ), -+ $('p.subtitle.description.coder-coder', {}, -+ "Check out: ", -+ $('a', { href: "https://github.com/coder/coder" }, "coder/coder") -+ ), -+ ); ++ gettingStartedCoder = $('.gettingStartedCategory', {}, ++ $('h2', { ++ style: 'margin-bottom: 12px', ++ }, 'Next Up'), ++ $('a', { ++ href: 'https://cdr.co/code-server-to-coder', ++ target: '_blank', ++ }, ++ $('button', { ++ style: [ ++ 'padding: 10px 16px ', ++ 'border-radius: 4px', ++ 'background: linear-gradient(94.04deg, #7934DA 0%, #4D52E0 101.2%)', ++ 'color: white', ++ 'overflow: hidden', ++ 'margin-right: 14px', ++ ].join(';'), ++ }, ++ $('h3', { ++ style: [ ++ 'margin: 0px 0px 6px', ++ 'font-weight: 500', ++ ].join(';'), ++ }, 'Deploy code-server for your team'), ++ $('p', { ++ style: [ ++ 'margin: 0', ++ 'font-size: 13px', ++ 'color: #dcdee2', ++ ].join(';'), ++ }, 'Provision remote development environments on your infrastructure with Coder.'), ++ $('p', { ++ style: [ ++ 'margin-top: 8px', ++ 'font-size: 13px', ++ 'color: #dcdee2', ++ ].join(';'), ++ }, 'Coder is a self-service portal which provisions via Terraform—Linux, macOS, Windows, x86, ARM, and, of course, Kubernetes based infrastructure.'), ++ $('p', { ++ style: [ ++ 'margin: 0', ++ 'margin-top: 8px', ++ 'font-size: 13px', ++ 'display: flex', ++ 'align-items: center', ++ ].join(';'), ++ }, 'Get started ', $('span', { ++ class: Codicon.arrowRight.classNames, ++ style: [ ++ 'color: white', ++ 'margin-left: 8px', ++ ].join(';'), ++ })), ++ $('img', { ++ src: './_static/src/browser/media/templates.png', ++ style: [ ++ 'margin-bottom: -65px', ++ ].join(';'), ++ }), ++ ), ++ ), ++ ); + } + const leftColumn = $('.categories-column.categories-column-left', {},); const rightColumn = $('.categories-column.categories-column-right', {},); +@@ -775,13 +841,23 @@ export class GettingStartedPage extends + const layoutLists = () => { + if (gettingStartedList.itemCount) { + this.container.classList.remove('noWalkthroughs'); +- reset(leftColumn, startList.getDomElement(), recentList.getDomElement()); +- reset(rightColumn, gettingStartedList.getDomElement()); ++ if (this.contextService.contextMatchesRules(IsEnabledCoderGettingStarted)) { ++ reset(leftColumn, startList.getDomElement(), recentList.getDomElement(), gettingStartedList.getDomElement()); ++ reset(rightColumn, gettingStartedCoder); ++ } else { ++ reset(leftColumn, startList.getDomElement(), recentList.getDomElement()); ++ reset(rightColumn, gettingStartedList.getDomElement()); ++ } ++ + recentList.setLimit(5); + } + else { + this.container.classList.add('noWalkthroughs'); +- reset(leftColumn, startList.getDomElement()); ++ if (this.contextService.contextMatchesRules(IsEnabledCoderGettingStarted)) { ++ reset(leftColumn, startList.getDomElement(), gettingStartedCoder); ++ } else { ++ reset(leftColumn, startList.getDomElement()); ++ } + reset(rightColumn, recentList.getDomElement()); + recentList.setLimit(10); + } Index: code-server/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css =================================================================== --- code-server.orig/lib/vscode/src/vs/workbench/contrib/welcomeGettingStarted/browser/media/gettingStarted.css diff --git a/src/browser/media/templates.png b/src/browser/media/templates.png new file mode 100644 index 000000000..1437658ec Binary files /dev/null and b/src/browser/media/templates.png differ diff --git a/test/scripts/install.bats b/test/scripts/install.bats index 651236b7a..c9fd8c0fa 100644 --- a/test/scripts/install.bats +++ b/test/scripts/install.bats @@ -11,14 +11,14 @@ function should-use-deb() { DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run [ "$status" -eq 0 ] [ "${lines[1]}" = "Installing v$VERSION of the $2 deb package from GitHub." ] - [ "${lines[-5]}" = "deb package has been installed." ] + [ "${lines[-6]}" = "deb package has been installed." ] } function should-use-rpm() { DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run [ "$status" -eq 0 ] [ "${lines[1]}" = "Installing v$VERSION of the $2 rpm package from GitHub." ] - [ "${lines[-5]}" = "rpm package has been installed." ] + [ "${lines[-6]}" = "rpm package has been installed." ] } function should-fallback-npm() { @@ -27,21 +27,21 @@ function should-fallback-npm() { [ "${lines[1]}" = "No standalone releases for $2." ] [ "${lines[2]}" = "Falling back to installation from npm." ] [ "${lines[3]}" = "Installing latest from npm." ] - [ "${lines[-5]}" = "npm package has been installed." ] + [ "${lines[-6]}" = "npm package has been installed." ] } function should-use-npm() { YARN_PATH=true DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run [ "$status" -eq 0 ] [ "${lines[1]}" = "Installing latest from npm." ] - [ "${lines[-5]}" = "npm package has been installed." ] + [ "${lines[-6]}" = "npm package has been installed." ] } function should-use-aur() { DISTRO=$1 ARCH=$2 OS=linux run "$SCRIPT" --dry-run [ "$status" -eq 0 ] [ "${lines[1]}" = "Installing latest from the AUR." ] - [ "${lines[-5]}" = "AUR package has been installed." ] + [ "${lines[-6]}" = "AUR package has been installed." ] } function should-fallback-npm-brew() { @@ -52,21 +52,21 @@ function should-fallback-npm-brew() { [ "${lines[3]}" = "No standalone releases for $1." ] [ "${lines[4]}" = "Falling back to installation from npm." ] [ "${lines[5]}" = "Installing latest from npm." ] - [ "${lines[-5]}" = "npm package has been installed." ] + [ "${lines[-6]}" = "npm package has been installed." ] } function should-use-brew() { BREW_PATH=true OS=macos ARCH=$1 run "$SCRIPT" --dry-run [ "$status" -eq 0 ] [ "${lines[1]}" = "Installing latest from Homebrew." ] - [ "${lines[-3]}" = "Brew release has been installed." ] + [ "${lines[-4]}" = "Brew release has been installed." ] } function should-use-standalone() { DISTRO=$1 ARCH=$2 OS=$3 run "$SCRIPT" --method standalone --dry-run [ "$status" -eq 0 ] [ "${lines[1]}" = "Installing v$VERSION of the $2 release from GitHub." ] - [[ "${lines[-5]}" = "Standalone release has been installed"* ]] + [[ "${lines[-6]}" = "Standalone release has been installed"* ]] } @test "$SCRIPT_NAME: usage with --help" { @@ -141,7 +141,7 @@ function should-use-standalone() { [ "${lines[1]}" = "Homebrew not installed." ] [ "${lines[2]}" = "Falling back to standalone installation." ] [ "${lines[3]}" = "Installing v$VERSION of the amd64 release from GitHub." ] - [[ "${lines[-5]}" = "Standalone release has been installed"* ]] + [[ "${lines[-6]}" = "Standalone release has been installed"* ]] } @test "$SCRIPT_NAME: macos i386 (no brew)" { should-fallback-npm-brew "i386"