v1.0.4
This commit is contained in:
parent
4433dbd5aa
commit
135f6261cc
26
create-component-packages.cjs
Normal file
26
create-component-packages.cjs
Normal file
@ -0,0 +1,26 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const componentsDir = path.resolve(__dirname, 'dist/components')
|
||||
|
||||
fs.readdir(componentsDir, { withFileTypes: true }, (err, entries) => {
|
||||
if (err) {
|
||||
console.error('Error al leer el directorio de componentes:', err)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
entries.forEach(entry => {
|
||||
if (entry.isDirectory()) {
|
||||
const componentDirPath = path.join(componentsDir, entry.name)
|
||||
const packageJson = {
|
||||
sideEffects: false,
|
||||
module: './index.js',
|
||||
main: './index.js',
|
||||
types: './index.d.ts'
|
||||
}
|
||||
|
||||
fs.writeFileSync(path.join(componentDirPath, 'package.json'), JSON.stringify(packageJson, null, 2))
|
||||
console.log(`package.json creado para el componente ${entry.name}`)
|
||||
}
|
||||
})
|
||||
})
|
5
dist/components/button/button.type.d.ts
vendored
5
dist/components/button/button.type.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
import React from 'react';
|
||||
export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
title: string;
|
||||
onClick?: () => void;
|
||||
}
|
6
dist/components/button/index.d.ts
vendored
6
dist/components/button/index.d.ts
vendored
@ -1,3 +1,7 @@
|
||||
import { ButtonProps } from './button.type';
|
||||
import React from 'react';
|
||||
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
title: string;
|
||||
onClick?: () => void;
|
||||
}
|
||||
declare const Button: ({ title, onClick }: ButtonProps) => any;
|
||||
export default Button;
|
||||
|
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\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"}
|
||||
{"version":3,"file":"index.js","sources":["../../../src/components/button/index.tsx"],"sourcesContent":["import { cn } from '@/lib/utils'\r\nimport React from 'react'\r\ninterface ButtonProps\r\n extends React.ButtonHTMLAttributes<HTMLButtonElement> {\r\n title: string\r\n onClick?: () => void\r\n}\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":"6DAQA,IAAMA,EAAS,SAAHC,GAAuC,IAAjCC,EAAKD,EAALC,MAAOC,EAAOF,EAAPE,QACvB,OACEC,EAAKC,cAAA,MAAA,CAAAC,UAAWC,EACd,cACA,cAEFJ,QAASA,GAEND,EAGP"}
|
6
dist/components/button/package.json
vendored
Normal file
6
dist/components/button/package.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"sideEffects": false,
|
||||
"module": "./index.js",
|
||||
"main": "./index.js",
|
||||
"types": "./index.d.ts"
|
||||
}
|
6
dist/components/input/package.json
vendored
Normal file
6
dist/components/input/package.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"sideEffects": false,
|
||||
"module": "./index.js",
|
||||
"main": "./index.js",
|
||||
"types": "./index.d.ts"
|
||||
}
|
21
package.json
21
package.json
@ -1,21 +1,9 @@
|
||||
{
|
||||
"name": "library-template",
|
||||
"version": "1.0.3",
|
||||
"version": "1.0.4",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
@ -32,7 +20,8 @@
|
||||
"rollupPrebuild": "rimraf srs && rimraf dist",
|
||||
"rollupBuild": "rollup -c --bundleConfigAsCjs",
|
||||
"rollupBuildProd": "rollup -c --environment NODE_ENV:production",
|
||||
"deploy": "git pull origin main && yarn rollupPrebuild && yarn rollupBuildProd && git add . && yarn version --patch && git push origin dev_ja && git push origin --tags"
|
||||
"postbuild": "node create-component-packages.cjs",
|
||||
"deploy": "git pull origin main && yarn rollupPrebuild && yarn rollupBuildProd && yarn postbuild && git add . && yarn version --patch && git push origin dev_ja && git push origin --tags"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.23.7",
|
||||
|
@ -1,7 +0,0 @@
|
||||
import React from 'react'
|
||||
|
||||
export interface ButtonProps
|
||||
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
title: string
|
||||
onClick?: () => void
|
||||
}
|
@ -1,6 +1,10 @@
|
||||
import { cn } from '@/lib/utils'
|
||||
import React from 'react'
|
||||
import { ButtonProps } from './button.type'
|
||||
interface ButtonProps
|
||||
extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
title: string
|
||||
onClick?: () => void
|
||||
}
|
||||
|
||||
const Button = ({ title, onClick }: ButtonProps) => {
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user