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
33 changes: 33 additions & 0 deletions packages/global/snap-tests/new-monorepo/snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,39 @@ pnpm-workspace.yaml
tsconfig.json
vite.config.ts

> cd hello-vite-plus && cat package.json # check package.json
{
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"ready": "vite fmt && vite run lint && vite run test && vite run prepublishOnly",
"dev": "vite run website#dev",
"lint": "vite lint --type-aware",
"test": "vite test --passWithNoTests",
"prepublishOnly": "vite run -r build"
},
"devDependencies": {
"vite": "catalog:"
},
"pnpm": {
"overrides": {
"vite": "catalog:",
"tsdown": "catalog:"
},
"peerDependencyRules": {
"allowAny": [
"vite"
]
}
},
"resolutions": {
"vite": "catalog:",
"tsdown": "catalog:"
},
"packageManager": "pnpm@<semver>"
}

> cd hello-vite-plus && vp new --app --template vanilla-ts apps/my-app # add app
┌ Vite+ - The Unified Toolchain for the Web
Expand Down
1 change: 1 addition & 0 deletions packages/global/snap-tests/new-monorepo/steps.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"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 -a . # check files",
"cd hello-vite-plus && cat package.json # check package.json",
"cd hello-vite-plus && vp new --app --template vanilla-ts apps/my-app # add app",
"cd hello-vite-plus && ls -a apps",
"cd hello-vite-plus && vp new --lib packages/my-lib --template react # add lib",
Expand Down
29 changes: 29 additions & 0 deletions packages/global/snap-tests/new-singlerepo/snap.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,32 @@ package.json
public
src
tsconfig.json

> cd hello-vite-plus && cat package.json # check package.json
{
"name": "hello-vite-plus",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "tsc && vite build",
"preview": "vite preview",
"ready": "vite fmt && vite lint --type-aware && vite run build && vite test --passWithNoTests"
},
"devDependencies": {
"typescript": "~5.8.3",
"vite": "npm:@voidzero-dev/vite-plus@latest"
},
"pnpm": {
"overrides": {
"vite": "npm:@voidzero-dev/vite-plus@latest"
},
"peerDependencyRules": {
"allowAny": [
"vite"
]
}
},
"packageManager": "pnpm@<semver>"
}
3 changes: 2 additions & 1 deletion packages/global/snap-tests/new-singlerepo/steps.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"commands": [
"vp new --template vanilla-ts --monorepo false --pm pnpm --git false --overwrite hello-vite-plus # create singlerepo",
"cd hello-vite-plus && ls -a . # check files"
"cd hello-vite-plus && ls -a . # check files",
"cd hello-vite-plus && cat package.json # check package.json"
]
}
2 changes: 1 addition & 1 deletion packages/global/src/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ async function fixPackageJsonForVitePlus(projectDir: string, selectedPackageMana
}
// try to add ready script
if (!pkg.scripts?.ready) {
pkg.scripts.ready = 'vite lint --type-aware && vite run build && vite test --passWithNoTests';
pkg.scripts.ready = 'vite fmt && vite lint --type-aware && vite run build && vite test --passWithNoTests';
}
// fix empty pkg.name
if (!pkg.name) {
Expand Down
2 changes: 1 addition & 1 deletion packages/global/templates/monorepo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"tools/*"
],
"scripts": {
"ready": "vite run lint && vite run test && vite run prepublishOnly",
"ready": "vite fmt && vite run lint && vite run test && vite run prepublishOnly",
"dev": "vite run website#dev",
"lint": "vite lint --type-aware",
"test": "vite test --passWithNoTests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,7 @@ exports[`replaceUnstableOutput > replace unstable semver version 1`] = `
<semver>
tsdown/<semver>
vitest/<semver>
foo/v<semver>"
foo/v<semver>
foo@<semver>
bar@v<semver>"
`;
2 changes: 2 additions & 0 deletions packages/tools/src/__tests__/utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ foo v1.0.0
tsdown/0.15.1
vitest/3.2.4
foo/v100.1.1000
foo@1.0.0
bar@v1.0.0
`;
expect(replaceUnstableOutput(output.trim())).toMatchSnapshot();
});
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export function replaceUnstableOutput(output: string, cwd?: string) {
// semver version
// e.g.: ` v1.0.0` -> ` <semver>`
// e.g.: `/1.0.0` -> `/<semver>`
.replaceAll(/([/\s]v?)\d+\.\d+\.\d+(?:-.*)?/g, '$1<semver>')
.replaceAll(/([@/\s]v?)\d+\.\d+\.\d+(?:-.*)?/g, '$1<semver>')
// date
.replaceAll(/\d{2}:\d{2}:\d{2}/g, '<date>')
// oxlint
Expand Down
Loading