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 label initialization #1473

Merged
merged 4 commits into from
Aug 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 13 additions & 9 deletions packages/core/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async function getLabel(label?: ILabelDefinition) {
/** Response value */
value: {
/** Snippet values */
values: [ILabelDefinition];
values: ILabelDefinition;
};
}

Expand All @@ -75,12 +75,14 @@ async function getLabel(label?: ILabelDefinition) {
}
description: #{description:${label.description}},
releaseType: #{releaseType:${label.releaseType}}
color: #{color:${label.color}}
}`
: endent`{
name: #{name},
changelogTitle: #{changelogTitle},
description: #{description},
releaseType: #{releaseType}
releaseType: #{releaseType},
color: #{color}
}`,
/** Check if returned config is valid */
// @ts-ignore
Expand Down Expand Up @@ -114,7 +116,7 @@ async function getLabel(label?: ILabelDefinition) {
},
});

return response.value.values[0];
return response.value.values;
}

/** Get any custom labels from the user */
Expand Down Expand Up @@ -169,11 +171,15 @@ async function getCustomizedDefaultLabels() {
/** Get the plugins the user wants to use */
async function getPlugins() {
const releasePlugins = {
Homebrew: "brew",
"Chrome Web Store": "chrome",
Cocoapod: "cocoapod",
"Rust Crate": "crates",
"Ruby Gem": "gem",
"Git Tag": "git-tag",
"npm Package": "npm",
Gradle: "Gradle",
Maven: "maven",
npm: "npm",
};

const releasePlugin = await prompt<InputResponse>({
Expand Down Expand Up @@ -290,11 +296,11 @@ async function createEnv(hook: InteractiveInitHooks["createEnv"]) {
}
}

type SnippetResponse<Key extends string, ReponseValue> = Record<
type SnippetResponse<Key extends string, ResponseValue> = Record<
Key,
{
/** The response from the user */
values: ReponseValue;
values: ResponseValue;
}
>;

Expand Down Expand Up @@ -432,9 +438,7 @@ export default class InteractiveInit {
message: `What are the api URLs for your GitHub enterprise instance?`,
required: true,
// @ts-ignore
template: endent`
GitHub API: #{githubApi}
Graphql API: #{githubGraphqlApi}`,
template: `GitHub API: #{githubApi}`,
});

autoRc = { ...autoRc, ...response.repoInfo.values };
Expand Down