mirror of
https://github.com/ershisan99/create-react-component.git
synced 2025-12-16 20:59:22 +00:00
adjust templates
This commit is contained in:
15
main.go
15
main.go
@@ -52,19 +52,16 @@ func createComponent(name, currentDir string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Component content
|
// Component content
|
||||||
componentContent := fmt.Sprintf(`import React from 'react'
|
componentContent := fmt.Sprintf(`import s from './%s.module.scss'
|
||||||
import s from './%s.module.scss'
|
|
||||||
export type %sProps = {}
|
export type %sProps = {}
|
||||||
|
|
||||||
export const %s: React.FC<%sProps> = ({}) => {
|
export const %s = ({}: %sProps) => {
|
||||||
return <div className={s.container}>%s</div>
|
return <div>%s</div>
|
||||||
}
|
}
|
||||||
`, name, capitalizedName, capitalizedName, capitalizedName, capitalizedName)
|
`, name, capitalizedName, capitalizedName, capitalizedName, capitalizedName)
|
||||||
|
|
||||||
// SASS content
|
// SASS content
|
||||||
sassContent := `.container {
|
sassContent := ``
|
||||||
// styles go here
|
|
||||||
}`
|
|
||||||
|
|
||||||
// Index content
|
// Index content
|
||||||
indexContent := fmt.Sprintf(`export * from './%s'`, name)
|
indexContent := fmt.Sprintf(`export * from './%s'`, name)
|
||||||
@@ -106,8 +103,8 @@ export const Default: Story = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Execute formatting and linting commands
|
// Execute formatting and linting commands
|
||||||
runCommand(currentDir, "pnpm", "run", "format:file", dirPath)
|
runCommand(currentDir, "npm", "run", "format:file", dirPath)
|
||||||
runCommand(currentDir, "pnpm", "run", "lint:file", dirPath+"/**")
|
runCommand(currentDir, "npm", "run", "lint:file", dirPath+"/**")
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user