Revert D5409825: [RN] Convert easy files to Prettier
Differential Revision: D5409825 fbshipit-source-id: f797a40b58bc6bcc6ae53ed820a10ab49d3f10f5
This commit is contained in:
parent
bfece1d800
commit
aafccdf622
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -18,8 +16,8 @@ var transformPath = require.resolve(hmrTransform);
|
||||||
|
|
||||||
module.exports = function(options, filename) {
|
module.exports = function(options, filename) {
|
||||||
var transform = filename
|
var transform = filename
|
||||||
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
|
? './' + path.relative(path.dirname(filename), transformPath) // packager can't handle absolute paths
|
||||||
: hmrTransform;
|
: hmrTransform;
|
||||||
|
|
||||||
// Fix the module path to use '/' on Windows.
|
// Fix the module path to use '/' on Windows.
|
||||||
if (path.sep === '\\') {
|
if (path.sep === '\\') {
|
||||||
|
@ -31,15 +29,13 @@ module.exports = function(options, filename) {
|
||||||
[
|
[
|
||||||
'react-transform',
|
'react-transform',
|
||||||
{
|
{
|
||||||
transforms: [
|
transforms: [{
|
||||||
{
|
transform: transform,
|
||||||
transform: transform,
|
imports: ['react'],
|
||||||
imports: ['react'],
|
locals: ['module'],
|
||||||
locals: ['module'],
|
}]
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
],
|
]
|
||||||
]),
|
])
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -15,4 +13,4 @@ var resolvePlugins = require('../lib/resolvePlugins');
|
||||||
module.exports = function(options) {
|
module.exports = function(options) {
|
||||||
// For future internal pipeline usage
|
// For future internal pipeline usage
|
||||||
return null;
|
return null;
|
||||||
};
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -27,10 +25,7 @@ var base = {
|
||||||
'transform-es2015-computed-properties',
|
'transform-es2015-computed-properties',
|
||||||
'check-es2015-constants',
|
'check-es2015-constants',
|
||||||
'transform-es2015-destructuring',
|
'transform-es2015-destructuring',
|
||||||
[
|
['transform-es2015-modules-commonjs', { strict: false, allowTopLevelThis: true }],
|
||||||
'transform-es2015-modules-commonjs',
|
|
||||||
{strict: false, allowTopLevelThis: true},
|
|
||||||
],
|
|
||||||
'transform-es2015-parameters',
|
'transform-es2015-parameters',
|
||||||
'transform-es2015-shorthand-properties',
|
'transform-es2015-shorthand-properties',
|
||||||
'transform-es2015-spread',
|
'transform-es2015-spread',
|
||||||
|
@ -42,7 +37,7 @@ var base = {
|
||||||
'transform-react-display-name',
|
'transform-react-display-name',
|
||||||
'transform-react-jsx',
|
'transform-react-jsx',
|
||||||
'transform-regenerator',
|
'transform-regenerator',
|
||||||
['transform-es2015-for-of', {loose: true}],
|
['transform-es2015-for-of', { loose: true }],
|
||||||
require('../transforms/transform-regenerator-runtime-insertion'),
|
require('../transforms/transform-regenerator-runtime-insertion'),
|
||||||
require('../transforms/transform-symbol-member'),
|
require('../transforms/transform-symbol-member'),
|
||||||
]),
|
]),
|
||||||
|
@ -50,9 +45,10 @@ var base = {
|
||||||
|
|
||||||
var devTools = Object.assign({}, base);
|
var devTools = Object.assign({}, base);
|
||||||
devTools.plugins = devTools.plugins.concat(
|
devTools.plugins = devTools.plugins.concat(
|
||||||
resolvePlugins(['transform-react-jsx-source']),
|
resolvePlugins(['transform-react-jsx-source'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
module.exports = function(options) {
|
module.exports = function(options) {
|
||||||
var withDevTools = options.withDevTools;
|
var withDevTools = options.withDevTools;
|
||||||
if (withDevTools == null) {
|
if (withDevTools == null) {
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -28,7 +26,7 @@ module.exports = {
|
||||||
'babel-plugin-transform-es2015-shorthand-properties': require('babel-plugin-transform-es2015-shorthand-properties'),
|
'babel-plugin-transform-es2015-shorthand-properties': require('babel-plugin-transform-es2015-shorthand-properties'),
|
||||||
'babel-plugin-transform-es2015-spread': require('babel-plugin-transform-es2015-spread'),
|
'babel-plugin-transform-es2015-spread': require('babel-plugin-transform-es2015-spread'),
|
||||||
'babel-plugin-transform-es2015-template-literals': require('babel-plugin-transform-es2015-template-literals'),
|
'babel-plugin-transform-es2015-template-literals': require('babel-plugin-transform-es2015-template-literals'),
|
||||||
'babel-plugin-transform-es2015-literals': require('babel-plugin-transform-es2015-literals'),
|
'babel-plugin-transform-es2015-literals' : require('babel-plugin-transform-es2015-literals'),
|
||||||
'babel-plugin-transform-flow-strip-types': require('babel-plugin-transform-flow-strip-types'),
|
'babel-plugin-transform-flow-strip-types': require('babel-plugin-transform-flow-strip-types'),
|
||||||
'babel-plugin-transform-object-assign': require('babel-plugin-transform-object-assign'),
|
'babel-plugin-transform-object-assign': require('babel-plugin-transform-object-assign'),
|
||||||
'babel-plugin-transform-object-rest-spread': require('babel-plugin-transform-object-rest-spread'),
|
'babel-plugin-transform-object-rest-spread': require('babel-plugin-transform-object-rest-spread'),
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -100,9 +98,9 @@ module.exports = function() {
|
||||||
t.identifier('regeneratorRuntime'),
|
t.identifier('regeneratorRuntime'),
|
||||||
t.callExpression(t.identifier('require'), [
|
t.callExpression(t.identifier('require'), [
|
||||||
t.stringLiteral(NAME),
|
t.stringLiteral(NAME),
|
||||||
]),
|
])
|
||||||
),
|
)
|
||||||
]),
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* Copyright 2004-present Facebook. All Rights Reserved.
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
@ -36,12 +34,16 @@ module.exports = function symbolMember(babel) {
|
||||||
t.conditionalExpression(
|
t.conditionalExpression(
|
||||||
t.binaryExpression(
|
t.binaryExpression(
|
||||||
'===',
|
'===',
|
||||||
t.unaryExpression('typeof', t.identifier('Symbol'), true),
|
t.unaryExpression(
|
||||||
t.stringLiteral('function'),
|
'typeof',
|
||||||
|
t.identifier('Symbol'),
|
||||||
|
true
|
||||||
|
),
|
||||||
|
t.stringLiteral('function')
|
||||||
),
|
),
|
||||||
node,
|
node,
|
||||||
t.stringLiteral(`@@${node.property.name}`),
|
t.stringLiteral(`@@${node.property.name}`)
|
||||||
),
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// We should stop to avoid infinite recursion, since Babel
|
// We should stop to avoid infinite recursion, since Babel
|
||||||
|
@ -55,10 +57,8 @@ module.exports = function symbolMember(babel) {
|
||||||
function isAppropriateMember(path) {
|
function isAppropriateMember(path) {
|
||||||
let node = path.node;
|
let node = path.node;
|
||||||
|
|
||||||
return (
|
return path.parentPath.type !== 'AssignmentExpression' &&
|
||||||
path.parentPath.type !== 'AssignmentExpression' &&
|
|
||||||
node.object.type === 'Identifier' &&
|
node.object.type === 'Identifier' &&
|
||||||
node.object.name === 'Symbol' &&
|
node.object.name === 'Symbol' &&
|
||||||
node.property.type === 'Identifier'
|
node.property.type === 'Identifier';
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -19,9 +17,7 @@ if (!process.env.CI_REPO) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (!process.env.GITHUB_TOKEN) {
|
if (!process.env.GITHUB_TOKEN) {
|
||||||
console.error(
|
console.error('Missing GITHUB_TOKEN. Example: 5fd88b964fa214c4be2b144dc5af5d486a2f8c1e');
|
||||||
'Missing GITHUB_TOKEN. Example: 5fd88b964fa214c4be2b144dc5af5d486a2f8c1e',
|
|
||||||
);
|
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
if (!process.env.PULL_REQUEST_NUMBER) {
|
if (!process.env.PULL_REQUEST_NUMBER) {
|
||||||
|
@ -96,7 +92,7 @@ var converters = {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function getShaFromPullRequest(user, repo, number, callback) {
|
function getShaFromPullRequest(user, repo, number, callback) {
|
||||||
|
@ -124,6 +120,7 @@ function getFilesFromCommit(user, repo, sha, callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sadly we can't just give the line number to github, we have to give the
|
* Sadly we can't just give the line number to github, we have to give the
|
||||||
* line number relative to the patch file which is super annoying. This
|
* line number relative to the patch file which is super annoying. This
|
||||||
|
@ -135,7 +132,7 @@ function getLineMapFromPatch(patchString) {
|
||||||
var fileLineIndex = 0;
|
var fileLineIndex = 0;
|
||||||
var lineMap = {};
|
var lineMap = {};
|
||||||
|
|
||||||
patchString.split('\n').forEach(line => {
|
patchString.split('\n').forEach((line) => {
|
||||||
if (line.match(/^@@/)) {
|
if (line.match(/^@@/)) {
|
||||||
fileLineIndex = line.match(/\+([0-9]+)/)[1] - 1;
|
fileLineIndex = line.match(/\+([0-9]+)/)[1] - 1;
|
||||||
return;
|
return;
|
||||||
|
@ -184,27 +181,27 @@ function main(messages, user, repo, number) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getShaFromPullRequest(user, repo, number, sha => {
|
getShaFromPullRequest(user, repo, number, (sha) => {
|
||||||
getFilesFromCommit(user, repo, sha, files => {
|
getFilesFromCommit(user, repo, sha, (files) => {
|
||||||
files.filter(file => messages[file.filename]).forEach(file => {
|
files
|
||||||
// github api sometimes does not return a patch on large commits
|
.filter((file) => messages[file.filename])
|
||||||
if (!file.patch) {
|
.forEach((file) => {
|
||||||
return;
|
// github api sometimes does not return a patch on large commits
|
||||||
}
|
if (!file.patch) {
|
||||||
var lineMap = getLineMapFromPatch(file.patch);
|
return;
|
||||||
messages[file.filename].forEach(message => {
|
}
|
||||||
sendComment(user, repo, number, sha, file.filename, lineMap, message);
|
var lineMap = getLineMapFromPatch(file.patch);
|
||||||
|
messages[file.filename].forEach((message) => {
|
||||||
|
sendComment(user, repo, number, sha, file.filename, lineMap, message);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var content = '';
|
var content = '';
|
||||||
process.stdin.resume();
|
process.stdin.resume();
|
||||||
process.stdin.on('data', function(buf) {
|
process.stdin.on('data', function(buf) { content += buf.toString(); });
|
||||||
content += buf.toString();
|
|
||||||
});
|
|
||||||
process.stdin.on('end', function() {
|
process.stdin.on('end', function() {
|
||||||
var messages = {};
|
var messages = {};
|
||||||
|
|
||||||
|
|
2
cli.js
2
cli.js
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -19,7 +17,7 @@ module.exports = moduleName => {
|
||||||
const name = RealComponent.displayName || RealComponent.name;
|
const name = RealComponent.displayName || RealComponent.name;
|
||||||
|
|
||||||
return React.createElement(
|
return React.createElement(
|
||||||
name.replace(/^(RCT|RK)/, ''),
|
name.replace(/^(RCT|RK)/,''),
|
||||||
this.props,
|
this.props,
|
||||||
this.props.children,
|
this.props.children,
|
||||||
);
|
);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @format
|
* @flow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* eslint-env node */
|
/* eslint-env node */
|
||||||
|
@ -17,18 +17,22 @@ const babel = require('babel-core');
|
||||||
const babelRegisterOnly = require('metro-bundler/src/babelRegisterOnly');
|
const babelRegisterOnly = require('metro-bundler/src/babelRegisterOnly');
|
||||||
const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
|
const createCacheKeyFunction = require('fbjs-scripts/jest/createCacheKeyFunction');
|
||||||
|
|
||||||
const nodeFiles = RegExp(['/local-cli/', '/metro-bundler/'].join('|'));
|
const nodeFiles = RegExp([
|
||||||
|
'/local-cli/',
|
||||||
|
'/metro-bundler/',
|
||||||
|
].join('|'));
|
||||||
const nodeOptions = babelRegisterOnly.config([nodeFiles]);
|
const nodeOptions = babelRegisterOnly.config([nodeFiles]);
|
||||||
|
|
||||||
babelRegisterOnly([]);
|
babelRegisterOnly([]);
|
||||||
|
|
||||||
const transformer = require('metro-bundler/src/transformer.js');
|
const transformer = require('metro-bundler/src/transformer.js');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
process(src, file) {
|
process(src/*: string*/, file/*: string*/) {
|
||||||
if (nodeFiles.test(file)) {
|
if (nodeFiles.test(file)) { // node specific transforms only
|
||||||
// node specific transforms only
|
return babel.transform(
|
||||||
return babel.transform(src, Object.assign({filename: file}, nodeOptions))
|
src,
|
||||||
.code;
|
Object.assign({filename: file}, nodeOptions)
|
||||||
|
).code;
|
||||||
}
|
}
|
||||||
|
|
||||||
return transformer.transform({
|
return transformer.transform({
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -19,9 +17,7 @@ require.requireActual('metro-bundler/src/Resolver/polyfills/error-guard');
|
||||||
global.__DEV__ = true;
|
global.__DEV__ = true;
|
||||||
|
|
||||||
global.Promise = require.requireActual('promise');
|
global.Promise = require.requireActual('promise');
|
||||||
global.regeneratorRuntime = require.requireActual(
|
global.regeneratorRuntime = require.requireActual('regenerator-runtime/runtime');
|
||||||
'regenerator-runtime/runtime',
|
|
||||||
);
|
|
||||||
|
|
||||||
global.requestAnimationFrame = function(callback) {
|
global.requestAnimationFrame = function(callback) {
|
||||||
setTimeout(callback, 0);
|
setTimeout(callback, 0);
|
||||||
|
@ -30,7 +26,9 @@ global.cancelAnimationFrame = function(id) {
|
||||||
clearTimeout(id);
|
clearTimeout(id);
|
||||||
};
|
};
|
||||||
|
|
||||||
jest.mock('setupDevtools').mock('npmlog');
|
jest
|
||||||
|
.mock('setupDevtools')
|
||||||
|
.mock('npmlog');
|
||||||
|
|
||||||
// there's a __mock__ for it.
|
// there's a __mock__ for it.
|
||||||
jest.setMock('ErrorUtils', require('ErrorUtils'));
|
jest.setMock('ErrorUtils', require('ErrorUtils'));
|
||||||
|
@ -44,7 +42,10 @@ jest
|
||||||
.mock('View', () => mockComponent('View'))
|
.mock('View', () => mockComponent('View'))
|
||||||
.mock('RefreshControl', () => require.requireMock('RefreshControlMock'))
|
.mock('RefreshControl', () => require.requireMock('RefreshControlMock'))
|
||||||
.mock('ScrollView', () => require.requireMock('ScrollViewMock'))
|
.mock('ScrollView', () => require.requireMock('ScrollViewMock'))
|
||||||
.mock('ActivityIndicator', () => mockComponent('ActivityIndicator'))
|
.mock(
|
||||||
|
'ActivityIndicator',
|
||||||
|
() => mockComponent('ActivityIndicator'),
|
||||||
|
)
|
||||||
.mock('ListView', () => require.requireMock('ListViewMock'))
|
.mock('ListView', () => require.requireMock('ListViewMock'))
|
||||||
.mock('ListViewDataSource', () => {
|
.mock('ListViewDataSource', () => {
|
||||||
const DataSource = require.requireActual('ListViewDataSource');
|
const DataSource = require.requireActual('ListViewDataSource');
|
||||||
|
@ -54,9 +55,9 @@ jest
|
||||||
// Ensure this doesn't throw.
|
// Ensure this doesn't throw.
|
||||||
try {
|
try {
|
||||||
Object.keys(dataBlob).forEach(key => {
|
Object.keys(dataBlob).forEach(key => {
|
||||||
this.items +=
|
this.items += dataBlob[key] && (
|
||||||
dataBlob[key] &&
|
dataBlob[key].length || dataBlob[key].size || 0
|
||||||
(dataBlob[key].length || dataBlob[key].size || 0);
|
);
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.items = 'unknown';
|
this.items = 'unknown';
|
||||||
|
@ -78,18 +79,10 @@ const mockNativeModules = {
|
||||||
addEventListener: jest.fn(),
|
addEventListener: jest.fn(),
|
||||||
},
|
},
|
||||||
AsyncLocalStorage: {
|
AsyncLocalStorage: {
|
||||||
multiGet: jest.fn((keys, callback) =>
|
multiGet: jest.fn((keys, callback) => process.nextTick(() => callback(null, []))),
|
||||||
process.nextTick(() => callback(null, [])),
|
multiSet: jest.fn((entries, callback) => process.nextTick(() => callback(null))),
|
||||||
),
|
multiRemove: jest.fn((keys, callback) => process.nextTick(() => callback(null))),
|
||||||
multiSet: jest.fn((entries, callback) =>
|
multiMerge: jest.fn((entries, callback) => process.nextTick(() => callback(null))),
|
||||||
process.nextTick(() => callback(null)),
|
|
||||||
),
|
|
||||||
multiRemove: jest.fn((keys, callback) =>
|
|
||||||
process.nextTick(() => callback(null)),
|
|
||||||
),
|
|
||||||
multiMerge: jest.fn((entries, callback) =>
|
|
||||||
process.nextTick(() => callback(null)),
|
|
||||||
),
|
|
||||||
clear: jest.fn(callback => process.nextTick(() => callback(null))),
|
clear: jest.fn(callback => process.nextTick(() => callback(null))),
|
||||||
getAllKeys: jest.fn(callback => process.nextTick(() => callback(null, []))),
|
getAllKeys: jest.fn(callback => process.nextTick(() => callback(null, []))),
|
||||||
},
|
},
|
||||||
|
@ -130,12 +123,14 @@ const mockNativeModules = {
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
ImageLoader: {
|
ImageLoader: {
|
||||||
getSize: jest.fn(url => new Promise(() => ({width: 320, height: 240}))),
|
getSize: jest.fn(
|
||||||
|
(url) => new Promise(() => ({width: 320, height: 240}))
|
||||||
|
),
|
||||||
prefetchImage: jest.fn(),
|
prefetchImage: jest.fn(),
|
||||||
},
|
},
|
||||||
ImageViewManager: {
|
ImageViewManager: {
|
||||||
getSize: jest.fn((uri, success) =>
|
getSize: jest.fn(
|
||||||
process.nextTick(() => success(320, 240)),
|
(uri, success) => process.nextTick(() => success(320, 240))
|
||||||
),
|
),
|
||||||
prefetchImage: jest.fn(),
|
prefetchImage: jest.fn(),
|
||||||
},
|
},
|
||||||
|
@ -145,9 +140,13 @@ const mockNativeModules = {
|
||||||
},
|
},
|
||||||
Linking: {
|
Linking: {
|
||||||
openURL: jest.fn(),
|
openURL: jest.fn(),
|
||||||
canOpenURL: jest.fn(() => new Promise(resolve => resolve(true))),
|
canOpenURL: jest.fn(
|
||||||
|
() => new Promise((resolve) => resolve(true))
|
||||||
|
),
|
||||||
addEventListener: jest.fn(),
|
addEventListener: jest.fn(),
|
||||||
getInitialURL: jest.fn(() => new Promise(resolve => resolve())),
|
getInitialURL: jest.fn(
|
||||||
|
() => new Promise((resolve) => resolve())
|
||||||
|
),
|
||||||
removeEventListener: jest.fn(),
|
removeEventListener: jest.fn(),
|
||||||
},
|
},
|
||||||
LocationObserver: {
|
LocationObserver: {
|
||||||
|
@ -157,10 +156,14 @@ const mockNativeModules = {
|
||||||
},
|
},
|
||||||
ModalFullscreenViewManager: {},
|
ModalFullscreenViewManager: {},
|
||||||
NetInfo: {
|
NetInfo: {
|
||||||
fetch: jest.fn(() => new Promise(resolve => resolve())),
|
fetch: jest.fn(
|
||||||
|
() => new Promise((resolve) => resolve())
|
||||||
|
),
|
||||||
addEventListener: jest.fn(),
|
addEventListener: jest.fn(),
|
||||||
isConnected: {
|
isConnected: {
|
||||||
fetch: jest.fn(() => new Promise(resolve => resolve())),
|
fetch: jest.fn(
|
||||||
|
() => new Promise((resolve) => resolve())
|
||||||
|
),
|
||||||
addEventListener: jest.fn(),
|
addEventListener: jest.fn(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -178,20 +181,12 @@ const mockNativeModules = {
|
||||||
getDeliveredNotifications: jest.fn(callback => process.nextTick(() => [])),
|
getDeliveredNotifications: jest.fn(callback => process.nextTick(() => [])),
|
||||||
removeDeliveredNotifications: jest.fn(),
|
removeDeliveredNotifications: jest.fn(),
|
||||||
setApplicationIconBadgeNumber: jest.fn(),
|
setApplicationIconBadgeNumber: jest.fn(),
|
||||||
getApplicationIconBadgeNumber: jest.fn(callback =>
|
getApplicationIconBadgeNumber: jest.fn(callback => process.nextTick(() => callback(0))),
|
||||||
process.nextTick(() => callback(0)),
|
|
||||||
),
|
|
||||||
cancelLocalNotifications: jest.fn(),
|
cancelLocalNotifications: jest.fn(),
|
||||||
getScheduledLocalNotifications: jest.fn(callback =>
|
getScheduledLocalNotifications: jest.fn(callback => process.nextTick(() => callback())),
|
||||||
process.nextTick(() => callback()),
|
requestPermissions: jest.fn(() => Promise.resolve({alert: true, badge: true, sound: true})),
|
||||||
),
|
|
||||||
requestPermissions: jest.fn(() =>
|
|
||||||
Promise.resolve({alert: true, badge: true, sound: true}),
|
|
||||||
),
|
|
||||||
abandonPermissions: jest.fn(),
|
abandonPermissions: jest.fn(),
|
||||||
checkPermissions: jest.fn(callback =>
|
checkPermissions: jest.fn(callback => process.nextTick(() => callback({alert: true, badge: true, sound: true}))),
|
||||||
process.nextTick(() => callback({alert: true, badge: true, sound: true})),
|
|
||||||
),
|
|
||||||
getInitialNotification: jest.fn(() => Promise.resolve(null)),
|
getInitialNotification: jest.fn(() => Promise.resolve(null)),
|
||||||
addListener: jest.fn(),
|
addListener: jest.fn(),
|
||||||
removeListeners: jest.fn(),
|
removeListeners: jest.fn(),
|
||||||
|
@ -271,6 +266,9 @@ jest
|
||||||
jest.doMock('requireNativeComponent', () => {
|
jest.doMock('requireNativeComponent', () => {
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
|
|
||||||
return viewName => props =>
|
return viewName => props => React.createElement(
|
||||||
React.createElement(viewName, props, props.children);
|
viewName,
|
||||||
|
props,
|
||||||
|
props.children,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @flow
|
* @flow
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @flow
|
* @flow
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @flow
|
* @flow
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @flow
|
* @flow
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @flow
|
* @flow
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @flow
|
* @flow
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @flow
|
* @flow
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @flow
|
* @flow
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
*
|
||||||
* @flow
|
* @flow
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @noformat
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
|
@ -5,18 +5,16 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
require('babel-register')({
|
require('babel-register')({
|
||||||
presets: [
|
presets: [
|
||||||
require('babel-preset-es2015-node'),
|
require('babel-preset-es2015-node'),
|
||||||
require('babel-preset-stage-3'),
|
require('babel-preset-stage-3')
|
||||||
],
|
],
|
||||||
// Enable transpiling for react-native-git-upgrade AND the generator, just like the upgrade CLI command does
|
// Enable transpiling for react-native-git-upgrade AND the generator, just like the upgrade CLI command does
|
||||||
only: /(react-native-git-upgrade\/(?!(node_modules)))|(local-cli\/generator)/,
|
only: /(react-native-git-upgrade\/(?!(node_modules)))|(local-cli\/generator)/
|
||||||
});
|
});
|
||||||
|
|
||||||
var cliEntry = require('./cliEntry');
|
var cliEntry = require('./cliEntry');
|
||||||
|
|
|
@ -7,34 +7,30 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var argv = require('minimist')(process.argv.slice(2));
|
var argv = require('minimist')(process.argv.slice(2));
|
||||||
var cli = require('./cli');
|
var cli = require('./cli');
|
||||||
|
|
||||||
if (argv._.length === 0 && (argv.h || argv.help)) {
|
if (argv._.length === 0 && (argv.h || argv.help)) {
|
||||||
console.log(
|
console.log([
|
||||||
[
|
'',
|
||||||
'',
|
' Usage: react-native-git-upgrade [version] [options]',
|
||||||
' Usage: react-native-git-upgrade [version] [options]',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
' Commands:',
|
||||||
' Commands:',
|
'',
|
||||||
'',
|
' [Version] upgrades React Native and app templates to the desired version',
|
||||||
' [Version] upgrades React Native and app templates to the desired version',
|
' (latest, if not specified)',
|
||||||
' (latest, if not specified)',
|
'',
|
||||||
'',
|
' Options:',
|
||||||
' Options:',
|
'',
|
||||||
'',
|
' -h, --help output usage information',
|
||||||
' -h, --help output usage information',
|
' -v, --version output the version number',
|
||||||
' -v, --version output the version number',
|
' --verbose output debugging info',
|
||||||
' --verbose output debugging info',
|
' --npm force using the npm client even if your project uses yarn',
|
||||||
' --npm force using the npm client even if your project uses yarn',
|
'',
|
||||||
'',
|
].join('\n'));
|
||||||
].join('\n'),
|
|
||||||
);
|
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,4 +39,5 @@ if (argv._.length === 0 && (argv.v || argv.version)) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
cli.run(argv._[0], argv).catch(console.error);
|
cli.run(argv._[0], argv)
|
||||||
|
.catch(console.error);
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
@ -26,8 +24,7 @@ function getYarnVersionIfAvailable() {
|
||||||
if (process.platform.startsWith('win')) {
|
if (process.platform.startsWith('win')) {
|
||||||
yarnVersion = (execSync('yarn --version').toString() || '').trim();
|
yarnVersion = (execSync('yarn --version').toString() || '').trim();
|
||||||
} else {
|
} else {
|
||||||
yarnVersion = (execSync('yarn --version 2>/dev/null').toString() || '')
|
yarnVersion = (execSync('yarn --version 2>/dev/null').toString() || '').trim();
|
||||||
.trim();
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* This source code is licensed under the BSD-style license found in the
|
||||||
* LICENSE file in the root directory of this source tree. An additional grant
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
* of patent rights can be found in the PATENTS file in the same directory.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
*
|
|
||||||
* @format
|
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue