Skip to content

Commit

Permalink
Merge pull request #3 from ramsunvtech/main
Browse files Browse the repository at this point in the history
tech(base): add support for TSX, JSX fixes
  • Loading branch information
ramsunvtech authored Feb 2, 2022
2 parents c75a42a + ea38329 commit 1001da2
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 6 deletions.
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,34 @@
# Chef Component
Create Components
Create Component Skeleton in Lightning speed.

### Below are useful commands.

#### Create component from definition file.
```
chef-component --f definitions.txt
chef-component --definitionFile=definitions.txt
```

#### Create component in TypeScript format
```
chef-component --f definitions.txt -e tsx
chef-component --definitionFile=definitions.txt --extension=tsx
```

#### Create component in JSX format
```
chef-component --f definitions.txt -e jsx
chef-component --definitionFile=definitions.txt --extension=jsx
```

#### Create component from existing location.
```
chef-component --f definitions.txt -l someDir/subDir1/subDir2
chef-component --definitionFile=definitions.txt --location=someDir/subDir1/subDir2
```

#### Create component in same path
```
chef-component --f definitions.txt -l .
chef-component --definitionFile=definitions.txt --location=.
```
6 changes: 3 additions & 3 deletions definitions.yml → definitions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ blocks/
FooterLinks
ProfileViewers
RecommendedFeeds
common/
Spinner
Loader
common/
Spinner
Loader
6 changes: 5 additions & 1 deletion generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ const createComponentSet = (line) => {
extension,
name: componentName
})
const componentIndexFileExtension = (FILE_EXTENSION === 'tsx') ? 'ts' : FILE_EXTENSION
const indexFileExtensionMap = {
'tsx': 'ts',
'jsx': 'js',
}
const componentIndexFileExtension = indexFileExtensionMap[FILE_EXTENSION] || FILE_EXTENSION

createFile({
pathToFile: `${getBasePath()}/${componentName}.${FILE_EXTENSION}`,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "git+https://github.com/ramsunvtech/chef-component.git"
},
"bin": {
"@chef-component": "./generator.js"
"chef-component": "./generator.js"
},
"keywords": [
"react-components",
Expand Down

0 comments on commit 1001da2

Please sign in to comment.