Skip to content

Commit 2307850

Browse files
committed
trying fropm previous commit that passed
2 parents 924c09f + 4a4997c commit 2307850

File tree

830 files changed

+31836
-8150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

830 files changed

+31836
-8150
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ docs/vendor/**
1010
docs/assets/**
1111
web/gtm.js
1212
**/.expo/**
13+
src/libs/SearchParser/searchParser.js

.eslintrc.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const restrictedImportPaths = [
88
'',
99
"For 'useWindowDimensions', please use '@src/hooks/useWindowDimensions' instead.",
1010
"For 'TouchableOpacity', 'TouchableWithoutFeedback', 'TouchableNativeFeedback', 'TouchableHighlight', 'Pressable', please use 'PressableWithFeedback' and/or 'PressableWithoutFeedback' from '@components/Pressable' instead.",
11-
"For 'StatusBar', please use '@src/libs/StatusBar' instead.",
11+
"For 'StatusBar', please use '@libs/StatusBar' instead.",
1212
"For 'Text', please use '@components/Text' instead.",
1313
"For 'ScrollView', please use '@components/ScrollView' instead.",
1414
].join('\n'),
@@ -59,8 +59,12 @@ const restrictedImportPaths = [
5959
},
6060
{
6161
name: 'expensify-common',
62-
importNames: ['Device'],
63-
message: "Do not import Device directly, it's known to make VSCode's IntelliSense crash. Please import the desired module from `expensify-common/dist/Device` instead.",
62+
importNames: ['Device', 'ExpensiMark'],
63+
message: [
64+
'',
65+
"For 'Device', do not import it directly, it's known to make VSCode's IntelliSense crash. Please import the desired module from `expensify-common/dist/Device` instead.",
66+
"For 'ExpensiMark', please use '@libs/Parser' instead.",
67+
].join('\n'),
6468
},
6569
];
6670

@@ -109,7 +113,6 @@ module.exports = {
109113
},
110114
rules: {
111115
// TypeScript specific rules
112-
'@typescript-eslint/no-unsafe-assignment': 'off',
113116
'@typescript-eslint/prefer-enum-initializers': 'error',
114117
'@typescript-eslint/no-var-requires': 'off',
115118
'@typescript-eslint/no-non-null-assertion': 'error',

.github/actions/javascript/bumpVersion/bumpVersion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ if (!semanticVersionLevel || !versionUpdater.isValidSemverLevel(semanticVersionL
4949
console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`, `Defaulting to: ${semanticVersionLevel}`);
5050
}
5151

52-
const {version: previousVersion}: PackageJson = JSON.parse(fs.readFileSync('./package.json').toString());
52+
const {version: previousVersion} = JSON.parse(fs.readFileSync('./package.json').toString()) as PackageJson;
5353
if (!previousVersion) {
5454
core.setFailed('Error: Could not read package.json');
5555
}

.github/actions/javascript/bumpVersion/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1928,7 +1928,7 @@ class SemVer {
19281928
do {
19291929
const a = this.build[i]
19301930
const b = other.build[i]
1931-
debug('prerelease compare', i, a, b)
1931+
debug('build compare', i, a, b)
19321932
if (a === undefined && b === undefined) {
19331933
return 0
19341934
} else if (b === undefined) {

.github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ import GitUtils from '@github/libs/GitUtils';
88

99
type IssuesCreateResponse = Awaited<ReturnType<typeof GithubUtils.octokit.issues.create>>['data'];
1010

11-
type PackageJSON = {
11+
type PackageJson = {
1212
version: string;
1313
};
1414

1515
async function run(): Promise<IssuesCreateResponse | void> {
1616
// Note: require('package.json').version does not work because ncc will resolve that to a plain string at compile time
17-
const packageJson: PackageJSON = JSON.parse(fs.readFileSync('package.json', 'utf8'));
17+
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf8')) as PackageJson;
1818
const newVersionTag = packageJson.version;
1919

2020
try {

.github/actions/javascript/getGraphiteString/getGraphiteString.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const run = () => {
3333
}
3434

3535
try {
36-
const current: RegressionEntry = JSON.parse(entry);
36+
const current = JSON.parse(entry) as RegressionEntry;
3737

3838
// Extract timestamp, Graphite accepts timestamp in seconds
3939
if (current.metadata?.creationDate) {

.github/actions/javascript/getPreviousVersion/getPreviousVersion.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function run() {
1111
core.setFailed(`'Error: Invalid input for 'SEMVER_LEVEL': ${semverLevel}`);
1212
}
1313

14-
const {version: currentVersion}: PackageJson = JSON.parse(readFileSync('./package.json', 'utf8'));
14+
const {version: currentVersion} = JSON.parse(readFileSync('./package.json', 'utf8')) as PackageJson;
1515
if (!currentVersion) {
1616
core.setFailed('Error: Could not read package.json');
1717
}

.github/actions/javascript/validateReassureOutput/validateReassureOutput.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {CompareResult, PerformanceEntry} from '@callstack/reassure-compare/
33
import fs from 'fs';
44

55
const run = (): boolean => {
6-
const regressionOutput: CompareResult = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8'));
6+
const regressionOutput = JSON.parse(fs.readFileSync('.reassure/output.json', 'utf8')) as CompareResult;
77
const countDeviation = Number(core.getInput('COUNT_DEVIATION', {required: true}));
88
const durationDeviation = Number(core.getInput('DURATION_DEVIATION_PERCENTAGE', {required: true}));
99

.github/libs/sanitizeStringForJSONParse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const replacer = (str: string): string =>
88
'\r': '\\r',
99
'\f': '\\f',
1010
'"': '\\"',
11-
})[str] ?? '';
11+
}[str] ?? '');
1212

1313
/**
1414
* Replace any characters in the string that will break JSON.parse for our Git Log output

.github/workflows/deploy.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,24 @@ jobs:
2828

2929
- name: 🚀 Push tags to trigger staging deploy 🚀
3030
run: git push --tags
31+
32+
- name: Warn deployers if staging deploy failed
33+
if: ${{ failure() }}
34+
uses: 8398a7/action-slack@v3
35+
with:
36+
status: custom
37+
custom_payload: |
38+
{
39+
channel: '#deployer',
40+
attachments: [{
41+
color: "#DB4545",
42+
pretext: `<!subteam^S4TJJ3PSL>`,
43+
text: `💥 NewDot staging deploy failed. 💥`,
44+
}]
45+
}
46+
env:
47+
GITHUB_TOKEN: ${{ github.token }}
48+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
3149

3250
deployProduction:
3351
runs-on: ubuntu-latest
@@ -65,6 +83,24 @@ jobs:
6583
PR_LIST: ${{ steps.getReleasePRList.outputs.PR_LIST }}
6684

6785
- name: 🚀 Create release to trigger production deploy 🚀
68-
run: gh release create ${{ env.PRODUCTION_VERSION }} --generate-notes
86+
run: gh release create ${{ env.PRODUCTION_VERSION }} --notes '${{ steps.getReleaseBody.outputs.RELEASE_BODY }}'
6987
env:
7088
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }}
89+
90+
- name: Warn deployers if production deploy failed
91+
if: ${{ failure() }}
92+
uses: 8398a7/action-slack@v3
93+
with:
94+
status: custom
95+
custom_payload: |
96+
{
97+
channel: '#deployer',
98+
attachments: [{
99+
color: "#DB4545",
100+
pretext: `<!subteam^S4TJJ3PSL>`,
101+
text: `💥 NewDot production deploy failed. 💥`,
102+
}]
103+
}
104+
env:
105+
GITHUB_TOKEN: ${{ github.token }}
106+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}

.github/workflows/e2ePerformanceTests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,12 +257,12 @@ jobs:
257257
- name: Check if test failed, if so post the results and add the DeployBlocker label
258258
id: checkIfRegressionDetected
259259
run: |
260-
if grep -q '🔴' ./output.md; then
260+
if grep -q '🔴' "./Host_Machine_Files/\$WORKING_DIRECTORY/output.md"; then
261261
# Create an output to the GH action that the test failed:
262262
echo "performanceRegressionDetected=true" >> "$GITHUB_OUTPUT"
263263
264264
gh pr edit ${{ inputs.PR_NUMBER }} --add-label DeployBlockerCash
265-
gh pr comment ${{ inputs.PR_NUMBER }} -F ./output.md
265+
gh pr comment ${{ inputs.PR_NUMBER }} -F "./Host_Machine_Files/\$WORKING_DIRECTORY/output.md"
266266
gh pr comment ${{ inputs.PR_NUMBER }} -b "@Expensify/mobile-deployers 📣 Please look into this performance regression as it's a deploy blocker."
267267
else
268268
echo "performanceRegressionDetected=false" >> "$GITHUB_OUTPUT"

.github/workflows/reassurePerformanceTests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ jobs:
4848
git fetch origin "$BASELINE_BRANCH" --no-tags --depth=1
4949
git switch "$BASELINE_BRANCH"
5050
npm install --force
51-
npx reassure --baseline
51+
NODE_OPTIONS=--experimental-vm-modules npx reassure --baseline
5252
git switch --force --detach -
5353
git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours
5454
git checkout --ours .
5555
npm install --force
56-
npx reassure --branch
56+
NODE_OPTIONS=--experimental-vm-modules npx reassure --branch
5757
5858
- name: Validate output.json
5959
id: validateReassureOutput

.github/workflows/sendReassurePerfData.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
shell: bash
2626
run: |
2727
set -e
28-
npx reassure --baseline
28+
NODE_OPTIONS=--experimental-vm-modules npx reassure --baseline
2929
3030
- name: Get merged pull request
3131
id: getMergedPullRequest

.github/workflows/typecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
# - git diff is used to see the files that were added on this branch
3535
# - gh pr view is used to list files touched by this PR. Git diff may give false positives if the branch isn't up-to-date with main
3636
# - wc counts the words in the result of the intersection
37-
count_new_js=$(comm -1 -2 <(git diff --name-only --diff-filter=A origin/main HEAD -- 'src/*.js' '__mocks__/*.js' '.storybook/*.js' 'assets/*.js' 'config/*.js' 'desktop/*.js' 'jest/*.js' 'scripts/*.js' 'tests/*.js' 'workflow_tests/*.js' '.github/libs/*.js' '.github/scripts/*.js') <(gh pr view ${{ github.event.pull_request.number }} --json files | jq -r '.files | map(.path) | .[]') | wc -l)
37+
count_new_js=$(comm -1 -2 <(git diff --name-only --diff-filter=A origin/main HEAD -- 'src/*.js' '__mocks__/*.js' '.storybook/*.js' 'assets/*.js' 'config/*.js' 'desktop/*.js' 'jest/*.js' 'scripts/*.js' 'tests/*.js' 'workflow_tests/*.js' '.github/libs/*.js' '.github/scripts/*.js' ':!src/libs/SearchParser/*.js') <(gh pr view ${{ github.event.pull_request.number }} --json files | jq -r '.files | map(.path) | .[]') | wc -l)
3838
if [ "$count_new_js" -gt "0" ]; then
3939
echo "ERROR: Found new JavaScript files in the project; use TypeScript instead."
4040
exit 1

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ package-lock.json
1919
src/libs/E2E/reactNativeLaunchingTest.ts
2020
# Temporary while we keep react-compiler in our repo
2121
lib/**
22+
23+
# Automatically generated files
24+
src/libs/SearchParser/searchParser.js

.prettierrc.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ module.exports = {
66
arrowParens: 'always',
77
printWidth: 190,
88
singleAttributePerLine: true,
9+
plugins: [require.resolve('@trivago/prettier-plugin-sort-imports')],
910
/** `importOrder` should be defined in an alphabetical order. */
1011
importOrder: [
1112
'@assets/(.*)$',
Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,65 @@
1-
import {useIsFocused as realUseIsFocused, useTheme as realUseTheme} from '@react-navigation/native';
1+
/* eslint-disable import/prefer-default-export, import/no-import-module-exports */
2+
import type * as ReactNavigation from '@react-navigation/native';
3+
import createAddListenerMock from '../../../tests/utils/createAddListenerMock';
24

3-
// We only want these mocked for storybook, not jest
4-
const useIsFocused: typeof realUseIsFocused = process.env.NODE_ENV === 'test' ? realUseIsFocused : () => true;
5+
const isJestEnv = process.env.NODE_ENV === 'test';
56

6-
const useTheme = process.env.NODE_ENV === 'test' ? realUseTheme : () => ({});
7+
const realReactNavigation = isJestEnv ? jest.requireActual<typeof ReactNavigation>('@react-navigation/native') : (require('@react-navigation/native') as typeof ReactNavigation);
8+
9+
const useIsFocused = isJestEnv ? realReactNavigation.useIsFocused : () => true;
10+
const useTheme = isJestEnv ? realReactNavigation.useTheme : () => ({});
11+
12+
const {triggerTransitionEnd, addListener} = isJestEnv
13+
? createAddListenerMock()
14+
: {
15+
triggerTransitionEnd: () => {},
16+
addListener: () => {},
17+
};
18+
19+
const useNavigation = () => ({
20+
...realReactNavigation.useNavigation,
21+
navigate: jest.fn(),
22+
getState: () => ({
23+
routes: [],
24+
}),
25+
addListener,
26+
});
27+
28+
type NativeNavigationMock = typeof ReactNavigation & {
29+
triggerTransitionEnd: () => void;
30+
};
731

832
export * from '@react-navigation/core';
9-
export {useIsFocused, useTheme};
33+
const Link = realReactNavigation.Link;
34+
const LinkingContext = realReactNavigation.LinkingContext;
35+
const NavigationContainer = realReactNavigation.NavigationContainer;
36+
const ServerContainer = realReactNavigation.ServerContainer;
37+
const DarkTheme = realReactNavigation.DarkTheme;
38+
const DefaultTheme = realReactNavigation.DefaultTheme;
39+
const ThemeProvider = realReactNavigation.ThemeProvider;
40+
const useLinkBuilder = realReactNavigation.useLinkBuilder;
41+
const useLinkProps = realReactNavigation.useLinkProps;
42+
const useLinkTo = realReactNavigation.useLinkTo;
43+
const useScrollToTop = realReactNavigation.useScrollToTop;
44+
export {
45+
// Overriden modules
46+
useIsFocused,
47+
useTheme,
48+
useNavigation,
49+
triggerTransitionEnd,
50+
51+
// Theme modules are left alone
52+
Link,
53+
LinkingContext,
54+
NavigationContainer,
55+
ServerContainer,
56+
DarkTheme,
57+
DefaultTheme,
58+
ThemeProvider,
59+
useLinkBuilder,
60+
useLinkProps,
61+
useLinkTo,
62+
useScrollToTop,
63+
};
64+
65+
export type {NativeNavigationMock};

__mocks__/@ua/react-native-airship.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ const iOS: Partial<typeof AirshipIOS> = {
1515
},
1616
};
1717

