Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(turbo-gen): better placeholders #5725

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
5 changes: 4 additions & 1 deletion packages/turbo-gen/src/generators/empty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export async function generate({ project, opts }: TurboGeneratorArguments) {
version: "0.0.0",
private: true,
scripts: {
build: "turbo build",
dev: "echo 'Add dev script here'",
build: "echo 'Add build script here'",
test: "echo 'Add test script here'",
lint: "echo 'Add lint script here'",
},
};

Expand Down
9 changes: 6 additions & 3 deletions packages/turbo-gen/src/utils/gatherAddRequirements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,17 @@ export async function gatherAddRequirements({
opts,
}: TurboGeneratorArguments) {
let source: Workspace | undefined = undefined;

// suggestion for the name based on the (optional) example path
const suggestion =
opts.copy.type === "external"
opts.method === "copy" && opts.copy.type === "external"
? opts.examplePath?.split("/").pop() || opts.copy.source.split("/").pop()
: undefined;

const { answer: type } = await prompts.type({
override: opts.type,
message:
opts.copy.source === "external"
opts.method === "copy" && opts.copy.source === "external"
? `What type of workspace should "${suggestion}" be created as?`
: undefined,
});
Expand All @@ -28,14 +29,16 @@ export async function gatherAddRequirements({
suggestion,
});

if (opts.copy.type === "internal") {
// if we're copying an internal workspace, we need to know which one
if (opts.method === "copy" && opts.copy.type === "internal") {
const { answer } = await prompts.source({
override: opts.copy.source,
workspaces: getWorkspaceList({ project, type }),
name,
});
source = answer;
}

const location = await prompts.location({
type,
name,
Expand Down
Loading