nork/artisan

55 lines
1.6 KiB
Plaintext
Raw Normal View History

2021-08-14 15:55:17 +02:00
// console.log(process.argv)
let arguments = process.argv
const fs = require('fs')
if (arguments[ 2 ] == 'init')
{
let path = __dirname
let paths = [
__dirname + '/views',
__dirname + '/models',
__dirname + '/controllers',
__dirname + '/public',
__dirname + '/routes',
__dirname + '/tests',
__dirname + '/utils',
__dirname + '/',
]
let pathsTypescript = {}
for (let i = 0; i < paths.length; i++)
{
fs.mkdir(paths[ i ], (err) => {
if (err) {
console.log(err)
}
})
}
}
if (arguments[ 2 ].includes('make:'))
{
switch (arguments[ 2 ].split('make:')[ 1 ])
{
case 'view':
// console.log("\x1b[32m%s\x1b[0m", 'View created successfully.')
console.log("\x1b[33m%s\x1b[0m", 'Views coming soon.')
break
case 'model':
console.log("\x1b[32m%s\x1b[0m", 'Model created successfully.')
break
case 'controller':
console.log("\x1b[32m%s\x1b[0m", 'Controller created successfully.')
break
case 'test':
console.log("\x1b[33m%s\x1b[0m", 'Tests coming soon.')
break
case 'middleware':
console.log("\x1b[33m%s\x1b[0m", 'Middlewares coming soon.')
break
case 'routes':
console.log("\x1b[33ms\x1b[0m", 'Routes coming soon.')
break
default:
console.log("\x1b[41m\x1b[37m%s\x1b[0m", 'node artisan make:view | model | controller | test | middleware | routes')
}
}