Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ const main = defineCommand({
if (!noDefaultTemplate && templates.length === 0) {
const project = createDefaultTemplate(
Object.fromEntries(deps.entries()),
isCommentWithDev,
);

for (const filePath of Object.keys(project)) {
Expand Down
7 changes: 4 additions & 3 deletions packages/cli/template.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const createDefaultTemplate = (
dependencies: Record<string, string>,
isCommentWithDev: boolean,
) => ({
"index.js": "",
"README.md": `
Expand All @@ -17,7 +18,7 @@ ${Object.values(dependencies)
.map(
(url) => `
\`\`\`sh
npm i ${url}
npm i ${url + (isCommentWithDev ? " -D" : "")}
\`\`\`
`,
)
Expand All @@ -28,7 +29,7 @@ npm i ${url}
To use this feature as a maintainer, you can run the following command:

\`\`\`sh
npx pkg-pr-new publish './packages/A' --template './examples/*'
npx pkg-pr-new publish './packages/A' --template './examples/*'${isCommentWithDev ? " --commentWithDev" : ""}
\`\`\`

## Benefits
Expand All @@ -43,7 +44,7 @@ npx pkg-pr-new publish './packages/A' --template './examples/*'
version: "1.0.0",
description: "generated by pkg.pr.new",
main: "index.js",
dependencies,
[isCommentWithDev ? "devDependencies" : "dependencies"]: dependencies,
keywords: [],
author: "pkg.pr.new",
license: "ISC",
Expand Down
Loading