import{appendFileSync as P,mkdirSync as p,writeFileSync as a}from"fs";import e from"path";import{CUSTOM_MARKDOC_TAGS_PATH as d,CUSTOM_MARKDOC_OPTIONS_PATH as l}from"../../constants/index.js";import{USER_THEME_ALIAS as C}from"../../server/config/constants.js";import{logger as T}from"../../server/utils/index.js";import{getComponentTemplate as O}from"./get-component-template.js";import{getComponentsFileTemplate as D}from"./get-components-file-template.js";import{getSchemaTemplate as E}from"./get-schema-template.js";import{isValidFilePath as f}from"./is-valid-file-path.js";import{capitalize as F}from"./string-utils.js";function K(h,o,m){const t=F(o),r=e.resolve(h,C),c=e.resolve(r,l,d),i=e.resolve(r,t),S=e.resolve(r,l,"components.ts"),s=e.resolve(i,`${t}.tsx`),n=e.resolve(c,`${o}.markdoc.ts`),g=!f(s,m),u=!f(n,m);if((g||u)&&!m)return;const v=O(t),_=E(o),A=D(t);p(i,{recursive:!0}),p(c,{recursive:!0}),a(n,_),T.success(`Generated schema: file://${n}`),a(s,v),T.success(`Generated component: file://${s}`),P(S,A)}export{K as generateTag};
