Skip to content
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

[No QA] [TS migration] Migrate 'Config' files to TypeScript #37718

Merged
merged 57 commits into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
7b98ae0
update libraries to newer version with types, install types
JKobrynski Mar 4, 2024
630b8ae
migrate electronBuilder.config.js to TypeScript
JKobrynski Mar 4, 2024
1dbe373
migrate proxyConfig.js to TypeScript
JKobrynski Mar 4, 2024
c6a484f
migrate webpack.common.js to TypeScript
JKobrynski Mar 4, 2024
866211c
migrate webpack.desktop.js to TypeScript
JKobrynski Mar 4, 2024
847b4b7
start migrating webpack.dev.js to TypeScript
JKobrynski Mar 4, 2024
b29a9b3
add module declaration for preload-webpack-plugin
JKobrynski Mar 4, 2024
7ad015d
update scripts and documentation
JKobrynski Mar 4, 2024
ffc7b3d
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 4, 2024
21f6328
fix webpack.common.ts
JKobrynski Mar 4, 2024
5a6b1ee
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 5, 2024
59522b7
update imports in webpack.dev.ts
JKobrynski Mar 5, 2024
1819da7
update scripts in package.json, install webpack types
JKobrynski Mar 6, 2024
05b5c43
update file extensions in documentation
JKobrynski Mar 6, 2024
8bcb078
update tsconfig
JKobrynski Mar 6, 2024
56e5b17
update file extensions in documentation
JKobrynski Mar 6, 2024
b80efcc
update file extension in webpack.config.js
JKobrynski Mar 6, 2024
7649b02
migrate webpack.common.js to TypeScript
JKobrynski Mar 6, 2024
a0ba014
migrate webpack.desktop.js to TypeScript
JKobrynski Mar 6, 2024
512cf42
migrate webpack.dev.js to TypeScript
JKobrynski Mar 6, 2024
5ef518a
update file extensions in scripts
JKobrynski Mar 6, 2024
677243b
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 6, 2024
77a9b0d
start migrating CustomVersionFilePlugin to TypeScript
JKobrynski Mar 7, 2024
0141669
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 8, 2024
3c29359
Migrate CustomVersionFilePlugin to TypeScript
JKobrynski Mar 8, 2024
ca48f2c
revert electronBuilder.config.to to JavaScript
JKobrynski Mar 8, 2024
dafc6bb
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 12, 2024
21721cf
convert CustomVersionFilePlugin to esmodule
JKobrynski Mar 12, 2024
ec234b6
use import instead of require in webpack.dev.ts
JKobrynski Mar 12, 2024
a3e32ed
use import instead of require in CustomVersionFilePlugin
JKobrynski Mar 12, 2024
73406a6
replace require with import in webpack.common.ts, bump version of cle…
JKobrynski Mar 12, 2024
d11e749
replace require with import in webpack.desktop.ts
JKobrynski Mar 12, 2024
e09aadf
replace require with import in webpack.dev.ts
JKobrynski Mar 12, 2024
acedc7f
update file extension in readme
JKobrynski Mar 12, 2024
1a31c28
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 14, 2024
b2fb18f
remove esModuleInterop from tsconfig
JKobrynski Mar 15, 2024
7dc8d4d
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 18, 2024
0984f64
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 19, 2024
b05ea1a
apply minor improvements
JKobrynski Mar 19, 2024
433c321
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 20, 2024
ffdcc2b
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 20, 2024
55eb2d3
apply suggested changes
JKobrynski Mar 20, 2024
bbe50b6
update require to suit ESM in webpack.config.js
JKobrynski Mar 20, 2024
cc93841
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 21, 2024
e059dd1
apply suggested changes
JKobrynski Mar 21, 2024
0781659
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 22, 2024
b44cd0f
apply suggested changes;
JKobrynski Mar 25, 2024
170b3fe
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 25, 2024
6ec96dd
apply suggested changes to CustomVersionFilePlugin.ts
JKobrynski Mar 25, 2024
5bb52b4
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 25, 2024
d38ea29
apply suggested changes
JKobrynski Mar 26, 2024
bfa7795
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 26, 2024
39fe477
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 27, 2024
80796d3
apply suggested changes
JKobrynski Mar 27, 2024
0756e49
apply suggested changes to webpack config files
JKobrynski Mar 28, 2024
4c9144b
Merge branch 'main' into migrateConfigFilesToTypeScript
JKobrynski Mar 28, 2024
ed108c4
add additional if statements to webpack.common.ts
JKobrynski Mar 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ module.exports = {
// This path is provide alias for files like `ONYXKEYS` and `CONST`.
'@src': './src',
'@desktop': './desktop',
'@github': './.github',
},
},
],
Expand Down
44 changes: 22 additions & 22 deletions .github/actions/javascript/authorChecklist/authorChecklist.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
/* eslint-disable @typescript-eslint/naming-convention */
import * as core from '@actions/core';
import * as github from '@actions/github';
import escapeRegExp from 'lodash/escapeRegExp';
import CONST from '../../../libs/CONST';
import GithubUtils from '../../../libs/GithubUtils';
import CONST from '@github/libs/CONST';
import GithubUtils from '@github/libs/GithubUtils';
import newComponentCategory from './categories/newComponentCategory';

