Skip to content

Commit 8d61bd9

Browse files
authored
Merge branch 'main' into fix-cli-create-fmt-call
2 parents ff8b8be + 69f551a commit 8d61bd9

10 files changed

Lines changed: 299 additions & 270 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,21 @@ defaults:
2323
shell: bash
2424

2525
jobs:
26+
optimize-ci:
27+
runs-on: ubuntu-latest # or whichever runner you use for your CI
28+
outputs:
29+
skip: ${{ steps.check_skip.outputs.skip }}
30+
steps:
31+
- name: Optimize CI
32+
id: check_skip
33+
uses: withgraphite/graphite-ci-action@ee395f3a78254c006d11339669c6cabddf196f72
34+
with:
35+
graphite_token: ${{ secrets.GRAPHITE_CI_OPTIMIZER_TOKEN }}
36+
2637
detect-changes:
2738
runs-on: ubuntu-latest
39+
needs: optimize-ci
40+
if: needs.optimize-ci.outputs.skip == 'false'
2841
permissions:
2942
contents: read
3043
pull-requests: read

packages/cli/snap-tests/bin-oxlint-wrapper/snap.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@ Basic Configuration
1616
running via Node.js
1717
* you can use comments in configuration files.
1818
* tries to be compatible with ESLint v8's format
19-
--tsconfig=<./tsconfig.json> TypeScript `tsconfig.json` path for reading path alias and
20-
project references for import plugin. If not provided, will look for
21-
`tsconfig.json` in the current working directory.
19+
--tsconfig=<./tsconfig.json> Override the TypeScript config used for import resolution.
20+
Oxlint automatically discovers the relevant `tsconfig.json` for each
21+
file. Use this only when your project uses a non-standard tsconfig
22+
name or location.
2223
--init Initialize oxlint configuration with default values
2324

2425
Allowing / Denying Multiple Lints
@@ -42,9 +43,7 @@ Enable/Disable Plugins
4243
--disable-unicorn-plugin Disable unicorn plugin, which is turned on by default
4344
--disable-oxc-plugin Disable oxc unique rules, which is turned on by default
4445
--disable-typescript-plugin Disable TypeScript plugin, which is turned on by default
45-
--import-plugin Enable import plugin and detect ESM problems. It should be used with
46-
the `--tsconfig` flag if your project has a tsconfig with a name other
47-
than `tsconfig.json`.
46+
--import-plugin Enable import plugin and detect ESM problems.
4847
--react-plugin Enable react plugin, which is turned off by default
4948
--jsdoc-plugin Enable jsdoc plugin and detect JSDoc problems
5049
--jest-plugin Enable the Jest plugin and detect test problems

packages/cli/snap-tests/check-fix-missing-stderr/snap.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
error: Formatting could not complete
33
Failed to load configuration file.
44
<cwd>/vite.config.ts
5+
Error: The `fmt` field in the default export must be an object.
56
Ensure the file has a valid default export of a JSON-serializable configuration object.
67

78
Formatting failed during fix
@@ -10,6 +11,7 @@ Formatting failed during fix
1011
error: Formatting could not start
1112
Failed to load configuration file.
1213
<cwd>/vite.config.ts
14+
Error: The `fmt` field in the default export must be an object.
1315
Ensure the file has a valid default export of a JSON-serializable configuration object.
1416

1517
Formatting failed before analysis started

packages/cli/snap-tests/command-helper/snap.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,10 @@ Basic Configuration
127127
running via Node.js
128128
* you can use comments in configuration files.
129129
* tries to be compatible with ESLint v8's format
130-
--tsconfig=<./tsconfig.json> TypeScript `tsconfig.json` path for reading path alias and
131-
project references for import plugin. If not provided, will look for
132-
`tsconfig.json` in the current working directory.
130+
--tsconfig=<./tsconfig.json> Override the TypeScript config used for import resolution.
131+
Oxlint automatically discovers the relevant `tsconfig.json` for each
132+
file. Use this only when your project uses a non-standard tsconfig
133+
name or location.
133134
--init Initialize oxlint configuration with default values
134135

135136
Allowing / Denying Multiple Lints
@@ -153,9 +154,7 @@ Enable/Disable Plugins
153154
--disable-unicorn-plugin Disable unicorn plugin, which is turned on by default
154155
--disable-oxc-plugin Disable oxc unique rules, which is turned on by default
155156
--disable-typescript-plugin Disable TypeScript plugin, which is turned on by default
156-
--import-plugin Enable import plugin and detect ESM problems. It should be used with
157-
the `--tsconfig` flag if your project has a tsconfig with a name other
158-
than `tsconfig.json`.
157+
--import-plugin Enable import plugin and detect ESM problems.
159158
--react-plugin Enable react plugin, which is turned off by default
160159
--jsdoc-plugin Enable jsdoc plugin and detect JSDoc problems
161160
--jest-plugin Enable the Jest plugin and detect test problems

