Skip to content

Commit

Permalink
merged main
Browse files Browse the repository at this point in the history
  • Loading branch information
keisyrzk committed Dec 19, 2023
2 parents d30c159 + e81ed8f commit 6e45bbb
Show file tree
Hide file tree
Showing 788 changed files with 6,997 additions and 4,437 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ module.exports = {
'rulesdir/prefer-underscore-method': 'off',
'rulesdir/prefer-import-module-contents': 'off',
'react/require-default-props': 'off',
'react/prop-types': 'off',
'no-restricted-syntax': [
'error',
{
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/composite/setupGitForOSBotifyApp/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ runs:
if: runner.debug == '1'
run: echo "GIT_TRACE=true" >> "$GITHUB_ENV"

- name: Sync clock
shell: bash
run: sudo sntp -sS time.windows.com
if: runner.os == 'macOS'

- name: Generate a token
id: generateToken
uses: actions/create-github-app-token@9d97a4282b2c51a2f4f0465b9326399f53c890d4
Expand Down
64 changes: 33 additions & 31 deletions .github/scripts/findUnusedKeys.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ LIB_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && cd ../../ && pwd)"

readonly SRC_DIR="${LIB_PATH}/src"
readonly STYLES_DIR="${LIB_PATH}/src/styles"
readonly STYLES_FILE="${LIB_PATH}/src/styles/styles.ts"
readonly UTILITIES_STYLES_FILE="${LIB_PATH}/src/styles/utilities"
readonly STYLES_FILE="${LIB_PATH}/src/styles/index.ts"
readonly UTILS_STYLES_FILE="${LIB_PATH}/src/styles/utils"
readonly UTILS_STYLES_GENERATORS_FILE="${LIB_PATH}/src/styles/utils/generators"
readonly STYLES_KEYS_FILE="${LIB_PATH}/scripts/style_keys_list_temp.txt"
readonly UTILITY_STYLES_KEYS_FILE="${LIB_PATH}/scripts/utility_keys_list_temp.txt"
readonly UTIL_STYLES_KEYS_FILE="${LIB_PATH}/scripts/util_keys_list_temp.txt"
readonly REMOVAL_KEYS_FILE="${LIB_PATH}/scripts/removal_keys_list_temp.txt"
readonly AMOUNT_LINES_TO_SHOW=3

Expand All @@ -29,7 +30,7 @@ ctrl_c() {
delete_temp_files
exit 1
}

count_lines() {
local file=$1
if [[ -e "$file" ]]; then
Expand All @@ -43,11 +44,11 @@ count_lines() {
show_unused_style_keywords() {
while IFS=: read -r key file line_number; do
title "File: $file:$line_number"

# Get lines before and after the error line
local lines_before=$((line_number - AMOUNT_LINES_TO_SHOW))
local lines_after=$((line_number + AMOUNT_LINES_TO_SHOW))

# Read the lines into an array
local lines=()
while IFS= read -r line; do
Expand Down Expand Up @@ -84,22 +85,22 @@ lookfor_unused_keywords() {

# Search for keywords starting with "styles"
while IFS= read -r keyword; do

# Remove any [ ] characters from the keyword
local clean_keyword="${keyword//[\[\]]/}"
# skip styles. keyword that might be used in comments
if [[ "$clean_keyword" == "styles." ]]; then
continue
fi

if ! remove_keyword "$clean_keyword" ; then
# In case of a leaf of the styles object is being used, it means the parent objects is being used
# we need to mark it as used.
if [[ "$clean_keyword" =~ ^styles\.[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+$ ]]; then
# Keyword has more than two words, remove words after the second word
local keyword_prefix="${clean_keyword%.*}"
remove_keyword "$keyword_prefix"
fi
fi
fi
done < <(grep -E -o '\bstyles\.[a-zA-Z0-9_.]*' "$file" | grep -v '\/\/' | grep -vE '\/\*.*\*\/')
done < <(find "${SRC_DIR}" -type f \( "${FILE_EXTENSIONS[@]}" \))
Expand Down Expand Up @@ -134,10 +135,10 @@ find_styles_object_and_store_keys() {
if [[ ! "$line" =~ ^[[:space:]]*(const|let|var)[[:space:]]+([a-zA-Z0-9_-]+)[[:space:]]*=[[:space:]]*\{|^[[:space:]]*([a-zA-Z0-9_-]+\.)?[a-zA-Z0-9_-]+:[[:space:]]*\{|^[[:space:]]*\} ]]; then
continue
fi

if [[ "$line" =~ ^[[:space:]]*(const|let|var)[[:space:]]+([a-zA-Z0-9_-]+)[[:space:]]*=[[:space:]]*\{ ]]; then
key="${BASH_REMATCH[2]%%:*{*)}"
echo "styles.${key}|...${key}|${base_name}.${key}:${file}:${line_number}" >> "$STYLES_KEYS_FILE"
echo "styles.${key}|...${key}|${base_name}.${key}:${file}:${line_number}" >> "$STYLES_KEYS_FILE"
fi
done < "$file"
}
Expand Down Expand Up @@ -225,7 +226,7 @@ find_theme_style_and_store_keys() {

continue
fi

if [[ "$line" =~ ^[[:space:]]*([a-zA-Z0-9_-]+\.)?[a-zA-Z0-9_-]+:[[:space:]]*\{|^[[:space:]]*([a-zA-Z0-9_-])+:[[:space:]]*\(.*\)[[:space:]]*'=>'[[:space:]]*\(\{ ]]; then
# Removing all the extra lines after the ":"
local key="${line%%:*}"
Expand Down Expand Up @@ -295,63 +296,64 @@ lookfor_unused_spread_keywords() {
done < "$STYLES_FILE"
}

find_utility_styles_store_prefix() {
find_util_styles_store_prefix() {
# Loop through all files in the src folder
while read -r file; do
# Search for keywords starting with "styles"
while IFS= read -r keyword; do
local variable="${keyword##*/}"
local variable_trimmed="${variable// /}" # Trim spaces
echo "$variable_trimmed" >> "$UTILITY_STYLES_KEYS_FILE"
done < <(grep -E -o './utilities/[a-zA-Z0-9_-]+' "$file" | grep -v '\/\/' | grep -vE '\/\*.*\*\/')

echo "$variable_trimmed" >> "$UTIL_STYLES_KEYS_FILE"
done < <(grep -E -o './utils/[a-zA-Z0-9_-]+' "$file" | grep -v '\/\/' | grep -vE '\/\*.*\*\/')
done < <(find "${STYLES_DIR}" -type f \( "${FILE_EXTENSIONS[@]}" \))

# Sort and remove duplicates from the temporary file
sort -u -o "${UTILITY_STYLES_KEYS_FILE}" "${UTILITY_STYLES_KEYS_FILE}"
sort -u -o "${UTIL_STYLES_KEYS_FILE}" "${UTIL_STYLES_KEYS_FILE}"
}

find_utility_usage_as_styles() {
find_util_usage_as_styles() {
while read -r file; do
local root_key
local parent_dir

# Get the folder name, given this utility files are index.js
# Get the folder name, given this util files are index.js
parent_dir=$(dirname "$file")
root_key=$(basename "${parent_dir}")

if [[ "${root_key}" == "utilities" ]]; then
if [[ "${root_key}" == "utils" ]]; then
continue
fi

find_theme_style_and_store_keys "${file}" 0 "${root_key}"
done < <(find "${UTILITIES_STYLES_FILE}" -type f \( "${FILE_EXTENSIONS[@]}" \))
done < <(find "${UTILS_STYLES_FILE}" -type f \( -path "${UTILS_STYLES_GENERATORS_FILE}" -prune -o -name "${FILE_EXTENSIONS[@]}" \) -print)

}

lookfor_unused_utilities() {
# Read each utility keyword from the file
lookfor_unused_utils() {
# Read each util keyword from the file
while read -r keyword; do
# Creating a copy so later the replacement can reference it
# Creating a copy so later the replacement can reference it
local original_keyword="${keyword}"

# Iterate through all files in "src/styles"
while read -r file; do
# Find all words that match "$keyword.[a-zA-Z0-9_-]+"
while IFS= read -r match; do
# Replace the utility prefix with "styles"
# Replace the util prefix with "styles"
local variable="${match/#$original_keyword/styles}"
# Call the remove_keyword function with the variable
remove_keyword "${variable}"
remove_keyword "${match}"
done < <(grep -E -o "$original_keyword\.[a-zA-Z0-9_-]+" "$file" | grep -v '\/\/' | grep -vE '\/\*.*\*\/')
done < <(find "${STYLES_DIR}" -type f \( "${FILE_EXTENSIONS[@]}" \))
done < "$UTILITY_STYLES_KEYS_FILE"
done < "$UTIL_STYLES_KEYS_FILE"
}

echo "🔍 Looking for styles."
# Find and store the name of the utility files as keys
find_utility_styles_store_prefix
find_utility_usage_as_styles
# Find and store the name of the util files as keys
find_util_styles_store_prefix
find_util_usage_as_styles

# Find and store keys from styles.ts
find_styles_object_and_store_keys "$STYLES_FILE"
Expand All @@ -360,8 +362,8 @@ collect_theme_keys_from_styles "$STYLES_FILE"

echo "🗄️ Now going through the codebase and looking for unused keys."

# Look for usages of utilities into src/styles
lookfor_unused_utilities
# Look for usages of utils into src/styles
lookfor_unused_utils
lookfor_unused_spread_keywords
lookfor_unused_keywords

Expand Down
12 changes: 2 additions & 10 deletions .github/workflows/createNewVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ on:
OS_BOTIFY_COMMIT_TOKEN:
description: OSBotify personal access token, used to workaround committing to protected branch
required: true
OS_BOTIFY_APP_ID:
description: Application ID for OS Botify App
required: true
OS_BOTIFY_PRIVATE_KEY:
description: OSBotify private key
required: true

jobs:
validateActor:
Expand Down Expand Up @@ -76,18 +70,16 @@ jobs:
token: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }}

- name: Setup git for OSBotify
uses: ./.github/actions/composite/setupGitForOSBotifyApp
uses: ./.github/actions/composite/setupGitForOSBotify
id: setupGitForOSBotify
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}
OS_BOTIFY_APP_ID: ${{ secrets.OS_BOTIFY_APP_ID }}
OS_BOTIFY_PRIVATE_KEY: ${{ secrets.OS_BOTIFY_PRIVATE_KEY }}

- name: Generate version
id: bumpVersion
uses: ./.github/actions/javascript/bumpVersion
with:
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }}
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }}
SEMVER_LEVEL: ${{ inputs.SEMVER_LEVEL }}

- name: Commit new version
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/reassurePerformanceTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ jobs:
- name: Setup NodeJS
uses: ./.github/actions/composite/setupNode

- name: Set dummy git credentials
run: |
git config --global user.email "[email protected]"
git config --global user.name "Test"
- name: Run performance testing script
shell: bash
run: |
Expand All @@ -27,6 +32,7 @@ jobs:
npm install --force
npx reassure --baseline
git switch --force --detach -
git merge --no-commit --allow-unrelated-histories "$BASELINE_BRANCH" -X ours
npm install --force
npx reassure --branch
Expand Down
2 changes: 1 addition & 1 deletion .storybook/theme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {create} from '@storybook/theming';
import colors from '../src/styles/colors';
import colors from '../src/styles/theme/colors';

export default create({
brandTitle: 'New Expensify UI Docs',
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1001041001
versionName "1.4.10-1"
versionCode 1001041200
versionName "1.4.12-0"
}

flavorDimensions "default"
Expand Down
8 changes: 8 additions & 0 deletions assets/images/thumbs-up.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 28 additions & 22 deletions desktop/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"dependencies": {
"electron-context-menu": "^2.3.0",
"electron-log": "^4.4.7",
"electron-serve": "^1.0.0",
"electron-updater": "^6.1.4",
"electron-serve": "^1.2.0",
"electron-updater": "^6.1.6",
"node-machine-id": "^1.1.12"
},
"author": "Expensify, Inc.",
Expand Down
5 changes: 0 additions & 5 deletions docs/_includes/floating-concierge-button.html

This file was deleted.

2 changes: 2 additions & 0 deletions docs/_includes/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ <h3>Get Started</h3>
</div>
</div>

<p class="page-footer__fine-print">The Expensify Visa® Commercial Card is issued by The Bancorp Bank, N.A., Member FDIC, pursuant to a license from Visa U.S.A. Inc. and may not be used at all merchants that accept Visa cards. Apple® and the Apple logo® are trademarks of Apple Inc., registered in the U.S. and other countries. App Store is a service mark of Apple Inc. Google Play and the Google Play logo are trademarks of Google LLC.</p>

<div class="page-footer__logo">
<img src="/assets/images/expensify-footer-logo.svg" alt="Expensify" />
</div>
Expand Down
Loading

0 comments on commit 6e45bbb

Please sign in to comment.