v1.0.3
This commit is contained in:
parent
d2b169c6f8
commit
4433dbd5aa
5
dist/components/button/button.type.d.ts
vendored
Normal file
5
dist/components/button/button.type.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
import React from 'react';
|
||||
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
title: string;
|
||||
onClick?: () => void;
|
||||
}
|
3
dist/components/button/index.d.ts
vendored
3
dist/components/button/index.d.ts
vendored
@ -1,2 +1,3 @@
|
||||
declare const Button: () => any;
|
||||
import { ButtonProps } from './button.type';
|
||||
declare const Button: ({ title, onClick }: ButtonProps) => any;
|
||||
export default Button;
|
||||
|
2
dist/components/button/index.js
vendored
2
dist/components/button/index.js
vendored
@ -1,2 +1,2 @@
|
||||
import{cn as t}from"../../lib/utils.js";import e from"react";var r=function(){return e.createElement("div",{className:t("bg-blue-500","text-white")},"Button")};export{r as default};
|
||||
import{cn as t}from"../../lib/utils.js";import e from"react";var r=function(r){var i=r.title,l=r.onClick;return e.createElement("div",{className:t("bg-blue-500","text-white"),onClick:l},i)};export{r as default};
|
||||
//# sourceMappingURL=index.js.map
|
||||
|
2
dist/components/button/index.js.map
vendored
2
dist/components/button/index.js.map
vendored
@ -1 +1 @@
|
||||
{"version":3,"file":"index.js","sources":["../../../src/components/button/index.tsx"],"sourcesContent":["import { cn } from '@/lib/utils'\r\nimport React from 'react'\r\n\r\n\r\nconst Button = () => {\r\n return (\r\n <div className={cn(\r\n 'bg-blue-500',\r\n 'text-white'\r\n )}>\r\n Button\r\n </div>\r\n )\r\n}\r\n\r\nexport default Button"],"names":["Button","React","createElement","className","cn"],"mappings":"6DAIA,IAAMA,EAAS,WACb,OACEC,EAAAC,cAAA,MAAA,CAAKC,UAAWC,EACd,cACA,eAGI,SAEV"}
|
||||
{"version":3,"file":"index.js","sources":["../../../src/components/button/index.tsx"],"sourcesContent":["import { cn } from '@/lib/utils'\r\nimport React from 'react'\r\nimport { ButtonProps } from './button.type'\r\n\r\nconst Button = ({ title, onClick }: ButtonProps) => {\r\n return (\r\n <div className={cn(\r\n 'bg-blue-500',\r\n 'text-white'\r\n )}\r\n onClick={onClick}\r\n >\r\n {title}\r\n </div>\r\n )\r\n}\r\n\r\nexport default Button"],"names":["Button","_ref","title","onClick","React","createElement","className","cn"],"mappings":"6DAIA,IAAMA,EAAS,SAAHC,GAAuC,IAAjCC,EAAKD,EAALC,MAAOC,EAAOF,EAAPE,QACvB,OACEC,EAAKC,cAAA,MAAA,CAAAC,UAAWC,EACd,cACA,cAEFJ,QAASA,GAEND,EAGP"}
|
53
generateRollupConfig.js
Normal file
53
generateRollupConfig.js
Normal file
@ -0,0 +1,53 @@
|
||||
const typescript = require('@rollup/plugin-typescript')
|
||||
const babel = require('@rollup/plugin-babel')
|
||||
const postcss = require('rollup-plugin-postcss')
|
||||
const tailwind = require('rollup-plugin-tailwindcss')
|
||||
const autoprefixer = require('autoprefixer')
|
||||
const resolve = require('@rollup/plugin-node-resolve')
|
||||
const commonjs = require('@rollup/plugin-commonjs')
|
||||
const { terser } = require('rollup-plugin-terser')
|
||||
const pkg = require('./package.json')
|
||||
|
||||
const external = [
|
||||
...Object.keys(pkg.dependencies || {}),
|
||||
...Object.keys(pkg.peerDependencies || {}),
|
||||
/@babel\/runtime/
|
||||
]
|
||||
|
||||
const rollupConfig = {
|
||||
input: 'src/index.ts',
|
||||
output: {
|
||||
dir: 'dist',
|
||||
format: 'esm',
|
||||
sourcemap: true,
|
||||
preserveModules: true,
|
||||
preserveModulesRoot: 'src'
|
||||
},
|
||||
external,
|
||||
plugins: [
|
||||
resolve(),
|
||||
commonjs(),
|
||||
typescript({
|
||||
declaration: true,
|
||||
noEmitOnError: true
|
||||
}),
|
||||
babel({
|
||||
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||
babelHelpers: 'runtime',
|
||||
include: ['src/**/*'],
|
||||
plugins: ['@babel/plugin-transform-runtime']
|
||||
}),
|
||||
postcss({
|
||||
plugins: [autoprefixer()],
|
||||
sourceMap: true,
|
||||
extract: true,
|
||||
minimize: true
|
||||
}),
|
||||
tailwind({
|
||||
input: './styles/globals.css'
|
||||
}),
|
||||
terser()
|
||||
]
|
||||
}
|
||||
|
||||
module.exports = rollupConfig
|
18
package.json
18
package.json
@ -1,13 +1,21 @@
|
||||
{
|
||||
"name": "library-template",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": "./dist/index.js",
|
||||
"./button": "./dist/components/button/index.js",
|
||||
"./input": "./dist/components/input/index.js"
|
||||
".": {
|
||||
"import": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./button": {
|
||||
"import": "./dist/components/button/index.js",
|
||||
"types": "./dist/components/button/index.d.ts"
|
||||
},
|
||||
"./input": {
|
||||
"import": "./dist/components/input/index.js",
|
||||
"types": "./dist/components/input/index.d.ts"
|
||||
}
|
||||
},
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
|
7
src/components/button/button.type.ts
Normal file
7
src/components/button/button.type.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import React from 'react'
|
||||
|
||||
export interface ButtonProps
|
||||
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
title: string
|
||||
onClick?: () => void
|
||||
}
|
@ -1,14 +1,16 @@
|
||||
import { cn } from '@/lib/utils'
|
||||
import React from 'react'
|
||||
import { ButtonProps } from './button.type'
|
||||
|
||||
|
||||
const Button = () => {
|
||||
const Button = ({ title, onClick }: ButtonProps) => {
|
||||
return (
|
||||
<div className={cn(
|
||||
'bg-blue-500',
|
||||
'text-white'
|
||||
)}>
|
||||
Button
|
||||
)}
|
||||
onClick={onClick}
|
||||
>
|
||||
{title}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
0
src/components/input/input.type.ts
Normal file
0
src/components/input/input.type.ts
Normal file
Loading…
Reference in New Issue
Block a user