packages/cli/src/create/__tests__/utils.spec.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ describe('formatTargetDir', () => {
1717
expect(formatTargetDir('../../foo/bar')).matchSnapshot();
1818
});
1919

20-
it.skipIf(process.platform === 'win32')('should format target dir with valid input', () => {
20+
// Should work on all platforms (including Windows) - directory must always use forward slashes
21+
it('should format target dir with valid input', () => {
2122
expect(formatTargetDir('./my-package')).matchSnapshot();
2223
expect(formatTargetDir('my-package')).matchSnapshot();
2324
expect(formatTargetDir('@my-scope/my-package')).matchSnapshot();
@@ -28,6 +29,17 @@ describe('formatTargetDir', () => {
2829
expect(formatTargetDir('./foo/bar/@scope/my-package/sub-package')).matchSnapshot();
2930
});
3031

32+
// Regression test for https://github.com/voidzero-dev/vite-plus/issues/938
33+
// On Windows, path.join/normalize produce backslashes which break when passed as CLI args.
34+
// Nested paths are the critical cases since they involve path separators.
35+
it('should always use forward slashes in directory (issue #938)', () => {
36+
expect(formatTargetDir('foo/@my-scope/my-package').directory).toBe('foo/my-package');
37+
expect(formatTargetDir('./foo/bar/@scope/my-package').directory).toBe('foo/bar/my-package');
38+
expect(formatTargetDir('./foo/bar/@scope/my-package/sub-package').directory).toBe(
39+
'foo/bar/@scope/my-package/sub-package',
40+
);
41+
});
42+
3143
it('should format target dir with invalid package name', () => {
3244
expect(formatTargetDir('my-package@').error).matchSnapshot();
3345
expect(formatTargetDir('my-package@1.0.0').error).matchSnapshot();

packages/cli/src/create/bin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
584584
const selected = await promptPackageNameAndTargetDir(defaultPackageName, options.interactive);
585585
packageName = selected.packageName;
586586
targetDir = selectedParentDir
587-
? path.join(selectedParentDir, selected.targetDir)
587+
? path.join(selectedParentDir, selected.targetDir).split(path.sep).join('/')
588588
: selected.targetDir;
589589
}
590590
}
@@ -782,7 +782,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
782782
const selected = await promptPackageNameAndTargetDir(defaultPackageName, options.interactive);
783783
packageName = selected.packageName;
784784
targetDir = templateInfo.parentDir
785-
? path.join(templateInfo.parentDir, selected.targetDir)
785+
? path.join(templateInfo.parentDir, selected.targetDir).split(path.sep).join('/')
786786
: selected.targetDir;
787787
}
788788
pauseCreateProgress();

packages/cli/src/create/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function formatTargetDir(input: string): {
8585
error: `Parsed package name "${packageName}" is invalid: ${message}`,
8686
};
8787
}
88-
return { directory: targetDir, packageName };
88+
return { directory: targetDir.split(path.sep).join('/'), packageName };
8989
}
9090

9191
// Get the project directory from the project name

packages/core/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
"@babel/types": "^7.28.5",
116116
"@oxc-node/cli": "catalog:",
117117
"@oxc-node/core": "catalog:",
118-
"@vitejs/devtools": "^0.1.0",
118+
"@vitejs/devtools": "^0.1.2",
119119
"es-module-lexer": "^1.7.0",
120120
"hookable": "^6.0.1",
121121
"magic-string": "^0.30.21",
@@ -136,8 +136,8 @@
136136
},
137137
"peerDependencies": {
138138
"@arethetypeswrong/core": "^0.18.1",
139-
"@tsdown/css": "0.21.3",
140-
"@tsdown/exe": "0.21.3",
139+
"@tsdown/css": "0.21.4",
140+
"@tsdown/exe": "0.21.4",
141141
"@types/node": "^20.19.0 || >=22.12.0",
142142
"@vitejs/devtools": "^0.0.0-alpha.31",
143143
"esbuild": "^0.27.0",
@@ -219,6 +219,6 @@
219219
"bundledVersions": {
220220
"vite": "8.0.0",
221221
"rolldown": "1.0.0-rc.9",
222-
"tsdown": "0.21.3"
222+
"tsdown": "0.21.4"
223223
}
224224
}

0 commit comments

Comments
 (0)