Skip to content

Instantly share code, notes, and snippets.

@chewhx
Last active April 3, 2023 13:22
Show Gist options
  • Select an option

  • Save chewhx/71983c2e999c2309919cf42988bde200 to your computer and use it in GitHub Desktop.

Select an option

Save chewhx/71983c2e999c2309919cf42988bde200 to your computer and use it in GitHub Desktop.
Initialise configurestore
export async function initConfig(keys: string[]) {
for (const key of keys) {
const hasKey = configstore.has(key);
if (!hasKey) {
const answer = await prompt([
{
name: key,
message: `Enter value for "${key}" config: `,
type: 'input',
},
]);
configstore.set(key, answer[key]);
}
}
// Perhaps, insert a logger here:
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment