@@ -23,6 +23,8 @@ main() {
23
23
bundle_code_server
24
24
bundle_vscode
25
25
26
+ create_shrinkwraps
27
+
26
28
rsync ./docs/README.md " $RELEASE_PATH "
27
29
rsync LICENSE.txt " $RELEASE_PATH "
28
30
rsync ./lib/vscode/ThirdPartyNotices.txt " $RELEASE_PATH "
56
58
) > " $RELEASE_PATH /package.json"
57
59
rsync yarn.lock " $RELEASE_PATH "
58
60
59
- # To ensure deterministic dependency versions (even when code-server is installed with NPM), we seed
60
- # an npm-shrinkwrap file from our yarn lockfile and the current node-modules installed.
61
- synp --source-file yarn.lock
62
- npm shrinkwrap
63
- # HACK@edvincent: The shrinkwrap file will contain the devDependencies, which by default
64
- # are installed if present in a lockfile. To avoid every user having to specify --production
65
- # to skip them, we carefully remove them from the shrinkwrap file.
66
- json -f npm-shrinkwrap.json -I -e " Object.keys(this.dependencies).forEach(dependency => { if (this.dependencies[dependency].dev) { delete this.dependencies[dependency] } } )"
67
- mv npm-shrinkwrap.json " $RELEASE_PATH "
68
-
69
61
rsync ci/build/npm-postinstall.sh " $RELEASE_PATH /postinstall.sh"
70
62
71
63
if [ " $KEEP_MODULES " = 1 ]; then
153
145
popd
154
146
}
155
147
148
+ create_shrinkwraps () {
149
+ # yarn.lock or package-lock.json files (used to ensure deterministic versions of dependencies) are
150
+ # not packaged when publishing to the NPM registry.
151
+ # To ensure deterministic dependency versions (even when code-server is installed with NPM), we create
152
+ # an npm-shrinkwrap.json file from the currently installed node_modules. This ensures the versions used
153
+ # from development (that the yarn.lock guarantees) are also the ones installed by end-users.
154
+
155
+ # We first generate the shrinkwrap file for code-server itself
156
+ npm shrinkwrap
157
+ # HACK@edvincent: The shrinkwrap file will contain the devDependencies, which by default
158
+ # are installed if present in a lockfile. To avoid every user having to specify --production
159
+ # to skip them, we carefully remove them from the shrinkwrap file.
160
+ json -f npm-shrinkwrap.json -I -e " Object.keys(this.dependencies).forEach(dependency => { if (this.dependencies[dependency].dev) { delete this.dependencies[dependency] } } )"
161
+ mv npm-shrinkwrap.json " $RELEASE_PATH "
162
+
163
+ # Then the shrinkwrap files for the bundled VSCode
164
+ # We don't need to remove the devDependencies for these because we control how it's installed - and
165
+ # as such we can force the --production flag
166
+ cd lib/vscode/
167
+ npm shrinkwrap
168
+
169
+ cd extensions/
170
+ npm shrinkwrap
171
+
172
+ cd ../../..
173
+ mv lib/vscode/npm-shrinkwrap.json " $RELEASE_PATH /lib/vscode/npm-shrinkwrap.json"
174
+ mv lib/vscode/extensions/npm-shrinkwrap.json " $RELEASE_PATH /lib/vscode/extensions/npm-shrinkwrap.json"
175
+ }
156
176
main " $@ "
0 commit comments