Skip to content

Commit

Permalink
feat: add program
Browse files Browse the repository at this point in the history
  • Loading branch information
selemondev committed Mar 11, 2024
1 parent 0d0f6f3 commit 7b6be5a
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 51 deletions.
71 changes: 68 additions & 3 deletions src/core/command/create-vue-next/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,82 @@ import createVueQuestions from '../../questions/vue/createVueQuestions'
import initialLog from '../create-vue-next/initialLog'
import installDeps from '../create-vue-next/install'
import copyTemplate from '../create-vue-next/copyTemplate'
import packageJson from "../../../../package.json"
import options from '../../utils/vue/options'
async function createProject() {
await initialLog()
await createVueQuestions()
await copyTemplate()
await installDeps();
}

export default async function createVueNext() {
program
.name(packageJson.name)
.arguments('<project-name>')
.version(packageJson.version)
.description(`Create Vue Next. The Next Generation Vue Scaffolding Tool ⚡`)
.action(async () => {
createProject()
.action((name: string) => {
options.name = name.trim()
})
.option(
'--ts, --typescript',
`
Initialize as a TypeScript project.
`
)
.option(
'--js, --javascript',
`
Initialize as a JavaScript project.
`
)
.option(
'--tailwind',
`
Initialize with Tailwind CSS config. (default)
`
)
.option(
'--eslint',
`
Initialize with eslint config.
`
)
.option(
'--use-npm',
`
Explicitly tell the CLI to bootstrap the application using npm
`
)
.option(
'--use-pnpm',
`
Explicitly tell the CLI to bootstrap the application using pnpm
`
)
.option(
'--use-yarn',
`
Explicitly tell the CLI to bootstrap the application using Yarn
`
)
.option(
'--use-bun',
`
Explicitly tell the CLI to bootstrap the application using Bun
`
)
.allowUnknownOption()
.parse(process.argv);
}
49 changes: 1 addition & 48 deletions src/core/program.ts
Original file line number Diff line number Diff line change
@@ -1,51 +1,4 @@
import { Command } from 'commander'
const program = new Command()

export default program


// const program = new Commander.Command(packageJson.name)
// .description(packageJson.description)
// .arguments('<project-directory>')
// .option(
// '--ts', '--typescript',
// 'Initialize as a TypeScript project'
// )
// .option(
// '--js', '--javascript',
// 'Initialize as a JavaScript project'
// )
// .option(
// '--tw', '--tailwind',
// 'Initialize as a Tailwind project'
// )
// .option(
// '--router', '--vue-router',
// 'Initialize with Vue Router'
// )
// .option(
// '--use-npm',
// 'BootStrap project with npm'
// )
// .option(
// '--use-pnpm',
// 'BootStrap project with yarn'
// )
// .option(
// '--use-pnpm',
// 'BootStrap project with pnpm'
// )
// .option(
// '--use-bun',
// 'BootStrap project with bun'
// )
// .option(
// '--reset-preferences',
// `
// Explicitly tell the CLI to reset any stored preferences
// `
// )
// .allowUnknownOption()
// .parse(process.argv);

// export default program
export default program

0 comments on commit 7b6be5a

Please sign in to comment.