18-
const pushIOS: AirshipPushIOS = jest.fn().mockImplementation(() => ({
18+
const pushIOS = jest.fn().mockImplementation(() => ({
1919
setBadgeNumber: jest.fn(),
2020
setForegroundPresentationOptions: jest.fn(),
2121
setForegroundPresentationOptionsCallback: jest.fn(),
22-
}))();
22+
}))() as AirshipPushIOS;
2323

24-
const pushAndroid: AirshipPushAndroid = jest.fn().mockImplementation(() => ({
24+
const pushAndroid = jest.fn().mockImplementation(() => ({
2525
setForegroundDisplayPredicate: jest.fn(),
26-
}))();
26+
}))() as AirshipPushAndroid;
2727

28-
const push: AirshipPush = jest.fn().mockImplementation(() => ({
28+
const push = jest.fn().mockImplementation(() => ({
2929
iOS: pushIOS,
3030
android: pushAndroid,
3131
enableUserNotifications: () => Promise.resolve(false),
3232
clearNotifications: jest.fn(),
3333
getNotificationStatus: () => Promise.resolve({airshipOptIn: false, systemEnabled: false, airshipEnabled: false}),
3434
getActiveNotifications: () => Promise.resolve([]),
35-
}))();
35+
}))() as AirshipPush;
3636

