Bump NodeJS to v18 (#56546)

* Bump NodeJS to v18

v16 is completely without support now, so finally making the switch to v18!

sg start and building the server image still seem to work - so I'm assuming this is fine.

Bazel question: Where does bazel get it's nodejs version from? Is this covered in this diff?

* update rules_js,rules_ts for node 18

* add rules_ts bazelrc config

* update test timeouts

* use 6.0.1 rules_nodejs and 18.17.1 nodejs tls

---------

Co-authored-by: William Bezuidenhout <william.bezuidenhout@sourcegraph.com>
This commit is contained in:
Erik Seliger 2023-09-13 10:48:33 -05:00 committed by GitHub
parent be69812776
commit bf63610fad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 221 additions and 197 deletions

View File

@ -0,0 +1,5 @@
# Needed by rules_ts for accurate type checking
build --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
fetch --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig
query --@aspect_rules_ts//ts:skipLibCheck=honor_tsconfig

View File

@ -6,6 +6,7 @@ import %workspace%/.aspect/bazelrc/correctness.bazelrc
import %workspace%/.aspect/bazelrc/debug.bazelrc
import %workspace%/.aspect/bazelrc/javascript.bazelrc
import %workspace%/.aspect/bazelrc/performance.bazelrc
import %workspace%/.aspect/bazelrc/rules_ts.bazelrc
### YOUR PROJECT SPECIFIC SETTINGS GO HERE ###

View File

@ -32,7 +32,7 @@ jobs:
# set up correct version of node
- name: Setup Node
id: node-setup
run: echo "NODE_VERSION=16.18.1" >> ${GITHUB_OUTPUT}
run: echo "NODE_VERSION=18.17.1" >> ${GITHUB_OUTPUT}
- uses: actions/setup-node@v2
with: { node-version: "${{ steps.node-setup.outputs.NODE_VERSION }}" }

View File

@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.18.1
node-version: 18.17.1
- uses: pnpm/action-setup@v2
with:
version: latest

View File

@ -1,5 +1,5 @@
golang 1.20.8
nodejs 16.18.1
nodejs 18.17.1
fd 8.6.0
shfmt 3.5.0
shellcheck 0.7.1

View File

@ -20,18 +20,26 @@ http_archive(
url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.31.2/bazel-lib-v1.31.2.tar.gz",
)
# rules_js defines an older rules_nodejs, so we override it here
http_archive(
name = "rules_nodejs",
sha256 = "5ad078287b5f3069735652e1fc933cb2e2189b15d2c9fc826c889dc466c32a07",
strip_prefix = "rules_nodejs-6.0.1",
url = "https://github.com/bazelbuild/rules_nodejs/releases/download/v6.0.1/rules_nodejs-v6.0.1.tar.gz",
)
http_archive(
name = "aspect_rules_js",
sha256 = "0b69e0967f8eb61de60801d6c8654843076bf7ef7512894a692a47f86e84a5c2",
strip_prefix = "rules_js-1.27.1",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.27.1/rules_js-v1.27.1.tar.gz",
sha256 = "77c4ea46c27f96e4aadcc580cd608369208422cf774988594ae8a01df6642c82",
strip_prefix = "rules_js-1.32.2",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.32.2/rules_js-v1.32.2.tar.gz",
)
http_archive(
name = "aspect_rules_ts",
sha256 = "ace5b609603d9b5b875d56c9c07182357c4ee495030f40dcefb10d443ba8c208",
strip_prefix = "rules_ts-1.4.0",
url = "https://github.com/aspect-build/rules_ts/releases/download/v1.4.0/rules_ts-v1.4.0.tar.gz",
sha256 = "8aabb2055629a7becae2e77ae828950d3581d7fc3602fe0276e6e039b65092cb",
strip_prefix = "rules_ts-2.0.0",
url = "https://github.com/aspect-build/rules_ts/releases/download/v2.0.0/rules_ts-v2.0.0.tar.gz",
)
http_archive(
@ -132,7 +140,7 @@ load("@rules_nodejs//nodejs:repositories.bzl", "nodejs_register_toolchains")
nodejs_register_toolchains(
name = "nodejs",
node_version = "16.19.0",
node_version = "18.17.1",
)
# rules_js npm setup ============================

View File

@ -281,7 +281,7 @@ npm_package(
jest_test(
name = "test",
timeout = "moderate",
timeout = "long",
data = [
":branded_tests",
],

View File

@ -852,7 +852,7 @@ export async function createDriverForTest(options?: Partial<DriverOptions>): Pro
// Chrome
args.push(`--window-size=${config.windowWidth},${config.windowHeight}`)
if (process.getuid() === 0) {
if (process.getuid?.() === 0) {
// TODO don't run as root in CI
logger.warn('Running as root, disabling sandbox')
args.push('--no-sandbox', '--disable-setuid-sandbox')

View File

@ -41,6 +41,7 @@ export const AdminSidebarItems: Story = () => (
batchChangesExecutionEnabled={true}
batchChangesWebhookLogsEnabled={true}
codeInsightsEnabled={true}
endUserOnboardingEnabled={false}
/>
<SiteAdminSidebar
{...webProps}
@ -51,6 +52,7 @@ export const AdminSidebarItems: Story = () => (
batchChangesExecutionEnabled={true}
batchChangesWebhookLogsEnabled={true}
codeInsightsEnabled={true}
endUserOnboardingEnabled={false}
/>
<SiteAdminSidebar
{...webProps}
@ -61,6 +63,7 @@ export const AdminSidebarItems: Story = () => (
batchChangesExecutionEnabled={true}
batchChangesWebhookLogsEnabled={true}
codeInsightsEnabled={true}
endUserOnboardingEnabled={false}
/>
<SiteAdminSidebar
{...webProps}
@ -71,6 +74,7 @@ export const AdminSidebarItems: Story = () => (
batchChangesExecutionEnabled={false}
batchChangesWebhookLogsEnabled={false}
codeInsightsEnabled={true}
endUserOnboardingEnabled={false}
/>
<SiteAdminSidebar
{...webProps}
@ -81,6 +85,7 @@ export const AdminSidebarItems: Story = () => (
batchChangesExecutionEnabled={true}
batchChangesWebhookLogsEnabled={true}
codeInsightsEnabled={false}
endUserOnboardingEnabled={false}
/>
</Grid>
)}

View File

@ -131,6 +131,7 @@ const barData: FetchOwnersAndHistoryResult = {
},
__typename: 'GitCommit',
},
changelist: null,
__typename: 'Repository',
},
}

View File

@ -571,7 +571,7 @@ npm_package(
jest_test(
name = "test",
timeout = "short",
timeout = "moderate",
data = [
":wildcard_tests",
],

View File

@ -74,7 +74,7 @@ def ts_project(name, srcs = [], deps = [], use_preset_env = True, **kwargs):
visibility = visibility,
testonly = kwargs.get("testonly", None),
),
supports_workers = False,
supports_workers = 0,
# Allow any other args
**kwargs

View File

@ -7,7 +7,7 @@
"url": "https://github.com/sourcegraph/sourcegraph"
},
"engines": {
"node": "^v16.18.1",
"node": "^v18.17.1",
"pnpm": "^8.3.0"
},
"scripts": {
@ -194,7 +194,7 @@
"@types/mock-require": "^2.0.1",
"@types/mockdate": "2.0.0",
"@types/mz": "2.7.3",
"@types/node": "13.13.5",
"@types/node": "18.17.15",
"@types/node-fetch": "2.5.10",
"@types/pollyjs__adapter": "4.3.0",
"@types/pollyjs__core": "4.3.1",

File diff suppressed because it is too large Load Diff

View File

@ -97,9 +97,9 @@ mkShell {
shellcheck
# Web tools.
nodejs-16_x
nodejs-16_x.pkgs.pnpm
nodejs-16_x.pkgs.typescript
nodejs-18_x
nodejs-18_x.pkgs.pnpm
nodejs-18_x.pkgs.typescript
# Rust utils for syntax-highlighter service, currently not pinned to the same versions.
cargo