feat: init command create file add packageManager field (#9069)

close #9068

---------

Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
btea
2025-02-11 18:30:11 +08:00
committed by GitHub
parent 4304d8e3e7
commit 483384af68
5 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
---
"@pnpm/plugin-commands-init": minor
"pnpm": patch
---
`pnpm init` command adds a `packageManager` field with the current version of pnpm CLI [#9069](https://github.com/pnpm/pnpm/pull/9069).

View File

@@ -37,6 +37,7 @@
"load-json-file": "catalog:"
},
"dependencies": {
"@pnpm/cli-meta": "workspace:*",
"@pnpm/cli-utils": "workspace:*",
"@pnpm/config": "workspace:*",
"@pnpm/error": "workspace:*",

View File

@@ -1,6 +1,7 @@
import fs from 'fs'
import path from 'path'
import { docsUrl } from '@pnpm/cli-utils'
import { packageManager } from '@pnpm/cli-meta'
import { type CliOptions, type UniversalOptions } from '@pnpm/config'
import { PnpmError } from '@pnpm/error'
import { writeProjectManifest } from '@pnpm/write-project-manifest'
@@ -45,6 +46,7 @@ export async function handler (
version: '1.0.0',
description: '',
main: 'index.js',
packageManager: `pnpm@${packageManager.version}`,
scripts: {
test: 'echo "Error: no test specified" && exit 1',
},

View File

@@ -15,6 +15,9 @@
{
"path": "../../__utils__/test-fixtures"
},
{
"path": "../../cli/cli-meta"
},
{
"path": "../../cli/cli-utils"
},

3
pnpm-lock.yaml generated
View File

@@ -3940,6 +3940,9 @@ importers:
packages/plugin-commands-init:
dependencies:
'@pnpm/cli-meta':
specifier: workspace:*
version: link:../../cli/cli-meta
'@pnpm/cli-utils':
specifier: workspace:*
version: link:../../cli/cli-utils