Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hunghg255/un-cc
A script help to create template components
https://github.com/hunghg255/un-cc
create-component generated-code nodejs package react-cli reactjs svelte templates vue-cli vuejs
Last synced: about 2 months ago
JSON representation
A script help to create template components
- Host: GitHub
- URL: https://github.com/hunghg255/un-cc
- Owner: hunghg255
- License: mit
- Created: 2024-05-25T06:49:27.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-05-26T04:13:07.000Z (8 months ago)
- Last Synced: 2024-11-01T06:36:45.564Z (2 months ago)
- Topics: create-component, generated-code, nodejs, package, react-cli, reactjs, svelte, templates, vue-cli, vuejs
- Language: TypeScript
- Homepage:
- Size: 88.9 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A script to create a template component## Demo
## Get started
```bash
npm install un-cc@latest -D
```## Usage
```ts
import { createComponent } from 'un-cc';createComponent({
staticComponentDir: 'src',
componentDirectoryStr: ['components'],
templatesDir: 'scripts/templates',transform(content, componentName) {
return content.replaceAll('COMPONENT_NAME', 'TestComponent');
},
});
```## API
```ts
type CreateComponentOptions = {
staticComponentDir: string;
componentDirectoryStr: string[];
templatesDir: string;
transform?: (content: string, componentName: string) => string;
transformFileName?: (filename: string, componentName: string) => string;
transformExecFile?: (componentName: string) => string;
};
```