Run eslint --fix
Summary: CI is currently failing because of a lint issue, this fixes it and a bunch of other warnings that are auto-fixable. **Test plan** Quick manual test, cosmetic changes only. Closes https://github.com/facebook/react-native/pull/16229 Differential Revision: D6009748 Pulled By: TheSavior fbshipit-source-id: cabd44fed99dd90bd0b35626492719c139c89f34
This commit is contained in:
parent
32e5c8e5b5
commit
0cd69e8a02
|
@ -45,7 +45,7 @@ const test_opts = {
|
|||
|
||||
OFFSET: argv.offset,
|
||||
COUNT: argv.count
|
||||
}
|
||||
};
|
||||
|
||||
let max_test_class_length = Number.NEGATIVE_INFINITY;
|
||||
|
||||
|
@ -85,14 +85,14 @@ if (test_opts.COUNT != null && test_opts.OFFSET != null) {
|
|||
}
|
||||
|
||||
return async.mapSeries(testClasses, (clazz, callback) => {
|
||||
if(clazz.length > max_test_class_length) {
|
||||
if (clazz.length > max_test_class_length) {
|
||||
max_test_class_length = clazz.length;
|
||||
}
|
||||
|
||||
return async.retry(test_opts.RETRIES, (retryCb) => {
|
||||
const test_process = child_process.spawn('./ContainerShip/scripts/run-instrumentation-tests-via-adb-shell.sh', [test_opts.PACKAGE, clazz], {
|
||||
stdio: 'inherit'
|
||||
})
|
||||
});
|
||||
|
||||
const timeout = setTimeout(() => {
|
||||
test_process.kill();
|
||||
|
@ -106,7 +106,7 @@ return async.mapSeries(testClasses, (clazz, callback) => {
|
|||
test_process.on('exit', (code) => {
|
||||
clearTimeout(timeout);
|
||||
|
||||
if(code !== 0) {
|
||||
if (code !== 0) {
|
||||
return retryCb(new Error(`Process exited with code: ${code}`));
|
||||
}
|
||||
|
||||
|
@ -138,16 +138,16 @@ function print_test_suite_results(results) {
|
|||
function pad_output(num_chars) {
|
||||
let i = 0;
|
||||
|
||||
while(i < num_chars) {
|
||||
while (i < num_chars) {
|
||||
process.stdout.write(' ');
|
||||
i++;
|
||||
}
|
||||
}
|
||||
results.forEach((test) => {
|
||||
if(test.status === 'success') {
|
||||
if (test.status === 'success') {
|
||||
color = colors.GREEN;
|
||||
passing_suites++;
|
||||
} else if(test.status === 'failure') {
|
||||
} else if (test.status === 'failure') {
|
||||
color = colors.RED;
|
||||
failing_suites++;
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ function testOptimizedMultiGet() {
|
|||
let keys = batch.map(([key, value]) => key);
|
||||
AsyncStorage.multiSet(batch, (err1) => {
|
||||
// yes, twice on purpose
|
||||
;[1, 2].forEach((i) => {
|
||||
[1, 2].forEach((i) => {
|
||||
expectAsyncNoError(`${i} testOptimizedMultiGet/multiSet`, err1);
|
||||
AsyncStorage.multiGet(keys, (err2, result) => {
|
||||
expectAsyncNoError(`${i} testOptimizedMultiGet/multiGet`, err2);
|
||||
|
|
|
@ -48,7 +48,7 @@ class ImageCachePolicyTest extends React.Component<Props, $FlowFixMeState> {
|
|||
const results: Array<?boolean> = TESTS.map(x => nextState[x]);
|
||||
|
||||
if (!results.includes(undefined)) {
|
||||
const result: boolean = results.reduce((x,y) => x === y === true, true)
|
||||
const result: boolean = results.reduce((x,y) => x === y === true, true);
|
||||
TestModule.markTestPassed(result);
|
||||
}
|
||||
|
||||
|
|
|
@ -548,7 +548,7 @@ var ScrollResponderMixin = {
|
|||
warning(
|
||||
typeof keyboardShouldPersistTaps !== 'boolean',
|
||||
`'keyboardShouldPersistTaps={${keyboardShouldPersistTaps}}' is deprecated. `
|
||||
+ `Use 'keyboardShouldPersistTaps="${keyboardShouldPersistTaps ? "always" : "never"}"' instead`
|
||||
+ `Use 'keyboardShouldPersistTaps="${keyboardShouldPersistTaps ? 'always' : 'never'}"' instead`
|
||||
);
|
||||
|
||||
this.keyboardWillOpenTo = null;
|
||||
|
|
|
@ -138,7 +138,7 @@ const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
|||
*
|
||||
* AppRegistry.registerComponent('App', () => App)
|
||||
* ```
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
var TouchableHighlight = createReactClass({
|
||||
|
|
|
@ -377,7 +377,7 @@ class WebView extends React.Component {
|
|||
'always',
|
||||
'compatibility'
|
||||
]),
|
||||
|
||||
|
||||
/**
|
||||
* Override the native component used to render the WebView. Enables a custom native
|
||||
* WebView which uses the same JavaScript as the original WebView.
|
||||
|
|
|
@ -16,7 +16,7 @@ const getDevServer = require('getDevServer');
|
|||
const {SourceCode} = require('NativeModules');
|
||||
|
||||
// Avoid requiring fetch on load of this module; see symbolicateStackTrace
|
||||
let fetch;
|
||||
let fetch;
|
||||
|
||||
import type {StackFrame} from 'parseErrorStack';
|
||||
|
||||
|
@ -25,13 +25,13 @@ function isSourcedFromDisk(sourcePath: string): boolean {
|
|||
}
|
||||
|
||||
async function symbolicateStackTrace(stack: Array<StackFrame>): Promise<Array<StackFrame>> {
|
||||
// RN currently lazy loads whatwg-fetch using a custom fetch module, which,
|
||||
// RN currently lazy loads whatwg-fetch using a custom fetch module, which,
|
||||
// when called for the first time, requires and re-exports 'whatwg-fetch'.
|
||||
// However, when a dependency of the project tries to require whatwg-fetch
|
||||
// either directly or indirectly, whatwg-fetch is required before
|
||||
// However, when a dependency of the project tries to require whatwg-fetch
|
||||
// either directly or indirectly, whatwg-fetch is required before
|
||||
// RN can lazy load whatwg-fetch. As whatwg-fetch checks
|
||||
// for a fetch polyfill before loading, it will in turn try to load
|
||||
// RN's fetch module, which immediately tries to import whatwg-fetch AGAIN.
|
||||
// for a fetch polyfill before loading, it will in turn try to load
|
||||
// RN's fetch module, which immediately tries to import whatwg-fetch AGAIN.
|
||||
// This causes a circular require which results in RN's fetch module
|
||||
// exporting fetch as 'undefined'.
|
||||
// The fix below postpones trying to load fetch until the first call to symbolicateStackTrace.
|
||||
|
|
|
@ -107,7 +107,7 @@ class Dimensions {
|
|||
handler: Function
|
||||
) {
|
||||
invariant(
|
||||
'change' === type,
|
||||
type === 'change',
|
||||
'Trying to subscribe to unknown event: "%s"', type
|
||||
);
|
||||
eventEmitter.addListener(type, handler);
|
||||
|
@ -121,7 +121,7 @@ class Dimensions {
|
|||
handler: Function
|
||||
) {
|
||||
invariant(
|
||||
'change' === type,
|
||||
type === 'change',
|
||||
'Trying to remove listener for unknown event: "%s"', type
|
||||
);
|
||||
eventEmitter.removeListener(type, handler);
|
||||
|
|
|
@ -29,33 +29,33 @@ var Dimensions = require('Dimensions');
|
|||
* });
|
||||
* <Image source={image} style={{width: 200, height: 100}} />
|
||||
* ```
|
||||
*
|
||||
*
|
||||
* ## Pixel grid snapping
|
||||
*
|
||||
* In iOS, you can specify positions and dimensions for elements with arbitrary
|
||||
*
|
||||
* In iOS, you can specify positions and dimensions for elements with arbitrary
|
||||
* precision, for example 29.674825. But, ultimately the physical display only
|
||||
* have a fixed number of pixels, for example 640×960 for iPhone 4 or 750×1334
|
||||
* for iPhone 6. iOS tries to be as faithful as possible to the user value by
|
||||
* spreading one original pixel into multiple ones to trick the eye. The
|
||||
* downside of this technique is that it makes the resulting element look
|
||||
* for iPhone 6. iOS tries to be as faithful as possible to the user value by
|
||||
* spreading one original pixel into multiple ones to trick the eye. The
|
||||
* downside of this technique is that it makes the resulting element look
|
||||
* blurry.
|
||||
*
|
||||
* In practice, we found out that developers do not want this feature and they
|
||||
* have to work around it by doing manual rounding in order to avoid having
|
||||
* blurry elements. In React Native, we are rounding all the pixels
|
||||
*
|
||||
* In practice, we found out that developers do not want this feature and they
|
||||
* have to work around it by doing manual rounding in order to avoid having
|
||||
* blurry elements. In React Native, we are rounding all the pixels
|
||||
* automatically.
|
||||
*
|
||||
* We have to be careful when to do this rounding. You never want to work with
|
||||
* rounded and unrounded values at the same time as you're going to accumulate
|
||||
* rounding errors. Having even one rounding error is deadly because a one
|
||||
*
|
||||
* We have to be careful when to do this rounding. You never want to work with
|
||||
* rounded and unrounded values at the same time as you're going to accumulate
|
||||
* rounding errors. Having even one rounding error is deadly because a one
|
||||
* pixel border may vanish or be twice as big.
|
||||
*
|
||||
*
|
||||
* In React Native, everything in JavaScript and within the layout engine works
|
||||
* with arbitrary precision numbers. It's only when we set the position and
|
||||
* dimensions of the native element on the main thread that we round. Also,
|
||||
* rounding is done relative to the root rather than the parent, again to avoid
|
||||
* with arbitrary precision numbers. It's only when we set the position and
|
||||
* dimensions of the native element on the main thread that we round. Also,
|
||||
* rounding is done relative to the root rather than the parent, again to avoid
|
||||
* accumulating rounding errors.
|
||||
*
|
||||
*
|
||||
*/
|
||||
class PixelRatio {
|
||||
/**
|
||||
|
|
|
@ -51,6 +51,6 @@ const RCTLog = {
|
|||
setWarningHandler(handler: typeof warningHandler): void {
|
||||
warningHandler = handler;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = RCTLog;
|
||||
|
|
|
@ -47,8 +47,8 @@ function createStrictShapeTypeChecker(
|
|||
invariant(
|
||||
false,
|
||||
`Invalid props.${propName} key \`${key}\` supplied to \`${componentName}\`.` +
|
||||
`\nBad object: ` + JSON.stringify(props[propName], null, ' ') +
|
||||
`\nValid keys: ` + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
||||
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
||||
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
||||
);
|
||||
}
|
||||
var error = checker(propValue, key, componentName, location, ...rest);
|
||||
|
@ -56,7 +56,7 @@ function createStrictShapeTypeChecker(
|
|||
invariant(
|
||||
false,
|
||||
error.message +
|
||||
`\nBad object: ` + JSON.stringify(props[propName], null, ' ')
|
||||
'\nBad object: ' + JSON.stringify(props[propName], null, ' ')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ function vibrateScheduler(id, pattern: Array<number>, repeat: boolean, nextIndex
|
|||
return;
|
||||
}
|
||||
}
|
||||
setTimeout(() => vibrateScheduler(id, pattern, repeat, nextIndex+1), pattern[nextIndex]);
|
||||
setTimeout(() => vibrateScheduler(id, pattern, repeat, nextIndex + 1), pattern[nextIndex]);
|
||||
}
|
||||
|
||||
var Vibration = {
|
||||
|
|
|
@ -74,9 +74,7 @@ const SwipeableFlatListExample = createReactClass({
|
|||
<View style={styles.row}>
|
||||
<Image style={styles.rowIcon} source={item.icon} />
|
||||
<View style={styles.rowData}>
|
||||
<Text style={styles.rowDataText}>
|
||||
{item.data}
|
||||
</Text>
|
||||
<Text style={styles.rowDataText}>{item.data}</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
|
|
|
@ -48,7 +48,7 @@ class TVEventHandlerView extends React.Component<$FlowFixMeProps, {
|
|||
this._tvEventHandler.enable(this, function(cmp, evt) {
|
||||
cmp.setState({
|
||||
lastEventType: evt.eventType
|
||||
})
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -515,8 +515,7 @@ exports.examples = [
|
|||
<TextInput
|
||||
defaultValue="Highlight Color is red"
|
||||
selectionColor={'red'}
|
||||
style={styles.singleLine}>
|
||||
</TextInput>
|
||||
style={styles.singleLine} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
@ -746,7 +745,7 @@ exports.examples = [
|
|||
<SelectionExample
|
||||
multiline
|
||||
style={styles.multiline}
|
||||
value={"multiline text selection\ncan also be changed"}
|
||||
value={'multiline text selection\ncan also be changed'}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
|
|
|
@ -610,12 +610,12 @@ exports.examples = [
|
|||
<View>
|
||||
<TextInput
|
||||
style={styles.default}
|
||||
selectionColor={"green"}
|
||||
selectionColor={'green'}
|
||||
defaultValue="Highlight me"
|
||||
/>
|
||||
<TextInput
|
||||
style={styles.default}
|
||||
selectionColor={"rgba(86, 76, 205, 1)"}
|
||||
selectionColor={'rgba(86, 76, 205, 1)'}
|
||||
defaultValue="Highlight me"
|
||||
/>
|
||||
</View>
|
||||
|
@ -872,7 +872,7 @@ exports.examples = [
|
|||
<SelectionExample
|
||||
multiline
|
||||
style={styles.multiline}
|
||||
value={"multiline text selection\ncan also be changed"}
|
||||
value={'multiline text selection\ncan also be changed'}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
|
|
|
@ -22,29 +22,29 @@ var assertEquals = require('Asserts').assertEquals;
|
|||
|
||||
var styles = StyleSheet.create({
|
||||
A: {
|
||||
"width": 500,
|
||||
"height": 500,
|
||||
'width': 500,
|
||||
'height': 500,
|
||||
},
|
||||
B: {
|
||||
backgroundColor: "rgb(255, 0, 0)",
|
||||
"left": 50,
|
||||
"top": 80,
|
||||
"width": 200,
|
||||
"height": 300,
|
||||
backgroundColor: 'rgb(255, 0, 0)',
|
||||
'left': 50,
|
||||
'top': 80,
|
||||
'width': 200,
|
||||
'height': 300,
|
||||
},
|
||||
C: {
|
||||
backgroundColor: "rgb(0, 255, 0)",
|
||||
"left": 100,
|
||||
"top": 70,
|
||||
"width": 50,
|
||||
"height": 150,
|
||||
backgroundColor: 'rgb(0, 255, 0)',
|
||||
'left': 100,
|
||||
'top': 70,
|
||||
'width': 50,
|
||||
'height': 150,
|
||||
},
|
||||
D: {
|
||||
backgroundColor: "rgb(0, 0, 255)",
|
||||
"left": 400,
|
||||
"top": 100,
|
||||
"width": 50,
|
||||
"height": 200,
|
||||
backgroundColor: 'rgb(0, 0, 255)',
|
||||
'left': 400,
|
||||
'top': 100,
|
||||
'width': 50,
|
||||
'height': 200,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @providesModule ProgressBarTestModule
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var BatchedBridge = require('BatchedBridge');
|
||||
var React = require('React');
|
||||
|
|
|
@ -34,47 +34,47 @@ function assertStrictStringEquals(a, b) {
|
|||
|
||||
var TestJavaToJSArgumentsModule = {
|
||||
receiveBasicTypes: function(str, dbl, bool, null_arg) {
|
||||
assertEquals("foo", str);
|
||||
assertEquals('foo', str);
|
||||
assertEquals(3.14, dbl);
|
||||
assertEquals(true, bool);
|
||||
assertEquals(null, null_arg);
|
||||
},
|
||||
receiveArrayWithBasicTypes: function(arr) {
|
||||
assertEquals(4, arr.length);
|
||||
assertEquals("red panda", arr[0]);
|
||||
assertEquals('red panda', arr[0]);
|
||||
assertEquals(1.19, arr[1]);
|
||||
assertEquals(true, arr[2]);
|
||||
assertEquals(null, arr[3]);
|
||||
},
|
||||
receiveNestedArray: function(arr) {
|
||||
assertEquals(2, arr.length);
|
||||
assertEquals("level1", arr[0]);
|
||||
assertEquals('level1', arr[0]);
|
||||
var arr2 = arr[1];
|
||||
assertEquals("level2", arr2[0]);
|
||||
assertEquals('level2', arr2[0]);
|
||||
var arr3 = arr2[1];
|
||||
assertEquals("level3", arr3[0]);
|
||||
assertEquals('level3', arr3[0]);
|
||||
},
|
||||
receiveArrayWithMaps: function(arr) {
|
||||
assertEquals(2, arr.length);
|
||||
var m1 = arr[0];
|
||||
var m2 = arr[1];
|
||||
assertEquals("m1v1", m1["m1k1"]);
|
||||
assertEquals("m1v2", m1["m1k2"]);
|
||||
assertEquals("m2v1", m2["m2k1"]);
|
||||
assertEquals('m1v1', m1.m1k1);
|
||||
assertEquals('m1v2', m1.m1k2);
|
||||
assertEquals('m2v1', m2.m2k1);
|
||||
},
|
||||
receiveMapWithBasicTypes: function(map) {
|
||||
assertEquals("stringValue", map["stringKey"]);
|
||||
assertEquals(3.14, map["doubleKey"]);
|
||||
assertEquals(true, map["booleanKey"]);
|
||||
assertEquals(null, map["nullKey"]);
|
||||
assertEquals('stringValue', map.stringKey);
|
||||
assertEquals(3.14, map.doubleKey);
|
||||
assertEquals(true, map.booleanKey);
|
||||
assertEquals(null, map.nullKey);
|
||||
},
|
||||
receiveNestedMap: function(map) {
|
||||
var nestedMap = map["nestedMap"];
|
||||
assertEquals("foxes", nestedMap["animals"]);
|
||||
var nestedMap = map.nestedMap;
|
||||
assertEquals('foxes', nestedMap.animals);
|
||||
},
|
||||
receiveMapWithArrays: function(map) {
|
||||
var a1 = map["array1"];
|
||||
var a2 = map["array2"];
|
||||
var a1 = map.array1;
|
||||
var a2 = map.array2;
|
||||
assertEquals(3, a1.length);
|
||||
assertEquals(2, a2.length);
|
||||
assertEquals(3, a1[0]);
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @providesModule TextInputTestModule
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var BatchedBridge = require('BatchedBridge');
|
||||
var React = require('React');
|
||||
|
@ -94,7 +94,7 @@ class TextInputTestApp extends React.Component {
|
|||
style={styles.textInputHeight}
|
||||
autoCorrect={true}
|
||||
autoFocus={true}
|
||||
keyboardType='numeric'
|
||||
keyboardType="numeric"
|
||||
multiline={true}
|
||||
secureTextEntry={true}
|
||||
defaultValue="This is text"
|
||||
|
@ -102,13 +102,13 @@ class TextInputTestApp extends React.Component {
|
|||
/>
|
||||
<TextInput
|
||||
style={styles.textInput}
|
||||
autoCapitalize='sentences'
|
||||
autoCapitalize="sentences"
|
||||
autoCorrect={false}
|
||||
autoFocus={false}
|
||||
keyboardType='default'
|
||||
keyboardType="default"
|
||||
multiline={false}
|
||||
secureTextEntry={false}
|
||||
placeholder='1234'
|
||||
placeholder="1234"
|
||||
testID="textInput2"
|
||||
/>
|
||||
<TextInput
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* @providesModule ViewRenderingTestModule
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
'use strict';
|
||||
|
||||
var BatchedBridge = require('BatchedBridge');
|
||||
var React = require('React');
|
||||
|
@ -21,7 +21,7 @@ var renderApplication = require('renderApplication');
|
|||
var styles = StyleSheet.create({
|
||||
view: {
|
||||
opacity: 0.75,
|
||||
backgroundColor: "rgb(255, 0, 0)",
|
||||
backgroundColor: 'rgb(255, 0, 0)',
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -44,7 +44,7 @@ class MarginSampleApp extends React.Component {
|
|||
updateMargins = this.setState.bind(this, {margin: 15});
|
||||
return (
|
||||
<View style={{margin: this.state.margin, marginLeft: 20}} collapsable={false}/>
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ function saveAssets(
|
|||
const src = asset.files[idx];
|
||||
const dest = path.join(assetsDest, getAssetDestPath(asset, scale));
|
||||
filesToCopy[src] = dest;
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
return copyAll(filesToCopy);
|
||||
|
|
|
@ -2,9 +2,9 @@ const s4 = () => {
|
|||
return Math.floor((1 + Math.random()) * 0x10000)
|
||||
.toString(16)
|
||||
.substring(1);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = function generateGUID() {
|
||||
return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
|
||||
s4() + '-' + s4() + s4() + s4();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -17,15 +17,15 @@ const generateGUID = require('./generateGUID');
|
|||
|
||||
const relativeProjectPath = (fullProjPath) => {
|
||||
const windowsPath = fullProjPath
|
||||
.substring(fullProjPath.lastIndexOf("node_modules") - 1, fullProjPath.length)
|
||||
.substring(fullProjPath.lastIndexOf('node_modules') - 1, fullProjPath.length)
|
||||
.replace(/\//g, '\\');
|
||||
|
||||
return '..' + windowsPath;
|
||||
}
|
||||
};
|
||||
|
||||
const getProjectName = (fullProjPath) => {
|
||||
return fullProjPath.split('/').slice(-1)[0].replace(/\.csproj/i, '');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets windows project config by analyzing given folder and taking some
|
||||
|
@ -41,7 +41,7 @@ exports.projectConfig = function projectConfigWindows(folder, userConfig) {
|
|||
|
||||
// expects solutions to be named the same as project folders
|
||||
const solutionPath = path.join(folder, csSolution);
|
||||
const windowsAppFolder = csSolution.substring(0, csSolution.lastIndexOf(".sln"));
|
||||
const windowsAppFolder = csSolution.substring(0, csSolution.lastIndexOf('.sln'));
|
||||
const src = userConfig.sourceDir || windowsAppFolder;
|
||||
const sourceDir = path.join(folder, src);
|
||||
const mainPage = path.join(sourceDir, 'MainPage.cs');
|
||||
|
@ -70,7 +70,7 @@ exports.dependencyConfig = function dependencyConfigWindows(folder, userConfig)
|
|||
}
|
||||
|
||||
// expects solutions to be named the same as project folders
|
||||
const windowsAppFolder = csSolution.substring(0, csSolution.lastIndexOf(".sln"));
|
||||
const windowsAppFolder = csSolution.substring(0, csSolution.lastIndexOf('.sln'));
|
||||
const src = userConfig.sourceDir || windowsAppFolder;
|
||||
|
||||
if (!src) {
|
||||
|
|
|
@ -38,11 +38,11 @@ function eject() {
|
|||
let appConfig = null;
|
||||
try {
|
||||
appConfig = require(path.resolve('app.json'));
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.error(
|
||||
`Eject requires an \`app.json\` config file to be located at ` +
|
||||
'Eject requires an `app.json` config file to be located at ' +
|
||||
`${path.resolve('app.json')}, and it must at least specify a \`name\` for the project ` +
|
||||
`name, and a \`displayName\` for the app's home screen label.`
|
||||
'name, and a `displayName` for the app\'s home screen label.'
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
@ -50,16 +50,16 @@ function eject() {
|
|||
const appName = appConfig.name;
|
||||
if (!appName) {
|
||||
console.error(
|
||||
`App \`name\` must be defined in the \`app.json\` config file to define the project name. `+
|
||||
`It must not contain any spaces or dashes.`
|
||||
'App `name` must be defined in the `app.json` config file to define the project name. ' +
|
||||
'It must not contain any spaces or dashes.'
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
const displayName = appConfig.displayName;
|
||||
if (!displayName) {
|
||||
console.error(
|
||||
`App \`displayName\` must be defined in the \`app.json\` config file, to define the label ` +
|
||||
`of the app on the home screen.`
|
||||
'App `displayName` must be defined in the `app.json` config file, to define the label ' +
|
||||
'of the app on the home screen.'
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ function copyProjectTemplateAndReplace(srcPath, destPath, newProjectName, option
|
|||
* behavior of automatically renaming .gitignore to .npmignore.
|
||||
*/
|
||||
function dotFilePath(path) {
|
||||
if (!path) return path;
|
||||
if (!path) {return path;}
|
||||
return path
|
||||
.replace('_gitignore', '.gitignore')
|
||||
.replace('_gitattributes', '.gitattributes')
|
||||
|
|
|
@ -25,7 +25,7 @@ function create() {
|
|||
var echo = opts.echo;
|
||||
var masked = 'echo' in opts;
|
||||
|
||||
var fd = (process.platform === 'win32') ?
|
||||
var fd = (process.platform === 'win32') ?
|
||||
process.stdin.fd :
|
||||
fs.openSync('/dev/tty', 'rs');
|
||||
|
||||
|
@ -51,15 +51,15 @@ function create() {
|
|||
str = str + buf.toString();
|
||||
str = str.replace(/\0/g, '');
|
||||
insert = str.length;
|
||||
process.stdout.write('\u001b[2K\u001b[0G'+ ask + str);
|
||||
process.stdout.write('\u001b[' + (insert+ask.length+1) + 'G');
|
||||
process.stdout.write('\u001b[2K\u001b[0G' + ask + str);
|
||||
process.stdout.write('\u001b[' + (insert + ask.length + 1) + 'G');
|
||||
buf = new Buffer(3);
|
||||
}
|
||||
continue; // any other 3 character sequence is ignored
|
||||
}
|
||||
|
||||
// if it is not a control character seq, assume only one character is read
|
||||
character = buf[read-1];
|
||||
character = buf[read - 1];
|
||||
|
||||
// catch a ^C and return null
|
||||
if (character == 3){
|
||||
|
@ -77,28 +77,28 @@ function create() {
|
|||
}
|
||||
|
||||
if (character == 127 || (process.platform == 'win32' && character == 8)) { //backspace
|
||||
if (!insert) continue;
|
||||
str = str.slice(0, insert-1) + str.slice(insert);
|
||||
if (!insert) {continue;}
|
||||
str = str.slice(0, insert - 1) + str.slice(insert);
|
||||
insert--;
|
||||
process.stdout.write('\u001b[2D');
|
||||
} else {
|
||||
if ((character < 32 ) || (character > 126))
|
||||
continue;
|
||||
{continue;}
|
||||
str = str.slice(0, insert) + String.fromCharCode(character) + str.slice(insert);
|
||||
insert++;
|
||||
};
|
||||
}
|
||||
|
||||
if (masked) {
|
||||
process.stdout.write('\u001b[2K\u001b[0G' + ask + Array(str.length+1).join(echo));
|
||||
process.stdout.write('\u001b[2K\u001b[0G' + ask + Array(str.length + 1).join(echo));
|
||||
} else {
|
||||
process.stdout.write('\u001b[s');
|
||||
if (insert == str.length) {
|
||||
process.stdout.write('\u001b[2K\u001b[0G'+ ask + str);
|
||||
process.stdout.write('\u001b[2K\u001b[0G' + ask + str);
|
||||
} else {
|
||||
if (ask) {
|
||||
process.stdout.write('\u001b[2K\u001b[0G'+ ask + str);
|
||||
process.stdout.write('\u001b[2K\u001b[0G' + ask + str);
|
||||
} else {
|
||||
process.stdout.write('\u001b[2K\u001b[0G'+ str + '\u001b[' + (str.length - insert) + 'D');
|
||||
process.stdout.write('\u001b[2K\u001b[0G' + str + '\u001b[' + (str.length - insert) + 'D');
|
||||
}
|
||||
}
|
||||
process.stdout.write('\u001b[u');
|
||||
|
@ -106,13 +106,13 @@ function create() {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
process.stdout.write('\n')
|
||||
|
||||
process.stdout.write('\n');
|
||||
|
||||
process.stdin.setRawMode(wasRaw);
|
||||
|
||||
return str || value || '';
|
||||
};
|
||||
};
|
||||
|
||||
module.exports = create;
|
||||
return str || value || '';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = create;
|
||||
|
|
|
@ -9,8 +9,8 @@ const projectConfig = {
|
|||
|
||||
describe('android::isInstalled', () => {
|
||||
it('should return true when project is already in build.gradle', () => {
|
||||
expect(isInstalled(projectConfig, 'test')).toBeTruthy()
|
||||
expect(isInstalled(projectConfig, 'test2')).toBeTruthy()
|
||||
expect(isInstalled(projectConfig, 'test')).toBeTruthy();
|
||||
expect(isInstalled(projectConfig, 'test2')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return false when project is not in build.gradle', () =>
|
||||
|
|
|
@ -14,7 +14,7 @@ jest.mock('fs');
|
|||
let plistPath = null;
|
||||
jest.mock('../../ios/getPlistPath', () => () => plistPath);
|
||||
|
||||
const { readFileSync } = require.requireActual('fs')
|
||||
const { readFileSync } = require.requireActual('fs');
|
||||
const fs = require('fs');
|
||||
|
||||
const xcode = require('xcode');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
module.exports = function makeBuildPatch(name) {
|
||||
const installPattern = new RegExp(
|
||||
`\\s{4}(compile)(\\(|\\s)(project)\\(\\\':${name}\\\'\\)(\\)|\\s)`
|
||||
)
|
||||
);
|
||||
|
||||
return {
|
||||
installPattern,
|
||||
|
|
|
@ -1 +1 @@
|
|||
module.exports = (cb) => cb();
|
||||
module.exports = (cb) => cb();
|
||||
|
|
|
@ -19,14 +19,14 @@ module.exports = function unlinkAssetsIOS(files, projectConfig) {
|
|||
if (!plist) {
|
||||
return log.error(
|
||||
'ERRPLIST',
|
||||
`Could not locate Info.plist file. Check if your project has 'INFOPLIST_FILE' set properly`
|
||||
'Could not locate Info.plist file. Check if your project has \'INFOPLIST_FILE\' set properly'
|
||||
);
|
||||
}
|
||||
|
||||
if (!project.pbxGroupByName('Resources')) {
|
||||
return log.error(
|
||||
'ERRGROUP',
|
||||
`Group 'Resources' does not exist in your Xcode project. There is nothing to unlink.`
|
||||
'Group \'Resources\' does not exist in your Xcode project. There is nothing to unlink.'
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ module.exports = function unlinkAssetsIOS(files, projectConfig) {
|
|||
)
|
||||
)
|
||||
.map(file => file.basename);
|
||||
}
|
||||
};
|
||||
|
||||
removeResourceFile(assets.image);
|
||||
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
module.exports = (func) => new Promise((resolve, reject) =>
|
||||
func((err, res) => err ? reject(err) : resolve(res))
|
||||
);
|
||||
);
|
||||
|
|
|
@ -156,7 +156,7 @@ function unlink(args, config) {
|
|||
);
|
||||
throw err;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
func: unlink,
|
||||
|
|
|
@ -5,7 +5,7 @@ module.exports = function applyPatch(file, patch, flip = false) {
|
|||
fs.writeFileSync(file, fs
|
||||
.readFileSync(file, 'utf8')
|
||||
.replace(patch.pattern, match => {
|
||||
return flip ? `${patch.patch}${match}` : `${match}${patch.patch}`
|
||||
return flip ? `${patch.patch}${match}` : `${match}${patch.patch}`;
|
||||
})
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const fs = require('fs');
|
||||
|
||||
module.exports = function revokePatch(file, patch) {
|
||||
const unpatch = patch.unpatch || patch.patch
|
||||
const unpatch = patch.unpatch || patch.patch;
|
||||
fs.writeFileSync(file, fs
|
||||
.readFileSync(file, 'utf8')
|
||||
.replace(unpatch, '')
|
||||
|
|
|
@ -22,7 +22,7 @@ function parseDevicesResult(result: string): Array<string> {
|
|||
const devices = [];
|
||||
const lines = result.trim().split(/\r?\n/);
|
||||
|
||||
for (let i=0; i < lines.length; i++) {
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
let words = lines[i].split(/[ ,\t]+/).filter((w) => w !== '');
|
||||
|
||||
if (words[1] === 'device') {
|
||||
|
@ -49,4 +49,4 @@ function getDevices(): Array<string> {
|
|||
module.exports = {
|
||||
parseDevicesResult: parseDevicesResult,
|
||||
getDevices: getDevices
|
||||
};
|
||||
};
|
||||
|
|
|
@ -16,37 +16,37 @@ const findMatchingSimulator = require('../findMatchingSimulator');
|
|||
describe('findMatchingSimulator', () => {
|
||||
it('should find simulator', () => {
|
||||
expect(findMatchingSimulator({
|
||||
"devices": {
|
||||
"iOS 9.2": [
|
||||
'devices': {
|
||||
'iOS 9.2': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 4s",
|
||||
"udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 4s',
|
||||
'udid': 'B9B5E161-416B-43C4-A78F-729CB96CC8C6'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 5",
|
||||
"udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 5',
|
||||
'udid': '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': 'BA0D93BD-07E6-4182-9B0A-F60A2474139C'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '9564ABEE-9EC2-4B4A-B443-D3710929A45A'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'D0F29BE7-CC3C-4976-888D-C739B4F50508'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -61,37 +61,37 @@ describe('findMatchingSimulator', () => {
|
|||
|
||||
it('should return null if no simulators available', () => {
|
||||
expect(findMatchingSimulator({
|
||||
"devices": {
|
||||
"iOS 9.2": [
|
||||
'devices': {
|
||||
'iOS 9.2': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 4s",
|
||||
"udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 4s',
|
||||
'udid': 'B9B5E161-416B-43C4-A78F-729CB96CC8C6'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 5",
|
||||
"udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 5',
|
||||
'udid': '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': 'BA0D93BD-07E6-4182-9B0A-F60A2474139C'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '9564ABEE-9EC2-4B4A-B443-D3710929A45A'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'D0F29BE7-CC3C-4976-888D-C739B4F50508'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -106,37 +106,37 @@ describe('findMatchingSimulator', () => {
|
|||
|
||||
it('should return the first simulator in list if none is defined', () => {
|
||||
expect(findMatchingSimulator({
|
||||
"devices": {
|
||||
"iOS 9.2": [
|
||||
'devices': {
|
||||
'iOS 9.2': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 4s",
|
||||
"udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 4s',
|
||||
'udid': 'B9B5E161-416B-43C4-A78F-729CB96CC8C6'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 5",
|
||||
"udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 5',
|
||||
'udid': '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': 'BA0D93BD-07E6-4182-9B0A-F60A2474139C'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '9564ABEE-9EC2-4B4A-B443-D3710929A45A'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'D0F29BE7-CC3C-4976-888D-C739B4F50508'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -151,63 +151,63 @@ describe('findMatchingSimulator', () => {
|
|||
|
||||
it('should return the first simulator in list if none is defined', () => {
|
||||
expect(findMatchingSimulator({
|
||||
"devices": {
|
||||
"iOS 9.2": [
|
||||
'devices': {
|
||||
'iOS 9.2': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 4s",
|
||||
"udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 4s',
|
||||
'udid': 'B9B5E161-416B-43C4-A78F-729CB96CC8C6'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 5",
|
||||
"udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 5',
|
||||
'udid': '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': 'BA0D93BD-07E6-4182-9B0A-F60A2474139C'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '9564ABEE-9EC2-4B4A-B443-D3710929A45A'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'D0F29BE7-CC3C-4976-888D-C739B4F50508'
|
||||
}
|
||||
],
|
||||
"iOS 10.0": [
|
||||
'iOS 10.0': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "CBBB8FB8-77AB-49A9-8297-4CCFE3189C22"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'CBBB8FB8-77AB-49A9-8297-4CCFE3189C22'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 7",
|
||||
"udid": "3A409DC5-5188-42A6-8598-3AA6F34607A5"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 7',
|
||||
'udid': '3A409DC5-5188-42A6-8598-3AA6F34607A5'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -222,37 +222,37 @@ describe('findMatchingSimulator', () => {
|
|||
|
||||
it('should return the booted simulator in list if none is defined', () => {
|
||||
expect(findMatchingSimulator({
|
||||
"devices": {
|
||||
"iOS 9.2": [
|
||||
'devices': {
|
||||
'iOS 9.2': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 4s",
|
||||
"udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 4s',
|
||||
'udid': 'B9B5E161-416B-43C4-A78F-729CB96CC8C6'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 5",
|
||||
"udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 5',
|
||||
'udid': '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': 'BA0D93BD-07E6-4182-9B0A-F60A2474139C'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '9564ABEE-9EC2-4B4A-B443-D3710929A45A'
|
||||
},
|
||||
{
|
||||
"state": "Booted",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"
|
||||
'state': 'Booted',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'D0F29BE7-CC3C-4976-888D-C739B4F50508'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -267,42 +267,42 @@ describe('findMatchingSimulator', () => {
|
|||
|
||||
it('should return the booted simulator in list even if another device is defined', () => {
|
||||
expect(findMatchingSimulator({
|
||||
"devices": {
|
||||
"iOS 9.2": [
|
||||
'devices': {
|
||||
'iOS 9.2': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 4s",
|
||||
"udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 4s',
|
||||
'udid': 'B9B5E161-416B-43C4-A78F-729CB96CC8C6'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 5",
|
||||
"udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 5',
|
||||
'udid': '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': 'BA0D93BD-07E6-4182-9B0A-F60A2474139C'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '9564ABEE-9EC2-4B4A-B443-D3710929A45A'
|
||||
},
|
||||
{
|
||||
"state": "Booted",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"
|
||||
'state': 'Booted',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'D0F29BE7-CC3C-4976-888D-C739B4F50508'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"iPhone 6"
|
||||
'iPhone 6'
|
||||
)).toEqual({
|
||||
udid: 'D0F29BE7-CC3C-4976-888D-C739B4F50508',
|
||||
name: 'iPhone 6s',
|
||||
|
@ -312,63 +312,63 @@ describe('findMatchingSimulator', () => {
|
|||
|
||||
it('should return the booted simulator in list if none is defined (multi ios versions)', () => {
|
||||
expect(findMatchingSimulator({
|
||||
"devices": {
|
||||
"iOS 9.2": [
|
||||
'devices': {
|
||||
'iOS 9.2': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 4s",
|
||||
"udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 4s',
|
||||
'udid': 'B9B5E161-416B-43C4-A78F-729CB96CC8C6'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 5",
|
||||
"udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 5',
|
||||
'udid': '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': 'BA0D93BD-07E6-4182-9B0A-F60A2474139C'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '9564ABEE-9EC2-4B4A-B443-D3710929A45A'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'D0F29BE7-CC3C-4976-888D-C739B4F50508'
|
||||
}
|
||||
],
|
||||
"iOS 10.0": [
|
||||
'iOS 10.0': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "CBBB8FB8-77AB-49A9-8297-4CCFE3189C22"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'CBBB8FB8-77AB-49A9-8297-4CCFE3189C22'
|
||||
},
|
||||
{
|
||||
"state": "Booted",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 7",
|
||||
"udid": "3A409DC5-5188-42A6-8598-3AA6F34607A5"
|
||||
'state': 'Booted',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 7',
|
||||
'udid': '3A409DC5-5188-42A6-8598-3AA6F34607A5'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -383,68 +383,68 @@ describe('findMatchingSimulator', () => {
|
|||
|
||||
it('should return the booted simulator in list even if another device is defined (multi ios versions)', () => {
|
||||
expect(findMatchingSimulator({
|
||||
"devices": {
|
||||
"iOS 9.2": [
|
||||
'devices': {
|
||||
'iOS 9.2': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(unavailable, runtime profile not found)",
|
||||
"name": "iPhone 4s",
|
||||
"udid": "B9B5E161-416B-43C4-A78F-729CB96CC8C6"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(unavailable, runtime profile not found)',
|
||||
'name': 'iPhone 4s',
|
||||
'udid': 'B9B5E161-416B-43C4-A78F-729CB96CC8C6'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 5",
|
||||
"udid": "1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 5',
|
||||
'udid': '1CCBBF8B-5773-4EA6-BD6F-C308C87A1ADB'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "BA0D93BD-07E6-4182-9B0A-F60A2474139C"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': 'BA0D93BD-07E6-4182-9B0A-F60A2474139C'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "9564ABEE-9EC2-4B4A-B443-D3710929A45A"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '9564ABEE-9EC2-4B4A-B443-D3710929A45A'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "D0F29BE7-CC3C-4976-888D-C739B4F50508"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'D0F29BE7-CC3C-4976-888D-C739B4F50508'
|
||||
}
|
||||
],
|
||||
"iOS 10.0": [
|
||||
'iOS 10.0': [
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6",
|
||||
"udid": "2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6',
|
||||
'udid': '2FF48AE5-CC3B-4C80-8D25-48966A6BE2C0'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6 (Plus)",
|
||||
"udid": "841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6 (Plus)',
|
||||
'udid': '841E33FE-E8A1-4B65-9FF8-6EAA6442A3FC'
|
||||
},
|
||||
{
|
||||
"state": "Shutdown",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 6s",
|
||||
"udid": "CBBB8FB8-77AB-49A9-8297-4CCFE3189C22"
|
||||
'state': 'Shutdown',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 6s',
|
||||
'udid': 'CBBB8FB8-77AB-49A9-8297-4CCFE3189C22'
|
||||
},
|
||||
{
|
||||
"state": "Booted",
|
||||
"availability": "(available)",
|
||||
"name": "iPhone 7",
|
||||
"udid": "3A409DC5-5188-42A6-8598-3AA6F34607A5"
|
||||
'state': 'Booted',
|
||||
'availability': '(available)',
|
||||
'name': 'iPhone 7',
|
||||
'udid': '3A409DC5-5188-42A6-8598-3AA6F34607A5'
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"iPhone 6s"
|
||||
'iPhone 6s'
|
||||
)).toEqual({
|
||||
udid: '3A409DC5-5188-42A6-8598-3AA6F34607A5',
|
||||
name: 'iPhone 7',
|
||||
|
|
|
@ -100,7 +100,7 @@ function guessEditor() {
|
|||
return [COMMON_EDITORS[processName]];
|
||||
}
|
||||
}
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
// Ignore...
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ function attachToServer(server, path) {
|
|||
|
||||
try {
|
||||
dest.send(message);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
console.warn(e);
|
||||
// Sometimes this call throws 'not opened'
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ const Touchable = ({onPress, children}) => {
|
|||
</TouchableHighlight>
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const ListItem = ({label, onPress}) => (
|
||||
<Touchable onPress={onPress}>
|
||||
|
|
|
@ -84,7 +84,7 @@ export default class ChatScreen extends Component {
|
|||
messages: messages,
|
||||
dataSource: prevState.dataSource.cloneWithRows(messages),
|
||||
myMessage: '',
|
||||
}
|
||||
};
|
||||
});
|
||||
this.textInput.clear();
|
||||
}
|
||||
|
|
|
@ -27,8 +27,8 @@ module.exports = function findSymlinksPaths(lookupFolder, ignoredRoots) {
|
|||
const index = visited.indexOf(symlink);
|
||||
if (index !== -1) {
|
||||
throw Error(
|
||||
`Infinite symlink recursion detected:\n ` +
|
||||
visited.slice(index).join(`\n `)
|
||||
'Infinite symlink recursion detected:\n ' +
|
||||
visited.slice(index).join('\n ')
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ function exec(command, logOutput) {
|
|||
stderr: ${stderr}
|
||||
stdout: ${stdout}`));
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function parseJsonFile(path, useYarn) {
|
||||
|
@ -93,7 +93,7 @@ function readPackageFiles(useYarn) {
|
|||
reactNativeNodeModulesPak: parseJsonFile(reactNativeNodeModulesPakPath),
|
||||
reactNodeModulesPak: parseJsonFile(reactNodeModulesPakPath),
|
||||
pak: parseJsonFile(pakPath)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function parseInformationJsonOutput(jsonOutput, requestedVersion) {
|
||||
|
@ -105,7 +105,7 @@ function parseInformationJsonOutput(jsonOutput, requestedVersion) {
|
|||
|
||||
assert(semver.valid(newVersion));
|
||||
|
||||
return {newVersion, newReactVersionRange}
|
||||
return {newVersion, newReactVersionRange};
|
||||
} catch (err) {
|
||||
throw new Error(
|
||||
'The specified version of React Native ' + requestedVersion + ' doesn\'t exist.\n' +
|
||||
|
@ -147,7 +147,7 @@ function generateTemplates(generatorDir, appName, verbose) {
|
|||
// Try requiring the index.js (entry-point of Yeoman generators)
|
||||
fs.accessSync(yeomanGeneratorEntryPoint);
|
||||
return runYeomanGenerators(generatorDir, appName, verbose);
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
return runCopyAndReplace(generatorDir, appName);
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ async function run(requestedVersion, cliArgs) {
|
|||
log.info('Commit current project sources');
|
||||
await exec('git commit -m "Project snapshot"', verbose);
|
||||
|
||||
log.info ('Create a tag before updating sources');
|
||||
log.info('Create a tag before updating sources');
|
||||
await exec('git tag project-snapshot', verbose);
|
||||
projectBackupCreated = true;
|
||||
|
||||
|
|
|
@ -32,15 +32,15 @@ let argv = minimist(process.argv.slice(2), {
|
|||
});
|
||||
|
||||
// - check we are in release branch, e.g. 0.33-stable
|
||||
let branch = exec(`git symbolic-ref --short HEAD`, {silent: true}).stdout.trim();
|
||||
let branch = exec('git symbolic-ref --short HEAD', {silent: true}).stdout.trim();
|
||||
|
||||
if (branch.indexOf(`-stable`) === -1) {
|
||||
echo(`You must be in 0.XX-stable branch to bump a version`);
|
||||
if (branch.indexOf('-stable') === -1) {
|
||||
echo('You must be in 0.XX-stable branch to bump a version');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// e.g. 0.33
|
||||
let versionMajor = branch.slice(0, branch.indexOf(`-stable`));
|
||||
let versionMajor = branch.slice(0, branch.indexOf('-stable'));
|
||||
|
||||
// - check that argument version matches branch
|
||||
// e.g. 0.33.1 or 0.33.0-rc4
|
||||
|
@ -79,13 +79,13 @@ cat('scripts/versiontemplates/ReactNativeVersion.js.template')
|
|||
.replace('${prerelease}', prerelease !== undefined ? `'${prerelease}'` : 'null')
|
||||
.to('Libraries/Core/ReactNativeVersion.js');
|
||||
|
||||
let packageJson = JSON.parse(cat(`package.json`));
|
||||
let packageJson = JSON.parse(cat('package.json'));
|
||||
packageJson.version = version;
|
||||
JSON.stringify(packageJson, null, 2).to(`package.json`);
|
||||
JSON.stringify(packageJson, null, 2).to('package.json');
|
||||
|
||||
// - change ReactAndroid/gradle.properties
|
||||
if (sed(`-i`, /^VERSION_NAME=.*/, `VERSION_NAME=${version}`, `ReactAndroid/gradle.properties`).code) {
|
||||
echo(`Couldn't update version for Gradle`);
|
||||
if (sed('-i', /^VERSION_NAME=.*/, `VERSION_NAME=${version}`, 'ReactAndroid/gradle.properties').code) {
|
||||
echo('Couldn\'t update version for Gradle');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -93,23 +93,23 @@ if (sed(`-i`, /^VERSION_NAME=.*/, `VERSION_NAME=${version}`, `ReactAndroid/gradl
|
|||
let numberOfChangedLinesWithNewVersion = exec(`git diff -U0 | grep '^[+]' | grep -c ${version} `, {silent: true})
|
||||
.stdout.trim();
|
||||
if (+numberOfChangedLinesWithNewVersion !== 2) {
|
||||
echo(`Failed to update all the files. package.json and gradle.properties must have versions in them`);
|
||||
echo(`Fix the issue, revert and try again`);
|
||||
exec(`git diff`);
|
||||
echo('Failed to update all the files. package.json and gradle.properties must have versions in them');
|
||||
echo('Fix the issue, revert and try again');
|
||||
exec('git diff');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// - make commit [0.21.0-rc] Bump version numbers
|
||||
if (exec(`git commit -a -m "[${version}] Bump version numbers"`).code) {
|
||||
echo(`failed to commit`);
|
||||
echo('failed to commit');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// - add tag v0.21.0-rc
|
||||
if (exec(`git tag v${version}`).code) {
|
||||
echo(`failed to tag the commit with v${version}, are you sure this release wasn't made earlier?`);
|
||||
echo(`You may want to rollback the last commit`);
|
||||
echo(`git reset --hard HEAD~1`);
|
||||
echo('You may want to rollback the last commit');
|
||||
echo('git reset --hard HEAD~1');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -118,10 +118,10 @@ let remote = argv.remote;
|
|||
exec(`git push ${remote} v${version}`);
|
||||
|
||||
// Tag latest if doing stable release
|
||||
if (version.indexOf(`rc`) === -1) {
|
||||
exec(`git tag -d latest`);
|
||||
if (version.indexOf('rc') === -1) {
|
||||
exec('git tag -d latest');
|
||||
exec(`git push ${remote} :latest`);
|
||||
exec(`git tag latest`);
|
||||
exec('git tag latest');
|
||||
exec(`git push ${remote} latest`);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,20 +47,20 @@
|
|||
*/
|
||||
|
||||
/*eslint-disable no-undef */
|
||||
require(`shelljs/global`);
|
||||
require('shelljs/global');
|
||||
|
||||
const buildBranch = process.env.CIRCLE_BRANCH;
|
||||
|
||||
let branchVersion;
|
||||
if (buildBranch.indexOf(`-stable`) !== -1) {
|
||||
branchVersion = buildBranch.slice(0, buildBranch.indexOf(`-stable`));
|
||||
if (buildBranch.indexOf('-stable') !== -1) {
|
||||
branchVersion = buildBranch.slice(0, buildBranch.indexOf('-stable'));
|
||||
} else {
|
||||
echo(`Error: We publish only from stable branches`);
|
||||
echo('Error: We publish only from stable branches');
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// 34c034298dc9cad5a4553964a5a324450fda0385
|
||||
const currentCommit = exec(`git rev-parse HEAD`, {silent: true}).stdout.trim();
|
||||
const currentCommit = exec('git rev-parse HEAD', {silent: true}).stdout.trim();
|
||||
// [34c034298dc9cad5a4553964a5a324450fda0385, refs/heads/0.33-stable, refs/tags/latest, refs/tags/v0.33.1, refs/tags/v0.34.1-rc]
|
||||
const tagsWithVersion = exec(`git ls-remote origin | grep ${currentCommit}`, {silent: true})
|
||||
.stdout.split(/\s/)
|
||||
|
@ -69,14 +69,14 @@ const tagsWithVersion = exec(`git ls-remote origin | grep ${currentCommit}`, {si
|
|||
// ['refs/tags/v0.33.0', 'refs/tags/v0.33.0-rc', 'refs/tags/v0.33.0-rc1', 'refs/tags/v0.33.0-rc2']
|
||||
.filter(version => version.indexOf(branchVersion) !== -1)
|
||||
// ['v0.33.0', 'v0.33.0-rc', 'v0.33.0-rc1', 'v0.33.0-rc2']
|
||||
.map(version => version.slice(`refs/tags/`.length));
|
||||
.map(version => version.slice('refs/tags/'.length));
|
||||
|
||||
if (tagsWithVersion.length === 0) {
|
||||
echo(`Error: Can't find version tag in current commit. To deploy to NPM you must add tag v0.XY.Z[-rc] to your commit`);
|
||||
echo('Error: Can\'t find version tag in current commit. To deploy to NPM you must add tag v0.XY.Z[-rc] to your commit');
|
||||
exit(1);
|
||||
}
|
||||
let releaseVersion;
|
||||
if (tagsWithVersion[0].indexOf(`-rc`) === -1) {
|
||||
if (tagsWithVersion[0].indexOf('-rc') === -1) {
|
||||
// if first tag on this commit is non -rc then we are making a stable release
|
||||
// '0.33.0'
|
||||
releaseVersion = tagsWithVersion[0].slice(1);
|
||||
|
@ -87,33 +87,33 @@ if (tagsWithVersion[0].indexOf(`-rc`) === -1) {
|
|||
}
|
||||
|
||||
// -------- Generating Android Artifacts with JavaDoc
|
||||
if (exec(`./gradlew :ReactAndroid:installArchives`).code) {
|
||||
echo(`Couldn't generate artifacts`);
|
||||
if (exec('./gradlew :ReactAndroid:installArchives').code) {
|
||||
echo('Couldn\'t generate artifacts');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// undo uncommenting javadoc setting
|
||||
exec(`git checkout ReactAndroid/gradle.properties`);
|
||||
exec('git checkout ReactAndroid/gradle.properties');
|
||||
|
||||
echo("Generated artifacts for Maven");
|
||||
echo('Generated artifacts for Maven');
|
||||
|
||||
let artifacts = ['-javadoc.jar', '-sources.jar', '.aar', '.pom'].map((suffix) => {
|
||||
return `react-native-${releaseVersion}${suffix}`;
|
||||
});
|
||||
|
||||
artifacts.forEach((name) => {
|
||||
if (!test(`-e`, `./android/com/facebook/react/react-native/${releaseVersion}/${name}`)) {
|
||||
if (!test('-e', `./android/com/facebook/react/react-native/${releaseVersion}/${name}`)) {
|
||||
echo(`file ${name} was not generated`);
|
||||
exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
if (releaseVersion.indexOf(`-rc`) === -1) {
|
||||
if (releaseVersion.indexOf('-rc') === -1) {
|
||||
// release, package will be installed by default
|
||||
exec(`npm publish`);
|
||||
exec('npm publish');
|
||||
} else {
|
||||
// RC release, package will be installed only if users specifically do it
|
||||
exec(`npm publish --tag next`);
|
||||
exec('npm publish --tag next');
|
||||
}
|
||||
|
||||
echo(`Published to npm ${releaseVersion}`);
|
||||
|
|
|
@ -31,7 +31,7 @@ class BlogPostFooter extends React.Component {
|
|||
<div>
|
||||
<aside className="author-info">
|
||||
<div className="author-image">
|
||||
<span className="the-image" style={{backgroundImage: "url(" + authorImage + ")"}}></span>
|
||||
<span className="the-image" style={{backgroundImage: 'url(' + authorImage + ')'}} />
|
||||
</div>
|
||||
<p className="posted-on">Posted on <BlogPostDate post={post} /></p>
|
||||
<p className="name-title">
|
||||
|
@ -50,9 +50,8 @@ class BlogPostFooter extends React.Component {
|
|||
data-layout="standard"
|
||||
data-share="true"
|
||||
data-width="225"
|
||||
data-show-faces="false">
|
||||
</div>
|
||||
<a href="https://twitter.com/share" className="twitter-share-button" data-text={post.title} data-url={"http://facebook.github.io/react-native/blog/" + post.path} data-via={post.authorTwitter} data-related="reactnative" data-show-count="false">Tweet</a>
|
||||
data-show-faces="false" />
|
||||
<a href="https://twitter.com/share" className="twitter-share-button" data-text={post.title} data-url={'http://facebook.github.io/react-native/blog/' + post.path} data-via={post.authorTwitter} data-related="reactnative" data-show-count="false">Tweet</a>
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
|
|
@ -24,18 +24,18 @@ class BlogPostHeader extends React.Component {
|
|||
}
|
||||
|
||||
var title = post.title;
|
||||
var href = "/react-native/blog/" + post.path;
|
||||
var href = '/react-native/blog/' + post.path;
|
||||
if (this.props.excerpt) {
|
||||
title = <a href={href}>{post.title}</a>;
|
||||
hero = <a href={href}>{hero}</a>;
|
||||
}
|
||||
|
||||
if (post.youtubeVideoId) {
|
||||
var embedURL = "https://www.youtube.com/embed/" + post.youtubeVideoId;
|
||||
var embedURL = 'https://www.youtube.com/embed/' + post.youtubeVideoId;
|
||||
hero = <div className="video-container youtube">
|
||||
<iframe id="ytplayer" type="text/html" width="650" height="345"
|
||||
src={embedURL}
|
||||
frameBorder="0"></iframe>
|
||||
frameBorder="0" />
|
||||
</div>;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,10 +15,10 @@ var React = require('React');
|
|||
|
||||
class ExcerptLink extends React.Component {
|
||||
render() {
|
||||
var cta = "Read more";
|
||||
var cta = 'Read more';
|
||||
|
||||
if (this.props.category === "videos") {
|
||||
cta = "Watch video";
|
||||
if (this.props.category === 'videos') {
|
||||
cta = 'Watch video';
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -227,7 +227,7 @@ function parseSegmentType(stream, pos) {
|
|||
var segmentAst;
|
||||
if (stream[pos].type == TOKENS.OPENSEGMENT &&
|
||||
(segmentAst = parseAnyType(stream, ++pos))) {
|
||||
pos += segmentAst.length
|
||||
pos += segmentAst.length;
|
||||
if (stream[pos].type == TOKENS.CLOSESEGMENT) {
|
||||
return createAst(SYMBOLS.SEGMENT, segmentAst, segmentAst.length + 2);
|
||||
}
|
||||
|
@ -235,9 +235,9 @@ function parseSegmentType(stream, pos) {
|
|||
}
|
||||
|
||||
function parseAnyType(stream, pos, parsers) {
|
||||
if (!parsers) parsers =
|
||||
if (!parsers) {parsers =
|
||||
PARSERS.SEGMENT | PARSERS.SIMPLE | PARSERS.UNION | PARSERS.GENERIC
|
||||
| PARSERS.FUNCTION;
|
||||
| PARSERS.FUNCTION;}
|
||||
|
||||
var ast =
|
||||
(parsers & PARSERS.UNION && parseUnionType(stream, pos)) ||
|
||||
|
|
|
@ -71,7 +71,7 @@ function isAssignmentStatement(node) {
|
|||
*/
|
||||
function expressionToArray(expr) {
|
||||
var parts = [];
|
||||
switch(expr.type) {
|
||||
switch (expr.type) {
|
||||
case Syntax.CallExpression:
|
||||
parts = expressionToArray(expr.callee);
|
||||
break;
|
||||
|
|
|
@ -48,7 +48,7 @@ function getTypeHintsFromDocBlock(node, docBlocksByLine) {
|
|||
}, {});
|
||||
|
||||
var param;
|
||||
while(param = paramRe.exec(comments.value)) {
|
||||
while (param = paramRe.exec(comments.value)) {
|
||||
|
||||
if (!param[1]) {
|
||||
continue;
|
||||
|
@ -80,7 +80,7 @@ function getTypeHintsFromDocBlock(node, docBlocksByLine) {
|
|||
var returnType = returnRe.exec(comments.value);
|
||||
if (returnType && returnType[1]) {
|
||||
throw new Error(util.format('Lines: %s-%s: Your @return declaration in' +
|
||||
' function %s is incorrectly written as @returns. Remove the trailing'+
|
||||
' function %s is incorrectly written as @returns. Remove the trailing' +
|
||||
' \'s\'.',
|
||||
comments.loc.start.line, comments.loc.end.line, functionName));
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ function getTypeHintFromInline(node, commentsByLine) {
|
|||
*/
|
||||
function parseComments(programNode, state) {
|
||||
programNode.comments.forEach(function(c) {
|
||||
if (c.type !== 'Block') return;
|
||||
if (c.type !== 'Block') {return;}
|
||||
|
||||
var comments;
|
||||
if (c.loc.start.line === c.loc.end.line &&
|
||||
|
@ -156,8 +156,8 @@ function normalizeTypeHintParams(node, state, typeHints) {
|
|||
if (typeHint[1]) {
|
||||
preCond.push([
|
||||
typeHint[0],
|
||||
'\''+ type.parseAndNormalize(typeHint[1], typeHint[0], node) +'\'',
|
||||
'\''+ typeHint[0] +'\''
|
||||
'\'' + type.parseAndNormalize(typeHint[1], typeHint[0], node) + '\'',
|
||||
'\'' + typeHint[0] + '\''
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -108,7 +108,7 @@ function getFileDocBlock(commentsForFile) {
|
|||
var lines = comment.value.split('\n');
|
||||
var inCopyrightBlock = false;
|
||||
var filteredLines = lines.filter(function(line) {
|
||||
if (!!line.match(/^\s*\*\s+Copyright \(c\)/)) {
|
||||
if (line.match(/^\s*\*\s+Copyright \(c\)/)) {
|
||||
inCopyrightBlock = true;
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ function getRequireData(node) {
|
|||
|| (callee.name !== 'require')) {
|
||||
return null;
|
||||
}
|
||||
var args = node['arguments'];
|
||||
var args = node.arguments;
|
||||
if (args.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -561,7 +561,7 @@ class APIDoc extends React.Component {
|
|||
</div>
|
||||
</span>
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
renderMainDescription(content) {
|
||||
if (content.docblock) {
|
||||
|
@ -655,7 +655,7 @@ class Method extends React.Component {
|
|||
</div>
|
||||
);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
renderMethodParameters(params) {
|
||||
if (!params || !params.length) {
|
||||
|
|
|
@ -47,7 +47,7 @@ class BlogPageLayout extends React.Component {
|
|||
.map((post) => {
|
||||
return (
|
||||
<BlogPostExcerpt post={post} />
|
||||
)
|
||||
);
|
||||
})
|
||||
}
|
||||
<div className="docs-prevnext">
|
||||
|
|
|
@ -28,124 +28,124 @@ const CI_PULL_REQUEST = process.env.CI_PULL_REQUEST;
|
|||
const GIT_USER = process.env.GIT_USER;
|
||||
const remoteBranch = `https://${GIT_USER}@github.com/facebook/react-native.git`;
|
||||
|
||||
if (!which(`git`)) {
|
||||
echo(`Sorry, this script requires git`);
|
||||
if (!which('git')) {
|
||||
echo('Sorry, this script requires git');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
let version;
|
||||
let areVersionlessSectionsToBeDeployed = false;
|
||||
if (CIRCLE_BRANCH.indexOf(`-stable`) !== -1) {
|
||||
version = CIRCLE_BRANCH.slice(0, CIRCLE_BRANCH.indexOf(`-stable`));
|
||||
} else if (CIRCLE_BRANCH === `master`) {
|
||||
version = `next`;
|
||||
if (CIRCLE_BRANCH.indexOf('-stable') !== -1) {
|
||||
version = CIRCLE_BRANCH.slice(0, CIRCLE_BRANCH.indexOf('-stable'));
|
||||
} else if (CIRCLE_BRANCH === 'master') {
|
||||
version = 'next';
|
||||
areVersionlessSectionsToBeDeployed = true;
|
||||
}
|
||||
|
||||
rm(`-rf`, `build`);
|
||||
mkdir(`-p`, `build`);
|
||||
rm('-rf', 'build');
|
||||
mkdir('-p', 'build');
|
||||
// if current commit is tagged "latest" we do a release to gh-pages root
|
||||
const currentCommit = exec(`git rev-parse HEAD`).stdout.trim();
|
||||
const latestTagCommit = exec(`git ls-remote origin latest`).stdout.split(/\s/)[0];
|
||||
const currentCommit = exec('git rev-parse HEAD').stdout.trim();
|
||||
const latestTagCommit = exec('git ls-remote origin latest').stdout.split(/\s/)[0];
|
||||
// pass along which branch contains latest version so that gh-pages root could mark it as latest
|
||||
const branchWithLatestTag = exec(`git branch -r --contains ${latestTagCommit}`).stdout.split('/')[1];
|
||||
let latestVersion = ``;
|
||||
if (branchWithLatestTag.indexOf(`-stable`) !== -1) {
|
||||
latestVersion = branchWithLatestTag.slice(0, branchWithLatestTag.indexOf(`-stable`));
|
||||
let latestVersion = '';
|
||||
if (branchWithLatestTag.indexOf('-stable') !== -1) {
|
||||
latestVersion = branchWithLatestTag.slice(0, branchWithLatestTag.indexOf('-stable'));
|
||||
}
|
||||
|
||||
if (!CI_PULL_REQUEST && CIRCLE_PROJECT_USERNAME === `facebook`) {
|
||||
if (!CI_PULL_REQUEST && CIRCLE_PROJECT_USERNAME === 'facebook') {
|
||||
echo(`Building branch ${version}, preparing to push to gh-pages`);
|
||||
// if code is running in a branch in CI, commit changes to gh-pages branch
|
||||
cd(`build`);
|
||||
rm(`-rf`, `react-native-gh-pages`);
|
||||
cd('build');
|
||||
rm('-rf', 'react-native-gh-pages');
|
||||
|
||||
if (exec(`git clone ${remoteBranch} react-native-gh-pages`).code !== 0) {
|
||||
echo(`Error: Git clone failed`);
|
||||
echo('Error: Git clone failed');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
cd(`react-native-gh-pages`);
|
||||
cd('react-native-gh-pages');
|
||||
|
||||
if (exec(`git checkout origin/gh-pages`).code +
|
||||
exec(`git checkout -b gh-pages`).code +
|
||||
exec(`git branch --set-upstream-to=origin/gh-pages`).code !== 0
|
||||
if (exec('git checkout origin/gh-pages').code +
|
||||
exec('git checkout -b gh-pages').code +
|
||||
exec('git branch --set-upstream-to=origin/gh-pages').code !== 0
|
||||
) {
|
||||
echo(`Error: Git checkout gh-pages failed`);
|
||||
echo('Error: Git checkout gh-pages failed');
|
||||
exit(1);
|
||||
}
|
||||
cd(`releases`);
|
||||
let releasesFolders = ls(`-d`, `*`);
|
||||
cd(`..`);
|
||||
let versions = releasesFolders.filter(name => name !== `next`);
|
||||
if (version !== `next` && versions.indexOf(version) === -1) {
|
||||
cd('releases');
|
||||
let releasesFolders = ls('-d', '*');
|
||||
cd('..');
|
||||
let versions = releasesFolders.filter(name => name !== 'next');
|
||||
if (version !== 'next' && versions.indexOf(version) === -1) {
|
||||
versions.push(version);
|
||||
}
|
||||
|
||||
versions.sort(semverCmp).reverse();
|
||||
|
||||
// generate to releases/XX when branch name indicates that it is some sort of release
|
||||
if (!!version) {
|
||||
if (version) {
|
||||
echo(`------------ DEPLOYING /releases/${version}`);
|
||||
rm(`-rf`, `releases/${version}`);
|
||||
mkdir(`-p`, `releases/${version}`);
|
||||
cd(`../..`);
|
||||
rm('-rf', `releases/${version}`);
|
||||
mkdir('-p', `releases/${version}`);
|
||||
cd('../..');
|
||||
if (exec(`RN_DEPLOYMENT_PATH=releases/${version} RN_VERSION=${version} RN_LATEST_VERSION=${latestVersion} \
|
||||
RN_AVAILABLE_DOCS_VERSIONS=${versions.join(',')} node server/generate.js`).code !== 0) {
|
||||
echo(`Error: Generating HTML failed`);
|
||||
echo('Error: Generating HTML failed');
|
||||
exit(1);
|
||||
}
|
||||
cd(`build/react-native-gh-pages`);
|
||||
cd('build/react-native-gh-pages');
|
||||
// blog, showcase, support are copied separately
|
||||
let toCopy = ls(`../react-native`)
|
||||
.filter(file => (file !== `blog`) && (file !== `showcase.html`) && (file !== `support.html`))
|
||||
let toCopy = ls('../react-native')
|
||||
.filter(file => (file !== 'blog') && (file !== 'showcase.html') && (file !== 'support.html'))
|
||||
.map(file => `../react-native/${file}`);
|
||||
cp(`-R`, toCopy, `releases/${version}`);
|
||||
cp('-R', toCopy, `releases/${version}`);
|
||||
// versions.html is located in root of website and updated with every release
|
||||
cp(`../react-native/versions.html`, `.`);
|
||||
cp('../react-native/versions.html', '.');
|
||||
}
|
||||
// generate to root folder when commit is tagged as latest, i.e. stable and needs to be shown at the root of repo
|
||||
if (currentCommit === latestTagCommit) {
|
||||
echo(`------------ DEPLOYING latest`);
|
||||
echo('------------ DEPLOYING latest');
|
||||
// leave only releases and blog folder
|
||||
rm(`-rf`, ls(`*`).filter(name => (name !== 'releases') && (name !== 'blog') && (name !== 'showcase.html') && (name !== 'support.html')));
|
||||
cd(`../..`);
|
||||
rm('-rf', ls('*').filter(name => (name !== 'releases') && (name !== 'blog') && (name !== 'showcase.html') && (name !== 'support.html')));
|
||||
cd('../..');
|
||||
if (exec(`RN_VERSION=${version} RN_LATEST_VERSION=${latestVersion} \
|
||||
RN_AVAILABLE_DOCS_VERSIONS=${versions} node server/generate.js`).code !== 0) {
|
||||
echo(`Error: Generating HTML failed`);
|
||||
echo('Error: Generating HTML failed');
|
||||
exit(1);
|
||||
}
|
||||
cd(`build/react-native-gh-pages`);
|
||||
cd('build/react-native-gh-pages');
|
||||
// blog, showcase, support are copied separately
|
||||
let toCopy = ls(`../react-native`)
|
||||
.filter(file => (file !== `blog`) && (file !== `showcase.html`) && (file !== `support.html`))
|
||||
let toCopy = ls('../react-native')
|
||||
.filter(file => (file !== 'blog') && (file !== 'showcase.html') && (file !== 'support.html'))
|
||||
.map(file => `../react-native/${file}`);
|
||||
cp(`-R`, toCopy, `.`);
|
||||
cp('-R', toCopy, '.');
|
||||
}
|
||||
// blog, showcase, support are versionless, we always build them in root file
|
||||
if (areVersionlessSectionsToBeDeployed) {
|
||||
echo(`------------ COPYING blog`);
|
||||
rm(`-rf`, `blog`);
|
||||
cp(`-R`, `../react-native/blog`, `.`);
|
||||
echo(`------------ COPYING showcase`);
|
||||
cp(`../react-native/showcase.html`, `.`);
|
||||
echo(`------------ COPYING support`);
|
||||
cp(`../react-native/support.html`, `.`);
|
||||
echo('------------ COPYING blog');
|
||||
rm('-rf', 'blog');
|
||||
cp('-R', '../react-native/blog', '.');
|
||||
echo('------------ COPYING showcase');
|
||||
cp('../react-native/showcase.html', '.');
|
||||
echo('------------ COPYING support');
|
||||
cp('../react-native/support.html', '.');
|
||||
}
|
||||
if (currentCommit === latestTagCommit || version) {
|
||||
exec(`git status`);
|
||||
exec(`git add -A .`);
|
||||
if (exec(`git diff-index --quiet HEAD --`).code !== 0) {
|
||||
exec('git status');
|
||||
exec('git add -A .');
|
||||
if (exec('git diff-index --quiet HEAD --').code !== 0) {
|
||||
if (exec(`git commit -m "Updated docs for ${version}"`).code !== 0) {
|
||||
echo(`Error: Git commit gh-pages failed`);
|
||||
echo('Error: Git commit gh-pages failed');
|
||||
exit(1);
|
||||
}
|
||||
if (exec(`git push origin gh-pages`).code !== 0) {
|
||||
echo(`Error: Git push gh-pages failed`);
|
||||
if (exec('git push origin gh-pages').code !== 0) {
|
||||
echo('Error: Git push gh-pages failed');
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
echo(`------------ gh-pages updated`);
|
||||
echo('------------ gh-pages updated');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var fs = require('fs')
|
||||
var fs = require('fs');
|
||||
var glob = require('glob');
|
||||
var mkdirp = require('mkdirp');
|
||||
var optimist = require('optimist');
|
||||
|
@ -36,7 +36,7 @@ function splitHeader(content) {
|
|||
function rmFile(file) {
|
||||
try {
|
||||
fs.unlinkSync(file);
|
||||
} catch(e) {
|
||||
} catch (e) {
|
||||
/* seriously, unlink throws when the file doesn't exist :( */
|
||||
}
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ function extractMetadata(content) {
|
|||
var key = keyvalue[0].trim();
|
||||
var value = keyvalue.slice(1).join(':').trim();
|
||||
// Handle the case where you have "Community #10"
|
||||
try { value = JSON.parse(value); } catch(e) { }
|
||||
try { value = JSON.parse(value); } catch (e) { }
|
||||
metadata[key] = value;
|
||||
}
|
||||
return {metadata: metadata, rawContent: both.content};
|
||||
|
|
|
@ -61,7 +61,7 @@ queue = queue.then(function() {
|
|||
|
||||
mkdirp.sync(targetFile.replace(new RegExp('/[^/]*$'), ''));
|
||||
fs.writeFileSync(targetFile, feed.render('atom-1.0'));
|
||||
console.log('Generated RSS feed')
|
||||
console.log('Generated RSS feed');
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue