Skip to content

Commit c71a739

Browse files
committed
fix: modify product.json before building
Code injects this into the client during the build process so it needs to be updated before we build.
1 parent fc08fa6 commit c71a739

File tree

2 files changed

+43
-37
lines changed

2 files changed

+43
-37
lines changed

ci/build/build-release.sh

-37
Original file line numberDiff line numberDiff line change
@@ -98,43 +98,6 @@ bundle_vscode() {
9898

9999
rsync "${rsync_opts[@]}" ./lib/vscode-reh-web-*/ "$VSCODE_OUT_PATH"
100100

101-
# Add the commit, date, our name, links, and enable telemetry. This just makes
102-
# telemetry available; telemetry can still be disabled by flag or setting.
103-
jq --slurp '.[0] * .[1]' "$VSCODE_SRC_PATH/product.json" <(
104-
cat << EOF
105-
{
106-
"enableTelemetry": true,
107-
"commit": "$(cd "$VSCODE_SRC_PATH" && git rev-parse HEAD)",
108-
"quality": "stable",
109-
"date": $(jq -n 'now | todate'),
110-
"codeServerVersion": "$VERSION",
111-
"nameShort": "code-server",
112-
"nameLong": "code-server",
113-
"applicationName": "code-server",
114-
"dataFolderName": ".code-server",
115-
"win32MutexName": "codeserver",
116-
"licenseUrl": "https://github.com/coder/code-server/blob/main/LICENSE",
117-
"win32DirName": "code-server",
118-
"win32NameVersion": "code-server",
119-
"win32AppUserModelId": "coder.code-server",
120-
"win32ShellNameShort": "c&ode-server",
121-
"darwinBundleIdentifier": "com.coder.code.server",
122-
"linuxIconName": "com.coder.code.server",
123-
"reportIssueUrl": "https://github.com/coder/code-server/issues/new",
124-
"documentationUrl": "https://go.microsoft.com/fwlink/?LinkID=533484#vscode",
125-
"keyboardShortcutsUrlMac": "https://go.microsoft.com/fwlink/?linkid=832143",
126-
"keyboardShortcutsUrlLinux": "https://go.microsoft.com/fwlink/?linkid=832144",
127-
"keyboardShortcutsUrlWin": "https://go.microsoft.com/fwlink/?linkid=832145",
128-
"introductoryVideosUrl": "https://go.microsoft.com/fwlink/?linkid=832146",
129-
"tipsAndTricksUrl": "https://go.microsoft.com/fwlink/?linkid=852118",
130-
"newsletterSignupUrl": "https://www.research.net/r/vsc-newsletter",
131-
"linkProtectionTrustedDomains": [
132-
"https://open-vsx.org"
133-
]
134-
}
135-
EOF
136-
) > "$VSCODE_OUT_PATH/product.json"
137-
138101
# Use the package.json for the web/remote server. It does not have the right
139102
# version though so pull that from the main package.json.
140103
jq --slurp '.[0] * {version: .[1].version}' \

ci/build/build-vscode.sh

+43
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,51 @@ MINIFY=${MINIFY-true}
99
main() {
1010
cd "$(dirname "${0}")/../.."
1111

12+
source ./ci/lib.sh
13+
1214
cd lib/vscode
1315

16+
# Add the commit, date, our name, links, and enable telemetry (this just makes
17+
# telemetry available; telemetry can still be disabled by flag or setting).
18+
# This needs to be done before building as Code will read this file and embed
19+
# it into the client-side code.
20+
cp product.json product.original.json
21+
jq --slurp '.[0] * .[1]' product.original.json <(
22+
cat << EOF
23+
{
24+
"enableTelemetry": true,
25+
"commit": "$(git rev-parse HEAD)",
26+
"quality": "stable",
27+
"date": $(jq -n 'now | todate'),
28+
"codeServerVersion": "$VERSION",
29+
"nameShort": "code-server",
30+
"nameLong": "code-server",
31+
"applicationName": "code-server",
32+
"dataFolderName": ".code-server",
33+
"win32MutexName": "codeserver",
34+
"licenseUrl": "https://github.com/coder/code-server/blob/main/LICENSE",
35+
"win32DirName": "code-server",
36+
"win32NameVersion": "code-server",
37+
"win32AppUserModelId": "coder.code-server",
38+
"win32ShellNameShort": "c&ode-server",
39+
"darwinBundleIdentifier": "com.coder.code.server",
40+
"linuxIconName": "com.coder.code.server",
41+
"reportIssueUrl": "https://github.com/coder/code-server/issues/new",
42+
"documentationUrl": "https://go.microsoft.com/fwlink/?LinkID=533484#vscode",
43+
"keyboardShortcutsUrlMac": "https://go.microsoft.com/fwlink/?linkid=832143",
44+
"keyboardShortcutsUrlLinux": "https://go.microsoft.com/fwlink/?linkid=832144",
45+
"keyboardShortcutsUrlWin": "https://go.microsoft.com/fwlink/?linkid=832145",
46+
"introductoryVideosUrl": "https://go.microsoft.com/fwlink/?linkid=832146",
47+
"tipsAndTricksUrl": "https://go.microsoft.com/fwlink/?linkid=852118",
48+
"newsletterSignupUrl": "https://www.research.net/r/vsc-newsletter",
49+
"linkProtectionTrustedDomains": [
50+
"https://open-vsx.org"
51+
]
52+
}
53+
EOF
54+
) > product.json
55+
rm product.original.json
56+
1457
# Any platform works since we have our own packaging step (for now).
1558
yarn gulp "vscode-reh-web-linux-x64${MINIFY:+-min}"
1659
}

0 commit comments

Comments
 (0)