Skip to content

Commit

Permalink
Prompt improvementes
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugos68 committed Sep 23, 2023
1 parent b2392f6 commit 48ceab5
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/commands/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,21 @@ async function promptOptions() {

const name = (await text({
message: `What is the ${kleur.underline('name')} of your project?`,
placeholder: packageJsonName
placeholder: packageJsonName,
validate: (value) => {
if (value.length < 1) return 'Invalid name. Must be at least 1 character long.';
}
})) as string;

const id = await text({
const id = (await text({
message: `What is the ${kleur.underline('ID')} of your project?`,
placeholder: `com.company.${name}`,
validate: (value) => {
if (!/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$/.test(value.toLowerCase())) {
return `Invalid App ID "${value}". Must be in Java package form with no dashes (ex: com.example.app)`;
}
}
});
})) as string;

const shouldPromptPlatforms = await confirm({
message: 'Do you want to add additional platforms?'
Expand All @@ -59,7 +62,7 @@ async function promptOptions() {
if (shouldPromptPlatforms) {
const platforms = ['Android', 'iOS'];
selectedPlatforms = (await multiselect({
message: 'What platforms do you want to add? (Optional)',
message: 'What platforms do you want to add?',
options: platforms.map((platform) => {
return {
value: platform.toLowerCase(),
Expand Down Expand Up @@ -104,7 +107,7 @@ async function promptOptions() {
let selectedPlugins: string[] | null = null;
if (shouldPromptPlugins) {
selectedPlugins = (await multiselect({
message: 'What plugins do you want to add? (Optional)',
message: 'What plugins do you want to add?',
options: plugins.map((plugin) => {
return {
value: plugin.toLowerCase().replace(/ /g, '-'),
Expand Down

0 comments on commit 48ceab5

Please sign in to comment.