Skip to content

Commit c0ac4bd

Browse files
committed
fix(sourcemap): add quality to sourcemaps release [skip ci]
1 parent f60f14d commit c0ac4bd

File tree

2 files changed

+34
-25
lines changed

2 files changed

+34
-25
lines changed

patches/sourcemaps.patch

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,71 @@
11
diff --git a/build/gulpfile.extensions.js b/build/gulpfile.extensions.js
2-
index 7826f48..ff0e2f0 100644
2+
index 7826f48..eca4a1d 100644
33
--- a/build/gulpfile.extensions.js
44
+++ b/build/gulpfile.extensions.js
5-
@@ -74,3 +74,3 @@ const compilations = [
5+
@@ -23,2 +23,3 @@ const plumber = require('gulp-plumber');
6+
const ext = require('./lib/extensions');
7+
+const product = require('../product.json');
8+
9+
@@ -74,3 +75,3 @@ const compilations = [
610

711
-const getBaseUrl = out => `https://main.vscode-cdn.net/sourcemaps/${commit}/${out}`;
8-
+const getBaseUrl = out => `https://github.com/VSCodium/sourcemaps/releases/download/${commit}/${out.replaceAll('/', '-')}`;
12+
+const getBaseUrl = out => `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}/${out.replaceAll('/', '-')}`;
913

1014
diff --git a/build/gulpfile.reh.js b/build/gulpfile.reh.js
11-
index 10b7b44..895b25b 100644
15+
index 10b7b44..79861bf 100644
1216
--- a/build/gulpfile.reh.js
1317
+++ b/build/gulpfile.reh.js
1418
@@ -454,3 +454,3 @@ function tweakProductForServerWeb(product) {
1519
util.rimraf(`out-vscode-${type}-min`),
1620
- optimize.minifyTask(`out-vscode-${type}`, `https://main.vscode-cdn.net/sourcemaps/${commit}/core`)
17-
+ optimize.minifyTask(`out-vscode-${type}`, `https://github.com/VSCodium/sourcemaps/releases/download/${commit}/core`)
21+
+ optimize.minifyTask(`out-vscode-${type}`, `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}/core`)
1822
));
1923
diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
20-
index ed06b6a..ebedfc4 100644
24+
index ed06b6a..9488983 100644
2125
--- a/build/gulpfile.vscode.js
2226
+++ b/build/gulpfile.vscode.js
2327
@@ -147,3 +147,3 @@ gulp.task(bundleVSCodeTask);
2428

2529
-const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`;
26-
+const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${commit}`;
30+
+const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}`;
2731
const minifyVSCodeTask = task.define('minify-vscode', task.series(
2832
diff --git a/build/gulpfile.vscode.web.js b/build/gulpfile.vscode.web.js
29-
index 295a977..ba0a598 100644
33+
index 295a977..318ce92 100644
3034
--- a/build/gulpfile.vscode.web.js
3135
+++ b/build/gulpfile.vscode.web.js
3236
@@ -140,3 +140,3 @@ const minifyVSCodeWebTask = task.define('minify-vscode-web', task.series(
3337
util.rimraf('out-vscode-web-min'),
3438
- optimize.minifyTask('out-vscode-web', `https://main.vscode-cdn.net/sourcemaps/${commit}/core`)
35-
+ optimize.minifyTask('out-vscode-web', `https://github.com/VSCodium/sourcemaps/releases/download/${commit}/core`)
39+
+ optimize.minifyTask('out-vscode-web', `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}/core`)
3640
));
3741
diff --git a/build/lib/extensions.js b/build/lib/extensions.js
38-
index c80a1be..000cf9f 100644
42+
index c80a1be..25cf259 100644
3943
--- a/build/lib/extensions.js
4044
+++ b/build/lib/extensions.js
41-
@@ -76,3 +76,3 @@ const root = path_1.default.dirname(path_1.default.dirname(__dirname));
45+
@@ -75,4 +75,5 @@ const vzip = require('gulp-vinyl-zip');
46+
const root = path_1.default.dirname(path_1.default.dirname(__dirname));
47+
+const product = JSON.parse(fs_1.default.readFileSync(path_1.default.join(root, 'product.json'), 'utf8'));
4248
const commit = (0, getVersion_1.getVersion)(root);
4349
-const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`;
44-
+const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${commit}`;
50+
+const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}`;
4551
function minifyExtensionResources(input) {
46-
@@ -205,3 +205,3 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName, disableMangle) {
52+
@@ -205,3 +206,3 @@ function fromLocalWebpack(extensionPath, webpackConfigFileName, disableMangle) {
4753
data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) {
4854
- return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path_1.default.basename(extensionPath)}/${relativeOutputPath}/${g1}`;
4955
+ return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions-${path_1.default.basename(extensionPath).replaceAll('/', '-')}-${relativeOutputPath.replaceAll('/', '-')}-${g1.replaceAll('/', '-')}`;
5056
}), 'utf8');
5157
diff --git a/build/lib/extensions.ts b/build/lib/extensions.ts
52-
index 9e7cf9f..e5f7c24 100644
58+
index 9e7cf9f..eed31ca 100644
5359
--- a/build/lib/extensions.ts
5460
+++ b/build/lib/extensions.ts
55-
@@ -31,3 +31,3 @@ const root = path.dirname(path.dirname(__dirname));
61+
@@ -30,4 +30,5 @@ const vzip = require('gulp-vinyl-zip');
62+
const root = path.dirname(path.dirname(__dirname));
63+
+const product = JSON.parse(fs.readFileSync(path.join(root, 'product.json'), 'utf8'));
5664
const commit = getVersion(root);
5765
-const sourceMappingURLBase = `https://main.vscode-cdn.net/sourcemaps/${commit}`;
58-
+const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${commit}`;
66+
+const sourceMappingURLBase = `https://github.com/VSCodium/sourcemaps/releases/download/${product.quality}-${commit}`;
5967

