2024-06-13 17:04:09 +00:00
|
|
|
import c from 'chalk'
|
|
|
|
import { input, select } from '@inquirer/prompts'
|
|
|
|
import clone from 'git-clone'
|
|
|
|
import path from 'node:path'
|
|
|
|
|
2024-06-13 19:47:33 +00:00
|
|
|
export async function initProject() {
|
|
|
|
let folder
|
|
|
|
let framework
|
2024-06-13 18:26:30 +00:00
|
|
|
|
|
|
|
if (!folder) {
|
|
|
|
folder = await input({
|
|
|
|
message: c.gray('Enter project name:'),
|
|
|
|
default: 'rage-fw',
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
console.log(c.gray('Project name:'), folder)
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!framework) {
|
|
|
|
framework = await select({
|
|
|
|
message: c.gray('Select frontend:'),
|
|
|
|
default: 'react',
|
|
|
|
loop: true,
|
|
|
|
choices: [
|
|
|
|
{
|
|
|
|
name: 'React + TypeScript (Vite)',
|
|
|
|
value: 'react',
|
|
|
|
description: 'React + TypeScript (Vite) as a frontend',
|
|
|
|
},
|
|
|
|
// {
|
|
|
|
// name: 'vue',
|
|
|
|
// value: 'vue',
|
|
|
|
// description: 'npm is the most popular package manager',
|
|
|
|
// },
|
|
|
|
],
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
console.log(c.gray('Frontend:'), framework)
|
|
|
|
}
|
2024-06-13 17:04:09 +00:00
|
|
|
|
|
|
|
console.log(
|
|
|
|
c.gray('\nScaffolding template project into'),
|
|
|
|
folder,
|
|
|
|
c.gray('with'),
|
|
|
|
framework,
|
|
|
|
c.gray('as a frontend..'),
|
|
|
|
)
|
|
|
|
|
|
|
|
clone(
|
|
|
|
'https://git.entityseven.com/entityseven/rage-framework-example',
|
|
|
|
path.join(__dirname, folder),
|
|
|
|
{},
|
|
|
|
err => {
|
|
|
|
if (err) {
|
|
|
|
console.log(c.red('Error occured: \n', err))
|
|
|
|
return
|
|
|
|
}
|
|
|
|
console.log(c.gray('Scaffolded project into'), folder)
|
|
|
|
console.log(
|
|
|
|
c.blueBright(
|
|
|
|
'Working on Rage Framework. RageFW © Powered by Entity Seven Group',
|
|
|
|
),
|
|
|
|
)
|
|
|
|
},
|
|
|
|
)
|
|
|
|
}
|