Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
feat: don't generate blank model file
Browse files Browse the repository at this point in the history
  • Loading branch information
Enda Phelan authored and wtrocki committed Mar 30, 2020
1 parent f0b8ed4 commit ca29103
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 6 additions & 4 deletions packages/graphback-cli/src/components/config.ts
Expand Up @@ -25,8 +25,8 @@ function postSetupMessage(): string {
Graphback configuration successfully bootstrapped :rocket:
Next Steps:
1. Review your configuration in ${chalk.white('.graphqlrc')} file
2. Edit the ${chalk.white('*.graphql')} files inside your model folder.
1. Review your configuration in your ${chalk.green('.graphqlrc')} file
2. Edit the ${chalk.green('*.graphql')} files inside your model folder
3. Run ${chalk.cyan('graphback generate')} to generate your schema and resolvers
`
}
Expand Down Expand Up @@ -55,10 +55,12 @@ export async function initConfig(options: InitOptions = {}) {
figlet.textSync('Graphback', { horizontalLayout: 'full' })
));

const { modelName, content } = options.model || await createModel()
const model = options.model || await createModel()
const database = options.database || await chooseDatabase()
const client = options.client || await askForClient()
addModel("", modelName, content)
if (model) {
addModel("", model.modelName, model.content)
}
if (!options.skipInstall) {
await installDependencies(database)
}
Expand Down
5 changes: 2 additions & 3 deletions packages/graphback-cli/src/templates/modelTemplates.ts
Expand Up @@ -57,7 +57,7 @@ export interface ModelTemplate {
/**
* Ask user to include model or not
*/
export async function createModel(): Promise<ModelTemplate> {
export async function createModel(): Promise<ModelTemplate | undefined> {
const { includeModel } = await ask([
{
type: 'confirm',
Expand All @@ -80,7 +80,6 @@ export async function createModel(): Promise<ModelTemplate> {

return { modelName, content }
}
const defaultName = 'Default'

return { modelName: defaultName, content: defaultModel }
return undefined
}

0 comments on commit ca29103

Please sign in to comment.