Skip to content

Update JS dependencies and webpack #14118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 27, 2020
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
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ rules:
unicorn/catch-error-name: [0]
unicorn/consistent-function-scoping: [2]
unicorn/custom-error-definition: [0]
unicorn/empty-brace-spaces: [2]
unicorn/error-message: [0]
unicorn/escape-case: [0]
unicorn/expiring-todo-comments: [0]
Expand All @@ -361,6 +362,7 @@ rules:
unicorn/no-for-loop: [0]
unicorn/no-hex-escape: [0]
unicorn/no-keyword-prefix: [0]
unicorn/no-lonely-if: [2]
unicorn/no-nested-ternary: [0]
unicorn/no-new-buffer: [0]
unicorn/no-null: [0]
Expand All @@ -377,6 +379,7 @@ rules:
unicorn/prefer-add-event-listener: [2]
unicorn/prefer-array-find: [2]
unicorn/prefer-dataset: [2]
unicorn/prefer-date-now: [2]
unicorn/prefer-event-key: [2]
unicorn/prefer-includes: [2]
unicorn/prefer-math-trunc: [2]
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ lint: lint-frontend lint-backend

.PHONY: lint-frontend
lint-frontend: node_modules
npx eslint --max-warnings=0 web_src/js build templates webpack.config.js
npx stylelint --max-warnings=0 web_src/less
npx eslint --color --max-warnings=0 web_src/js build templates webpack.config.js
npx stylelint --color --max-warnings=0 web_src/less

.PHONY: lint-backend
lint-backend: golangci-lint revive vet
Expand All @@ -330,7 +330,7 @@ watch:
.PHONY: watch-frontend
watch-frontend: node-check node_modules
rm -rf $(WEBPACK_DEST_ENTRIES)
NODE_ENV=development npx webpack --hide-modules --display-entrypoints=false --watch --progress
NODE_ENV=development npx webpack --watch --progress

.PHONY: watch-backend
watch-backend: go-check
Expand Down Expand Up @@ -660,7 +660,7 @@ webpack: $(WEBPACK_DEST)

