Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Expensify/App into feat/pro…
Browse files Browse the repository at this point in the history
…posal-police
  • Loading branch information
ikevin127 committed Jun 22, 2024
1 parent 623ca4d commit 4ffbd42
Show file tree
Hide file tree
Showing 1,287 changed files with 32,262 additions and 16,787 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ USE_WEB_PROXY=false
USE_WDYR=false
CAPTURE_METRICS=false
ONYX_METRICS=false
GOOGLE_GEOLOCATION_API_KEY=AIzaSyBqg6bMvQU7cPWDKhhzpYqJrTEnSorpiLI

EXPENSIFY_ACCOUNT_ID_ACCOUNTING=-1
EXPENSIFY_ACCOUNT_ID_ADMIN=-1
Expand Down
1 change: 0 additions & 1 deletion .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ PUSHER_APP_KEY=268df511a204fbb60884
USE_WEB_PROXY=false
ENVIRONMENT=production
SEND_CRASH_REPORTS=true
GOOGLE_GEOLOCATION_API_KEY=AIzaSyBFKujMpzExz0_z2pAGfPUwkmlaUc-uw1Q
3 changes: 1 addition & 2 deletions .env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ EXPENSIFY_PARTNER_PASSWORD=e21965746fd75f82bb66
PUSHER_APP_KEY=268df511a204fbb60884
USE_WEB_PROXY=false
ENVIRONMENT=staging
SEND_CRASH_REPORTS=true
GOOGLE_GEOLOCATION_API_KEY=AIzaSyD2T1mlByThbUN88O8OPOD8vKuMMwLD4-M
SEND_CRASH_REPORTS=true
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ android/**/build/**
docs/vendor/**
docs/assets/**
web/gtm.js
**/.expo/**
32 changes: 27 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const path = require('path');

const restrictedImportPaths = [
{
name: 'react-native',
Expand Down Expand Up @@ -55,6 +57,11 @@ const restrictedImportPaths = [
name: 'date-fns/locale',
message: "Do not import 'date-fns/locale' directly. Please use the submodule import instead, like 'date-fns/locale/en-GB'.",
},
{
name: 'expensify-common',
importNames: ['Device'],
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.",
},
];

const restrictedImportPatterns = [
Expand Down Expand Up @@ -91,7 +98,7 @@ module.exports = {
plugins: ['@typescript-eslint', 'jsdoc', 'you-dont-need-lodash-underscore', 'react-native-a11y', 'react', 'testing-library'],
parser: '@typescript-eslint/parser',
parserOptions: {
project: './tsconfig.json',
project: path.resolve(__dirname, './tsconfig.json'),
},
env: {
jest: true,
Expand All @@ -100,11 +107,9 @@ module.exports = {
__DEV__: 'readonly',
},
rules: {
'@typescript-eslint/no-unsafe-call': 'off',
// TypeScript specific rules
'@typescript-eslint/no-unsafe-member-access': 'off',
'@typescript-eslint/no-unsafe-assignment': 'off',

// TypeScript specific rules
'@typescript-eslint/prefer-enum-initializers': 'error',
'@typescript-eslint/no-var-requires': 'off',
'@typescript-eslint/no-non-null-assertion': 'error',
Expand Down Expand Up @@ -167,6 +172,7 @@ module.exports = {

// Rulesdir specific rules
'rulesdir/no-default-props': 'error',
'rulesdir/prefer-type-fest': 'error',
'rulesdir/no-multiple-onyx-in-file': 'off',
'rulesdir/prefer-underscore-method': 'off',
'rulesdir/prefer-import-module-contents': 'off',
Expand Down Expand Up @@ -210,6 +216,8 @@ module.exports = {
// Other rules
curly: 'error',
'you-dont-need-lodash-underscore/throttle': 'off',
// The suggested alternative (structuredClone) is not supported in Hermes:https://github.com/facebook/hermes/issues/684
'you-dont-need-lodash-underscore/clone-deep': 'off',
'prefer-regex-literals': 'off',
'valid-jsdoc': 'off',
'jsdoc/no-types': 'error',
Expand All @@ -235,10 +243,24 @@ module.exports = {
],
},

// Remove once no JS files are left
overrides: [
// Enforces every Onyx type and its properties to have a comment explaining its purpose.
{
files: ['src/types/onyx/**/*.ts'],
rules: {
'jsdoc/require-jsdoc': [
'error',
{
contexts: ['TSInterfaceDeclaration', 'TSTypeAliasDeclaration', 'TSPropertySignature'],
},
],
},
},

