1
1
#! /usr/bin/env bash
2
2
set -euo pipefail
3
3
4
- # This script requires code-server and vscode to be built with
5
- # matching MINIFY.
6
-
7
- # RELEASE_PATH is the destination directory for the release from the root.
8
- # Defaults to release
9
- RELEASE_PATH=" ${RELEASE_PATH-release} "
10
-
11
- # STATIC controls whether node and node_modules are packaged into the release.
12
- # Disabled by default.
13
- STATIC=" ${STATIC-} "
4
+ # This script requires code-server and vscode to be built with matching MINIFY.
14
5
15
6
# MINIFY controls whether minified vscode is bundled and whether
16
7
# any included node_modules are pruned for production.
17
8
MINIFY=" ${MINIFY-true} "
18
9
19
- VSCODE_SRC_PATH=" lib/vscode"
20
-
21
- VSCODE_OUT_PATH=" $RELEASE_PATH /lib/vscode"
22
-
23
10
main () {
24
11
cd " $( dirname " ${0} " ) /../.."
25
- source ./ci/lib.sh
12
+ source ./ci/build/lib.sh
13
+
14
+ VSCODE_SRC_PATH=" lib/vscode"
15
+ VSCODE_OUT_PATH=" $RELEASE_PATH /lib/vscode"
26
16
27
17
mkdir -p " $RELEASE_PATH "
28
18
@@ -32,20 +22,6 @@ main() {
32
22
rsync README.md " $RELEASE_PATH "
33
23
rsync LICENSE.txt " $RELEASE_PATH "
34
24
rsync ./lib/vscode/ThirdPartyNotices.txt " $RELEASE_PATH "
35
-
36
- if [[ $STATIC ]]; then
37
- rsync " $RELEASE_PATH /" " $RELEASE_PATH -static"
38
- RELEASE_PATH+=-static
39
- VSCODE_OUT_PATH=" $RELEASE_PATH /lib/vscode"
40
-
41
- bundle_node
42
- else
43
- rm -Rf " $VSCODE_OUT_PATH /extensions/node_modules"
44
- fi
45
- }
46
-
47
- rsync () {
48
- command rsync -a --del " $@ "
49
25
}
50
26
51
27
bundle_code_server () {
@@ -76,6 +52,7 @@ bundle_vscode() {
76
52
mkdir -p " $VSCODE_OUT_PATH "
77
53
rsync " $VSCODE_SRC_PATH /out-vscode${MINIFY+-min} /" " $VSCODE_OUT_PATH /out"
78
54
rsync " $VSCODE_SRC_PATH /.build/extensions/" " $VSCODE_OUT_PATH /extensions"
55
+ rm -Rf " $VSCODE_OUT_PATH /extensions/node_modules"
79
56
rsync " $VSCODE_SRC_PATH /extensions/package.json" " $VSCODE_OUT_PATH /extensions"
80
57
rsync " $VSCODE_SRC_PATH /extensions/yarn.lock" " $VSCODE_OUT_PATH /extensions"
81
58
rsync " $VSCODE_SRC_PATH /extensions/postinstall.js" " $VSCODE_OUT_PATH /extensions"
103
80
jq ' del(.scripts)' < " $VSCODE_SRC_PATH /package.json" > " $VSCODE_OUT_PATH /package.json"
104
81
}
105
82
106
- bundle_node () {
107
- # We cannot find the path to node from $PATH because yarn shims a script to ensure
108
- # we use the same version it's using so we instead run a script with yarn that
109
- # will print the path to node.
110
- local node_path
111
- node_path=" $( yarn -s node <<< ' console.info(process.execPath)' ) "
112
-
113
- mkdir -p " $RELEASE_PATH /bin"
114
- rsync ./ci/build/code-server.sh " $RELEASE_PATH /bin/code-server"
115
- rsync " $node_path " " $RELEASE_PATH /lib/node"
116
-
117
- rsync node_modules " $RELEASE_PATH "
118
- rsync " $VSCODE_SRC_PATH /node_modules" " $VSCODE_OUT_PATH "
119
-
120
- if [[ $MINIFY ]]; then
121
- pushd " $RELEASE_PATH "
122
- yarn --production
123
- popd
124
- fi
125
- }
126
-
127
83
main " $@ "
0 commit comments