Skip to content

Commit 9f94a10

Browse files
authored
Merge pull request #62 from AnthonyLzq/hotfix/dbQuestions
2 parents d6bd826 + d7f6867 commit 9f94a10

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

lib/index.js

+22-19
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ const argv = yargs(hideBin(process.argv))
9292
.alias('h', 'help')
9393
.epilog('Developed by AnthonyLzq').argv
9494

95+
const PROJECT_VERSION = '0.1.0'
96+
const MAIN_FILE = 'src/index.ts'
9597
/** @type {Config} */
9698
const config = {
9799
author: '',
@@ -100,11 +102,11 @@ const config = {
100102
projectDescription: '',
101103
heroku: false,
102104
license: 'unlicensed',
103-
version: '0.1.0',
105+
version: PROJECT_VERSION,
104106
licenseYear: CURRENT_YEAR,
105107
npm: false,
106108
manager: 'yarn add',
107-
mainFile: 'src/index.ts',
109+
mainFile: MAIN_FILE,
108110
fastify: false,
109111
graphql: false,
110112
tests: true,
@@ -210,17 +212,12 @@ const main = async () => {
210212
limitMessage: 'That is not a valid email!'
211213
})
212214
config.version = readLineSync.question('> Project version (0.1.0): ')
213-
config.version = config.version === '' ? '0.1.0' : config.version
214-
215-
const licensePos = readLineSync.keyInSelect(
216-
LICENSES,
217-
'> Select your license: ',
218-
{
215+
config.version = config.version === '' ? PROJECT_VERSION : config.version
216+
config.license = LICENSES[
217+
readLineSync.keyInSelect(LICENSES, '> Select your license: ', {
219218
cancel: false
220-
}
221-
)
222-
223-
config.license = LICENSES[licensePos]
219+
})
220+
]
224221
.toLowerCase()
225222
.replace(/ /g, '-')
226223
.replace('d', '')
@@ -249,6 +246,7 @@ const main = async () => {
249246
}
250247
)
251248
config.mainFile = readLineSync.question('> Main file (src/index.ts): ')
249+
config.mainFile = config.mainFile === '' ? MAIN_FILE : config.mainFile
252250
config.tests = readLineSync.keyInYNStrict(
253251
'> Would you want to have a basic suit of tests with Jest? ',
254252
{
@@ -265,13 +263,18 @@ const main = async () => {
265263
)
266264
else config.ghat = false
267265

268-
config.database = readLineSync.keyInSelect(
269-
Object.keys(DATABASES),
270-
'> Select your database: ',
271-
{
272-
cancel: false
273-
}
274-
)
266+
config.database =
267+
DATABASES[
268+
Object.keys(DATABASES)[
269+
readLineSync.keyInSelect(
270+
Object.keys(DATABASES),
271+
'> Select your database: ',
272+
{
273+
cancel: false
274+
}
275+
)
276+
]
277+
]
275278
} else {
276279
if (!argv.author) return console.log('Error! An author is required!')
277280
else config.author = argv.author

lib/src/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ module.exports = async ({
9696
case 'sqlServer':
9797
prodPackages +=
9898
' sequelize sequelize-typescript sequelize-typescript-migration-lts tedious'
99+
break
100+
default:
101+
throw new Error('Wrong database')
99102
}
100103

101104
const expressDevPackages =

0 commit comments

Comments
 (0)