Skip to content

Commit 50a4113

Browse files
authored
Fix react-native-macos package name and version (#333)
* Update scripts to publish react-native-macos-init * Clean up merge markers * Restored ios:macos RNTester parity except for InputAccessoryView. * Revert "Restored ios:macos RNTester parity except for InputAccessoryView." This reverts commit 5a67ae0. * Fix package name and version scheme * Actually rename the package. Rename arg from minorVersionPrefix to patchVersionPrefix because that's what it actually is. * Rename package before install * Fix metro bundler. * Fix Jest tests. * Try CmdLine@2 instead of script * Rename repo for jest tests
1 parent af3eb35 commit 50a4113

12 files changed

+214
-205
lines changed

.ado/android-pr.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ jobs:
3535
inputs:
3636
versionSpec: '>=4.6.4'
3737

38+
- task: CmdLine@2
39+
displayName: "Rename package to react-native"
40+
inputs:
41+
script: node .ado/renamePackageForOffice.js
42+
3843
- task: CmdLine@2
3944
displayName: npm install
4045
inputs:

.ado/bumpFileVersions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// @ts-check
22
const {updateVersionsInFiles} = require('./versionUtils');
3-
updateVersionsInFiles();
3+
updateVersionsInFiles('');

.ado/bumpOfficeFileVersions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// @ts-check
2+
const {updateVersionsInFiles} = require('./versionUtils');
3+
updateVersionsInFiles('.0-microsoft');

.ado/publish.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ jobs:
3838
inputs:
3939
script: node .ado/bumpFileVersions.js
4040

41-
- task: CmdLine@2
42-
displayName: "Prepare package.json for npm publishing as react-native-macos"
43-
inputs:
44-
script: node .ado/renamePackageToMac.js
45-
4641
- task: Npm@1
4742
displayName: "Publish react-native-macos to npmjs.org"
4843
inputs:
@@ -109,6 +104,11 @@ jobs:
109104
inputs:
110105
versionSpec: '>=4.6.4'
111106

107+
- task: CmdLine@2
108+
displayName: "Rename package to react-native"
109+
inputs:
110+
script: node .ado/renamePackageForOffice.js
111+
112112
- task: CmdLine@2
113113
displayName: npm install
114114
inputs:
@@ -117,7 +117,7 @@ jobs:
117117
- task: CmdLine@2
118118
displayName: Bump package version
119119
inputs:
120-
script: node .ado/bumpFileVersions.js
120+
script: node .ado/bumpOfficeFileVersions.js
121121

122122
- task: NuGetCommand@2
123123
displayName: NuGet restore
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
// @ts-check
22
const {updatePackageName} = require('./versionUtils');
3-
updatePackageName('react-native-macos');
3+
updatePackageName('react-native');

.ado/templates/apple-job-javascript.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@ steps:
1414
parameters:
1515
apply_office_patches: $(apply_office_patches)
1616

17+
- task: CmdLine@2
18+
displayName: "Rename package to react-native"
19+
inputs:
20+
script: node .ado/renamePackageForOffice.js
21+
1722
- script: 'yarn install'
1823
displayName: 'yarn install'
1924

20-
- script: 'yarn test-ci'
21-
displayName: 'yarn test-ci'
22-
25+
- task: CmdLine@2
26+
displayName: yarn test-ci
27+
inputs:
28+
script: 'yarn test-ci'
29+
2330
- script: 'yarn flow-check-ios'
2431
displayName: 'yarn flow-check-ios'
2532

.ado/templates/react-native-macos-init.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ steps:
6565
inputs:
6666
script: node .ado/bumpFileVersions.js
6767

68-
- task: CmdLine@2
69-
displayName: "Prepare package.json for npm publishing as react-native-macos"
70-
inputs:
71-
script: node .ado/renamePackageToMac.js
72-
7368
- script: |
7469
npm publish --registry http://localhost:4873
7570
displayName: Publish react-native-macos to verdaccio

.ado/versionUtils.js

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,17 @@ function gatherVersionInfo() {
1717
return {pkgJson, releaseVersion, branchVersionSuffix};
1818
}
1919

20-
function updateVersionsInFiles() {
20+
function updateVersionsInFiles(patchVersionPrefix) {
2121

2222
let {pkgJson, releaseVersion, branchVersionSuffix} = gatherVersionInfo();
2323

24-
const versionStringRegEx = new RegExp(`(.*-microsoft)(-${publishBranchName})?\\.([0-9]*)`);
24+
const versionStringRegEx = new RegExp(`(.*)(-${publishBranchName})?\\.([0-9]*)`);
2525
const versionGroups = versionStringRegEx.exec(releaseVersion);
2626
if (versionGroups) {
27-
releaseVersion = versionGroups[1] + branchVersionSuffix + '.' + (parseInt(versionGroups[3]) + 1);
27+
releaseVersion = versionGroups[1] + patchVersionPrefix + branchVersionSuffix + '.' + (parseInt(versionGroups[3]) + 1);
2828
} else {
29-
if (releaseVersion.indexOf("-") === -1) {
30-
releaseVersion = releaseVersion + `-microsoft${branchVersionSuffix}.0`;
31-
} else {
32-
console.log("Invalid version to publish");
33-
process.exit(1);
34-
}
29+
console.log("Invalid version to publish");
30+
process.exit(1);
3531
}
3632

3733
pkgJson.version = releaseVersion;

0 commit comments

Comments
 (0)