From 3940fab732d1eafe798b1af8d869d6eeae5cb286 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Mon, 31 Jul 2017 20:22:40 +0200 Subject: [PATCH] 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. --- scripts/deploy/publish-build-artifacts.sh | 12 ++++-------- src/cdk/package.json | 2 +- src/lib/package.json | 2 +- tools/package-tools/version-placeholders.ts | 2 +- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/scripts/deploy/publish-build-artifacts.sh b/scripts/deploy/publish-build-artifacts.sh index e689c991837..c6151f259eb 100755 --- a/scripts/deploy/publish-build-artifacts.sh +++ b/scripts/deploy/publish-build-artifacts.sh @@ -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}" diff --git a/src/cdk/package.json b/src/cdk/package.json index a8a07fbbf3e..80d474b2372 100644 --- a/src/cdk/package.json +++ b/src/cdk/package.json @@ -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", diff --git a/src/lib/package.json b/src/lib/package.json index f31977574f2..b6ea8b0c0f1 100644 --- a/src/lib/package.json +++ b/src/lib/package.json @@ -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" }, diff --git a/tools/package-tools/version-placeholders.ts b/tools/package-tools/version-placeholders.ts index 61d81aa6000..ba50e7ef918 100644 --- a/tools/package-tools/version-placeholders.ts +++ b/tools/package-tools/version-placeholders.ts @@ -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