JS: Format with Prettier v2.4.1 [3/n]

Summary:
Changelog:
[General][Internal]

Reviewed By: zertosh

Differential Revision: D31883447

fbshipit-source-id: cbbf85e4bf935096d242336f41bf0cc5d6f92359
This commit is contained in:
Tim Yung
2021-11-02 22:14:16 -07:00
committed by Facebook GitHub Bot
parent 4e587a1b7d
commit 77ecc7ede1
260 changed files with 1751 additions and 2143 deletions
+9 -12
View File
@@ -40,20 +40,20 @@ const pd = require('pretty-data2').pd;
// value in ms to print out screen contents, set this value in CI to debug if tests are failing
const appiumDebugInterval = process.env.APPIUM_DEBUG_INTERVAL;
describe('Android Test App', function() {
describe('Android Test App', function () {
this.timeout(600000);
let driver;
let debugIntervalId;
before(function() {
before(function () {
driver = wd.promiseChainRemote({
host: 'localhost',
port: 4723,
});
driver.on('status', function(info) {
driver.on('status', function (info) {
console.log(info.cyan);
});
driver.on('command', function(method, command, data) {
driver.on('command', function (method, command, data) {
if (command === 'source()' && data) {
console.log(
' > ' + method.yellow,
@@ -65,7 +65,7 @@ describe('Android Test App', function() {
console.log(' > ' + method.yellow, command.grey, data || '');
}
});
driver.on('http', function(method, urlPath, data) {
driver.on('http', function (method, urlPath, data) {
console.log(' > ' + method.magenta, urlPath, (data || '').grey);
});
@@ -100,14 +100,14 @@ describe('Android Test App', function() {
);
});
after(function() {
after(function () {
if (debugIntervalId) {
clearInterval(debugIntervalId);
}
return driver.quit();
});
it('should display new content after a refresh', function() {
it('should display new content after a refresh', function () {
const androidAppCode = fs.readFileSync('App.js', 'utf-8');
let intervalToUpdate;
return (
@@ -133,15 +133,12 @@ describe('Android Test App', function() {
.finally(() => {
clearInterval(intervalToUpdate);
fs.writeFileSync('App.js', androidAppCode, 'utf-8');
driver
.pressDeviceKey(46)
.pressDeviceKey(46)
.sleep(2000);
driver.pressDeviceKey(46).pressDeviceKey(46).sleep(2000);
})
);
});
it('should have the menu available', function() {
it('should have the menu available', function () {
return (
driver
.waitForElementByXPath(
+15 -7
View File
@@ -39,9 +39,7 @@ const nightlyBuild = argv.nightly;
const version = argv.toVersion;
if (!version) {
echo(
'You must specify a version using -v',
);
echo('You must specify a version using -v');
exit(1);
}
@@ -139,10 +137,16 @@ delete packageJson.private;
// Copy dependencies over from repo-config/package.json
const repoConfigJson = JSON.parse(cat('repo-config/package.json'));
packageJson.devDependencies = {...packageJson.devDependencies, ...repoConfigJson.dependencies};
packageJson.devDependencies = {
...packageJson.devDependencies,
...repoConfigJson.dependencies,
};
// Make react-native-codegen a direct dependency of react-native
delete packageJson.devDependencies['react-native-codegen'];
packageJson.dependencies = {...packageJson.dependencies, 'react-native-codegen': repoConfigJson.dependencies['react-native-codegen']};
packageJson.dependencies = {
...packageJson.dependencies,
'react-native-codegen': repoConfigJson.dependencies['react-native-codegen'],
};
fs.writeFileSync('package.json', JSON.stringify(packageJson, null, 2), 'utf-8');
// Change ReactAndroid/gradle.properties
@@ -168,7 +172,9 @@ const filesToValidate = [
'template/package.json',
];
let numberOfChangedLinesWithNewVersion = exec(
`git diff -U0 ${filesToValidate.join(' ')}| grep '^[+]' | grep -c ${version} `,
`git diff -U0 ${filesToValidate.join(
' ',
)}| grep '^[+]' | grep -c ${version} `,
{silent: true},
).stdout.trim();
@@ -183,7 +189,9 @@ if (exec('scripts/update-ruby.sh').code) {
if (!nightlyBuild) {
if (+numberOfChangedLinesWithNewVersion !== filesToValidate.length) {
echo(
`Failed to update all the files: [${filesToValidate.join(', ')}] must have versions in them`,
`Failed to update all the files: [${filesToValidate.join(
', ',
)}] must have versions in them`,
);
echo('Fix the issue, revert and try again');
exec('git diff');
+14 -10
View File
@@ -15,22 +15,24 @@ const fs = require('fs');
const argv = process.argv.slice(2);
let outputPath;
for (let i = 0; i < argv.length;) {
if (argv[i] === '-o') {
outputPath = argv[i + 1];
argv.splice(i, 2);
continue;
}
++i;
for (let i = 0; i < argv.length; ) {
if (argv[i] === '-o') {
outputPath = argv[i + 1];
argv.splice(i, 2);
continue;
}
++i;
}
if (!argv.length) {
process.stderr.write(
'Usage: node compose-source-maps.js <packager_sourcemap> <compiler_sourcemap> [-o output_file]\n'
'Usage: node compose-source-maps.js <packager_sourcemap> <compiler_sourcemap> [-o output_file]\n',
);
process.exitCode = -1;
} else {
const [packagerSourcemapPath, compilerSourcemapPath] = argv.splice(0, 2);
const packagerSourcemap = JSON.parse(fs.readFileSync(packagerSourcemapPath, 'utf8'));
const packagerSourcemap = JSON.parse(
fs.readFileSync(packagerSourcemapPath, 'utf8'),
);
const compilerSourcemap = JSON.parse(
fs.readFileSync(compilerSourcemapPath, 'utf8'),
);
@@ -53,7 +55,9 @@ if (!argv.length) {
);
}
const composedMapJSON = JSON.stringify(composeSourceMaps([packagerSourcemap, compilerSourcemap]));
const composedMapJSON = JSON.stringify(
composeSourceMaps([packagerSourcemap, compilerSourcemap]),
);
if (outputPath) {
fs.writeFileSync(outputPath, composedMapJSON, 'utf8');
} else {