-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(infrastructure): restore the fix to bump peer dependencies
- Loading branch information
Showing
4 changed files
with
42 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { readdirSync, readFileSync, writeFileSync } from 'node:fs' | ||
import { join } from 'node:path' | ||
|
||
const files = {} | ||
const packages = {} | ||
const versions = {} | ||
|
||
readdirSync('./packages', { withFileTypes: true }) | ||
.filter(dirent => dirent.isDirectory()) | ||
.map(dirent => join('packages', dirent.name, 'package.json')) | ||
.forEach(file => { | ||
const pkg = JSON.parse(readFileSync(file, 'utf-8')) | ||
files[pkg.name] = file | ||
packages[pkg.name] = pkg | ||
versions[pkg.name] = pkg.version | ||
}) | ||
|
||
for (const [pkgName, pkg] of Object.entries(packages)) { | ||
for (const [peerDep, currentVersion] of Object.entries(pkg.peerDependencies || {})) { | ||
if (!peerDep.startsWith('@nivo/')) continue | ||
|
||
if (!(peerDep in versions)) { | ||
throw new Error(`Unable to find ${peerDep} in packages`) | ||
} | ||
|
||
const version = versions[peerDep] | ||
pkg.peerDependencies[peerDep] = version | ||
|
||
console.log( | ||
`Bumping peerDependency ${peerDep} in ${pkgName} to ${version} (was ${currentVersion})` | ||
) | ||
} | ||
|
||
writeFileSync( | ||
files[pkgName], | ||
JSON.stringify(pkg, null, 4) + '\n', | ||
{ encoding: 'utf-8' } | ||
) | ||
} |
b287651
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nivo – ./
nivo-plouc.vercel.app
nivo-git-master-plouc.vercel.app
nivo.vercel.app
www.nivo.rocks
nivo.rocks