chore(scripts): add getPackageRegistryVersions script
This commit is contained in:
@@ -8,9 +8,13 @@ const __dirname = path.dirname(__filename)
|
|||||||
const packagesDir = path.resolve(__dirname, '../../packages')
|
const packagesDir = path.resolve(__dirname, '../../packages')
|
||||||
|
|
||||||
export type PackageDetails = {
|
export type PackageDetails = {
|
||||||
|
/** Name in package.json / npm registry */
|
||||||
name: string
|
name: string
|
||||||
|
/** Full path to package */
|
||||||
packagePath: string
|
packagePath: string
|
||||||
|
/** Short name is the directory name */
|
||||||
shortName: string
|
shortName: string
|
||||||
|
/** Version in package.json */
|
||||||
version: string
|
version: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
46
scripts/lib/getPackageRegistryVersions.ts
Normal file
46
scripts/lib/getPackageRegistryVersions.ts
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import chalk from 'chalk'
|
||||||
|
|
||||||
|
import { getPackageDetails } from './getPackageDetails.js'
|
||||||
|
|
||||||
|
const packages = [
|
||||||
|
'payload',
|
||||||
|
'translations',
|
||||||
|
'ui',
|
||||||
|
'next',
|
||||||
|
'graphql',
|
||||||
|
'db-mongodb',
|
||||||
|
'db-postgres',
|
||||||
|
'richtext-slate',
|
||||||
|
'richtext-lexical',
|
||||||
|
|
||||||
|
'create-payload-app',
|
||||||
|
|
||||||
|
// Plugins
|
||||||
|
'plugin-cloud',
|
||||||
|
'plugin-cloud-storage',
|
||||||
|
'plugin-form-builder',
|
||||||
|
'plugin-nested-docs',
|
||||||
|
'plugin-redirects',
|
||||||
|
'plugin-search',
|
||||||
|
'plugin-seo',
|
||||||
|
// 'plugin-stripe',
|
||||||
|
// 'plugin-sentry',
|
||||||
|
]
|
||||||
|
|
||||||
|
export const getPackageRegistryVersions = async (): Promise<void> => {
|
||||||
|
const packageDetails = await getPackageDetails(packages)
|
||||||
|
|
||||||
|
await Promise.all(
|
||||||
|
packageDetails.map(async (pkg) => {
|
||||||
|
// Get published version from npm
|
||||||
|
const json = await fetch(`https://registry.npmjs.org/${pkg.name}`).then((res) => res.json())
|
||||||
|
const { latest, beta } = json['dist-tags']
|
||||||
|
const msg = `${chalk.bold(pkg.name.padEnd(32))} latest: ${latest?.padEnd(16)} beta: ${beta?.padEnd(16)}`
|
||||||
|
console.log(msg)
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (import.meta.url === new URL(import.meta.url).href) {
|
||||||
|
await getPackageRegistryVersions()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user