// Remove once no JS files are left
{
files: ['*.js', '*.jsx'],
extends: ['plugin:@typescript-eslint/disable-type-checked'],
rules: {
'@typescript-eslint/prefer-nullish-coalescing': 'off',
'@typescript-eslint/no-unsafe-return': 'off',
Expand Down
60 changes: 43 additions & 17 deletions .github/actions/javascript/authorChecklist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11710,7 +11710,7 @@ FetchError.prototype.name = 'FetchError';

let convert;
try {
convert = (__nccwpck_require__(2877).convert);
convert = (__nccwpck_require__(3975).convert);
} catch (e) {}

const INTERNALS = Symbol('Body internals');
Expand Down Expand Up @@ -17081,13 +17081,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873));
class GithubUtils {
static internalOctokit;
/**
* Initialize internal octokit
*
* @private
* Initialize internal octokit.
* NOTE: When using GithubUtils in CI, you don't need to call this manually.
*/
static initOctokit() {
static initOctokitWithToken(token) {
const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest);
const token = core.getInput('GITHUB_TOKEN', { required: true });
// Save a copy of octokit used in this class
this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, {
throttle: {
Expand All @@ -17107,6 +17105,15 @@ class GithubUtils {
},
}));
}
/**
* Default initialize method assuming running in CI, getting the token from an input.
*
* @private
*/
static initOctokit() {
const token = core.getInput('GITHUB_TOKEN', { required: true });
this.initOctokitWithToken(token);
}
/**
* Either give an existing instance of Octokit rest or create a new one
*
Expand Down Expand Up @@ -17462,12 +17469,31 @@ class GithubUtils {
.then((events) => events.filter((event) => event.event === 'closed'))
.then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? '');
}
static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
/**
* Returns a single artifact by name. If none is found, it returns undefined.
*/
static getArtifactByName(artifactName) {
return this.octokit.actions
.listArtifactsForRepo({
owner: CONST_1.default.GITHUB_OWNER,
repo: CONST_1.default.APP_REPO,
per_page: 100,
}).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName));
per_page: 1,
name: artifactName,
})
.then((response) => response.data.artifacts[0]);
}
/**
* Given an artifact ID, returns the download URL to a zip file containing the artifact.
*/
static getArtifactDownloadURL(artifactId) {
return this.octokit.actions
.downloadArtifact({
owner: CONST_1.default.GITHUB_OWNER,
repo: CONST_1.default.APP_REPO,
artifact_id: artifactId,
archive_format: 'zip',
})
.then((response) => response.url);
}
}
exports["default"] = GithubUtils;
Expand Down Expand Up @@ -17539,27 +17565,27 @@ exports["default"] = arrayDifference;

/***/ }),

/***/ 2877:
/***/ 9491:
/***/ ((module) => {

module.exports = eval("require")("encoding");

"use strict";
module.exports = require("assert");

/***/ }),

/***/ 9491:
/***/ 6113:
/***/ ((module) => {

"use strict";
module.exports = require("assert");
module.exports = require("crypto");

/***/ }),

/***/ 6113:
/***/ 3975:
/***/ ((module) => {

"use strict";
module.exports = require("crypto");
module.exports = require("encoding");

/***/ }),

Expand Down
60 changes: 43 additions & 17 deletions .github/actions/javascript/awaitStagingDeploys/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7373,7 +7373,7 @@ FetchError.prototype.name = 'FetchError';

let convert;
try {
convert = (__nccwpck_require__(2877).convert);
convert = (__nccwpck_require__(3975).convert);
} catch (e) {}

const INTERNALS = Symbol('Body internals');
Expand Down Expand Up @@ -12322,13 +12322,11 @@ const CONST_1 = __importDefault(__nccwpck_require__(9873));
class GithubUtils {
static internalOctokit;
/**
* Initialize internal octokit
*
* @private
* Initialize internal octokit.
* NOTE: When using GithubUtils in CI, you don't need to call this manually.
*/
static initOctokit() {
static initOctokitWithToken(token) {
const Octokit = utils_1.GitHub.plugin(plugin_throttling_1.throttling, plugin_paginate_rest_1.paginateRest);
const token = core.getInput('GITHUB_TOKEN', { required: true });
// Save a copy of octokit used in this class
this.internalOctokit = new Octokit((0, utils_1.getOctokitOptions)(token, {
throttle: {
Expand All @@ -12348,6 +12346,15 @@ class GithubUtils {
},
}));
}
/**
* Default initialize method assuming running in CI, getting the token from an input.
*
* @private
*/
static initOctokit() {
const token = core.getInput('GITHUB_TOKEN', { required: true });
this.initOctokitWithToken(token);
}
/**
* Either give an existing instance of Octokit rest or create a new one
*
Expand Down Expand Up @@ -12703,12 +12710,31 @@ class GithubUtils {
.then((events) => events.filter((event) => event.event === 'closed'))
.then((closedEvents) => closedEvents.at(-1)?.actor?.login ?? '');
}
static getArtifactByName(artefactName) {
return this.paginate(this.octokit.actions.listArtifactsForRepo, {
/**
* Returns a single artifact by name. If none is found, it returns undefined.
*/
static getArtifactByName(artifactName) {
return this.octokit.actions
.listArtifactsForRepo({
owner: CONST_1.default.GITHUB_OWNER,
repo: CONST_1.default.APP_REPO,
per_page: 100,
}).then((artifacts) => artifacts.find((artifact) => artifact.name === artefactName));
per_page: 1,
name: artifactName,
})
.then((response) => response.data.artifacts[0]);
}
/**
* Given an artifact ID, returns the download URL to a zip file containing the artifact.
*/
static getArtifactDownloadURL(artifactId) {
return this.octokit.actions
.downloadArtifact({
owner: CONST_1.default.GITHUB_OWNER,
repo: CONST_1.default.APP_REPO,
artifact_id: artifactId,
archive_format: 'zip',
})
.then((response) => response.url);
}
}
exports["default"] = GithubUtils;
Expand Down Expand Up @@ -12804,27 +12830,27 @@ exports["default"] = arrayDifference;