$(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json | node_modules
rm -rf $(WEBPACK_DEST_ENTRIES)
npx webpack --hide-modules --display-entrypoints=false
npx webpack
@touch $(WEBPACK_DEST)

.PHONY: svg
Expand Down
4,531 changes: 1,019 additions & 3,512 deletions package-lock.json

Large diffs are not rendered by default.

53 changes: 26 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
"node": ">= 10.13.0"
},
"dependencies": {
"@babel/core": "7.12.9",
"@babel/plugin-transform-runtime": "7.12.1",
"@babel/preset-env": "7.12.7",
"@babel/core": "7.12.10",
"@babel/plugin-transform-runtime": "7.12.10",
"@babel/preset-env": "7.12.11",
"@babel/runtime": "7.12.5",
"@claviska/jquery-minicolors": "2.3.5",
"@primer/octicons": "11.1.0",
"add-asset-webpack-plugin": "1.0.0",
"@primer/octicons": "11.2.0",
"add-asset-webpack-plugin": "2.0.0",
"babel-loader": "8.2.2",
"clipboard": "2.0.6",
"codemirror": "5.58.3",
"core-js": "3.8.0",
"codemirror": "5.59.0",
"core-js": "3.8.1",
"css-loader": "5.0.1",
"css-minimizer-webpack-plugin": "1.1.5",
"dropzone": "5.7.2",
Expand All @@ -26,42 +26,41 @@
"font-awesome": "4.7.0",
"jquery": "3.5.1",
"jquery.are-you-sure": "1.9.0",
"less": "3.12.2",
"less-loader": "7.1.0",
"license-webpack-plugin": "2.3.1",
"mermaid": "8.8.3",
"mini-css-extract-plugin": "1.3.1",
"less": "4.0.0",
"less-loader": "7.2.0",
"license-checker-webpack-plugin": "0.2.1",
"mermaid": "8.8.4",
"mini-css-extract-plugin": "1.3.3",
"monaco-editor": "0.21.2",
"monaco-editor-webpack-plugin": "2.0.0",
"postcss": "8.1.10",
"monaco-editor-webpack-plugin": "2.1.0",
"postcss": "8.2.1",
"raw-loader": "4.0.2",
"sortablejs": "1.12.0",
"swagger-ui-dist": "3.37.2",
"terser-webpack-plugin": "4.2.3",
"swagger-ui-dist": "3.38.0",
"terser-webpack-plugin": "5.0.3",
"tributejs": "5.1.3",
"vue": "2.6.12",
"vue-bar-graph": "1.2.0",
"vue-calendar-heatmap": "0.8.4",
"vue-loader": "15.9.5",
"vue-loader": "15.9.6",
"vue-template-compiler": "2.6.12",
"webpack": "4.44.1",
"webpack-cli": "3.3.12",
"webpack-fix-style-only-entries": "0.6.0",
"workbox-routing": "5.1.4",
"workbox-strategies": "5.1.4",
"worker-loader": "3.0.5",
"webpack": "5.11.0",
"webpack-cli": "4.3.0",
"workbox-routing": "6.0.2",
"workbox-strategies": "6.0.2",
"worker-loader": "3.0.7",
"wrap-ansi": "7.0.0"
},
"devDependencies": {
"eslint": "7.14.0",
"eslint": "7.16.0",
"eslint-plugin-html": "6.1.1",
"eslint-plugin-import": "2.22.1",
"eslint-plugin-unicorn": "23.0.0",
"eslint-plugin-vue": "7.1.0",
"eslint-plugin-unicorn": "24.0.0",
"eslint-plugin-vue": "7.3.0",
"stylelint": "13.8.0",
"stylelint-config-standard": "20.0.0",
"svgo": "1.3.2",
"updates": "11.4.0"
"updates": "11.4.2"
},
"browserslist": [
"defaults",
Expand Down
2 changes: 1 addition & 1 deletion public/img/svg/octicon-dash.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/img/svg/octicon-plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/img/svg/octicon-strikethrough.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 35 additions & 37 deletions web_src/js/features/notification.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,53 +43,51 @@ export async function initNotificationCount() {
return;
}

if (NotificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource) {
if (NotificationSettings.EventSourceUpdateTime > 0 && !!window.EventSource && window.SharedWorker) {
// Try to connect to the event source via the shared worker first
if (window.SharedWorker) {
const worker = new SharedWorker(`${__webpack_public_path__}js/eventsource.sharedworker.js`, 'notification-worker');
worker.addEventListener('error', (event) => {
const worker = new SharedWorker(`${__webpack_public_path__}js/eventsource.sharedworker.js`, 'notification-worker');
worker.addEventListener('error', (event) => {
console.error(event);
});
worker.port.onmessageerror = () => {
console.error('Unable to deserialize message');
};
worker.port.postMessage({
type: 'start',
url: `${window.location.origin}${AppSubUrl}/user/events`,
});
worker.port.addEventListener('message', (event) => {
if (!event.data || !event.data.type) {
console.error(event);
});
worker.port.onmessageerror = () => {
console.error('Unable to deserialize message');
};
worker.port.postMessage({
type: 'start',
url: `${window.location.origin}${AppSubUrl}/user/events`,
});
worker.port.addEventListener('message', (event) => {
if (!event.data || !event.data.type) {
console.error(event);
return;
}
if (event.data.type === 'notification-count') {
receiveUpdateCount(event.data);
} else if (event.data.type === 'error') {
console.error(event.data);
} else if (event.data.type === 'logout') {
if (event.data !== 'here') {
return;
}
if (event.data.type === 'notification-count') {
receiveUpdateCount(event.data);
} else if (event.data.type === 'error') {
console.error(event.data);
} else if (event.data.type === 'logout') {
if (event.data !== 'here') {
return;
}
worker.port.postMessage({
type: 'close',
});
worker.port.close();
window.location.href = AppSubUrl;
}
});
worker.port.addEventListener('error', (e) => {
console.error(e);
});
worker.port.start();
window.addEventListener('beforeunload', () => {
worker.port.postMessage({
type: 'close',
});
worker.port.close();
window.location.href = AppSubUrl;
}
});
worker.port.addEventListener('error', (e) => {
console.error(e);
});
worker.port.start();
window.addEventListener('beforeunload', () => {
worker.port.postMessage({
type: 'close',
});
worker.port.close();
});

return;
}
return;
}

if (NotificationSettings.MinTimeout <= 0) {
Expand Down
46 changes: 20 additions & 26 deletions web_src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,24 +204,22 @@ function initRepoStatusChecker() {
_csrf: csrf,
},
complete(xhr) {
if (xhr.status === 200) {
if (xhr.responseJSON) {
if (xhr.responseJSON.status === 4) {
window.location.reload();
return;
} else if (xhr.responseJSON.status === 3) {
$('#repo_migrating_progress').hide();
$('#repo_migrating').hide();
$('#repo_migrating_failed').show();
$('#repo_migrating_failed_image').show();
$('#repo_migrating_failed_error').text(xhr.responseJSON.err);
return;
}
setTimeout(() => {
initRepoStatusChecker();
}, 2000);
if (xhr.status === 200 && xhr.responseJSON) {
if (xhr.responseJSON.status === 4) {
window.location.reload();
return;
} else if (xhr.responseJSON.status === 3) {
$('#repo_migrating_progress').hide();
$('#repo_migrating').hide();
$('#repo_migrating_failed').show();
$('#repo_migrating_failed_image').show();
$('#repo_migrating_failed_error').text(xhr.responseJSON.err);
return;
}
setTimeout(() => {
initRepoStatusChecker();
}, 2000);
return;
}
$('#repo_migrating_progress').hide();
$('#repo_migrating').hide();
Expand Down Expand Up @@ -1625,16 +1623,12 @@ async function initEditor() {
let value;
let parts;

if (e.keyCode === 8) {
if ($(this).getCursorPosition() === 0) {
if ($section.length > 0) {
value = $section.last().find('a').text();
$(this).val(value + $(this).val());
$(this)[0].setSelectionRange(value.length, value.length);
$section.last().remove();
$divider.last().remove();
}
}
if (e.keyCode === 8 && $(this).getCursorPosition() === 0 && $section.length > 0) {
value = $section.last().find('a').text();
$(this).val(value + $(this).val());
$(this)[0].setSelectionRange(value.length, value.length);
$section.last().remove();
$divider.last().remove();
}
if (e.keyCode === 191) {
parts = $(this).val().split('/');
Expand Down
4 changes: 2 additions & 2 deletions web_src/less/_form.less
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ textarea:focus,
.user.signin,
.user.signup {
@input-padding: 200px;
#create-page-form;
#create-page-form();

form {
width: 700px !important;
Expand Down Expand Up @@ -273,7 +273,7 @@ textarea:focus,
&.new.repo,
&.new.migrate,
&.new.fork {
#create-page-form;
#create-page-form();

form {
.dropdown .text {
Expand Down
2 changes: 1 addition & 1 deletion web_src/less/_organization.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}

&.new.org {
#create-page-form;
#create-page-form();

form {
.header {
Expand Down
12 changes: 6 additions & 6 deletions web_src/less/_repository.less
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@
border: 1px solid var(--color-secondary);
background: var(--color-box-body);
border-radius: 3px;
#avatar-arrow;
#avatar-arrow();

&::after {
border-right-color: var(--color-box-body);
Expand Down Expand Up @@ -555,7 +555,7 @@

.content {
margin-left: 4em;
#avatar-arrow;
#avatar-arrow();

&::after {
border-right-color: var(--color-box-body);
Expand Down Expand Up @@ -979,7 +979,7 @@
}

&.no-header {
#avatar-arrow;
#avatar-arrow();

&::after {
border-right-color: var(--color-box-body);
Expand Down Expand Up @@ -1098,7 +1098,7 @@
}

.form {
#avatar-arrow;
#avatar-arrow();

&::after {
border-right-color: var(--color-box-body);
Expand Down Expand Up @@ -1195,7 +1195,7 @@

.comment.form {
.content {
#avatar-arrow;
#avatar-arrow();

&::after {
border-right-color: var(--color-box-body);
Expand Down Expand Up @@ -2458,7 +2458,7 @@
}

.comment-header {
#avatar-arrow;
#avatar-arrow();
border: none !important;
background: var(--color-box-header);
border-bottom: 1px solid var(--color-secondary) !important;
Expand Down
Loading