Skip to content

Commit d5557f9

Browse files
acoates-msontzic
authored andcommitted
sync from internal (#6)
1 parent c6cb0ad commit d5557f9

11 files changed

+5194
-12
lines changed

.ado/publish.js

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
// Used to publish this fork of react-native
2+
// Publish it as an attached tar asset to the GitHub release for general consumption, since we can't publish this to the npmjs npm feed
3+
4+
const fs = require("fs");
5+
const path = require("path");
6+
const execSync = require("child_process").execSync;
7+
8+
function exec(command) {
9+
try {
10+
console.log(`Running command: ${command}`);
11+
return execSync(command, {
12+
stdio: "inherit"
13+
});
14+
} catch (err) {
15+
process.exitCode = 1;
16+
console.log(`Failure running: ${command}`);
17+
throw err;
18+
}
19+
}
20+
21+
function doPublish() {
22+
const publishBranchName = process.env.publishBranchName;
23+
24+
const tempPublishBranch = `publish-${Date.now()}`;
25+
26+
const pkgJsonPath = path.resolve(__dirname, "../package.json");
27+
let pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
28+
29+
let releaseVersion = pkgJson.version;
30+
31+
const versionGroups = /(.*-microsoft\.)([0-9]*)/.exec(releaseVersion);
32+
if (versionGroups) {
33+
releaseVersion = versionGroups[1] + (parseInt(versionGroups[2]) + 1);
34+
} else {
35+
if (releaseVersion.indexOf("-") === -1) {
36+
releaseVersion = releaseVersion + "-microsoft.0";
37+
} else {
38+
console.log("Invalid version to publish");
39+
exit(1);
40+
}
41+
}
42+
43+
pkgJson.version = releaseVersion;
44+
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
45+
console.log(`Updating package.json to version ${releaseVersion}`);
46+
47+
exec(`git checkout -b ${tempPublishBranch}`);
48+
49+
exec(`git add ${pkgJsonPath}`);
50+
exec(`git commit -m "Applying package update to ${releaseVersion}`);
51+
exec(`git tag v${releaseVersion}`);
52+
exec(`git push origin HEAD:${tempPublishBranch} --follow-tags --verbose`);
53+
exec(`git push origin tag v${releaseVersion}`);
54+
55+
// -------- Generating Android Artifacts with JavaDoc
56+
exec("gradlew installArchives");
57+
58+
// undo uncommenting javadoc setting
59+
exec("git checkout ReactAndroid/gradle.properties");
60+
61+
// Configure npm to publish to internal feed
62+
const npmrcPath = path.resolve(__dirname, "../.npmrc");
63+
const npmrcContents = `registry=https:${
64+
process.env.publishnpmfeed
65+
}/registry/\nalways-auth=true`;
66+
console.log(`Creating ${npmrcPath} for publishing:`);
67+
console.log(npmrcContents);
68+
fs.writeFileSync(npmrcPath, npmrcContents);
69+
70+
exec(`npm publish`);
71+
exec(`del ${npmrcPath}`);
72+
73+
// Push tar to GitHub releases
74+
exec(`npm pack`);
75+
76+
const npmTarPath = path.resolve(
77+
__dirname,
78+
`../react-native-${releaseVersion}.tgz`
79+
);
80+
const assetUpdateUrl = `https://uploads.github.com/repos/Microsoft/react-native/releases/{id}/assets?name=react-native-${releaseVersion}.tgz`;
81+
const authHeader =
82+
"Basic " + new Buffer(":" + process.env.githubToken).toString("base64");
83+
const userAgent = "Microsoft-React-Native-Release-Agent";
84+
85+
let uploadReleaseAssetUrl = "";
86+
exec("npm install request@^2.69.0 --no-save");
87+
88+
const request = require("request");
89+
90+
const uploadTarBallToRelease = function() {
91+
request.post(
92+
{
93+
url: uploadReleaseAssetUrl,
94+
headers: {
95+
"User-Agent": userAgent,
96+
Authorization: authHeader,
97+
"Content-Type": "application/octet-stream"
98+
},
99+
formData: {
100+
file: fs.createReadStream(npmTarPath)
101+
}
102+
},
103+
function(err, res, body) {
104+
if (err) {
105+
console.error(err);
106+
process.exitCode = 1;
107+
throw err;
108+
}
109+
110+
var formattedResponse = JSON.parse(body);
111+
112+
if (formattedResponse.errors) {
113+
process.exitCode = 1;
114+
console.error(formattedResponse.errors);
115+
throw formattedResponse.errors;
116+
}
117+
118+
exec(`del ${npmTarPath}`);
119+
exec(`git checkout ${publishBranchName}`);
120+
exec(`git pull origin ${publishBranchName}`);
121+
exec(`git merge ${tempPublishBranch} --no-edit`);
122+
exec(
123+
`git push origin HEAD:${publishBranchName} --follow-tags --verbose`
124+
);
125+
exec(`git branch -d ${tempPublishBranch}`);
126+
exec(`git push origin --delete -d ${tempPublishBranch}`);
127+
}
128+
);
129+
};
130+
131+
const createReleaseRequestBody = {
132+
tag_name: `v${releaseVersion}`,
133+
target_commitish: tempPublishBranch,
134+
name: `v${releaseVersion}`,
135+
body: `v${releaseVersion}`,
136+
draft: false,
137+
prerelease: true
138+
};
139+
console.log('createReleaseRequestBody: ' + JSON.stringify(createReleaseRequestBody, null, 2));
140+
141+
request.post(
142+
{
143+
url: "https://github.com/api/repos/Microsoft/react-native/releases",
144+
headers: {
145+
"User-Agent": userAgent,
146+
Authorization: authHeader
147+
},
148+
json: true,
149+
body: createReleaseRequestBody
150+
},
151+
function(err, res, body) {
152+
if (err) {
153+
console.log(err);
154+
throw new Error("Error fetching release id.");
155+
}
156+
157+
console.log("Created GitHub Release: " + JSON.stringify(body, null, 2));
158+
uploadReleaseAssetUrl = assetUpdateUrl.replace(/{id}/, body.id);
159+
uploadTarBallToRelease();
160+
}
161+
);
162+
}
163+
164+
doPublish();

.ado/publish.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# This file defines the Android PR build steps used during the CI loop
2+
name: $(Date:yyyyMMdd).$(Rev:.r)
3+
4+
trigger: none # will disable CI builds entirely
5+
6+
pr:
7+
- master
8+
9+
jobs:
10+
- job: RNGithubPublish
11+
displayName: React-Native GitHub Publish
12+
pool:
13+
name: OE Standard Pool
14+
demands: ['Agent.OS -equals Windows_NT', 'ANDROID_NDK', 'OnPrem -equals False']
15+
timeoutInMinutes: 90 # how long to run the job before automatically cancelling
16+
cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them
17+
steps:
18+
- checkout: self # self represents the repo where the initial Pipelines YAML file was found
19+
clean: true # whether to fetch clean each time
20+
fetchDepth: 2 # the depth of commits to ask Git to fetch
21+
lfs: false # whether to download Git-LFS files
22+
submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules
23+
persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch
24+
25+
- task: CmdLine@2
26+
displayName: npm install
27+
inputs:
28+
script: npm install
29+
30+
- task: NuGetCommand@2
31+
displayName: NuGet restore
32+
inputs:
33+
command: restore
34+
restoreSolution: ReactAndroid/packages.config
35+
feedsToUse: config
36+
#vstsFeed: # Required when feedsToUse == Select
37+
#includeNuGetOrg: true # Required when feedsToUse == Select
38+
nugetConfigPath: ReactAndroid/NuGet.Config
39+
#externalFeedCredentials: # Optional
40+
#noCache: false
41+
#disableParallelProcessing: false
42+
restoreDirectory: packages/
43+
verbosityRestore: Detailed # Options: quiet, normal, detailed
44+
#packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' # Required when command == Push
45+
#nuGetFeedType: 'internal' # Required when command == Push# Options: internal, external
46+
#publishVstsFeed: # Required when command == Push && NuGetFeedType == Internal
47+
#publishPackageMetadata: true # Optional
48+
#allowPackageConflicts: # Optional
49+
#publishFeedCredentials: # Required when command == Push && NuGetFeedType == External
50+
#verbosityPush: 'Detailed' # Options: quiet, normal, detailed
51+
#packagesToPack: '**/*.csproj' # Required when command == Pack
52+
#configuration: '$(BuildConfiguration)' # Optional
53+
#packDestination: '$(Build.ArtifactStagingDirectory)' # Optional
54+
#versioningScheme: 'off' # Options: off, byPrereleaseNumber, byEnvVar, byBuildNumber
55+
#includeReferencedProjects: false # Optional
56+
#versionEnvVar: # Required when versioningScheme == ByEnvVar
57+
#majorVersion: '1' # Required when versioningScheme == ByPrereleaseNumber
58+
#minorVersion: '0' # Required when versioningScheme == ByPrereleaseNumber
59+
#patchVersion: '0' # Required when versioningScheme == ByPrereleaseNumber
60+
#packTimezone: 'utc' # Required when versioningScheme == ByPrereleaseNumber# Options: utc, local
61+
#includeSymbols: false # Optional
62+
#toolPackage: # Optional
63+
#buildProperties: # Optional
64+
#basePath: # Optional
65+
#verbosityPack: 'Detailed' # Options: quiet, normal, detailed
66+
#arguments: # Required when command == Custom
67+
68+
- task: CmdLine@1
69+
displayName: 'npm auth'
70+
inputs:
71+
filename: npm
72+
arguments: 'config set $(publishnpmfeed)/registry/:_authToken $(npmTokenOffice)'
73+
74+
- task: CmdLine@2
75+
displayName: Do Publish
76+
inputs:
77+
script: node .ado/publish.js
78+
79+
- task: CmdLine@1
80+
displayName: 'npm unauth'
81+
inputs:
82+
filename: npm
83+
arguments: 'config set $(publishnpmfeed)/registry/:_authToken XXXXX'
84+

CHANGELOG.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
{
2-
"name": "@microsoft/react-native",
2+
"name": "react-native",
33
"entries": [
4+
{
5+
"version": "0.0.2",
6+
"tag": "react-native_v0.0.2",
7+
"date": "Wed, 06 Mar 2019 05:43:46 GMT",
8+
"comments": {
9+
"patch": [
10+
{
11+
"comment": "Rename microsoft react-native",
12+
"author": "Andrew Coates (REDMOND) <[email protected]>",
13+
"commit": "0c0c2e0fa8762dda21b96ec3031a90450a45607f"
14+
}
15+
]
16+
}
17+
},
418
{
519
"version": "0.3.9",
620
"tag": "@microsoft/react-native_v0.3.9",

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1-
# Change Log - @microsoft/react-native
1+
# Change Log - react-native
22

3-
This log was last generated on Tue, 05 Mar 2019 20:54:55 GMT and should not be manually modified.
3+
This log was last generated on Wed, 06 Mar 2019 05:43:46 GMT and should not be manually modified.
4+
5+
## 0.0.2
6+
Wed, 06 Mar 2019 05:43:46 GMT
7+
8+
### Patches
9+
10+
- Rename microsoft react-native
411

512
## 0.3.9
613
Tue, 05 Mar 2019 20:54:55 GMT

Libraries/Components/TextInput/TextInputState.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ function focusTextInput(textFieldID: ?number) {
4545
UIManager.AndroidTextInput.Commands.focusTextInput,
4646
null,
4747
);
48+
} else if (Platform.OS === 'win32') {
49+
UIManager.dispatchViewManagerCommand(
50+
textFieldID,
51+
UIManager.RCTView.Commands.focus,
52+
null,
53+
);
4854
}
4955
}
5056
}
@@ -65,6 +71,12 @@ function blurTextInput(textFieldID: ?number) {
6571
UIManager.AndroidTextInput.Commands.blurTextInput,
6672
null,
6773
);
74+
} else if (Platform.OS === 'win32') {
75+
UIManager.dispatchViewManagerCommand(
76+
textFieldID,
77+
UIManager.RCTView.Commands.blur,
78+
null,
79+
);
6880
}
6981
}
7082
}

