Skip to content

Commit

Permalink
Do not consider 10.0.0 as a version marker...
Browse files Browse the repository at this point in the history
  • Loading branch information
Elad Ben-Israel committed Feb 26, 2020
1 parent 9d4fe58 commit b356b47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions scripts/align-version.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ for (const file of process.argv.splice(2)) {

pkg.version = repoVersion;

processSection(pkg.dependencies || { });
processSection(pkg.devDependencies || { });
processSection(pkg.peerDependencies || { });
processSection(pkg.dependencies || { }, file);
processSection(pkg.devDependencies || { }, file);
processSection(pkg.peerDependencies || { }, file);

console.error(`${file} => ${repoVersion}`);
fs.writeFileSync(file, JSON.stringify(pkg, undefined, 2));
}

function processSection(section) {
function processSection(section, file) {
for (const [ name, version ] of Object.entries(section)) {
if (version.includes(marker)) {
if (version === marker || version === '^' + marker) {
section[name] = version.replace(marker, repoVersion);
}
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/align-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ${scriptdir}/align-version.js ${files}

# validation
marker=$(node -p "require('./scripts/get-version-marker')")
if find . -name package.json | grep -v node_modules | xargs grep "${marker}"; then
if find . -name package.json | grep -v node_modules | xargs grep "[^0-9]${marker}"; then
echo "ERROR: unexpected version marker ${marker} in a package.json file"
exit 1
fi

0 comments on commit b356b47

Please sign in to comment.