const pathToAuthorChecklist = `https://raw.githubusercontent.com/${CONST.GITHUB_OWNER}/${CONST.APP_REPO}/main/.github/PULL_REQUEST_TEMPLATE.md`;
Expand All @@ -20,24 +21,24 @@ const CHECKLIST_CATEGORIES = {
*/
async function getChecklistCategoriesForPullRequest(): Promise<Set<string>> {
const checks = new Set<string>();
const changedFiles = await GithubUtils.paginate(GithubUtils.octokit.pulls.listFiles, {
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
// eslint-disable-next-line @typescript-eslint/naming-convention
pull_number: prNumber,
// eslint-disable-next-line @typescript-eslint/naming-convention
per_page: 100,
});
const possibleCategories = await Promise.all(
Object.values(CHECKLIST_CATEGORIES).map(async (category) => ({
items: category.items,
doesCategoryApply: await category.detect(changedFiles),
})),
);
for (const category of possibleCategories) {
if (category.doesCategoryApply) {
for (const item of category.items) {
checks.add(item);
if (prNumber !== undefined) {
const changedFiles = await GithubUtils.paginate(GithubUtils.octokit.pulls.listFiles, {
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
pull_number: prNumber,
per_page: 100,
});
const possibleCategories = await Promise.all(
Object.values(CHECKLIST_CATEGORIES).map(async (category) => ({
items: category.items,
doesCategoryApply: await category.detect(changedFiles),
})),
);
for (const category of possibleCategories) {
if (category.doesCategoryApply) {
for (const item of category.items) {
checks.add(item);
}
}
}
}
Expand Down Expand Up @@ -126,12 +127,11 @@ async function generateDynamicChecksAndCheckForCompletion() {
const newBody = contentBeforeChecklist + checklistStartsWith + checklist + checklistEndsWith + contentAfterChecklist;

// Update the PR body
if (didChecklistChange) {
if (didChecklistChange && prNumber !== undefined) {
console.log('Checklist changed, updating PR...');
await GithubUtils.octokit.pulls.update({
owner: CONST.GITHUB_OWNER,
repo: CONST.APP_REPO,
// eslint-disable-next-line @typescript-eslint/naming-convention
pull_number: prNumber,
body: newBody,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import github from '@actions/github';
import {parse} from '@babel/parser';
import traverse from '@babel/traverse';
import CONST from '../../../../libs/CONST';
import GithubUtils from '../../../../libs/GithubUtils';
import promiseSome from '../../../../libs/promiseSome';
import CONST from '@github/libs/CONST';
import GithubUtils from '@github/libs/GithubUtils';
import promiseSome from '@github/libs/promiseSome';
import type Category from './Category';

type SuperClassType = {superClass: {name?: string; object: {name: string}; property: {name: string}} | null; name: string};
Expand Down Expand Up @@ -81,7 +81,7 @@ async function detectReactComponentInFile(filename: string): Promise<boolean | u
};
try {
const {data} = await GithubUtils.octokit.repos.getContent(params);
const content = 'content' in data ? nodeBase64ToUtf8(data.content || '') : data;
const content = nodeBase64ToUtf8('content' in data ? data?.content ?? '' : '');
return detectReactComponent(content, filename);
} catch (error) {
console.error('An unknown error occurred with the GitHub API: ', error, params);
Expand Down
Loading
Loading