un-cc
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

logo

A script to create a template component

NPM Version NPM Downloads Minizip Contributors License

Get started

# npx
npm install un-cc@latest -D

Usage

import { createComponent } from 'un-cc';

createComponent({
  staticComponentDir: 'src',
  componentDirectoryStr: ['components'],
  templatesDir: 'scripts/templates',

  transform(content, componentName) {
    return content.replaceAll('COMPONENT_NAME', 'TestComponent');
  },
});

API

type CreateComponentOptions = {
  staticComponentDir: string;
  componentDirectoryStr: string[];
  templatesDir: string;
  transform?: (content: string, componentName: string) => string;
  transformFileName?: (filename: string, componentName: string) => string;
  transformExecFile?: (componentName: string) => string;
};

Readme

Keywords

none

Package Sidebar

Install

npm i un-cc

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

14.6 kB

Total Files

8

Last publish

Collaborators

  • hunghg255