Archived
1
0

feat: customize getting started page (#5707)

* feat: add getting-started patch

This modifies the text on the Getting Started page to promote
coder/coder.

* feat: add --disable-getting-started-override

This adds a new CLI flag to code-server called
`--disable-getting-started` which will be used in Code to not use
Coder's custom Getting Started text.

* refactor: conditionally show coder getting started

This modifies the getting started patch changes to work with the new
`--disable-getting-started-override`.

The flag is false by default meaning the Coder getting started is shown.
By passing the flag to code-server, it will not be shown.

* docs: update faq for getting started override

* docs: update getting-started patch description

* fixup!: update patch

* fixup!: unit test

* feat: add more tests

* fixup!: use correct env var in tests

Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
This commit is contained in:
Joe Previte
2022-10-28 09:59:24 -07:00
committed by GitHub
parent ca182b9fb5
commit 649985af8e
5 changed files with 221 additions and 0 deletions

View File

@ -43,6 +43,7 @@ describe("parser", () => {
delete process.env.LOG_LEVEL
delete process.env.PASSWORD
delete process.env.CS_DISABLE_FILE_DOWNLOADS
delete process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE
console.log = jest.fn()
})
@ -97,6 +98,8 @@ describe("parser", () => {
"--disable-file-downloads",
"--disable-getting-started-override",
["--host", "0.0.0.0"],
"4",
"--",
@ -114,6 +117,7 @@ describe("parser", () => {
value: path.resolve("path/to/cert"),
},
"disable-file-downloads": true,
"disable-getting-started-override": true,
enable: ["feature1", "feature2"],
help: true,
host: "0.0.0.0",
@ -378,6 +382,30 @@ describe("parser", () => {
})
})
it("should use env var CS_DISABLE_GETTING_STARTED_OVERRIDE", async () => {
process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE = "1"
const args = parse([])
expect(args).toEqual({})
const defaultArgs = await setDefaults(args)
expect(defaultArgs).toEqual({
...defaults,
"disable-getting-started-override": true,
})
})
it("should use env var CS_DISABLE_GETTING_STARTED_OVERRIDE set to true", async () => {
process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE = "true"
const args = parse([])
expect(args).toEqual({})
const defaultArgs = await setDefaults(args)
expect(defaultArgs).toEqual({
...defaults,
"disable-getting-started-override": true,
})
})
it("should error if password passed in", () => {
expect(() => parse(["--password", "supersecret123"])).toThrowError(
"--password can only be set in the config file or passed in via $PASSWORD",