mirror of
https://github.com/filiprojek/nork.git
synced 2024-11-02 10:02:28 +01:00
added setup funtion for existing projects
This commit is contained in:
parent
44368920e7
commit
1382fdaea8
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nork",
|
||||
"version": "1.0.1",
|
||||
"version": "1.1.0",
|
||||
"description": "The best node.js 'framework' :)",
|
||||
"main": "src/app.js",
|
||||
"bin": "src/app.js",
|
||||
|
20
src/app.js
20
src/app.js
@ -63,7 +63,7 @@ const logHelp = (specific = false, command = false) => {
|
||||
console.log(pad(' make:route', spc), 'create a new route')
|
||||
console.log(pad(' make:test', spc), 'create a new test')
|
||||
console.log(pad(' make:view', spc), 'create a new view')
|
||||
|
||||
console.log(pad(' setup', spc), 'set up an existing project for nork')
|
||||
console.log()
|
||||
console.log(' Run', colors.cyan('nork help <command>'), 'for detailed usage of given command.')
|
||||
|
||||
@ -77,7 +77,6 @@ const logHelp = (specific = false, command = false) => {
|
||||
;(async () => {
|
||||
if (process.argv[2] == 'create') {
|
||||
// get info about new project
|
||||
const data = { lang: 'ts' }
|
||||
const questions = [
|
||||
{
|
||||
type: 'input',
|
||||
@ -188,6 +187,22 @@ const logHelp = (specific = false, command = false) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv[2] == 'setup') {
|
||||
const questions = {
|
||||
type: 'list',
|
||||
message: "Pick the technology you're using:",
|
||||
name: 'lang',
|
||||
choices: [
|
||||
{ name: 'Typescript', value: 'ts' },
|
||||
{ name: 'Javascript', value: 'js' },
|
||||
],
|
||||
}
|
||||
let answers = await inquirer.prompt(questions)
|
||||
|
||||
fs.writeJsonSync(path.join(process.cwd(), './norkconfig.json'), answers)
|
||||
return logSuccess()
|
||||
}
|
||||
|
||||
if (process.argv[2] == '-v' || process.argv[2] == '--version') {
|
||||
const pkgJson = require(path.join(__dirname, '../package.json'))
|
||||
return console.log('nork', pkgJson.version)
|
||||
@ -200,7 +215,6 @@ const logHelp = (specific = false, command = false) => {
|
||||
return logHelp()
|
||||
}
|
||||
|
||||
|
||||
process.argv.splice(0, 2)
|
||||
logHelp(false, process.argv.join(' '))
|
||||
})()
|
||||
|
Loading…
Reference in New Issue
Block a user