@openbytes/ts-react-directives 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +9 -0
- package/dist/ts-react-directives.cjs.js +1 -0
- package/dist/ts-react-directives.css +1 -0
- package/dist/ts-react-directives.es.js +88 -0
- package/dist/ts-react-directives.umd.js +1 -0
- package/dist/types/types/index.d.ts +8 -0
- package/package.json +74 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 SkyCodr (aka: Dulan Sudasinghe)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# ts-react-directives
|
|
2
|
+
|
|
3
|
+
## About
|
|
4
|
+
|
|
5
|
+
**ts-react-directives** is small React/Typescript library designed to mimic 'Angular' directives. This is not static library. It's meant to be used as declarative component. Also, it alleviates the limitations and cognitive complexity created by the ternary operations when using conditional rendering.
|
|
6
|
+
|
|
7
|
+
## Authors
|
|
8
|
+
|
|
9
|
+
[AUTHORS](AUTHORS.md)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),I=require("react");var t=(e=>(e[e.IfBlockExpected=2001]="IfBlockExpected",e[e.OnlyOneIfBlockExpected=2002]="OnlyOneIfBlockExpected",e[e.OnlyOneElseBlockExpected=2003]="OnlyOneElseBlockExpected",e[e.SwitchBlockExpected=2005]="SwitchBlockExpected",e[e.InvalidIfBlockOrdinal=2004]="InvalidIfBlockOrdinal",e[e.InvalidElseBlockOrdinal=2006]="InvalidElseBlockOrdinal",e[e.InvalidElseIfBlockOrdinal=2007]="InvalidElseIfBlockOrdinal",e[e.InvalidElement=3002]="InvalidElement",e[e.ChildrenExpected=3003]="ChildrenExpected",e))(t||{});const u={[t.IfBlockExpected]:"Missing 'If'",[t.OnlyOneIfBlockExpected]:"Can only have one 'If'",[t.OnlyOneElseBlockExpected]:"Can only have one 'Else'",[t.SwitchBlockExpected]:"'If', 'ElseIf', 'Else' need to be wrapped in 'Switch'",[t.InvalidElseBlockOrdinal]:"Invalid ordinals, 'Else' should be the last",[t.InvalidIfBlockOrdinal]:"Invalid ordinals, 'If' block should be the first",[t.InvalidElseIfBlockOrdinal]:"Invalid ordinals, cannot have 'ElseIf' before 'If'",[t.ChildrenExpected]:"Should at least have one child",[t.InvalidElement]:"Invalid element"},r=({errors:e})=>d.jsx("ol",{className:"error-list",children:e.map((n,l)=>d.jsx("li",{children:u[n]},`${n}-${l}`))}),B=e=>{const n=[];return e.length===0?(n.push(t.ChildrenExpected),n):(e.forEach(l=>{const a=I.isValidElement(l)?l.type.name:"unknown";(a===s.name||a===f.name||a===h.name)&&n.push(t.SwitchBlockExpected)}),n)},O=e=>{const n=[],l={};return e.length===0?(n.push(t.ChildrenExpected,t.IfBlockExpected),n):(e.forEach((a,o)=>{const i=I.isValidElement(a)?a.type.name:"unknown",c=l[i]??0;l[i]=c+1,x(i,o,l,n),y(i,o,e.length,l,n),S(i,o,n),w(i,n)}),l[s.name]||n.push(t.IfBlockExpected),n)},x=(e,n,l,a)=>{e===s.name&&(n!==0&&a.push(t.InvalidIfBlockOrdinal),l[s.name]>1&&a.push(t.OnlyOneIfBlockExpected))},y=(e,n,l,a,o)=>{e===h.name&&(a[h.name]>1&&o.push(t.OnlyOneElseBlockExpected),(n===0||n!==l-1)&&o.push(t.InvalidElseBlockOrdinal))},S=(e,n,l)=>{e===f.name&&n===0&&l.push(t.InvalidElseIfBlockOrdinal)},w=(e,n)=>{e!==s.name&&e!==f.name&&e!==h.name&&n.push(t.InvalidElement)};class v{static get(n){let l;switch(n){case m.name:l=O;break;case s.name:case f.name:case h.name:l=B;break;default:l=()=>[]}return l}}const E=(e,n)=>{const{children:l}=e,a=I.Children.toArray(l);return v.get(n)(a)},j=e=>{const n=E(e,m.name);if(n.length)return{children:I.createElement(r,{errors:n})};const{children:l}=e;return{children:I.Children.toArray(l).reduce((i,c)=>{var k,p;return(k=i==null?void 0:i.props)!=null&&k.condition?i:(p=c==null?void 0:c.props)!=null&&p.condition||(c==null?void 0:c.type.name)==="Else"?c:i},null)}},m=e=>{const{children:n}=j(e);return d.jsx(d.Fragment,{children:n})},s=e=>{const n=E(e,s.name),l=n.length===0?e.children:d.jsx(r,{errors:n});return d.jsx(d.Fragment,{children:l})},f=e=>{const n=E(e,f.name),l=n.length===0?e.children:d.jsx(r,{errors:n});return d.jsx(d.Fragment,{children:l})},h=e=>{const n=E(e,h.name),l=n.length===0?e.children:d.jsx(r,{errors:n});return d.jsx(d.Fragment,{children:l})};exports.ERRORS=u;exports.Else=h;exports.ElseIf=f;exports.Errors=r;exports.If=s;exports.LogicErrors=t;exports.SwitchIf=m;exports.ValidationFactory=v;exports.useValidate=E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
:root{--color: 255, 100, 200;--bg-color: 0, 100, 200}ol.error-list{border:.2rem double rgb(var(--bg-color));background-color:rgba(var(--bg-color),.1);list-style-type:none;box-sizing:border-box;padding:.5rem;margin:0}.error-list>li{color:#000;background-color:rgba(var(--color),.1);padding:.125rem;margin:.125rem;border:2px solid rgb(var(--color));font-size:1.5rem;font-family:monospace}.error-list>li:before{content:"🛈 ";font-size:1.5rem;padding-left:.125rem;margin-right:.125rem}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { jsx as i, Fragment as I } from "react/jsx-runtime";
|
|
2
|
+
import { isValidElement as v, Children as r, createElement as O } from "react";
|
|
3
|
+
var t = /* @__PURE__ */ ((e) => (e[e.IfBlockExpected = 2001] = "IfBlockExpected", e[e.OnlyOneIfBlockExpected = 2002] = "OnlyOneIfBlockExpected", e[e.OnlyOneElseBlockExpected = 2003] = "OnlyOneElseBlockExpected", e[e.SwitchBlockExpected = 2005] = "SwitchBlockExpected", e[e.InvalidIfBlockOrdinal = 2004] = "InvalidIfBlockOrdinal", e[e.InvalidElseBlockOrdinal = 2006] = "InvalidElseBlockOrdinal", e[e.InvalidElseIfBlockOrdinal = 2007] = "InvalidElseIfBlockOrdinal", e[e.InvalidElement = 3002] = "InvalidElement", e[e.ChildrenExpected = 3003] = "ChildrenExpected", e))(t || {});
|
|
4
|
+
const u = {
|
|
5
|
+
[t.IfBlockExpected]: "Missing 'If'",
|
|
6
|
+
[t.OnlyOneIfBlockExpected]: "Can only have one 'If'",
|
|
7
|
+
[t.OnlyOneElseBlockExpected]: "Can only have one 'Else'",
|
|
8
|
+
[t.SwitchBlockExpected]: "'If', 'ElseIf', 'Else' need to be wrapped in 'Switch'",
|
|
9
|
+
[t.InvalidElseBlockOrdinal]: "Invalid ordinals, 'Else' should be the last",
|
|
10
|
+
[t.InvalidIfBlockOrdinal]: "Invalid ordinals, 'If' block should be the first",
|
|
11
|
+
[t.InvalidElseIfBlockOrdinal]: "Invalid ordinals, cannot have 'ElseIf' before 'If'",
|
|
12
|
+
[t.ChildrenExpected]: "Should at least have one child",
|
|
13
|
+
[t.InvalidElement]: "Invalid element"
|
|
14
|
+
}, m = ({ errors: e }) => /* @__PURE__ */ i("ol", { className: "error-list", children: e.map((n, l) => /* @__PURE__ */ i("li", { children: u[n] }, `${n}-${l}`)) }), x = (e) => {
|
|
15
|
+
const n = [];
|
|
16
|
+
return e.length === 0 ? (n.push(t.ChildrenExpected), n) : (e.forEach((l) => {
|
|
17
|
+
const a = v(l) ? l.type.name : "unknown";
|
|
18
|
+
(a === o.name || a === f.name || a === h.name) && n.push(t.SwitchBlockExpected);
|
|
19
|
+
}), n);
|
|
20
|
+
}, y = (e) => {
|
|
21
|
+
const n = [], l = {};
|
|
22
|
+
return e.length === 0 ? (n.push(t.ChildrenExpected, t.IfBlockExpected), n) : (e.forEach((a, s) => {
|
|
23
|
+
const d = v(a) ? a.type.name : "unknown", c = l[d] ?? 0;
|
|
24
|
+
l[d] = c + 1, w(d, s, l, n), S(d, s, e.length, l, n), C(d, s, n), b(d, n);
|
|
25
|
+
}), l[o.name] || n.push(t.IfBlockExpected), n);
|
|
26
|
+
}, w = (e, n, l, a) => {
|
|
27
|
+
e === o.name && (n !== 0 && a.push(t.InvalidIfBlockOrdinal), l[o.name] > 1 && a.push(t.OnlyOneIfBlockExpected));
|
|
28
|
+
}, S = (e, n, l, a, s) => {
|
|
29
|
+
e === h.name && (a[h.name] > 1 && s.push(t.OnlyOneElseBlockExpected), (n === 0 || n !== l - 1) && s.push(t.InvalidElseBlockOrdinal));
|
|
30
|
+
}, C = (e, n, l) => {
|
|
31
|
+
e === f.name && n === 0 && l.push(t.InvalidElseIfBlockOrdinal);
|
|
32
|
+
}, b = (e, n) => {
|
|
33
|
+
e !== o.name && e !== f.name && e !== h.name && n.push(t.InvalidElement);
|
|
34
|
+
};
|
|
35
|
+
class _ {
|
|
36
|
+
static get(n) {
|
|
37
|
+
let l;
|
|
38
|
+
switch (n) {
|
|
39
|
+
case B.name:
|
|
40
|
+
l = y;
|
|
41
|
+
break;
|
|
42
|
+
case o.name:
|
|
43
|
+
case f.name:
|
|
44
|
+
case h.name:
|
|
45
|
+
l = x;
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
l = () => [];
|
|
49
|
+
}
|
|
50
|
+
return l;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const E = (e, n) => {
|
|
54
|
+
const { children: l } = e, a = r.toArray(l);
|
|
55
|
+
return _.get(n)(a);
|
|
56
|
+
}, F = (e) => {
|
|
57
|
+
const n = E(e, B.name);
|
|
58
|
+
if (n.length)
|
|
59
|
+
return { children: O(m, { errors: n }) };
|
|
60
|
+
const { children: l } = e;
|
|
61
|
+
return { children: r.toArray(l).reduce((d, c) => {
|
|
62
|
+
var k, p;
|
|
63
|
+
return (k = d == null ? void 0 : d.props) != null && k.condition ? d : (p = c == null ? void 0 : c.props) != null && p.condition || (c == null ? void 0 : c.type.name) === "Else" ? c : d;
|
|
64
|
+
}, null) };
|
|
65
|
+
}, B = (e) => {
|
|
66
|
+
const { children: n } = F(e);
|
|
67
|
+
return /* @__PURE__ */ i(I, { children: n });
|
|
68
|
+
}, o = (e) => {
|
|
69
|
+
const n = E(e, o.name), l = n.length === 0 ? e.children : /* @__PURE__ */ i(m, { errors: n });
|
|
70
|
+
return /* @__PURE__ */ i(I, { children: l });
|
|
71
|
+
}, f = (e) => {
|
|
72
|
+
const n = E(e, f.name), l = n.length === 0 ? e.children : /* @__PURE__ */ i(m, { errors: n });
|
|
73
|
+
return /* @__PURE__ */ i(I, { children: l });
|
|
74
|
+
}, h = (e) => {
|
|
75
|
+
const n = E(e, h.name), l = n.length === 0 ? e.children : /* @__PURE__ */ i(m, { errors: n });
|
|
76
|
+
return /* @__PURE__ */ i(I, { children: l });
|
|
77
|
+
};
|
|
78
|
+
export {
|
|
79
|
+
u as ERRORS,
|
|
80
|
+
h as Else,
|
|
81
|
+
f as ElseIf,
|
|
82
|
+
m as Errors,
|
|
83
|
+
o as If,
|
|
84
|
+
t as LogicErrors,
|
|
85
|
+
B as SwitchIf,
|
|
86
|
+
_ as ValidationFactory,
|
|
87
|
+
E as useValidate
|
|
88
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(d,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],a):(d=typeof globalThis<"u"?globalThis:d||self,a(d["ts-react-directives"]={},d["react/jsx-runtime"],d.React))})(this,function(d,a,r){"use strict";var t=(e=>(e[e.IfBlockExpected=2001]="IfBlockExpected",e[e.OnlyOneIfBlockExpected=2002]="OnlyOneIfBlockExpected",e[e.OnlyOneElseBlockExpected=2003]="OnlyOneElseBlockExpected",e[e.SwitchBlockExpected=2005]="SwitchBlockExpected",e[e.InvalidIfBlockOrdinal=2004]="InvalidIfBlockOrdinal",e[e.InvalidElseBlockOrdinal=2006]="InvalidElseBlockOrdinal",e[e.InvalidElseIfBlockOrdinal=2007]="InvalidElseIfBlockOrdinal",e[e.InvalidElement=3002]="InvalidElement",e[e.ChildrenExpected=3003]="ChildrenExpected",e))(t||{});const m={[t.IfBlockExpected]:"Missing 'If'",[t.OnlyOneIfBlockExpected]:"Can only have one 'If'",[t.OnlyOneElseBlockExpected]:"Can only have one 'Else'",[t.SwitchBlockExpected]:"'If', 'ElseIf', 'Else' need to be wrapped in 'Switch'",[t.InvalidElseBlockOrdinal]:"Invalid ordinals, 'Else' should be the last",[t.InvalidIfBlockOrdinal]:"Invalid ordinals, 'If' block should be the first",[t.InvalidElseIfBlockOrdinal]:"Invalid ordinals, cannot have 'ElseIf' before 'If'",[t.ChildrenExpected]:"Should at least have one child",[t.InvalidElement]:"Invalid element"},E=({errors:e})=>a.jsx("ol",{className:"error-list",children:e.map((n,l)=>a.jsx("li",{children:m[n]},`${n}-${l}`))}),u=e=>{const n=[];return e.length===0?(n.push(t.ChildrenExpected),n):(e.forEach(l=>{const i=r.isValidElement(l)?l.type.name:"unknown";(i===o.name||i===I.name||i===f.name)&&n.push(t.SwitchBlockExpected)}),n)},y=e=>{const n=[],l={};return e.length===0?(n.push(t.ChildrenExpected,t.IfBlockExpected),n):(e.forEach((i,h)=>{const c=r.isValidElement(i)?i.type.name:"unknown",s=l[c]??0;l[c]=s+1,S(c,h,l,n),w(c,h,e.length,l,n),x(c,h,n),C(c,n)}),l[o.name]||n.push(t.IfBlockExpected),n)},S=(e,n,l,i)=>{e===o.name&&(n!==0&&i.push(t.InvalidIfBlockOrdinal),l[o.name]>1&&i.push(t.OnlyOneIfBlockExpected))},w=(e,n,l,i,h)=>{e===f.name&&(i[f.name]>1&&h.push(t.OnlyOneElseBlockExpected),(n===0||n!==l-1)&&h.push(t.InvalidElseBlockOrdinal))},x=(e,n,l)=>{e===I.name&&n===0&&l.push(t.InvalidElseIfBlockOrdinal)},C=(e,n)=>{e!==o.name&&e!==I.name&&e!==f.name&&n.push(t.InvalidElement)};class p{static get(n){let l;switch(n){case v.name:l=y;break;case o.name:case I.name:case f.name:l=u;break;default:l=()=>[]}return l}}const k=(e,n)=>{const{children:l}=e,i=r.Children.toArray(l);return p.get(n)(i)},b=e=>{const n=k(e,v.name);if(n.length)return{children:r.createElement(E,{errors:n})};const{children:l}=e;return{children:r.Children.toArray(l).reduce((c,s)=>{var B,O;return(B=c==null?void 0:c.props)!=null&&B.condition?c:(O=s==null?void 0:s.props)!=null&&O.condition||(s==null?void 0:s.type.name)==="Else"?s:c},null)}},v=e=>{const{children:n}=b(e);return a.jsx(a.Fragment,{children:n})},o=e=>{const n=k(e,o.name),l=n.length===0?e.children:a.jsx(E,{errors:n});return a.jsx(a.Fragment,{children:l})},I=e=>{const n=k(e,I.name),l=n.length===0?e.children:a.jsx(E,{errors:n});return a.jsx(a.Fragment,{children:l})},f=e=>{const n=k(e,f.name),l=n.length===0?e.children:a.jsx(E,{errors:n});return a.jsx(a.Fragment,{children:l})};d.ERRORS=m,d.Else=f,d.ElseIf=I,d.Errors=E,d.If=o,d.LogicErrors=t,d.SwitchIf=v,d.ValidationFactory=p,d.useValidate=k,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare type SwitchIfProps<T extends React.ReactNode = any> = React.PropsWithChildren<T>;
|
|
2
|
+
declare type IfProps<T extends React.ReactNode = any> = React.PropsWithChildren<T> & { condition: boolean };
|
|
3
|
+
declare type ElseIfProps<T extends React.ReactNode = any> = IfProps<T>;
|
|
4
|
+
declare type ElseProps<T extends React.ReactNode = any> = React.PropsWithChildren<T>;
|
|
5
|
+
|
|
6
|
+
declare type ValidatorFn = (children: Array<Exclude<React.ReactNode, boolean | null | undefined>>) => number[];
|
|
7
|
+
|
|
8
|
+
declare type ErrorProps = { errors: number[] };
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@openbytes/ts-react-directives",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"author": {
|
|
6
|
+
"name": "SkyCodr (aka: Dulan Sudasinghe)",
|
|
7
|
+
"email": "dulan81@gmail.com"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"main": "dist/ts-react-directives.umd.js",
|
|
13
|
+
"module": "dist/ts-react-directives.es.js",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"import": "./dist/ts-react-directives.es.js",
|
|
17
|
+
"require": "./dist/ts-react-directives.umd.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"types": "dist/types/index.d.ts",
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"react": "^19.0.0",
|
|
23
|
+
"react-dom": "^19.0.0"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@commitlint/cli": "^19.7.1",
|
|
27
|
+
"@commitlint/config-conventional": "^19.7.1",
|
|
28
|
+
"@eslint/js": "^9.19.0",
|
|
29
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
30
|
+
"@testing-library/react": "^16.2.0",
|
|
31
|
+
"@types/react": "^19.0.8",
|
|
32
|
+
"@types/react-dom": "^19.0.3",
|
|
33
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
34
|
+
"@vitest/coverage-v8": "^3.0.5",
|
|
35
|
+
"@vitest/ui": "^3.0.5",
|
|
36
|
+
"eslint": "^9.19.0",
|
|
37
|
+
"eslint-config-prettier": "^10.0.1",
|
|
38
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
39
|
+
"eslint-plugin-react": "^7.37.4",
|
|
40
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
41
|
+
"eslint-plugin-react-refresh": "^0.4.18",
|
|
42
|
+
"globals": "^15.14.0",
|
|
43
|
+
"husky": "^9.1.7",
|
|
44
|
+
"jsdom": "^26.0.0",
|
|
45
|
+
"lint-staged": "^15.4.3",
|
|
46
|
+
"prettier": "^3.4.2",
|
|
47
|
+
"typescript": "~5.7.2",
|
|
48
|
+
"typescript-eslint": "^8.22.0",
|
|
49
|
+
"vite": "^6.1.0",
|
|
50
|
+
"vite-plugin-static-copy": "^2.2.0",
|
|
51
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
52
|
+
"vitest": "^3.0.5"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"react": "^19.0.0",
|
|
56
|
+
"react-dom": "^19.0.0"
|
|
57
|
+
},
|
|
58
|
+
"publishConfig": {
|
|
59
|
+
"access": "public"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"dev": "vite",
|
|
63
|
+
"build": "tsc -b && vite build",
|
|
64
|
+
"lint": "eslint src/**/*.{ts,tsx}",
|
|
65
|
+
"lint:fix": "eslint --fix src/**/*.{ts,tsx}",
|
|
66
|
+
"format:fix": "prettier --write src/**/*.{ts,tsx}",
|
|
67
|
+
"format:check": "prettier --check src/**/*.{ts,tsx}",
|
|
68
|
+
"preview": "vite preview",
|
|
69
|
+
"test": "vitest",
|
|
70
|
+
"test:ui": "vitest --ui",
|
|
71
|
+
"test:coverage": "vitest --coverage",
|
|
72
|
+
"prepublish": "pnpm run build"
|
|
73
|
+
}
|
|
74
|
+
}
|