Skip to content

Commit 0569058

Browse files
authored
Change publish step to publish react-native-macos npm package. (#228)
1 parent 7a4f812 commit 0569058

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

.ado/publish.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,14 @@ jobs:
139139
inputs:
140140
PathtoPublish: '$(Build.StagingDirectory)\final'
141141
ArtifactName: 'ReactNative-Final'
142+
143+
- task: CmdLine@2
144+
displayName: "Prepare package.json for npm publishing as react-native-macos"
145+
inputs:
146+
script: node .ado/renamePackageToMac.js
147+
148+
- task: Npm@1
149+
displayName: "Publish react-native-macos to npmjs.org"
150+
inputs:
151+
command: 'publish'
152+
publishEndpoint: 'npmjs'

.ado/renamePackageToMac.js

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

.ado/versionUtils.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,17 @@ function updateVersionsInFiles() {
3737
return {releaseVersion, branchVersionSuffix};
3838
}
3939

40+
function updatePackageName(name) {
41+
let pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
42+
pkgJson.name = name;
43+
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
44+
console.log(`Updating package.json to name ${name}`);
45+
}
46+
4047
module.exports = {
4148
gatherVersionInfo,
4249
publishBranchName,
4350
pkgJsonPath,
44-
updateVersionsInFiles
51+
updateVersionsInFiles,
52+
updatePackageName
4553
}

0 commit comments

Comments
 (0)