Skip to content

Commit b3ae4d6

Browse files
committed
Hide bundled node_modules to prevent them from being ignored
1 parent d30f3db commit b3ae4d6

File tree

5 files changed

+44
-10
lines changed

5 files changed

+44
-10
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ For a proper setup and walkthrough, please see [./doc/guide.md](./doc/guide.md).
2020
```bash
2121
curl -sSOL https://github.com/cdr/code-server/releases/download/3.3.0/code-server_3.3.0_amd64.deb
2222
sudo dpkg -i code-server_3.3.0_amd64.deb
23-
sudo systemctl enable --now code-server
23+
systemctl --user enable --now code-server
2424
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
2525
```
2626

@@ -29,7 +29,7 @@ sudo systemctl enable --now code-server
2929
```bash
3030
curl -sSOL https://github.com/cdr/code-server/releases/download/3.3.0/code-server-3.3.0-amd64.rpm
3131
sudo yum install -y code-server-3.3.0-amd64.rpm
32-
sudo systemctl enable --now code-server
32+
systemctl --user enable --now code-server
3333
# Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml
3434
```
3535

ci/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ You can disable minification by setting `MINIFY=`.
9090
- Downloads the release-package artifacts for the current commit from CI
9191
- Uses [hub](https://github.com/github/hub) to upload the artifacts to the release
9292
specified in `package.json`
93+
- [./build/npm-postinstall.sh](./build/npm-postinstall.sh)
94+
- Post install script for the npm package
95+
- Bundled by`yarn release`
9396

9497
## release-container
9598

ci/build/build-release.sh

+17-7
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,20 @@ bundle_code_server() {
3232
mkdir -p "$RELEASE_PATH/src/browser/pages"
3333
rsync src/browser/pages/*.html "$RELEASE_PATH/src/browser/pages"
3434

35-
rsync yarn.lock "$RELEASE_PATH"
36-
3735
# Adds the commit to package.json
3836
jq --slurp '.[0] * .[1]' package.json <(
3937
cat << EOF
4038
{
4139
"commit": "$(git rev-parse HEAD)",
4240
"scripts": {
43-
"postinstall": "cd lib/vscode && npm rebuild # Builds native modules"
41+
"postinstall": "./postinstall.sh"
4442
}
4543
}
4644
EOF
4745
) > "$RELEASE_PATH/package.json"
46+
rsync yarn.lock "$RELEASE_PATH"
47+
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
48+
4849
}
4950

5051
bundle_vscode() {
@@ -72,13 +73,22 @@ EOF
7273
yarn --production --ignore-scripts
7374
popd
7475

75-
# Now we clear any native module builds.
76-
local nativeModules
77-
mapfile -t nativeModules < <(find "$VSCODE_OUT_PATH/node_modules" -name "binding.gyp" -exec dirname {} \;)
76+
# We clear any native module builds.
77+
local native_modules
78+
mapfile -t native_modules < <(find "$VSCODE_OUT_PATH/node_modules" -name "binding.gyp" -exec dirname {} \;)
7879
local nm
79-
for nm in "${nativeModules[@]}"; do
80+
for nm in "${native_modules[@]}"; do
8081
rm -R "$nm/build"
8182
done
83+
84+
# We have to rename node_modules to node_modules.bundled to avoid them being ignored by yarn.
85+
local node_modules
86+
mapfile -t node_modules < <(find "$VSCODE_OUT_PATH" -depth -name "node_modules")
87+
local nm
88+
for nm in "${node_modules[@]}"; do
89+
rm -Rf "$nm.bundled"
90+
mv "$nm" "$nm.bundled"
91+
done
8292
}
8393

8494
main "$@"

ci/build/npm-postinstall.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
4+
main() {
5+
cd lib/vscode
6+
7+
# We have to rename node_modules.bundled to node_modules.
8+
# The bundled modules were renamed originally to avoid being ignored by yarn.
9+
local node_modules
10+
node_modules="$(find . -depth -name "node_modules.bundled")"
11+
local nm
12+
for nm in $node_modules; do
13+
rm -Rf "${nm%.bundled}"
14+
mv "$nm" "${nm%.bundled}"
15+
done
16+
17+
# Rebuilds native modules.
18+
npm rebuild
19+
}
20+
21+
main "$@"

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "code-server",
33
"license": "MIT",
4-
"version": "3.3.0-rc.10",
4+
"version": "3.3.0-rc.21",
55
"description": "Run VS Code on a remote server.",
66
"homepage": "https://github.com/cdr/code-server",
77
"bugs": {

0 commit comments

Comments
 (0)