60-
@@ -179,3 +179,3 @@ function fromLocalWebpack(extensionPath: string, webpackConfigFileName: string,
68+
@@ -179,3 +180,3 @@ function fromLocalWebpack(extensionPath: string, webpackConfigFileName: string,
6169
data.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, function (_m, g1) {
6270
- return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions/${path.basename(extensionPath)}/${relativeOutputPath}/${g1}`;
6371
+ return `\n//# sourceMappingURL=${sourceMappingURLBase}/extensions-${path.basename(extensionPath).replaceAll('/', '-')}-${relativeOutputPath.replaceAll('/', '-')}-${g1.replaceAll('/', '-')}`;
@@ -81,15 +89,15 @@ index d89d0d6..fca30cf 100644
8189
+ const sourceMappingURL = sourceMapBaseUrl ? ((f: any) => `${sourceMapBaseUrl}-${f.relative.replaceAll('/', '-')}.map`) : undefined;
8290

8391
diff --git a/build/lib/util.js b/build/lib/util.js
84-
index 389b9e0..9abdb3c 100644
92+
index 389b9e0..f80d8e5 100644
8593
--- a/build/lib/util.js
8694
+++ b/build/lib/util.js
8795
@@ -235,4 +235,4 @@ function rewriteSourceMappingURL(sourceMappingURLBase) {
8896
const contents = f.contents.toString('utf8');
8997
- const str = `//# sourceMappingURL=${sourceMappingURLBase}/${path_1.default.dirname(f.relative).replace(/\\/g, '/')}/$1`;
9098
- f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, str));
91-
+ const fp = path_1.default.dirname(f.relative).replace(/\\/g, '/').replaceAll('/', '-');
92-
+ f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, (_m, p) => `//# sourceMappingURL=${sourceMappingURLBase}/${fp}-${p.replaceAll('/', '-')}`));
99+
+ const fp = path_1.default.dirname(f.relative).replace(/\\/g, '/').replaceAll('/', '-');
100+
+ f.contents = Buffer.from(contents.replace(/\n\/\/# sourceMappingURL=(.*)$/gm, (_m, p) => `//# sourceMappingURL=${sourceMappingURLBase}/${fp}-${p.replaceAll('/', '-')}`));
93101
return f;
94102
diff --git a/build/lib/util.ts b/build/lib/util.ts
95103
index 4931342..833091c 100644

upload_sourcemaps.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,28 @@ checksum -a sha256 checksum.txt > checksum.txt.sha256
3333

3434
REPOSITORY_OWNER="${SOURCEMAPS_REPOSITORY/\/*/}"
3535
REPOSITORY_NAME="${SOURCEMAPS_REPOSITORY/*\//}"
36+
RELEASE_TAG="${VSCODE_QUALITY}-${BUILD_SOURCEVERSION}"
3637

37-
gh release create "${BUILD_SOURCEVERSION}" --repo "${SOURCEMAPS_REPOSITORY}" --title "${RELEASE_VERSION}"
38+
gh release create "${RELEASE_TAG}" --repo "${SOURCEMAPS_REPOSITORY}" --title "${RELEASE_VERSION}"
3839

3940
set +e
4041

4142
for FILE in *; do
4243
if [[ -f "${FILE}" ]]; then
4344
echo "::group::Uploading '${FILE}' at $( date "+%T" )"
44-
gh release upload --repo "${SOURCEMAPS_REPOSITORY}" "${RELEASE_VERSION}" "${FILE}"
45+
gh release upload --repo "${SOURCEMAPS_REPOSITORY}" "${RELEASE_TAG}" "${FILE}"
4546

4647
EXIT_STATUS=$?
4748
echo "exit: ${EXIT_STATUS}"
4849

4950
if (( "${EXIT_STATUS}" )); then
5051
for (( i=0; i<10; i++ )); do
51-
github-release delete --owner "${REPOSITORY_OWNER}" --repo "${REPOSITORY_NAME}" --tag "${BUILD_SOURCEVERSION}" "${FILE}"
52+
github-release delete --owner "${REPOSITORY_OWNER}" --repo "${REPOSITORY_NAME}" --tag "${RELEASE_TAG}" "${FILE}"
5253

5354
sleep $(( 15 * (i + 1)))
5455

5556
echo "RE-Uploading '${FILE}' at $( date "+%T" )"
56-
gh release upload --repo "${SOURCEMAPS_REPOSITORY}" "${BUILD_SOURCEVERSION}" "${FILE}"
57+
gh release upload --repo "${SOURCEMAPS_REPOSITORY}" "${RELEASE_TAG}" "${FILE}"
5758

5859
EXIT_STATUS=$?
5960
echo "exit: ${EXIT_STATUS}"
@@ -67,7 +68,7 @@ for FILE in *; do
6768
if (( "${EXIT_STATUS}" )); then
6869
echo "'${FILE}' hasn't been uploaded!"
6970

70-
github-release delete --owner "${REPOSITORY_OWNER}" --repo "${REPOSITORY_NAME}" --tag "${BUILD_SOURCEVERSION}" "${FILE}"
71+
github-release delete --owner "${REPOSITORY_OWNER}" --repo "${REPOSITORY_NAME}" --tag "${RELEASE_TAG}" "${FILE}"
7172

7273
exit 1
7374
fi

0 commit comments

Comments
 (0)