build: use version placeholder in package configs (#6112)

Recently the version placeholders had been replaced with hardcoded versions because it was necessary to be able to release the CDK.

But now the version placeholders are replaced in every file and therefore they can be used instead of the hardcoded values.
This commit is contained in:
Paul Gschwendtner
2017-07-31 20:22:40 +02:00
committed by tinayuangao
parent 88772d46f5
commit 3940fab732
4 changed files with 7 additions and 11 deletions
+4 -8
View File
@@ -59,14 +59,10 @@ publishPackage() {
# Create the build commit and push the changes to the repository.
cd ${repoDir}
# Update the package.json version to include the current commit SHA.
# Normally this "sed" call would just replace the version placeholder, but the version in the
# package.json file is already replaced by the release task of the current package.
sed -i "s/${buildVersion}/${buildVersion}-${commitSha}/g" package.json
# For build artifacts the different Angular packages that refer to the 0.0.0-PLACEHOLDER should
# be replaced with the Github builds that are published at the same time.
sed -i "s/0.0.0-PLACEHOLDER/${buildVersion}-${commitSha}/g" package.json
# Replace the version in every file recursively with a more specific version that also includes
# the SHA of the current build job. Normally this "sed" call would just replace the version
# placeholder, but the version placeholders have been replaced by the release task already.
sed -i "s/${buildVersion}/${buildVersion}-${commitSha}/g" $(find . -type f)
# Prepare Git for pushing the artifacts to the repository.
git config user.name "${commitAuthorName}"
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@angular/cdk",
"version": "2.0.0-beta.8",
"version": "0.0.0-PLACEHOLDER",
"description": "Angular Material Component Development Kit",
"main": "./bundles/cdk.umd.js",
"module": "./@angular/cdk.es5.js",
+1 -1
View File
@@ -22,7 +22,7 @@
},
"homepage": "https://github.com/angular/material2#readme",
"peerDependencies": {
"@angular/cdk": "2.0.0-beta.8",
"@angular/cdk": "0.0.0-PLACEHOLDER",
"@angular/core": "^4.0.0",
"@angular/common": "^4.0.0"
},
+1 -1
View File
@@ -6,7 +6,7 @@ import {spawnSync} from 'child_process';
const versionPlaceholderText = '0.0.0-PLACEHOLDER';
/** RegExp that matches version placeholders inside of a file. */
const versionPlaceholderRegex = new RegExp(versionPlaceholderText);
const versionPlaceholderRegex = new RegExp(versionPlaceholderText, 'g');
/**
* Walks through every file in a directory and replaces the version placeholders with the current