Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
> test -f tools/vite-plus-generator/package.json && echo 'Created at tools/vite-plus-generator' || echo 'NOT at tools/'
Created at tools/vite-plus-generator

> cd apps/website && vp create --no-interactive --git vite:generator 2>&1 || true # --git is unavailable for generator
The --git/--no-git options are not available with vite:generator because it adds a package to an existing monorepo


> cd apps/website && vp create --no-interactive --no-git vite:generator 2>&1 || true # --no-git is unavailable for generator
The --git/--no-git options are not available with vite:generator because it adds a package to an existing monorepo


> test ! -f apps/website/tools/vite-plus-generator/package.json && echo 'Not in apps/website/' || echo 'BUG: in apps/website/'
Not in apps/website/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"ignoreOutput": true
},
"test -f tools/vite-plus-generator/package.json && echo 'Created at tools/vite-plus-generator' || echo 'NOT at tools/'",
"cd apps/website && vp create --no-interactive --git vite:generator 2>&1 || true # --git is unavailable for generator",
"cd apps/website && vp create --no-interactive --no-git vite:generator 2>&1 || true # --no-git is unavailable for generator",
"test ! -f apps/website/tools/vite-plus-generator/package.json && echo 'Not in apps/website/' || echo 'BUG: in apps/website/'",

{
Expand Down
11 changes: 10 additions & 1 deletion packages/cli/src/create/bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ export interface Options {
verbose: boolean;
agent?: string | string[] | false;
editor?: string | false;
git?: boolean;
hooks?: boolean;
packageManager?: string;
}
Expand Down Expand Up @@ -584,6 +585,12 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
);
cancelAndExit('Cannot create a generator outside a monorepo', 1);
}
if (selectedTemplateName === BuiltinTemplate.generator && options.git !== undefined) {
cancelAndExit(
'The --git/--no-git options are not available with vite:generator because it adds a package to an existing monorepo',
Comment thread
jong-kyung marked this conversation as resolved.
Outdated
1,
);
}

if (isInSubdirectory && !compactOutput) {
prompts.log.info(`Detected monorepo root at ${accent(workspaceInfoOptional.rootDir)}`);
Expand Down Expand Up @@ -807,7 +814,9 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
}));
}

const shouldSetupGit = await promptGitInit(options);
// vite:generator adds a package to an existing monorepo, not a new repository.
const shouldSetupGit =
selectedTemplateName === BuiltinTemplate.generator ? false : await promptGitInit(options);
Comment thread
jong-kyung marked this conversation as resolved.
if (!isMonorepo) {
shouldSetupHooks = await promptGitHooks(options);
}
Expand Down
Loading