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
18 changes: 14 additions & 4 deletions packages/global/snap-tests/new-monorepo/snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ qwik-ts qwik
vite new --lib packages/my-lib


> cd hello-vite-plus && ls # check files
> cd hello-vite-plus && ls -a . # check files
.
..
.gitignore
.npmrc
README.md
apps
package.json
Expand All @@ -59,7 +63,9 @@ vite.config.ts
vite run dev


> cd hello-vite-plus && ls apps
> cd hello-vite-plus && ls -a apps
.
..
my-app
website

Expand All @@ -76,7 +82,9 @@ website
vite run dev


> cd hello-vite-plus && ls packages
> cd hello-vite-plus && ls -a packages
.
..
my-lib

> cd hello-vite-plus && vp new --lib tools/my-tool --template default # add lib new not exists tools directory
Expand All @@ -92,5 +100,7 @@ my-lib
vite run dev


> cd hello-vite-plus && ls tools
> cd hello-vite-plus && ls -a tools
.
..
my-tool
8 changes: 4 additions & 4 deletions packages/global/snap-tests/new-monorepo/steps.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"commands": [
"vp new -h # show help",
"vp new --template vanilla-ts --monorepo --pm pnpm --git false --overwrite hello-vite-plus # create monorepo",
"cd hello-vite-plus && ls # check files",
"cd hello-vite-plus && ls -a . # check files",
"cd hello-vite-plus && vp new --app --template vanilla-ts apps/my-app # add app",
"cd hello-vite-plus && ls apps",
"cd hello-vite-plus && ls -a apps",
"cd hello-vite-plus && vp new --lib packages/my-lib --template react # add lib",
"cd hello-vite-plus && ls packages",
"cd hello-vite-plus && ls -a packages",
"cd hello-vite-plus && vp new --lib tools/my-tool --template default # add lib new not exists tools directory",
"cd hello-vite-plus && ls tools"
"cd hello-vite-plus && ls -a tools"
]
}
6 changes: 5 additions & 1 deletion packages/global/snap-tests/new-singlerepo/snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
vite run dev


> cd hello-vite-plus && ls # check files
> cd hello-vite-plus && ls -a . # check files
.
..
.gitignore
.npmrc
index.html
package.json
public
Expand Down
2 changes: 1 addition & 1 deletion packages/global/snap-tests/new-singlerepo/steps.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commands": [
"vp new --template vanilla-ts --monorepo false --pm pnpm --git false --overwrite hello-vite-plus # create singlerepo",
"cd hello-vite-plus && ls # check files"
"cd hello-vite-plus && ls -a . # check files"
]
}
4 changes: 3 additions & 1 deletion packages/global/src/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ async function initMonorepo(rootProjectDir: string, packageManager: string) {
'templates/monorepo',
);
copyDir(templateDir, rootProjectDir);
renameFiles(rootProjectDir);
if (packageManager === 'pnpm') {
// remove workspaces field
editFile(path.join(rootProjectDir, 'package.json'), (content) => {
Expand Down Expand Up @@ -784,11 +785,12 @@ async function initMonorepo(rootProjectDir: string, packageManager: string) {
}

await setPackageManager(rootProjectDir, packageManager);
renameFiles(rootProjectDir);
}

const RENAME_FILES: Record<string, string> = {
_gitignore: '.gitignore',
_npmrc: '.npmrc',
'_yarnrc.yml': '.yarnrc.yml',
};

function renameFiles(projectDir: string) {
Expand Down
Loading