Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix/43599
Browse files Browse the repository at this point in the history
  • Loading branch information
dominictb committed Jun 24, 2024
2 parents aca4770 + 2026f62 commit 6fc46c5
Show file tree
Hide file tree
Showing 277 changed files with 7,361 additions and 4,089 deletions.
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/**
10 changes: 7 additions & 3 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 @@ -96,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 @@ -105,10 +107,9 @@ module.exports = {
__DEV__: 'readonly',
},
rules: {
// 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 @@ -215,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 Down Expand Up @@ -257,6 +260,7 @@ module.exports = {
// 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 @@ -17073,13 +17073,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 @@ -17099,6 +17097,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 @@ -17454,12 +17461,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 @@ -17531,27 +17557,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 @@ -12314,13 +12314,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 @@ -12340,6 +12338,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 @@ -12695,12 +12702,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 @@ -12796,27 +12822,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 6fc46c5

Please sign in to comment.