@teambit/generator 1.0.258 → 1.0.259

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <testsuites tests="0" failures="0" errors="0" skipped="0">
3
- <testsuite name="teambit.generator/generator@1.0.258" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.generator/generator@1.0.259" tests="0" failures="0" errors="0" skipped="0"/>
4
4
  </testsuites>
@@ -1 +1 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.generator/generator-preview"]=t():e["teambit.generator/generator-preview"]=t()}(self,(()=>(()=>{"use strict";var e={40107:(e,t,n)=>{var o={id:"teambit.generator/aspect-docs/generator@0.0.171",homepage:"https://bit.cloud/teambit/generator/aspect-docs/generator",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=c,l(n(41594));var a=n(5016),r=["components"];function l(e){return e&&e.__esModule?e:{default:e}}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},p.apply(this,arguments)}function m(e,t){if(null==e)return{};var n,o,a=i(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function i(e,t){if(null==e)return{};var n,o,a={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}l.__bit_component=o,p.__bit_component=o,m.__bit_component=o,i.__bit_component=o;var s={},d="wrapper";function c(e){var t=e.components,n=m(e,r);return(0,a.mdx)(d,p({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.mdx)("p",null,"Generator extension enable generating new components by pre-defined templates"),(0,a.mdx)("h3",null,"Component location"),(0,a.mdx)("p",null,"Component location in the workspace directory tree is defined with the ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit create")," command (see below). For example, a component named ",(0,a.mdx)("inlineCode",{parentName:"p"},"ShoppingCart")," created in the ",(0,a.mdx)("inlineCode",{parentName:"p"},"acme.shopper")," and the namespace ",(0,a.mdx)("inlineCode",{parentName:"p"},"ui")," will be generated in the following directory:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre"},"acme.shopper/ui/shopping-cart\n")),(0,a.mdx)("h3",null,"Component name"),(0,a.mdx)("p",null,"When using templates Bit will use CamelCasing for passing the component-name to the template, but generated file structure should be in kebab-case, for better cross-operating-system compatibility of the component."),(0,a.mdx)("h3",null,"Automatically ",(0,a.mdx)("inlineCode",{parentName:"h3"},"add")," component"),(0,a.mdx)("p",null,"Bit should automatically register the new component to the ",(0,a.mdx)("inlineCode",{parentName:"p"},".bitmap")," file with a symmetrical name to the component-location in the workspace."),(0,a.mdx)("h2",null,"Register a template"),(0,a.mdx)("p",null,"Any aspect (include envs) can register templates. Each template should have a name and a list of files. Each file has a relative-path to the component-dir and template content. See the ",(0,a.mdx)("inlineCode",{parentName:"p"},"component-template.ts")," file for more info about the exact API."),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},"Component name should be available as a param for the file-content-template."),(0,a.mdx)("li",{parentName:"ul"},"TBD: An environment must have a default template (if not set, use first template in array?).")),(0,a.mdx)("p",null,"To register a template, use the Generator API: ",(0,a.mdx)("inlineCode",{parentName:"p"},"registerComponentTemplate(templates: ComponentTemplate[])"),"."),(0,a.mdx)("p",null,"To make the templates of an aspect available on a workspace, they need to be added to the workspace.jsonc. For example:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-json"},'"teambit.generator/generator": {\n "aspects": [\n "teambit.harmony/aspect"\n ]\n },\n')),(0,a.mdx)("p",null,"In the example above, the aspect ",(0,a.mdx)("inlineCode",{parentName:"p"},"teambit.harmony/aspect")," is configured to be available for the generator."),(0,a.mdx)("h2",null,"Show all available templates"),(0,a.mdx)("p",null,"Introduce a new command ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit templates"),", which groups all available templates by aspects."),(0,a.mdx)("h2",null,"Hide core templates"),(0,a.mdx)("p",null,"Configure the Generator aspect to hide core templates when running ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit templates"),". They'll be only shown when using ",(0,a.mdx)("inlineCode",{parentName:"p"},"--show-all")," flag."),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-json"},'"teambit.generator/generator": {\n "hideCoreTemplates": true\n },\n')),(0,a.mdx)("h2",null,"Generate a template from CLI"),(0,a.mdx)("p",null,"Introduce a ",(0,a.mdx)("inlineCode",{parentName:"p"},"create")," command to use templates."),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-sh"},"bit create <template-name> <component-name...> [--scope | -s] [--namespace | -n] [--aspect | -a]\n")),(0,a.mdx)("h3",null,"Args"),(0,a.mdx)("h4",null,(0,a.mdx)("inlineCode",{parentName:"h4"},"<component name>")),(0,a.mdx)("p",null,"Name of the component to create. Will be used as the component's dir name and fed to the component template."),(0,a.mdx)("p",null,(0,a.mdx)("strong",{parentName:"p"},"generated file structure should use kebab-case, while the template itself be in camel case"),"."),(0,a.mdx)("h3",null,"Options"),(0,a.mdx)("h4",null,(0,a.mdx)("inlineCode",{parentName:"h4"},"[--scope | -s]")),(0,a.mdx)("p",null,"Sets the component's scope and base directory. If not defined, use the ",(0,a.mdx)("inlineCode",{parentName:"p"},"defaultScope")," from ",(0,a.mdx)("inlineCode",{parentName:"p"},"teambit.workspace/workspace")," config."),(0,a.mdx)("h4",null,(0,a.mdx)("inlineCode",{parentName:"h4"},"[--namespace | -n]")),(0,a.mdx)("p",null,"Sets the component's namespace and nested dirs inside the scope. If not define, use empty string."),(0,a.mdx)("h4",null,(0,a.mdx)("inlineCode",{parentName:"h4"},"[--aspect | -a]")),(0,a.mdx)("p",null,"Aspect ID that registered this template, required only if there are two templates with the same name from several aspects in the workspace."),(0,a.mdx)("h2",null,"Creating a custom template generator"),(0,a.mdx)("p",null,"See our ",(0,a.mdx)("a",{parentName:"p",href:"https://harmony-docs.bit.dev/extending-bit/creating-a-custom-generator"},"tutorial")," on how to Create your own custom component generator."))}c.__bit_component=o,c.isMDXComponent=!0},14879:(e,t,n)=>{Object.defineProperty(t,"W",{enumerable:!0,get:function(){return o.default}});var o=a(n(40107));function a(e){return e&&e.__esModule?e:{default:e}}a.__bit_component={id:"teambit.generator/aspect-docs/generator@0.0.171",homepage:"https://bit.cloud/teambit/generator/aspect-docs/generator",exported:!0}},80934:(e,t,n)=>{var o={id:"teambit.generator/generator@1.0.258",homepage:"https://bit.cloud/teambit/generator/generator",exported:!0};function a(){const e=r(n(41594));return a=function(){return e},e}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,a.__bit_component=o,r.__bit_component=o;const l=()=>a().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},a().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/generator-new.svg"}));l.__bit_component=o,t.Logo=l},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{compositions:()=>c,compositions_metadata:()=>h,overview:()=>u});var e={};n.r(e),n.d(e,{default:()=>d});var t=n(80934),a=(n(41594),n(5016));const r=TeambitMdxUiMdxScopeContext;var l=n(14879),p=["components"];function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},m.apply(this,arguments)}var i={},s="wrapper";function d(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,a=function(e,t){if(null==e)return{};var n,o,a={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,p);return(0,a.mdx)(s,m({},i,n,{components:t,mdxType:"MDXLayout"}),(0,a.mdx)(r.MDXScopeProvider,{components:{Generator:l.W},mdxType:"MDXScopeProvider"},(0,a.mdx)(l.W,{mdxType:"Generator"})))}d.isMDXComponent=!0;const c=[t],u=[e],h={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["teambit.generator/generator-preview"]=t():e["teambit.generator/generator-preview"]=t()}(self,(()=>(()=>{"use strict";var e={29820:(e,t,n)=>{var o={id:"teambit.generator/aspect-docs/generator@0.0.171",homepage:"https://bit.cloud/teambit/generator/aspect-docs/generator",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=c,l(n(41594));var a=n(5016),r=["components"];function l(e){return e&&e.__esModule?e:{default:e}}function p(){return p=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},p.apply(this,arguments)}function m(e,t){if(null==e)return{};var n,o,a=i(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function i(e,t){if(null==e)return{};var n,o,a={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}l.__bit_component=o,p.__bit_component=o,m.__bit_component=o,i.__bit_component=o;var s={},d="wrapper";function c(e){var t=e.components,n=m(e,r);return(0,a.mdx)(d,p({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.mdx)("p",null,"Generator extension enable generating new components by pre-defined templates"),(0,a.mdx)("h3",null,"Component location"),(0,a.mdx)("p",null,"Component location in the workspace directory tree is defined with the ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit create")," command (see below). For example, a component named ",(0,a.mdx)("inlineCode",{parentName:"p"},"ShoppingCart")," created in the ",(0,a.mdx)("inlineCode",{parentName:"p"},"acme.shopper")," and the namespace ",(0,a.mdx)("inlineCode",{parentName:"p"},"ui")," will be generated in the following directory:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre"},"acme.shopper/ui/shopping-cart\n")),(0,a.mdx)("h3",null,"Component name"),(0,a.mdx)("p",null,"When using templates Bit will use CamelCasing for passing the component-name to the template, but generated file structure should be in kebab-case, for better cross-operating-system compatibility of the component."),(0,a.mdx)("h3",null,"Automatically ",(0,a.mdx)("inlineCode",{parentName:"h3"},"add")," component"),(0,a.mdx)("p",null,"Bit should automatically register the new component to the ",(0,a.mdx)("inlineCode",{parentName:"p"},".bitmap")," file with a symmetrical name to the component-location in the workspace."),(0,a.mdx)("h2",null,"Register a template"),(0,a.mdx)("p",null,"Any aspect (include envs) can register templates. Each template should have a name and a list of files. Each file has a relative-path to the component-dir and template content. See the ",(0,a.mdx)("inlineCode",{parentName:"p"},"component-template.ts")," file for more info about the exact API."),(0,a.mdx)("ul",null,(0,a.mdx)("li",{parentName:"ul"},"Component name should be available as a param for the file-content-template."),(0,a.mdx)("li",{parentName:"ul"},"TBD: An environment must have a default template (if not set, use first template in array?).")),(0,a.mdx)("p",null,"To register a template, use the Generator API: ",(0,a.mdx)("inlineCode",{parentName:"p"},"registerComponentTemplate(templates: ComponentTemplate[])"),"."),(0,a.mdx)("p",null,"To make the templates of an aspect available on a workspace, they need to be added to the workspace.jsonc. For example:"),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-json"},'"teambit.generator/generator": {\n "aspects": [\n "teambit.harmony/aspect"\n ]\n },\n')),(0,a.mdx)("p",null,"In the example above, the aspect ",(0,a.mdx)("inlineCode",{parentName:"p"},"teambit.harmony/aspect")," is configured to be available for the generator."),(0,a.mdx)("h2",null,"Show all available templates"),(0,a.mdx)("p",null,"Introduce a new command ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit templates"),", which groups all available templates by aspects."),(0,a.mdx)("h2",null,"Hide core templates"),(0,a.mdx)("p",null,"Configure the Generator aspect to hide core templates when running ",(0,a.mdx)("inlineCode",{parentName:"p"},"bit templates"),". They'll be only shown when using ",(0,a.mdx)("inlineCode",{parentName:"p"},"--show-all")," flag."),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-json"},'"teambit.generator/generator": {\n "hideCoreTemplates": true\n },\n')),(0,a.mdx)("h2",null,"Generate a template from CLI"),(0,a.mdx)("p",null,"Introduce a ",(0,a.mdx)("inlineCode",{parentName:"p"},"create")," command to use templates."),(0,a.mdx)("pre",null,(0,a.mdx)("code",{parentName:"pre",className:"language-sh"},"bit create <template-name> <component-name...> [--scope | -s] [--namespace | -n] [--aspect | -a]\n")),(0,a.mdx)("h3",null,"Args"),(0,a.mdx)("h4",null,(0,a.mdx)("inlineCode",{parentName:"h4"},"<component name>")),(0,a.mdx)("p",null,"Name of the component to create. Will be used as the component's dir name and fed to the component template."),(0,a.mdx)("p",null,(0,a.mdx)("strong",{parentName:"p"},"generated file structure should use kebab-case, while the template itself be in camel case"),"."),(0,a.mdx)("h3",null,"Options"),(0,a.mdx)("h4",null,(0,a.mdx)("inlineCode",{parentName:"h4"},"[--scope | -s]")),(0,a.mdx)("p",null,"Sets the component's scope and base directory. If not defined, use the ",(0,a.mdx)("inlineCode",{parentName:"p"},"defaultScope")," from ",(0,a.mdx)("inlineCode",{parentName:"p"},"teambit.workspace/workspace")," config."),(0,a.mdx)("h4",null,(0,a.mdx)("inlineCode",{parentName:"h4"},"[--namespace | -n]")),(0,a.mdx)("p",null,"Sets the component's namespace and nested dirs inside the scope. If not define, use empty string."),(0,a.mdx)("h4",null,(0,a.mdx)("inlineCode",{parentName:"h4"},"[--aspect | -a]")),(0,a.mdx)("p",null,"Aspect ID that registered this template, required only if there are two templates with the same name from several aspects in the workspace."),(0,a.mdx)("h2",null,"Creating a custom template generator"),(0,a.mdx)("p",null,"See our ",(0,a.mdx)("a",{parentName:"p",href:"https://harmony-docs.bit.dev/extending-bit/creating-a-custom-generator"},"tutorial")," on how to Create your own custom component generator."))}c.__bit_component=o,c.isMDXComponent=!0},75520:(e,t,n)=>{Object.defineProperty(t,"W",{enumerable:!0,get:function(){return o.default}});var o=a(n(29820));function a(e){return e&&e.__esModule?e:{default:e}}a.__bit_component={id:"teambit.generator/aspect-docs/generator@0.0.171",homepage:"https://bit.cloud/teambit/generator/aspect-docs/generator",exported:!0}},52768:(e,t,n)=>{var o={id:"teambit.generator/generator@1.0.259",homepage:"https://bit.cloud/teambit/generator/generator",exported:!0};function a(){const e=r(n(41594));return a=function(){return e},e}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,a.__bit_component=o,r.__bit_component=o;const l=()=>a().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},a().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/generator-new.svg"}));l.__bit_component=o,t.Logo=l},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},t={};function n(o){var a=t[o];if(void 0!==a)return a.exports;var r=t[o]={exports:{}};return e[o](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{compositions:()=>c,compositions_metadata:()=>h,overview:()=>u});var e={};n.r(e),n.d(e,{default:()=>d});var t=n(52768),a=(n(41594),n(5016));const r=TeambitMdxUiMdxScopeContext;var l=n(75520),p=["components"];function m(){return m=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},m.apply(this,arguments)}var i={},s="wrapper";function d(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,o,a=function(e,t){if(null==e)return{};var n,o,a={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}(e,p);return(0,a.mdx)(s,m({},i,n,{components:t,mdxType:"MDXLayout"}),(0,a.mdx)(r.MDXScopeProvider,{components:{Generator:l.W},mdxType:"MDXScopeProvider"},(0,a.mdx)(l.W,{mdxType:"Generator"})))}d.isMDXComponent=!0;const c=[t],u=[e],h={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));