@tiptap/cli 3.11.0 → 3.11.1
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/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -345,5 +345,5 @@ The built-in AI tools let you:
|
|
|
345
345
|
|
|
346
346
|
## Extendability
|
|
347
347
|
|
|
348
|
-
This template is designed to grow with your needs. New Tiptap Cloud features will be seamlessly compatible with the same UI system\u2014no rewrites required.`;async function _n(e,t){let n=te.join(e,"README.md"),r={"simple-editor":ps,"notion-like-editor":ms},s=t&&t in r?r[t]:"";try{s.trim()&&await K.writeFile(n,s,"utf-8")}catch{}}var gs=H.object({cwd:H.string(),components:H.array(H.string()).optional(),silent:H.boolean(),isNewProject:H.boolean(),srcDir:H.boolean().optional(),reactCompiler:H.boolean().optional(),framework:H.string().optional().refine(e=>!e||ke[e],{message:"Invalid framework. Please use 'next' or 'vite'."})}),$t=(e,t=!0)=>fs({message:a.reset(e),default:t,theme:{prefix:{done:a.cyan("\u2714"),idle:"?"}}}),Fn=new ds().name("init").description("initialize your project and install Tiptap UI components as source code").argument("[components...]","the components to add").option("-f, --framework <framework>","the framework to use. (next, vite)").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-s, --silent","mute output.",!1).option("--src-dir","use the src directory when creating a new project (specific to next).",!1).option("--react-compiler","enable React Compiler when creating a new project (specific to next).",!1).action(async(e,t)=>{try{Ge();let n=Je("Tiptap UI Components","Install UI components or templates as editable source code in your project");G(n);let r=Ye("What are Tiptap UI Components?",["React UI components that help you develop an editor","They install as source code (not npm packages) in your src/components/","UI components are a foundation for customization rather than a fixed library"]);G(r),await us({message:a.reset(`Press ${a.cyan("Enter")} to initialize a project...`),theme:{prefix:{done:"",idle:""}}}),o.log("");let s=gs.parse({cwd:On.resolve(t.cwd),isNewProject:!1,components:e,...t}),i=await hs(s),c=(i?.filesCreated?.length||0)+(i?.filesUpdated?.length||0)+(i?.filesSkipped?.length||0);if(i&&c>0){let p=[...i.filesCreated||[],...i.filesUpdated||[],...i.filesSkipped||[]],l=p.some(d=>d.includes("notion")),w=p.some(d=>d.includes("simple")&&d.includes("editor"));if(l){o.log(""),i.filesCreated.length>0?o.log(`${a.green("\u2714")} Notion template installed - ${i.filesCreated.length} files added to ${a.cyan("src/components/")}`):o.log(`${a.green("\u2714")} Notion template already installed - ${i.filesSkipped.length} files skipped`),o.log("");let d=i.framework||i.projectInfo?.framework;if(d){let h=await Q({filesCreated:i.filesCreated,filesUpdated:i.filesUpdated,filesSkipped:i.filesSkipped},i.config,d);ee(h),h.success?He(d):Xe(d,i.config)}}else if(w){o.log(""),i.filesCreated.length>0?o.log(`${a.green("\u2714")} Simple editor template installed - ${i.filesCreated.length} files added to ${a.cyan("src/components/")}`):o.log(`${a.green("\u2714")} Simple editor template already installed - ${i.filesSkipped.length} files skipped`),o.log("");let d=i.framework||i.projectInfo?.framework;if(d){let h=await Q({filesCreated:i.filesCreated,filesUpdated:i.filesUpdated,filesSkipped:i.filesSkipped},i.config,d);ee(h),h.success||we(d,i.config)}}else{if(o.log(""),i.filesCreated.length>0?o.log(`${a.green("\u2714")} Components installed - ${i.filesCreated.length} files added to ${a.cyan("src/components/")}`):i.filesSkipped.length>0&&o.log(`${a.green("\u2714")} Components already installed - ${i.filesSkipped.length} files skipped`),o.log(""),i?.projectInfo?.framework){let h=await Q({filesCreated:i.filesCreated,filesUpdated:i.filesUpdated,filesSkipped:i.filesSkipped},i.config,i.projectInfo.framework);ee(h),h.success||we(i?.projectInfo?.framework,i.config)}i.selectedComponents?.includes("table-node")&&Ze()}}o.break()}catch(n){o.break(),_(n)}});async function hs(e){let{cwd:t,skipPreflight:n,components:r,silent:s}=e,i={...e},c,p=(b,A,F=[],D)=>({config:b,projectInfo:A,framework:c,selectedComponents:F,filesCreated:D?.filesCreated||[],filesUpdated:D?.filesUpdated||[],filesSkipped:D?.filesSkipped||[],errors:[]}),l;if(n)l=await U(t);else{let b=await Nn(e);if(b.errors["1"]){let{projectPath:F,framework:D}=await jn(e);F||process.exit(0),i={...i,cwd:F,isNewProject:!0},c=D,o.log("")}l=b.projectInfo}if(c==="next-monorepo"){let b=On.resolve(i.cwd,"apps/web"),A=await Y(b);return p(A,l)}let w=await Lt(i.cwd,l),d=w?await ws(w):await ys(await Y(i.cwd));o.log("");let h=r||[];if(!h.length){if(!await $t("Would you like to add a template or UI components to your project?")){let A=await re(i.cwd,d);return p(A,l)}if(h=await Et({...i,overwrite:!1},!0),!h.length){let A=await re(i.cwd,d);return p(A,l)}}let u;try{if(u=await Z(),!u)throw new Error("Failed to fetch registry index.")}catch(b){if(b instanceof Error&&b.message.includes("You are not authorized")){let A=h.map(D=>({name:D,plans:["start"]}));if(await ye(A,i.cwd)||(o.error("Authentication failed. Cannot proceed with paid component download."),o.log("You can try again with only free components, or authenticate first."),process.exit(1)),u=await Z(),!u)throw new Error("Failed to fetch registry index after authentication.")}else throw b}let k=h.map(b=>{let A=u.find(F=>F.name===b);return{name:b,plans:A?.plans||[]}});await ye(k,i.cwd)||(o.error("Authentication failed. Cannot proceed with paid component download."),o.log("You can try again with only free components, or authenticate first."),process.exit(1));let x=await re(i.cwd,d),I=await Le(h,x,{overwrite:!1,silent:s,isNewProject:i.isNewProject||l?.framework.name==="next-app"});return p(x,l,h,I||{filesCreated:[],filesUpdated:[],filesSkipped:[]})}async function ys(e=null){o.log(""),o.log(a.cyan("Project Configuration")),o.log("");let t=await $t(`Would you like to use ${a.cyan("TypeScript")} (recommended)?`,e?.tsx??!0),n=await $t(`Are you using ${a.cyan("React Server Components")}?`,e?.rsc??!0);return oe.parse({rsc:n,tsx:t,aliases:{components:ot,contexts:st,hooks:it,tiptapIcons:at,lib:$e,tiptapExtensions:ct,tiptapNodes:lt,tiptapUi:pt,tiptapUiPrimitives:mt,tiptapUiUtils:dt,styles:ft}})}async function ws(e){return oe.parse({rsc:e?.rsc,tsx:e?.tsx,aliases:e?.aliases})}import{Command as ks}from"commander";var Dn={name:"@tiptap/cli",version:"3.11.
|
|
348
|
+
This template is designed to grow with your needs. New Tiptap Cloud features will be seamlessly compatible with the same UI system\u2014no rewrites required.`;async function _n(e,t){let n=te.join(e,"README.md"),r={"simple-editor":ps,"notion-like-editor":ms},s=t&&t in r?r[t]:"";try{s.trim()&&await K.writeFile(n,s,"utf-8")}catch{}}var gs=H.object({cwd:H.string(),components:H.array(H.string()).optional(),silent:H.boolean(),isNewProject:H.boolean(),srcDir:H.boolean().optional(),reactCompiler:H.boolean().optional(),framework:H.string().optional().refine(e=>!e||ke[e],{message:"Invalid framework. Please use 'next' or 'vite'."})}),$t=(e,t=!0)=>fs({message:a.reset(e),default:t,theme:{prefix:{done:a.cyan("\u2714"),idle:"?"}}}),Fn=new ds().name("init").description("initialize your project and install Tiptap UI components as source code").argument("[components...]","the components to add").option("-f, --framework <framework>","the framework to use. (next, vite)").option("-c, --cwd <cwd>","the working directory. defaults to the current directory.",process.cwd()).option("-s, --silent","mute output.",!1).option("--src-dir","use the src directory when creating a new project (specific to next).",!1).option("--react-compiler","enable React Compiler when creating a new project (specific to next).",!1).action(async(e,t)=>{try{Ge();let n=Je("Tiptap UI Components","Install UI components or templates as editable source code in your project");G(n);let r=Ye("What are Tiptap UI Components?",["React UI components that help you develop an editor","They install as source code (not npm packages) in your src/components/","UI components are a foundation for customization rather than a fixed library"]);G(r),await us({message:a.reset(`Press ${a.cyan("Enter")} to initialize a project...`),theme:{prefix:{done:"",idle:""}}}),o.log("");let s=gs.parse({cwd:On.resolve(t.cwd),isNewProject:!1,components:e,...t}),i=await hs(s),c=(i?.filesCreated?.length||0)+(i?.filesUpdated?.length||0)+(i?.filesSkipped?.length||0);if(i&&c>0){let p=[...i.filesCreated||[],...i.filesUpdated||[],...i.filesSkipped||[]],l=p.some(d=>d.includes("notion")),w=p.some(d=>d.includes("simple")&&d.includes("editor"));if(l){o.log(""),i.filesCreated.length>0?o.log(`${a.green("\u2714")} Notion template installed - ${i.filesCreated.length} files added to ${a.cyan("src/components/")}`):o.log(`${a.green("\u2714")} Notion template already installed - ${i.filesSkipped.length} files skipped`),o.log("");let d=i.framework||i.projectInfo?.framework;if(d){let h=await Q({filesCreated:i.filesCreated,filesUpdated:i.filesUpdated,filesSkipped:i.filesSkipped},i.config,d);ee(h),h.success?He(d):Xe(d,i.config)}}else if(w){o.log(""),i.filesCreated.length>0?o.log(`${a.green("\u2714")} Simple editor template installed - ${i.filesCreated.length} files added to ${a.cyan("src/components/")}`):o.log(`${a.green("\u2714")} Simple editor template already installed - ${i.filesSkipped.length} files skipped`),o.log("");let d=i.framework||i.projectInfo?.framework;if(d){let h=await Q({filesCreated:i.filesCreated,filesUpdated:i.filesUpdated,filesSkipped:i.filesSkipped},i.config,d);ee(h),h.success||we(d,i.config)}}else{if(o.log(""),i.filesCreated.length>0?o.log(`${a.green("\u2714")} Components installed - ${i.filesCreated.length} files added to ${a.cyan("src/components/")}`):i.filesSkipped.length>0&&o.log(`${a.green("\u2714")} Components already installed - ${i.filesSkipped.length} files skipped`),o.log(""),i?.projectInfo?.framework){let h=await Q({filesCreated:i.filesCreated,filesUpdated:i.filesUpdated,filesSkipped:i.filesSkipped},i.config,i.projectInfo.framework);ee(h),h.success||we(i?.projectInfo?.framework,i.config)}i.selectedComponents?.includes("table-node")&&Ze()}}o.break()}catch(n){o.break(),_(n)}});async function hs(e){let{cwd:t,skipPreflight:n,components:r,silent:s}=e,i={...e},c,p=(b,A,F=[],D)=>({config:b,projectInfo:A,framework:c,selectedComponents:F,filesCreated:D?.filesCreated||[],filesUpdated:D?.filesUpdated||[],filesSkipped:D?.filesSkipped||[],errors:[]}),l;if(n)l=await U(t);else{let b=await Nn(e);if(b.errors["1"]){let{projectPath:F,framework:D}=await jn(e);F||process.exit(0),i={...i,cwd:F,isNewProject:!0},c=D,o.log("")}l=b.projectInfo}if(c==="next-monorepo"){let b=On.resolve(i.cwd,"apps/web"),A=await Y(b);return p(A,l)}let w=await Lt(i.cwd,l),d=w?await ws(w):await ys(await Y(i.cwd));o.log("");let h=r||[];if(!h.length){if(!await $t("Would you like to add a template or UI components to your project?")){let A=await re(i.cwd,d);return p(A,l)}if(h=await Et({...i,overwrite:!1},!0),!h.length){let A=await re(i.cwd,d);return p(A,l)}}let u;try{if(u=await Z(),!u)throw new Error("Failed to fetch registry index.")}catch(b){if(b instanceof Error&&b.message.includes("You are not authorized")){let A=h.map(D=>({name:D,plans:["start"]}));if(await ye(A,i.cwd)||(o.error("Authentication failed. Cannot proceed with paid component download."),o.log("You can try again with only free components, or authenticate first."),process.exit(1)),u=await Z(),!u)throw new Error("Failed to fetch registry index after authentication.")}else throw b}let k=h.map(b=>{let A=u.find(F=>F.name===b);return{name:b,plans:A?.plans||[]}});await ye(k,i.cwd)||(o.error("Authentication failed. Cannot proceed with paid component download."),o.log("You can try again with only free components, or authenticate first."),process.exit(1));let x=await re(i.cwd,d),I=await Le(h,x,{overwrite:!1,silent:s,isNewProject:i.isNewProject||l?.framework.name==="next-app"});return p(x,l,h,I||{filesCreated:[],filesUpdated:[],filesSkipped:[]})}async function ys(e=null){o.log(""),o.log(a.cyan("Project Configuration")),o.log("");let t=await $t(`Would you like to use ${a.cyan("TypeScript")} (recommended)?`,e?.tsx??!0),n=await $t(`Are you using ${a.cyan("React Server Components")}?`,e?.rsc??!0);return oe.parse({rsc:n,tsx:t,aliases:{components:ot,contexts:st,hooks:it,tiptapIcons:at,lib:$e,tiptapExtensions:ct,tiptapNodes:lt,tiptapUi:pt,tiptapUiPrimitives:mt,tiptapUiUtils:dt,styles:ft}})}async function ws(e){return oe.parse({rsc:e?.rsc,tsx:e?.tsx,aliases:e?.aliases})}import{Command as ks}from"commander";var Dn={name:"@tiptap/cli",version:"3.11.1",description:"Tiptap CLI",publishConfig:{access:"public"},author:{name:"tiptap",url:"https://github.com/ueberdosis/tiptap"},files:["dist"],keywords:["cli","components","nextjs","react","templates","tiptap","@tiptap/cli","ui"],license:"SEE LICENSE IN LICENSE.md",type:"module",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},bin:"./dist/index.js",scripts:{dev:"tsup --watch",build:"tsup",typecheck:"tsc --noEmit",clean:"rm -rf dist","start:dev":"cross-env REGISTRY_URL=http://localhost:3000 node dist/index.js","start:prod":"cross-env REGISTRY_URL=https://template.tiptap.dev node dist/index.js",start:"node dist/index.js","pub:beta":"pnpm build && pnpm publish --no-git-checks --access public --tag beta","pub:release":"pnpm build && pnpm publish --access public"},dependencies:{"@antfu/ni":"^23.3.1","@babel/core":"^7.28.5","@babel/parser":"^7.28.5","@babel/plugin-transform-typescript":"^7.28.5","@inquirer/core":"^10.3.2","@inquirer/figures":"^1.0.15","@inquirer/prompts":"^7.10.1","@inquirer/type":"^3.0.10","ansi-escapes":"^7.2.0",chalk:"^5.6.2",commander:"^13.1.0",conf:"^14.0.0",cosmiconfig:"^9.0.0",deepmerge:"^4.3.1",execa:"^9.6.1","fast-glob":"^3.3.3","fs-extra":"^11.3.3","https-proxy-agent":"^7.0.6","jsonc-parser":"^3.3.1","node-fetch":"^3.3.2",ora:"^8.2.0",recast:"^0.23.11",sass:"^1.97.2","ts-morph":"^25.0.1","tsconfig-paths":"^4.2.0",yaml:"^2.8.2","yoctocolors-cjs":"^2.1.3",zod:"^3.25.76"},devDependencies:{"@babel/plugin-transform-typescript":"^7.26.5","@types/babel__core":"^7.20.5","@types/conf":"^3.0.3","@types/fs-extra":"^11.0.4","@types/prompts":"^2.4.9","cross-env":"^7.0.3",tsup:"^8.5.1","type-fest":"^4.41.0"}};process.on("SIGINT",()=>process.exit(0));process.on("SIGTERM",()=>process.exit(0));async function Ps(){let e=new ks().name("tiptap").description("add components and dependencies to your project").version(Dn.version||"1.0.0","-v, --version","display the CLI version number");e.addCommand(Fn).addCommand(An).addCommand(En).addCommand(hn).addCommand(wn).addCommand(yn).addCommand(xn),e.parse()}Ps();
|
|
349
349
|
//# sourceMappingURL=index.js.map
|