Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update @pnpm/meta-updater #5360

Merged
merged 1 commit into from Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/lemon-adults-grow.md
@@ -0,0 +1,5 @@
---
"@pnpm-private/updater": minor
---

Changes in meta-updater scripts following @pnpm/meta-updater update
18 changes: 12 additions & 6 deletions .meta-updater/src/index.ts
Expand Up @@ -2,6 +2,7 @@ import fs from 'fs'
import path from 'path'
import { readWantedLockfile, Lockfile } from '@pnpm/lockfile-file'
import { ProjectManifest } from '@pnpm/types'
import { createUpdateOptions, FormatPluginFnOptions } from '@pnpm/meta-updater'
import isSubdir from 'is-subdir'
import loadJsonFile from 'load-json-file'
import normalizePath from 'normalize-path'
Expand All @@ -20,8 +21,11 @@ export default async (workspaceDir: string) => {
if (lockfile == null) {
throw new Error('no lockfile found')
}
return {
'package.json': (manifest: ProjectManifest & { keywords?: string[] }, dir: string) => {
return createUpdateOptions({
'package.json': (manifest: ProjectManifest & { keywords?: string[] } | null, { dir }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extension .json currently resolves to object | null. Might try to check if it is possible to have special case for package.json where it will be ProjectManifest (w/o | null).

dir is now part of FormatPluginFnOptions

if (!manifest) {
return manifest;
}
if (manifest.name === 'monorepo-root') {
manifest.scripts!['release'] = `pnpm --filter=@pnpm/exe publish --tag=${NEXT_TAG} --access=public && pnpm publish --filter=!pnpm --filter=!@pnpm/exe --access=public && pnpm publish --filter=pnpm --tag=${NEXT_TAG} --access=public`
return manifest
Expand Down Expand Up @@ -60,17 +64,19 @@ export default async (workspaceDir: string) => {
lockfile,
workspaceDir,
}),
}
})
}

async function updateTSConfig (
context: {
lockfile: Lockfile
workspaceDir: string
},
tsConfig: object,
dir: string,
manifest: ProjectManifest
tsConfig: object | null,
{
dir,
manifest,
}: FormatPluginFnOptions
) {
if (tsConfig == null) return tsConfig
if (manifest.name === '@pnpm/tsconfig') return tsConfig
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -38,7 +38,7 @@
"@commitlint/config-conventional": "^17.1.0",
"@commitlint/prompt-cli": "^17.1.2",
"@pnpm/eslint-config": "workspace:*",
"@pnpm/meta-updater": "0.0.6",
"@pnpm/meta-updater": "0.2.0",
"@pnpm/registry-mock": "3.0.0-3",
"@pnpm/tsconfig": "workspace:*",
"@types/jest": "^28.1.8",
Expand Down