Skip to content

Commit b3b10e4

Browse files
committed
Merge branch 'main' of github.com:sveltejs/cli into create-add-one-go
2 parents 4545c47 + 6ce2b8a commit b3b10e4

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

packages/addons/_tests/storybook/test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const CI = Boolean(process.env.CI);
1818
beforeAll(() => {
1919
if (CI) {
2020
// prefetch the storybook cli during ci to reduce fetching errors in tests
21-
execSync('pnpx create-storybook@latest --version');
21+
execSync('pnpm dlx create-storybook@latest --version');
2222
}
2323
});
2424

packages/cli/commands/create.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,18 +156,19 @@ async function createProject(cwd: ProjectPath, options: Options) {
156156
});
157157
},
158158
force: async ({ results: { directory } }) => {
159-
const directoryExists = fs.existsSync(directory!);
160-
const hasNonIgnoredFiles =
161-
fs.readdirSync(directory!).filter((x) => !x.startsWith('.git')).length > 0;
162-
if (directoryExists && hasNonIgnoredFiles && options.dirCheck) {
163-
const force = await p.confirm({
164-
message: 'Directory not empty. Continue?',
165-
initialValue: false
166-
});
167-
if (p.isCancel(force) || !force) {
168-
p.cancel('Exiting.');
169-
process.exit(0);
170-
}
159+
if (!options.dirCheck) return;
160+
161+
const files = fs.readdirSync(directory!);
162+
const hasNonIgnoredFiles = files.some((file) => !file.startsWith('.git'));
163+
if (!hasNonIgnoredFiles) return;
164+
165+
const force = await p.confirm({
166+
message: 'Directory not empty. Continue?',
167+
initialValue: false
168+
});
169+
if (p.isCancel(force) || !force) {
170+
p.cancel('Exiting.');
171+
process.exit(0);
171172
}
172173
},
173174
template: () => {

0 commit comments

Comments
 (0)