@gx-design-vue/create-gx-cli 0.1.13 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/cli.js +7 -5
    
        package/package.json
    CHANGED
    
    
    
        package/src/cli.js
    CHANGED
    
    | @@ -1,13 +1,15 @@ | |
| 1 1 | 
             
            import chalk from 'chalk'
         | 
| 2 2 | 
             
            import fs from 'node:fs'
         | 
| 3 | 
            +
            import { fileURLToPath } from 'node:url'
         | 
| 3 4 | 
             
            import path from 'node:path'
         | 
| 4 5 | 
             
            import minimist from 'minimist'
         | 
| 5 6 | 
             
            import prompts from 'prompts'
         | 
| 6 7 | 
             
            import { blue, green, red, reset, yellow } from 'kolorist'
         | 
| 7 8 | 
             
            import { createProject } from './main.js'
         | 
| 8 9 |  | 
| 9 | 
            -
            const  | 
| 10 | 
            -
             | 
| 10 | 
            +
            const __filename = fileURLToPath(import.meta.url)
         | 
| 11 | 
            +
            const __dirname = path.dirname(__filename)
         | 
| 12 | 
            +
            let packageJSON = fs.readFileSync(path.join(__dirname, '../package.json'), 'utf-8')
         | 
| 11 13 | 
             
            packageJSON = JSON.parse(packageJSON)
         | 
| 12 14 | 
             
            const { version } = packageJSON
         | 
| 13 15 |  | 
| @@ -33,7 +35,7 @@ const FRAMEWORKS = [ | |
| 33 35 | 
             
            ]
         | 
| 34 36 |  | 
| 35 37 | 
             
            const TEMPLATES = FRAMEWORKS.map(
         | 
| 36 | 
            -
              f => (f.variants && f.variants.map(v => v.name)) || [f.name]
         | 
| 38 | 
            +
              f => (f.variants && f.variants.map(v => v.name)) || [ f.name ]
         | 
| 37 39 | 
             
            ).reduce((a, b) => a.concat(b), [])
         | 
| 38 40 |  | 
| 39 41 | 
             
            function formatTargetDir(targetDir) {
         | 
| @@ -41,7 +43,7 @@ function formatTargetDir(targetDir) { | |
| 41 43 | 
             
            }
         | 
| 42 44 |  | 
| 43 45 | 
             
            function parseArgumentsIntoOptions() {
         | 
| 44 | 
            -
              const argv = minimist(process.argv.slice(2), { string: ['_'] })
         | 
| 46 | 
            +
              const argv = minimist(process.argv.slice(2), { string: [ '_' ] })
         | 
| 45 47 | 
             
              const argTargetDir = formatTargetDir(argv._[0])
         | 
| 46 48 | 
             
              const argTemplate = argv.template || argv.t
         | 
| 47 49 | 
             
              return {
         | 
| @@ -101,7 +103,7 @@ async function promptForMissingOptions(options) { | |
| 101 103 | 
             
            export async function cli() {
         | 
| 102 104 | 
             
              let options = parseArgumentsIntoOptions()
         | 
| 103 105 | 
             
              if (options.v) {
         | 
| 104 | 
            -
                console.log(chalk. | 
| 106 | 
            +
                console.log(chalk.blueBright(version))
         | 
| 105 107 | 
             
                process.exit(1)
         | 
| 106 108 | 
             
              }
         | 
| 107 109 | 
             
              options = await promptForMissingOptions(options)
         |