Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .ado/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,14 @@ jobs:
inputs:
PathtoPublish: '$(Build.StagingDirectory)\final'
ArtifactName: 'ReactNative-Final'

- task: CmdLine@2
displayName: "Prepare package.json for npm publishing as react-native-macos"
inputs:
script: node .ado/renamePackageToMac.js

- task: Npm@1
displayName: "Publish react-native-macos to npmjs.org"
inputs:
command: 'publish'
publishEndpoint: 'npmjs'
3 changes: 3 additions & 0 deletions .ado/renamePackageToMac.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @ts-check
const {updatePackageName} = require('./versionUtils');
updatePackageName('react-native-macos');
10 changes: 9 additions & 1 deletion .ado/versionUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,17 @@ function updateVersionsInFiles() {
return {releaseVersion, branchVersionSuffix};
}

function updatePackageName(name) {
let pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf8"));
pkgJson.name = name;
fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
console.log(`Updating package.json to name ${name}`);
}

module.exports = {
gatherVersionInfo,
publishBranchName,
pkgJsonPath,
updateVersionsInFiles
updateVersionsInFiles,
updatePackageName
}