/***/ }),

/***/ 2877:
/***/ 9491:
/***/ ((module) => {

module.exports = eval("require")("encoding");

"use strict";
module.exports = require("assert");

/***/ }),

/***/ 9491:
/***/ 6113:
/***/ ((module) => {

"use strict";
module.exports = require("assert");
module.exports = require("crypto");

/***/ }),

/***/ 6113:
/***/ 3975:
/***/ ((module) => {

"use strict";
module.exports = require("crypto");
module.exports = require("encoding");

/***/ }),

Expand Down
5 changes: 3 additions & 2 deletions .github/actions/javascript/bumpVersion/bumpVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type {PackageJson} from 'type-fest';
import {promisify} from 'util';
import {generateAndroidVersionCode, updateAndroidVersion, updateiOSVersion} from '@github/libs/nativeVersionUpdater';
import * as versionUpdater from '@github/libs/versionUpdater';
import type {SemverLevel} from '@github/libs/versionUpdater';

const exec = promisify(originalExec);

Expand Down Expand Up @@ -43,7 +44,7 @@ function updateNativeVersions(version: string) {
}

let semanticVersionLevel = core.getInput('SEMVER_LEVEL', {required: true});
if (!semanticVersionLevel || !Object.keys(versionUpdater.SEMANTIC_VERSION_LEVELS).includes(semanticVersionLevel)) {
if (!semanticVersionLevel || !versionUpdater.isValidSemverLevel(semanticVersionLevel)) {
semanticVersionLevel = versionUpdater.SEMANTIC_VERSION_LEVELS.BUILD;
console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`, `Defaulting to: ${semanticVersionLevel}`);
}
Expand All @@ -53,7 +54,7 @@ if (!previousVersion) {
core.setFailed('Error: Could not read package.json');
}

const newVersion = versionUpdater.incrementVersion(previousVersion ?? '', semanticVersionLevel);
const newVersion = versionUpdater.incrementVersion(previousVersion ?? '', semanticVersionLevel as SemverLevel);
console.log(`Previous version: ${previousVersion}`, `New version: ${newVersion}`);

updateNativeVersions(newVersion);
Expand Down
8 changes: 6 additions & 2 deletions .github/actions/javascript/bumpVersion/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3473,7 +3473,7 @@ function updateNativeVersions(version) {
}
}
let semanticVersionLevel = core.getInput('SEMVER_LEVEL', { required: true });
if (!semanticVersionLevel || !Object.keys(versionUpdater.SEMANTIC_VERSION_LEVELS).includes(semanticVersionLevel)) {
if (!semanticVersionLevel || !versionUpdater.isValidSemverLevel(semanticVersionLevel)) {
semanticVersionLevel = versionUpdater.SEMANTIC_VERSION_LEVELS.BUILD;
console.log(`Invalid input for 'SEMVER_LEVEL': ${semanticVersionLevel}`, `Defaulting to: ${semanticVersionLevel}`);
}
Expand Down Expand Up @@ -3589,7 +3589,7 @@ exports.updateiOSVersion = updateiOSVersion;
"use strict";

Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getPreviousVersion = exports.incrementPatch = exports.incrementMinor = exports.SEMANTIC_VERSION_LEVELS = exports.MAX_INCREMENTS = exports.incrementVersion = exports.getVersionStringFromNumber = exports.getVersionNumberFromString = void 0;
exports.getPreviousVersion = exports.incrementPatch = exports.incrementMinor = exports.SEMANTIC_VERSION_LEVELS = exports.MAX_INCREMENTS = exports.incrementVersion = exports.getVersionStringFromNumber = exports.getVersionNumberFromString = exports.isValidSemverLevel = void 0;
const SEMANTIC_VERSION_LEVELS = {
MAJOR: 'MAJOR',
MINOR: 'MINOR',
Expand All @@ -3599,6 +3599,10 @@ const SEMANTIC_VERSION_LEVELS = {
exports.SEMANTIC_VERSION_LEVELS = SEMANTIC_VERSION_LEVELS;
const MAX_INCREMENTS = 99;
exports.MAX_INCREMENTS = MAX_INCREMENTS;
function isValidSemverLevel(str) {
return Object.keys(SEMANTIC_VERSION_LEVELS).includes(str);
}
exports.isValidSemverLevel = isValidSemverLevel;
/**
* Transforms a versions string into a number
*/
Expand Down
Loading

0 comments on commit 4ffbd42

Please sign in to comment.