Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        



logo


A script to create a template component


NPM Version
NPM Downloads
Minizip
Contributors
License

## 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;
};
```