Libraries/Components/Touchable/TouchableBounce.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ const TouchableBounce = ((createReactClass({
164164
accessibilityRole={this.props.accessibilityRole}
165165
accessibilityStates={this.props.accessibilityStates}
166166
onAccessibilityTap={this.props.onAccessibilityTap} // TODO(OSS Candidate ISS#2710739)
167+
acceptsKeyboardFocus={(this.props.acceptsKeyboardFocus === undefined || this.props.acceptsKeyboardFocus) && !this.props.disabled} // TODO(macOS/win ISS#2323203)
168+
enableFocusRing={(this.props.enableFocusRing === undefined || this.props.enableFocusRing) && !this.props.disabled} // TODO(macOS/win ISS#2323203)
169+
tabIndex={this.props.tabIndex} // TODO(win ISS#2323203)
167170
nativeID={this.props.nativeID}
168171
testID={this.props.testID}
169172
hitSlop={this.props.hitSlop}
@@ -175,6 +178,7 @@ const TouchableBounce = ((createReactClass({
175178
onResponderMove={this.touchableHandleResponderMove}
176179
onResponderRelease={this.touchableHandleResponderRelease}
177180
onResponderTerminate={this.touchableHandleResponderTerminate}
181+
tooltip={this.props.tooltip} // TODO(macOS/win ISS#2323203)
178182
clickable={this.props.clickable !== false && this.props.onPress !== undefined && !this.props.disabled} // TODO(android ISS)
179183
onClick={this.touchableHandlePress} // TODO(android ISS)
180184
onMouseEnter={this.props.onMouseEnter} // [TODO(macOS ISS#2323203)

Libraries/Components/Touchable/TouchableHighlight.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,8 +352,9 @@ const TouchableHighlight = ((createReactClass({
352352
accessibilityRole={this.props.accessibilityRole}
353353
accessibilityStates={this.props.accessibilityStates}
354354
onAccessibilityTap={this.props.onAccessibilityTap} // TODO(OSS Candidate ISS#2710739)
355-
acceptsKeyboardFocus={(this.props.acceptsKeyboardFocus === undefined || this.props.acceptsKeyboardFocus) && !this.props.disabled} // TODO(macOS ISS#2323203)
356-
enableFocusRing={(this.props.enableFocusRing === undefined || this.props.enableFocusRing) && !this.props.disabled} // TODO(macOS ISS#2323203)
355+
acceptsKeyboardFocus={(this.props.acceptsKeyboardFocus === undefined || this.props.acceptsKeyboardFocus) && !this.props.disabled} // TODO(macOS/win ISS#2323203)
356+
enableFocusRing={(this.props.enableFocusRing === undefined || this.props.enableFocusRing) && !this.props.disabled} // TODO(macOS/win ISS#2323203)
357+
tabIndex={this.props.tabIndex} // TODO(win ISS#2323203)
357358
style={StyleSheet.compose(
358359
this.props.style,
359360
this.state.extraUnderlayStyle,
@@ -371,14 +372,15 @@ const TouchableHighlight = ((createReactClass({
371372
onResponderMove={this.touchableHandleResponderMove}
372373
onResponderRelease={this.touchableHandleResponderRelease}
373374
onResponderTerminate={this.touchableHandleResponderTerminate}
375+
tooltip={this.props.tooltip} // TODO(macOS/win ISS#2323203)
374376
clickable={this.props.clickable !== false && this.props.onPress !== undefined} // TODO(android ISS)
375377
onClick={this.touchableHandlePress} // TODO(android ISS)
376-
onMouseEnter={this.props.onMouseEnter} // [TODO(macOS ISS#2323203)
378+
onMouseEnter={this.props.onMouseEnter} // [TODO(macOS/win ISS#2323203)
377379
onMouseLeave={this.props.onMouseLeave}
378380
onDragEnter={this.props.onDragEnter}
379381
onDragLeave={this.props.onDragLeave}
380382
onDrop={this.props.onDrop}
381-
draggedTypes={this.props.draggedTypes} // ]TODO(macOS ISS#2323203)
383+
draggedTypes={this.props.draggedTypes} // ]TODO(macOS/win ISS#2323203)
382384
nativeID={this.props.nativeID}
383385
testID={this.props.testID}>
384386
{React.cloneElement(child, {

Libraries/Components/Touchable/TouchableOpacity.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ const TouchableOpacity = ((createReactClass({
262262
onAccessibilityTap={this.props.onAccessibilityTap} // TODO(OSS Candidate ISS#2710739)
263263
acceptsKeyboardFocus={(this.props.acceptsKeyboardFocus === undefined || this.props.acceptsKeyboardFocus) && !this.props.disabled} // TODO(macOS ISS#2323203)
264264
enableFocusRing={(this.props.enableFocusRing === undefined || this.props.enableFocusRing) && !this.props.disabled} // TODO(macOS ISS#2323203)
265+
tabIndex={this.props.tabIndex} // TODO(win ISS#2323203)
265266
style={[this.props.style, {opacity: this.state.anim}]}
266267
nativeID={this.props.nativeID}
267268
testID={this.props.testID}
@@ -278,6 +279,7 @@ const TouchableOpacity = ((createReactClass({
278279
onResponderMove={this.touchableHandleResponderMove}
279280
onResponderRelease={this.touchableHandleResponderRelease}
280281
onResponderTerminate={this.touchableHandleResponderTerminate}
282+
tooltip={this.props.tooltip} // TODO(macOS/win ISS#2323203)
281283
clickable={this.props.clickable !== false && this.props.onPress !== undefined} // TODO(android ISS)
282284
onClick={this.touchableHandlePress} // TODO(android ISS)
283285
onMouseEnter={this.props.onMouseEnter} // [TODO(macOS ISS#2323203)

0 commit comments

Comments
 (0)