Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions .github/workflows/deploy.yml

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"clean-build": "./scripts/clean-build.sh",
"clean": "./scripts/clean.sh",
"build": "./scripts/build.sh",
"vercel-build": "yarn build && mv dist public",
"vercel-build": "yarn build && yarn hash && mv dist public",
"hash": "./scripts/hash.sh",
"package": "./scripts/package.sh",
"watch": "rm -rf dist && run-p watch:*",
Expand Down
30 changes: 15 additions & 15 deletions resources/index-hash.html
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ <h1>You need to enable JavaScript to run this app.</h1>

<script>
self.require = {
baseUrl: `${window.location.origin}/{STATIC_FOLDER}/vscode`,
baseUrl: `${window.location.origin}/static/{STATIC_HASH_CODE}/vscode`,
recordStats: true,
trustedTypesPolicy: window.trustedTypes?.createPolicy('amdLoader', {
createScriptURL(value) {
Expand All @@ -144,25 +144,25 @@ <h1>You need to enable JavaScript to run this app.</h1>
},
}),
paths: {
'vscode-textmate': `${window.location.origin}/{STATIC_FOLDER}/node_modules/vscode-textmate/release/main`,
'vscode-oniguruma': `${window.location.origin}/{STATIC_FOLDER}/node_modules/vscode-oniguruma/release/main`,
xterm: `${window.location.origin}/{STATIC_FOLDER}/node_modules/xterm/lib/xterm.js`,
'xterm-addon-search': `${window.location.origin}/{STATIC_FOLDER}/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
'xterm-addon-unicode11': `${window.location.origin}/{STATIC_FOLDER}/node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`,
'xterm-addon-webgl': `${window.location.origin}/{STATIC_FOLDER}/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
'tas-client-umd': `${window.location.origin}/{STATIC_FOLDER}/node_modules/tas-client-umd/lib/tas-client-umd.js`,
'iconv-lite-umd': `${window.location.origin}/{STATIC_FOLDER}/node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`,
jschardet: `${window.location.origin}/{STATIC_FOLDER}/node_modules/jschardet/dist/jschardet.min.js`,
'vscode-textmate': `${window.location.origin}/static/{STATIC_HASH_CODE}/node_modules/vscode-textmate/release/main`,
'vscode-oniguruma': `${window.location.origin}/static/{STATIC_HASH_CODE}/node_modules/vscode-oniguruma/release/main`,
xterm: `${window.location.origin}/static/{STATIC_HASH_CODE}/node_modules/xterm/lib/xterm.js`,
'xterm-addon-search': `${window.location.origin}/static/{STATIC_HASH_CODE}/node_modules/xterm-addon-search/lib/xterm-addon-search.js`,
'xterm-addon-unicode11': `${window.location.origin}/static/{STATIC_HASH_CODE}/node_modules/xterm-addon-unicode11/lib/xterm-addon-unicode11.js`,
'xterm-addon-webgl': `${window.location.origin}/static/{STATIC_HASH_CODE}/node_modules/xterm-addon-webgl/lib/xterm-addon-webgl.js`,
'tas-client-umd': `${window.location.origin}/static/{STATIC_HASH_CODE}/node_modules/tas-client-umd/lib/tas-client-umd.js`,
'iconv-lite-umd': `${window.location.origin}/static/{STATIC_HASH_CODE}/node_modules/iconv-lite-umd/lib/iconv-lite-umd.js`,
jschardet: `${window.location.origin}/static/{STATIC_HASH_CODE}/node_modules/jschardet/dist/jschardet.min.js`,
},
};
</script>
<script src="/{STATIC_FOLDER}/vscode/vs/loader.js"></script>
<script src="/{STATIC_FOLDER}/vscode/vs/workbench/workbench.web.api.js"></script>
<script src="/static/{STATIC_HASH_CODE}/vscode/vs/loader.js"></script>
<script src="/static/{STATIC_HASH_CODE}/vscode/vs/workbench/workbench.web.api.js"></script>
<script>
globalThis.MonacoPerformanceMarks.push('willLoadWorkbenchMain', Date.now());
</script>
<script>
fetch('/{STATIC_FOLDER}/configure/extensions.json')
fetch('/static/{STATIC_HASH_CODE}/configure/extensions.json')
.then((response) => response.text())
.then((extensionsJson) => {
document
Expand All @@ -176,9 +176,9 @@ <h1>You need to enable JavaScript to run this app.</h1>
enableSyncByDefault: false,
webviewEndpoint:
window.location.origin +
'/{STATIC_FOLDER}/vscode/vs/workbench/contrib/webview/browser/pre',
'/static/{STATIC_HASH_CODE}/vscode/vs/workbench/contrib/webview/browser/pre',
webWorkerExtensionHostIframeSrc:
'/{STATIC_FOLDER}/vscode/vs/workbench/services/extensions/worker/httpWebWorkerExtensionHostIframe.html',
'/static/{STATIC_HASH_CODE}/vscode/vs/workbench/services/extensions/worker/httpWebWorkerExtensionHostIframe.html',
})
);
document
Expand Down
9 changes: 5 additions & 4 deletions scripts/hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ APP_ROOT=$(pwd)

COMMIT_ID=$(git rev-parse HEAD)
SHORT_COMMIT_ID=${COMMIT_ID:0:7}
STATIC_FOLDER_NAME="static-${SHORT_COMMIT_ID-unknown}"
STATIC_HASH_CODE="${SHORT_COMMIT_ID-unknown}"

if [ -e "${APP_ROOT}/dist/static" ]; then
mv "${APP_ROOT}/dist/static" "${APP_ROOT}/dist/${STATIC_FOLDER_NAME}"
sed "s/{STATIC_FOLDER}/${STATIC_FOLDER_NAME}/" "${APP_ROOT}/resources/index-hash.html" > "${APP_ROOT}/dist/404.html"
rm -f "${APP_ROOT}/dist/index.html" # remove the exists `index.html` file
mv "${APP_ROOT}/dist/static" "${APP_ROOT}/dist/${STATIC_HASH_CODE}"
mkdir -p "${APP_ROOT}/dist/static"
mv "${APP_ROOT}/dist/${STATIC_HASH_CODE}" "${APP_ROOT}/dist/static/${STATIC_HASH_CODE}"
sed "s/{STATIC_HASH_CODE}/${STATIC_HASH_CODE}/" "${APP_ROOT}/resources/index-hash.html" > "${APP_ROOT}/dist/index.html"
echo "hash static files done"
else
echo "Please build github1s first"
Expand Down
3 changes: 2 additions & 1 deletion vercel.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"routes": [{
"src": "/static/(.*)",
"dest": "/images/$1"
"dest": "/static/$1",
"headers": { "Cache-Control": "max-age=604800" }
},
{
"src": "/favicon.ico",
Expand Down