Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3083c71
Update dep
yakov116 Jun 4, 2021
8113505
Make `list-prs-for-file` faster
yakov116 Jun 4, 2021
2e6fb19
Make `default- branch-button` faster
yakov116 Jun 4, 2021
868ded5
Change `latest-tag-button` style
yakov116 Jun 4, 2021
187fa09
Move addAfterBranchSelector to its own file
yakov116 Jun 4, 2021
dccd621
Make `convert-release-to-draft` faster
yakov116 Jun 4, 2021
ca261b5
Lint
yakov116 Jun 4, 2021
c695dc9
Restore on-new-comments.ts
yakov116 Jun 4, 2021
e54f33f
some more
yakov116 Jun 4, 2021
b45b4bb
Fix `comment-time-machine-links` date check
yakov116 Jun 4, 2021
44a418c
Fix duplication in `show-whitespace`
yakov116 Jun 4, 2021
5e45759
o
yakov116 Jun 6, 2021
fb5d493
Update source/features/latest-tag-button.tsx
yakov116 Jun 6, 2021
e9ffcbb
Update source/features/list-prs-for-file.tsx
yakov116 Jun 6, 2021
1c2bde5
Update source/features/list-prs-for-file.tsx
yakov116 Jun 6, 2021
4d89d0f
Merge remote-tracking branch 'upstream/dep' into dep
yakov116 Jun 6, 2021
5dbbdad
await
yakov116 Jun 6, 2021
4c1f253
Remove outdated comment
yakov116 Jun 6, 2021
b078346
Correct `show-associated-branch-prs-on-fork` display text
yakov116 Jun 7, 2021
719dcbe
Fix console error in `clean-conversation-filters`
yakov116 Jun 7, 2021
ef26cac
Fix types
yakov116 Jun 8, 2021
7c5c2a0
dep
yakov116 Jun 8, 2021
9745099
Restore clean-conversation-filters.tsx
fregante Jun 8, 2021
5e00403
Fix console error in `faster-pr-diff-options`
yakov116 Jun 9, 2021
8559f0f
Merge branch 'main' into dep
yakov116 Jun 9, 2021
e610260
Merge remote-tracking branch 'upstream/dep' into dep
yakov116 Jun 9, 2021
2e8bbec
Sort `show-associated-branch-prs-on-fork`
yakov116 Jun 10, 2021
d968a48
Exclude issue links in `mark-merge-commits-in-list`
yakov116 Jun 10, 2021
207f3f9
Revert "Restore clean-conversation-filters.tsx"
fregante Jun 8, 2021
cde5aca
Restore clean-conversation-filters.tsx
fregante Jun 10, 2021
ce1d4c6
Restore mark-merge-commits-in-list.tsx
fregante Jun 10, 2021
79e0614
Restore show-associated-branch-prs-on-fork.tsx
fregante Jun 10, 2021
f954767
Restore comments-time-machine-links.tsx
fregante Jun 10, 2021
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
1,925 changes: 691 additions & 1,234 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
},
"dependencies": {
"@cheap-glitch/mi-cron": "^1.0.1",
"@primer/octicons-react": "^14.1.0",
"@primer/octicons-react": "^14.2.1",
"array-union": "^3.0.1",
"copy-text-to-clipboard": "^3.0.1",
"debounce-fn": "^5.0.0",
Expand Down Expand Up @@ -88,38 +88,38 @@
"devDependencies": {
"@ava/typescript": "^1.1.1",
"@sindresorhus/tsconfig": "^0.9.0",
"@types/chrome": "^0.0.141",
"@types/chrome": "^0.0.144",
"@types/codemirror": "^5.60.0",
"@types/copy-webpack-plugin": "^8.0.0",
"@types/firefox-webext-browser": "^82.0.0",
"@types/jsdom": "^16.2.10",
"@types/mini-css-extract-plugin": "^1.4.3",
"@types/react": "^17.0.6",
"@types/react": "^17.0.9",
"@types/terser-webpack-plugin": "^5.0.3",
"ava": "^3.15.0",
"copy-webpack-plugin": "^8.1.1",
"css-loader": "^5.2.5",
"copy-webpack-plugin": "^9.0.0",
"css-loader": "^5.2.6",
"daily-version": "^2.0.0",
"dot-json": "^1.2.2",
"esbuild-loader": "^2.13.1",
"eslint-config-xo-react": "^0.25.0",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.2.0",
"jsdom": "^16.5.2",
"jsdom": "^16.6.0",
"markdown-wasm": "^1.1.2",
"mini-css-extract-plugin": "^1.6.0",
"npm-run-all": "^4.1.5",
"size-plugin": "^2.0.2",
"stylelint": "^13.13.1",
"stylelint-config-xo": "^0.20.0",
"terser-webpack-plugin": "^5.1.2",
"terser-webpack-plugin": "^5.1.3",
"ts-node": "^9.1.1",
"tslib": "^2.2.0",
"type-fest": "^1.1.3",
"type-fest": "^1.2.0",
"typed-query-selector": "^2.6.0",
"typescript": "^4.2.4",
"webpack": "^5.37.1",
"webpack-cli": "^4.7.0",
"typescript": "^4.3.2",
"webpack": "^5.38.1",
"webpack-cli": "^4.7.2",
"xo": "^0.38.2"
},
"engines": {
Expand Down
4 changes: 3 additions & 1 deletion source/features/convert-release-to-draft.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'dom-chef';
import select from 'select-dom';
import delegate from 'delegate-it';
import elementReady from 'element-ready';
import * as pageDetect from 'github-url-detection';

import features from '.';
Expand Down Expand Up @@ -30,7 +31,7 @@ async function convertToDraft({delegateTarget: draftButton}: delegate.Event): Pr
async function init(): Promise<void | false> {
await api.expectToken();

const editButton = select('.BtnGroup a[href*="releases/edit"]');
const editButton = await elementReady('.BtnGroup a[href*="releases/edit"]');
if (!editButton || select.exists('.label-draft')) {
return false;
}
Expand All @@ -43,5 +44,6 @@ void features.add(__filebasename, {
include: [
pageDetect.isSingleTag
],
awaitDomReady: false,
init
});
2 changes: 1 addition & 1 deletion source/features/default-branch-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import getDefaultBranch from '../github-helpers/get-default-branch';
import {getCurrentCommittish} from '../github-helpers';

async function init(): Promise<false | void> {
const defaultBranch = await getDefaultBranch();
const branchSelector = await elementReady('[data-hotkey="w"]');
// The branch selector is missing from History pages of files and folders (it only appears on the root)
if (!branchSelector) {
return false;
}

const defaultBranch = await getDefaultBranch();
const currentBranch = getCurrentCommittish();

// Don't show the button if we’re already on the default branch
Expand Down
3 changes: 3 additions & 0 deletions source/features/faster-pr-diff-options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ void features.add(__filebasename, {
pageDetect.isPRFiles,
pageDetect.isPRCommit
],
exclude: [
pageDetect.isPRFile404
],
shortcuts: {
'd w': 'Show/hide whitespaces in diffs'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async function init(): Promise<void | false> {
filename.classList.add('rgh-pr-file-state');
const sourceIcon = pageDetect.isPR() ?
select(`[href="${filename.hash}"] svg`, fileList)! :
select(`svg + [href="${filename.hash}"]`, fileList)?.previousElementSibling!;
select(`svg + [href="${filename.hash}"]`, fileList)?.previousElementSibling as SVGSVGElement;
const icon = sourceIcon.cloneNode(true);
const action = icon.getAttribute('title')!;
if (action === 'added') {
Expand Down
29 changes: 2 additions & 27 deletions source/features/latest-tag-button.tsx
Original file line number Diff line number Diff line change
@@ -1,43 +1,18 @@
import './latest-tag-button.css';
import React from 'dom-chef';
import cache from 'webext-storage-cache';
import select from 'select-dom';
import elementReady from 'element-ready';
import * as pageDetect from 'github-url-detection';
import {DiffIcon, TagIcon} from '@primer/octicons-react';

import features from '.';
import * as api from '../github-helpers/api';
import pluralize from '../helpers/pluralize';
import GitHubURL from '../github-helpers/github-url';
import {wrapAll} from '../helpers/dom-utils';
import {groupButtons} from '../github-helpers/group-buttons';
import getDefaultBranch from '../github-helpers/get-default-branch';
import addAfterBranchSelector from '../helpers/add-after-branch-selector';
import {buildRepoURL, getCurrentCommittish, getLatestVersionTag, getRepo} from '../github-helpers';

// eslint-disable-next-line import/prefer-default-export
export async function addAfterBranchSelector(button: Element): Promise<void> {
button.classList.add('ml-2');
const branchSelector = (await elementReady('#branch-select-menu', {waitForChildren: false}))!;
const branchSelectorWrapper = branchSelector.closest('.position-relative')!;
const breadcrumb = select('.breadcrumb');
if (!breadcrumb) {
branchSelectorWrapper.after(button);
return;
}

branchSelectorWrapper.append(button);
if (branchSelector.classList.contains('rgh-wrapper-added')) {
return;
}

breadcrumb.classList.add('flex-shrink-0');
breadcrumb.classList.remove('mt-3');
branchSelector.classList.add('rgh-wrapper-added');
branchSelectorWrapper.classList.add('d-flex', 'flex-shrink-0');
wrapAll([branchSelectorWrapper, breadcrumb], <div className="d-flex flex-wrap flex-1 mr-2" style={{rowGap: '16px'}}/>);
}

interface RepoPublishState {
latestTag: string | false;
aheadBy?: number;
Expand Down Expand Up @@ -159,7 +134,7 @@ async function init(): Promise<false | void> {
href={buildRepoURL(`compare/${latestTag}...${defaultBranch}`)}
aria-label={`Compare ${latestTag}...${defaultBranch}`}
>
<DiffIcon/>
<DiffIcon className="v-align-middle"/>
</a>
);
groupButtons([link, compareLink]).classList.add('flex-self-center', 'd-flex');
Expand Down
2 changes: 1 addition & 1 deletion source/features/list-pr-for-branch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {GitMergeIcon, GitPullRequestIcon} from '@primer/octicons-react';

import features from '.';
import getDefaultBranch from '../github-helpers/get-default-branch';
import {addAfterBranchSelector} from './latest-tag-button';
import addAfterBranchSelector from '../helpers/add-after-branch-selector';
import {getPullRequestsAssociatedWithBranch} from './show-associated-branch-prs-on-fork';

// Taken from https://github.com/fregante/github-issue-link-status/blob/98792f2837352bacbf80664f3edbcec8e579ed17/source/github-issue-link-status.js#L10
Expand Down
9 changes: 5 additions & 4 deletions source/features/list-prs-for-file.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'dom-chef';
import cache from 'webext-storage-cache';
import select from 'select-dom';
import elementReady from 'element-ready';
import * as pageDetect from 'github-url-detection';
import {GitPullRequestIcon} from '@primer/octicons-react';

import features from '.';
import * as api from '../github-helpers/api';
import getDefaultBranch from '../github-helpers/get-default-branch';
import addAfterBranchSelector from '../helpers/add-after-branch-selector';
import {buildRepoURL, getRepo} from '../github-helpers';
import {addAfterBranchSelector} from './latest-tag-button';

function getPRUrl(prNumber: number): string {
return buildRepoURL('pull', prNumber, 'files');
Expand Down Expand Up @@ -102,7 +102,7 @@ const getPrsByFile = cache.function(async (): Promise<Record<string, number[]>>

async function init(): Promise<void> {
// `clipboard-copy` on blob page, `#blob-edit-path` on edit page
const path = select('clipboard-copy, #blob-edit-path')!.getAttribute('value')!;
const path = (await elementReady('clipboard-copy, #blob-edit-path'))!.getAttribute('value')!;
let {[path]: prs} = await getPrsByFile();

if (!prs) {
Expand All @@ -120,7 +120,7 @@ async function init(): Promise<void> {
const [prNumber] = prs; // First one or only one

if (pageDetect.isEditingFile()) {
select('.file')!.after(
(await elementReady('.file'))!.after(
<div className="form-warning p-3 mb-3 mx-lg-3">
{
prs.length === 1 ?
Expand Down Expand Up @@ -155,5 +155,6 @@ void features.add(__filebasename, {
pageDetect.isSingleFile
],
deduplicate: '.rgh-list-prs-for-file', // #3945
awaitDomReady: false,
init
});
1 change: 1 addition & 0 deletions source/features/show-whitespace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,6 @@ void features.add(__filebasename, {
onNewComments,
onPrFileLoad
],
deduplicate: '.rgh-observing-whitespace',
init
});
27 changes: 27 additions & 0 deletions source/helpers/add-after-branch-selector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'dom-chef';
import select from 'select-dom';
import elementReady from 'element-ready';

import {wrapAll} from './dom-utils';

export default async function addAfterBranchSelector(button: Element): Promise<void> {
button.classList.add('ml-2');
const branchSelector = (await elementReady('#branch-select-menu', {waitForChildren: false}))!;
const branchSelectorWrapper = branchSelector.closest('.position-relative')!;
const breadcrumb = select('.breadcrumb');
if (!breadcrumb) {
branchSelectorWrapper.after(button);
return;
}

branchSelectorWrapper.append(button);
if (branchSelector.classList.contains('rgh-wrapper-added')) {
return;
}

breadcrumb.classList.add('flex-shrink-0');
breadcrumb.classList.remove('mt-3');
branchSelector.classList.add('rgh-wrapper-added');
branchSelectorWrapper.classList.add('d-flex', 'flex-shrink-0');
wrapAll([branchSelectorWrapper, breadcrumb], <div className="d-flex flex-wrap flex-1 mr-2" style={{rowGap: '16px'}}/>);
}
2 changes: 0 additions & 2 deletions source/refined-github.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// To disable features temporarily, simply comment them out #3678

import 'typed-query-selector';
import select from 'select-dom';

Expand Down