37-
const contact: AirshipContact = jest.fn().mockImplementation(() => ({
37+
const contact = jest.fn().mockImplementation(() => ({
3838
identify: jest.fn(),
3939
getNamedUserId: () => Promise.resolve(undefined),
4040
reset: jest.fn(),
4141
module: jest.fn(),
42-
}))();
42+
}))() as AirshipContact;
4343

4444
const Airship: Partial<AirshipRoot> = {
4545
addListener: jest.fn(),

__mocks__/fs.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
12
const {fs} = require('memfs');
23

34
module.exports = fs;

__mocks__/react-native.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jest.doMock('react-native', () => {
4141
};
4242
};
4343

44-
const reactNativeMock: ReactNativeMock = Object.setPrototypeOf(
44+
const reactNativeMock = Object.setPrototypeOf(
4545
{
4646
NativeModules: {
4747
...ReactNative.NativeModules,
@@ -86,7 +86,7 @@ jest.doMock('react-native', () => {
8686
},
8787
Dimensions: {
8888
...ReactNative.Dimensions,
89-
addEventListener: jest.fn(),
89+
addEventListener: jest.fn(() => ({remove: jest.fn()})),
9090
get: () => dimensions,
9191
set: (newDimensions: Record<string, number>) => {
9292
dimensions = newDimensions;
@@ -98,11 +98,14 @@ jest.doMock('react-native', () => {
9898
// so it seems easier to just run the callback immediately in tests.
9999
InteractionManager: {
100100
...ReactNative.InteractionManager,
101-
runAfterInteractions: (callback: () => void) => callback(),
101+
runAfterInteractions: (callback: () => void) => {
102+
callback();
103+
return {cancel: () => {}};
104+
},
102105
},
103106
},
104107
ReactNative,
105-
);
108+
) as ReactNativeMock;
106109

107110
return reactNativeMock;
108111
});

android/app/build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ fullstory {
1515
org 'o-1WN56P-na1'
1616
enabledVariants 'all'
1717
logcatLevel 'debug'
18+
recordOnStart false
1819
}
1920

2021
react {
@@ -107,8 +108,8 @@ android {
107108
minSdkVersion rootProject.ext.minSdkVersion
108109
targetSdkVersion rootProject.ext.targetSdkVersion
109110
multiDexEnabled rootProject.ext.multiDexEnabled
110-
versionCode 1009000302
111-
versionName "9.0.3-2"
111+
versionCode 1009000602
112+
versionName "9.0.6-2"
112113
// Supported language variants must be declared here to avoid from being removed during the compilation.
113114
// This also helps us to not include unnecessary language variants in the APK.
114115
resConfigs "en", "es"

0 commit comments

Comments
 (0)