Skip to content

Commit

Permalink
fix: some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ipetinate committed May 13, 2024
1 parent 081bddb commit ebaf1ea
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 64 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<p align="center">
<img
src="https://raw.githubusercontent.com/ipetinate/clingon/main/doc/img/clingon.svg"
alt="Clingon CLI logo" width="256" style="display: block; margin: 0 auto;"
/>
<a href="https://clingon.dev">
<img
src="https://raw.githubusercontent.com/ipetinate/clingon/main/doc/img/clingon.svg"
alt="Clingon CLI logo" width="256" style="display: block; margin: 0 auto;"
/>
</a>
</p>

[![Build CI](https://github.com/ipetinate/clingon/actions/workflows/node.js.yml/badge.svg?branch=main)](https://github.com/ipetinate/clingon/actions/workflows/node.js.yml)
Expand All @@ -27,7 +29,10 @@ Let's simplify all of this, execute a command, answer some questions, or select

## Links

- Official website: [clingon.dev](https://clingon.dev)
<p align="center" style="font-size: 20px;">
<a href="https://clingon.dev">🔗 Official website 🔗</a>
</p>

- Releases
- [CHANGELOG](https://github.com/ipetinate/clingon/blob/main/CHANGELOG.md)
- Documentation
Expand Down
2 changes: 1 addition & 1 deletion src/actions/guided.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function guidedAction(resourceName) {
/**
* Selected preset
*
* @type {string }
* @type { string | boolean }
*/
let preset = false

Expand Down
116 changes: 58 additions & 58 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import { Command } from 'commander'

import { initAction } from './actions/init.js'
import { guidedAction } from './actions/guided.js'
import { createAction } from './actions/create.js'

import { getLocalLibDirname } from './utils/directory.js'
import { TestFrameworkEnum } from './enums/frameworks.js'
import { initAction } from './actions/init.js'

/*
* Global Variables
Expand All @@ -26,81 +26,81 @@ const program = new Command()
*/

program
.name('clingon')
.description('CLI to generate files based on templates')
.version('0.9.0', '-v, --version', 'Current version')
.name('clingon')
.description('CLI to generate files based on templates')
.version('0.9.0', '-v, --version', 'Current version')

/*
* Guided flow - generate components based on prompt answers
*/

program
.command('gen')
.argument('[name]', 'Resource name')
.action(guidedAction)
.description('Start a guided flow to generate resources (components, functions, pages, etc)')
.command('gen')
.argument('[name]', 'Resource name')
.action(guidedAction)
.description('Start a guided flow to generate resources (components, functions, pages, etc)')

/*
* Preset flow - create instantly resources with presets
*/

program
.command('create')
.argument('<name>', 'Resource name')
.option('--preset [preset]', 'Preset name')
.option('--type <resourceType>', 'Resource type: "function" | "page" | "component"')
.option('--vue-version [vueVersion]', 'Vue version: "2" | "3" (default: 3))', '3')
.option('--framework <frameworkName>', 'Framework name for default preset: vue or react')
.option(
'--css-framework [cssFramework]',
'Style approach: "css_modules" | "tailwind_inline" | "tailwind_file" | "css_vanilla" | "scss" (default: no_style)',
'no_style'
)
.option(
'--test-framework [testFrameworkName]',
'Test framework: jest or vitest (default: vitest)',
TestFrameworkEnum.vitest
)
.option(
'--path <resourcePath>',
'Path to resource, use dot (".") to current dir where command is executed'
)
.option(
'--test-path [testPath]',
'Path to test, use dot (".") to current dir where command is executed, if ommited, and --spec is present, will use the same path to resource'
)
.option(
'--story-path [storyPath]',
'Path to story, use dot (".") to current dir where command is executed, if ommited, and --spec is present, will use the same path to resource'
)
.option('--typescript', 'With TypeScript (default: false)', false)
.option('--testing-library', 'With Testing Library (default: false)', false)
.option('--test', 'Add test file (default: false)', false)
.option('--spec', 'Add spec file (default: false)', false)
.option('--story', 'Add story file (default: false)', false)
.option(
'--folder-wrapper',
'Creates a folder with the name of the resource, with the files inside it',
false
)
.action(createAction)
.usage('create <resourceName> --preset <presetName>')
.usage(
'create <resourceName> --type (component | page | function) --framework <framework> (--test | --spec) --typescript --folder-wrapper --story --test-framework (vitest | jest)'
)
.description(
'Creates the resources with a local preset in non-verbose mode (preview and ask to confirm are not shown, resources will be created immediately), if the preset folder is empty, it will call the guided flow (the same as the `gen` command executes)'
)
.command('create')
.argument('<name>', 'Resource name')
.option('--preset [preset]', 'Preset name')
.option('--type <resourceType>', 'Resource type: "function" | "page" | "component"')
.option('--vue-version [vueVersion]', 'Vue version: "2" | "3" (default: 3))', '3')
.option('--framework <frameworkName>', 'Framework name for default preset: vue or react')
.option(
'--css-framework [cssFramework]',
'Style approach: "css_modules" | "tailwind_inline" | "tailwind_file" | "css_vanilla" | "scss" (default: no_style)',
'no_style'
)
.option(
'--test-framework [testFrameworkName]',
'Test framework: jest or vitest (default: vitest)',
TestFrameworkEnum.vitest
)
.option(
'--path <resourcePath>',
'Path to resource, use dot (".") to current dir where command is executed'
)
.option(
'--test-path [testPath]',
'Path to test, use dot (".") to current dir where command is executed, if ommited, and --spec is present, will use the same path to resource'
)
.option(
'--story-path [storyPath]',
'Path to story, use dot (".") to current dir where command is executed, if ommited, and --spec is present, will use the same path to resource'
)
.option('--typescript', 'With TypeScript (default: false)', false)
.option('--testing-library', 'With Testing Library (default: false)', false)
.option('--test', 'Add test file (default: false)', false)
.option('--spec', 'Add spec file (default: false)', false)
.option('--story', 'Add story file (default: false)', false)
.option(
'--folder-wrapper',
'Creates a folder with the name of the resource, with the files inside it',
false
)
.action(createAction)
.usage('create <resourceName> --preset <presetName>')
.usage(
'create <resourceName> --type (component | page | function) --framework <framework> (--test | --spec) --typescript --folder-wrapper --story --test-framework (vitest | jest)'
)
.description(
'Creates the resources with a local preset in non-verbose mode (preview and ask to confirm are not shown, resources will be created immediately), if the preset folder is empty, it will call the guided flow (the same as the `gen` command executes)'
)

/*
* Init tool assets, generate clingon.config.json
*/

program
.command('init')
.actions(initAction)
.usage('init')
.description('Init all needed setup, generate files and create folders to store assets.')
.command('init')
.action(initAction)
.usage('init')
.description('Init all needed setup, generate files and create folders to store assets.')

/*
* Parse program to execution
Expand Down

0 comments on commit ebaf1ea

Please sign in to comment.