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

Feat(create robo) no credential feature #253

Merged
merged 13 commits into from
Jun 4, 2024
5 changes: 5 additions & 0 deletions .changeset/hip-spoons-pretend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-robo': patch
---

fix(create-robo): no creds flag.
5 changes: 5 additions & 0 deletions .changeset/kind-goats-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-robo': patch
---

feat(create-robo): `--no-creds` option
7 changes: 3 additions & 4 deletions packages/create-robo/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface CommandOptions {
verbose?: boolean
roboVersion?: string
update?: boolean
noCreds?: boolean
creds?: boolean
}

new Command('create-robo <projectName>')
Expand All @@ -41,7 +41,7 @@ new Command('create-robo <projectName>')
.option('-v --verbose', 'print more information for debugging')
.option('-rv, --robo-version <value>', 'specify a Robo.js version to use')
.option('-k, --kit <value>', 'choose a kit to start off with your Robo')
.option('-nc, --no-creds', 'Skips asking for the credentials')
.option('-nc --no-creds', 'Skips asking for the credentials')
.action(async (options: CommandOptions, { args }) => {
logger({
level: options.verbose ? 'debug' : 'info'
Expand Down Expand Up @@ -165,8 +165,7 @@ new Command('create-robo <projectName>')

// Ask the user for their Discord credentials (token and client ID) and store them for later use
// Skip this step if the user is creating a plugin
//
if (!robo.isPlugin && options.noCreds) {
if (!robo.isPlugin) {
logger.debug(`Asking for Discord credentials...`)
await robo.askForDiscordCredentials()
}
Expand Down
21 changes: 13 additions & 8 deletions packages/create-robo/src/robo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -837,20 +837,25 @@ export default class Robo {
const discordPortalUrl = chalk.bold.blue('https://discord.com/developers/applications')
const officialGuide = 'Guide:'
const officialGuideUrl = chalk.bold.blue('https://roboplay.dev/' + (this._isApp ? 'appkey' : 'botkey'))

let discordClientId = ''
let discordToken = ''
logger.log('')
logger.log(Indent, chalk.bold('🔑 Setting up credentials'))
logger.log(Indent, ' Get your credentials from the Discord Developer portal.\n')
logger.log(Indent, ` ${discordPortal} ${discordPortalUrl}`)
logger.log(Indent, ` ${officialGuide} ${officialGuideUrl}\n`)

const discordClientId = await input({
message: 'Enter your Discord Client ID (press Enter to skip):'
})
const discordToken = await input({
message: this._isApp
? 'Enter your Discord Client Secret (press enter to skip)'
: 'Enter your Discord Token (press Enter to skip):'
})
if (this._cliOptions.creds) {
discordClientId = await input({
message: 'Enter your Discord Client ID (press Enter to skip):'
})
discordToken = await input({
message: this._isApp
? 'Enter your Discord Client Secret (press enter to skip)'
: 'Enter your Discord Token (press Enter to skip):'
})
}

if (!discordClientId || !discordToken) {
this._missingEnv = true
Expand Down
Loading