mirror of
https://github.com/ershisan99/create-react-component.git
synced 2025-12-16 20:59:22 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 37e941ac56 | |||
| 984517cf90 |
15
main.go
15
main.go
@@ -52,19 +52,16 @@ func createComponent(name, currentDir string) error {
|
||||
}
|
||||
|
||||
// Component content
|
||||
componentContent := fmt.Sprintf(`import React from 'react'
|
||||
import s from './%s.module.scss'
|
||||
componentContent := fmt.Sprintf(`import s from './%s.module.scss'
|
||||
export type %sProps = {}
|
||||
|
||||
export const %s: React.FC<%sProps> = ({}) => {
|
||||
return <div className={s.container}>%s</div>
|
||||
export const %s = ({}: %sProps) => {
|
||||
return <div>%s</div>
|
||||
}
|
||||
`, name, capitalizedName, capitalizedName, capitalizedName, capitalizedName)
|
||||
|
||||
// SASS content
|
||||
sassContent := `.container {
|
||||
// styles go here
|
||||
}`
|
||||
sassContent := ``
|
||||
|
||||
// Index content
|
||||
indexContent := fmt.Sprintf(`export * from './%s'`, name)
|
||||
@@ -106,8 +103,8 @@ export const Default: Story = {
|
||||
}
|
||||
|
||||
// Execute formatting and linting commands
|
||||
runCommand(currentDir, "pnpm", "run", "format:file", dirPath)
|
||||
runCommand(currentDir, "pnpm", "run", "lint:file", dirPath+"/**")
|
||||
runCommand(currentDir, "npm", "run", "format:file", dirPath)
|
||||
runCommand(currentDir, "npm", "run", "lint:file", dirPath+"/**")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@ershisan99/create-react-component",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@ershisan99/create-react-component",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@ershisan99/go-npm": "^0.1.14"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ershisan99/create-react-component",
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"private": false,
|
||||
"repository": "https://github.com/ershisan99/create-react-component",
|
||||
"description": "A simple CLI tool to create react component",
|
||||
|
||||
Reference in New Issue
Block a user