@teambit/generator 1.0.334 → 1.0.335

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.334" tests="0" failures="0" errors="0" skipped="0"/>
3
+ <testsuite name="teambit.generator/generator@1.0.335" 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={32734:(e,t,n)=>{var a={id:"teambit.generator/aspect-docs/generator@0.0.172",homepage:"https://bit.cloud/teambit/generator/aspect-docs/generator",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=c,l(n(41594));var o=n(5016),r=["components"];function l(e){return e&&e.__esModule?e:{default:e}}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 a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},m.apply(null,arguments)}function p(e,t){if(null==e)return{};var n,a,o=i(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function i(e,t){if(null==e)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;n[a]=e[a]}return n}l.__bit_component=a,m.__bit_component=a,p.__bit_component=a,i.__bit_component=a;var d={},s="wrapper";function c(e){var t=e.components,n=p(e,r);return(0,o.mdx)(s,m({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.mdx)("p",null,"Generator extension enable generating new components by pre-defined templates"),(0,o.mdx)("h3",null,"Component location"),(0,o.mdx)("p",null,"Component location in the workspace directory tree is defined with the ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit create")," command (see below). For example, a component named ",(0,o.mdx)("inlineCode",{parentName:"p"},"ShoppingCart")," created in the ",(0,o.mdx)("inlineCode",{parentName:"p"},"acme.shopper")," and the namespace ",(0,o.mdx)("inlineCode",{parentName:"p"},"ui")," will be generated in the following directory:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre"},"acme.shopper/ui/shopping-cart\n")),(0,o.mdx)("h3",null,"Component name"),(0,o.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,o.mdx)("h3",null,"Automatically ",(0,o.mdx)("inlineCode",{parentName:"h3"},"add")," component"),(0,o.mdx)("p",null,"Bit should automatically register the new component to the ",(0,o.mdx)("inlineCode",{parentName:"p"},".bitmap")," file with a symmetrical name to the component-location in the workspace."),(0,o.mdx)("h2",null,"Register a template"),(0,o.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,o.mdx)("inlineCode",{parentName:"p"},"component-template.ts")," file for more info about the exact API."),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},"Component name should be available as a param for the file-content-template."),(0,o.mdx)("li",{parentName:"ul"},"TBD: An environment must have a default template (if not set, use first template in array?).")),(0,o.mdx)("p",null,"To register a template, use the Generator API: ",(0,o.mdx)("inlineCode",{parentName:"p"},"registerComponentTemplate(templates: ComponentTemplate[])"),"."),(0,o.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,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'"teambit.generator/generator": {\n "aspects": [\n "teambit.harmony/aspect"\n ]\n },\n')),(0,o.mdx)("p",null,"In the example above, the aspect ",(0,o.mdx)("inlineCode",{parentName:"p"},"teambit.harmony/aspect")," is configured to be available for the generator."),(0,o.mdx)("h2",null,"Show all available templates"),(0,o.mdx)("p",null,"Introduce a new command ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit templates"),", which groups all available templates by aspects."),(0,o.mdx)("h2",null,"Hide core templates"),(0,o.mdx)("p",null,"Configure the Generator aspect to hide core templates when running ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit templates"),". They'll be only shown when using ",(0,o.mdx)("inlineCode",{parentName:"p"},"--show-all")," flag."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'"teambit.generator/generator": {\n "hideCoreTemplates": true\n },\n')),(0,o.mdx)("h2",null,"Generate a template from CLI"),(0,o.mdx)("p",null,"Introduce a ",(0,o.mdx)("inlineCode",{parentName:"p"},"create")," command to use templates."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-sh"},"bit create <template-name> <component-name...> [--scope | -s] [--namespace | -n] [--aspect | -a]\n")),(0,o.mdx)("h3",null,"Args"),(0,o.mdx)("h4",null,(0,o.mdx)("inlineCode",{parentName:"h4"},"<component name>")),(0,o.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,o.mdx)("p",null,(0,o.mdx)("strong",{parentName:"p"},"generated file structure should use kebab-case, while the template itself be in camel case"),"."),(0,o.mdx)("h3",null,"Options"),(0,o.mdx)("h4",null,(0,o.mdx)("inlineCode",{parentName:"h4"},"[--scope | -s]")),(0,o.mdx)("p",null,"Sets the component's scope and base directory. If not defined, use the ",(0,o.mdx)("inlineCode",{parentName:"p"},"defaultScope")," from ",(0,o.mdx)("inlineCode",{parentName:"p"},"teambit.workspace/workspace")," config."),(0,o.mdx)("h4",null,(0,o.mdx)("inlineCode",{parentName:"h4"},"[--namespace | -n]")),(0,o.mdx)("p",null,"Sets the component's namespace and nested dirs inside the scope. If not define, use empty string."),(0,o.mdx)("h4",null,(0,o.mdx)("inlineCode",{parentName:"h4"},"[--aspect | -a]")),(0,o.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,o.mdx)("h2",null,"Creating a custom template generator"),(0,o.mdx)("p",null,"See our ",(0,o.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=a,c.isMDXComponent=!0},65838:(e,t,n)=>{Object.defineProperty(t,"W",{enumerable:!0,get:function(){return a.default}});var a=o(n(32734));function o(e){return e&&e.__esModule?e:{default:e}}o.__bit_component={id:"teambit.generator/aspect-docs/generator@0.0.172",homepage:"https://bit.cloud/teambit/generator/aspect-docs/generator",exported:!0}},39795:(e,t,n)=>{var a={id:"teambit.generator/generator@1.0.334",homepage:"https://bit.cloud/teambit/generator/generator",exported:!0};function o(){const e=r(n(41594));return o=function(){return e},e}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,o.__bit_component=a,r.__bit_component=a;const l=()=>o().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},o().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/generator-new.svg"}));l.__bit_component=a,t.Logo=l},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},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 a={};n.r(a),n.d(a,{compositions:()=>h,compositions_metadata:()=>x,overview:()=>f});var o={};n.r(o),n.d(o,{default:()=>u});var r=n(39795),l=(n(41594),n(5016));const m=TeambitMdxUiMdxScopeContext;var p=n(65838),i=["components"];function d(){return d=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},d.apply(null,arguments)}var s={},c="wrapper";function u(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;n[a]=e[a]}return n}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,i);return(0,l.mdx)(c,d({},s,n,{components:t,mdxType:"MDXLayout"}),(0,l.mdx)(m.MDXScopeProvider,{components:{Generator:p.W},mdxType:"MDXScopeProvider"},(0,l.mdx)(p.W,{mdxType:"Generator"})))}u.isMDXComponent=!0;const h=[r],f=[o],x={compositions:[{displayName:"Logo",identifier:"Logo"}]};return a})()));
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={15826:(e,t,n)=>{var a={id:"teambit.generator/aspect-docs/generator@0.0.172",homepage:"https://bit.cloud/teambit/generator/aspect-docs/generator",exported:!0};Object.defineProperty(t,"__esModule",{value:!0}),t.default=c,l(n(41594));var o=n(5016),r=["components"];function l(e){return e&&e.__esModule?e:{default:e}}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 a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},m.apply(null,arguments)}function p(e,t){if(null==e)return{};var n,a,o=i(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function i(e,t){if(null==e)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.indexOf(a)>=0)continue;n[a]=e[a]}return n}l.__bit_component=a,m.__bit_component=a,p.__bit_component=a,i.__bit_component=a;var s={},d="wrapper";function c(e){var t=e.components,n=p(e,r);return(0,o.mdx)(d,m({},s,n,{components:t,mdxType:"MDXLayout"}),(0,o.mdx)("p",null,"Generator extension enable generating new components by pre-defined templates"),(0,o.mdx)("h3",null,"Component location"),(0,o.mdx)("p",null,"Component location in the workspace directory tree is defined with the ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit create")," command (see below). For example, a component named ",(0,o.mdx)("inlineCode",{parentName:"p"},"ShoppingCart")," created in the ",(0,o.mdx)("inlineCode",{parentName:"p"},"acme.shopper")," and the namespace ",(0,o.mdx)("inlineCode",{parentName:"p"},"ui")," will be generated in the following directory:"),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre"},"acme.shopper/ui/shopping-cart\n")),(0,o.mdx)("h3",null,"Component name"),(0,o.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,o.mdx)("h3",null,"Automatically ",(0,o.mdx)("inlineCode",{parentName:"h3"},"add")," component"),(0,o.mdx)("p",null,"Bit should automatically register the new component to the ",(0,o.mdx)("inlineCode",{parentName:"p"},".bitmap")," file with a symmetrical name to the component-location in the workspace."),(0,o.mdx)("h2",null,"Register a template"),(0,o.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,o.mdx)("inlineCode",{parentName:"p"},"component-template.ts")," file for more info about the exact API."),(0,o.mdx)("ul",null,(0,o.mdx)("li",{parentName:"ul"},"Component name should be available as a param for the file-content-template."),(0,o.mdx)("li",{parentName:"ul"},"TBD: An environment must have a default template (if not set, use first template in array?).")),(0,o.mdx)("p",null,"To register a template, use the Generator API: ",(0,o.mdx)("inlineCode",{parentName:"p"},"registerComponentTemplate(templates: ComponentTemplate[])"),"."),(0,o.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,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'"teambit.generator/generator": {\n "aspects": [\n "teambit.harmony/aspect"\n ]\n },\n')),(0,o.mdx)("p",null,"In the example above, the aspect ",(0,o.mdx)("inlineCode",{parentName:"p"},"teambit.harmony/aspect")," is configured to be available for the generator."),(0,o.mdx)("h2",null,"Show all available templates"),(0,o.mdx)("p",null,"Introduce a new command ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit templates"),", which groups all available templates by aspects."),(0,o.mdx)("h2",null,"Hide core templates"),(0,o.mdx)("p",null,"Configure the Generator aspect to hide core templates when running ",(0,o.mdx)("inlineCode",{parentName:"p"},"bit templates"),". They'll be only shown when using ",(0,o.mdx)("inlineCode",{parentName:"p"},"--show-all")," flag."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-json"},'"teambit.generator/generator": {\n "hideCoreTemplates": true\n },\n')),(0,o.mdx)("h2",null,"Generate a template from CLI"),(0,o.mdx)("p",null,"Introduce a ",(0,o.mdx)("inlineCode",{parentName:"p"},"create")," command to use templates."),(0,o.mdx)("pre",null,(0,o.mdx)("code",{parentName:"pre",className:"language-sh"},"bit create <template-name> <component-name...> [--scope | -s] [--namespace | -n] [--aspect | -a]\n")),(0,o.mdx)("h3",null,"Args"),(0,o.mdx)("h4",null,(0,o.mdx)("inlineCode",{parentName:"h4"},"<component name>")),(0,o.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,o.mdx)("p",null,(0,o.mdx)("strong",{parentName:"p"},"generated file structure should use kebab-case, while the template itself be in camel case"),"."),(0,o.mdx)("h3",null,"Options"),(0,o.mdx)("h4",null,(0,o.mdx)("inlineCode",{parentName:"h4"},"[--scope | -s]")),(0,o.mdx)("p",null,"Sets the component's scope and base directory. If not defined, use the ",(0,o.mdx)("inlineCode",{parentName:"p"},"defaultScope")," from ",(0,o.mdx)("inlineCode",{parentName:"p"},"teambit.workspace/workspace")," config."),(0,o.mdx)("h4",null,(0,o.mdx)("inlineCode",{parentName:"h4"},"[--namespace | -n]")),(0,o.mdx)("p",null,"Sets the component's namespace and nested dirs inside the scope. If not define, use empty string."),(0,o.mdx)("h4",null,(0,o.mdx)("inlineCode",{parentName:"h4"},"[--aspect | -a]")),(0,o.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,o.mdx)("h2",null,"Creating a custom template generator"),(0,o.mdx)("p",null,"See our ",(0,o.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=a,c.isMDXComponent=!0},32450:(e,t,n)=>{Object.defineProperty(t,"W",{enumerable:!0,get:function(){return a.default}});var a=o(n(15826));function o(e){return e&&e.__esModule?e:{default:e}}o.__bit_component={id:"teambit.generator/aspect-docs/generator@0.0.172",homepage:"https://bit.cloud/teambit/generator/aspect-docs/generator",exported:!0}},80722:(e,t,n)=>{var a={id:"teambit.generator/generator@1.0.335",homepage:"https://bit.cloud/teambit/generator/generator",exported:!0};function o(){const e=r(n(41594));return o=function(){return e},e}function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.Logo=void 0,o.__bit_component=a,r.__bit_component=a;const l=()=>o().default.createElement("div",{style:{height:"100%",display:"flex",justifyContent:"center"}},o().default.createElement("img",{style:{width:70},src:"https://static.bit.dev/extensions-icons/generator-new.svg"}));l.__bit_component=a,t.Logo=l},5016:e=>{e.exports=MdxJsReact},41594:e=>{e.exports=React}},t={};function n(a){var o=t[a];if(void 0!==o)return o.exports;var r=t[a]={exports:{}};return e[a](r,r.exports,n),r.exports}n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},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 a={};n.r(a),n.d(a,{compositions:()=>h,compositions_metadata:()=>x,overview:()=>f});var o={};n.r(o),n.d(o,{default:()=>u});var r=n(80722),l=(n(41594),n(5016));const m=TeambitMdxUiMdxScopeContext;var p=n(32450),i=["components"];function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)({}).hasOwnProperty.call(n,a)&&(e[a]=n[a])}return e},s.apply(null,arguments)}var d={},c="wrapper";function u(e){var t=e.components,n=function(e,t){if(null==e)return{};var n,a,o=function(e,t){if(null==e)return{};var n={};for(var a in e)if({}.hasOwnProperty.call(e,a)){if(t.includes(a))continue;n[a]=e[a]}return n}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.includes(n)||{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,i);return(0,l.mdx)(c,s({},d,n,{components:t,mdxType:"MDXLayout"}),(0,l.mdx)(m.MDXScopeProvider,{components:{Generator:p.W},mdxType:"MDXScopeProvider"},(0,l.mdx)(p.W,{mdxType:"Generator"})))}u.isMDXComponent=!0;const h=[r],f=[o],x={compositions:[{displayName:"Logo",identifier:"Logo"}]};return a})()));
@@ -13101,7 +13101,7 @@
13101
13101
  "componentId": {
13102
13102
  "scope": "teambit.generator",
13103
13103
  "name": "generator",
13104
- "version": "1.0.334"
13104
+ "version": "1.0.335"
13105
13105
  },
13106
13106
  "taggedModuleExports": []
13107
13107
  }
@@ -17,8 +17,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
17
17
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
18
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19
19
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
- function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
21
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
20
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
21
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
22
22
  function generatorSchema(generator) {
23
23
  return {
24
24
  typeDefs: (0, _graphqlTag().gql)`
@@ -1 +1 @@
1
- {"version":3,"names":["_graphqlTag","data","require","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","hasOwnProperty","generatorSchema","generator","typeDefs","gql","resolvers","Mutation","createComponent","req","_ref","name","templateName","options","res","generateComponentTemplate","map","component","id","toString","dir","files","Generator","templates","listTemplates","Query"],"sources":["generator.graphql.ts"],"sourcesContent":["import { Schema } from '@teambit/graphql';\nimport { gql } from 'graphql-tag';\nimport { GeneratorMain } from './generator.main.runtime';\nimport { CreateOptions } from './create.cmd';\n\nexport type CreateQueryOptions = CreateOptions & { templateName: string };\n\nexport function generatorSchema(generator: GeneratorMain): Schema {\n return {\n typeDefs: gql`\n type GenerateResult {\n id: String\n dir: String\n files: [String]\n }\n\n type Mutation {\n # create Component by template\n createComponent(\n name: String!\n templateName: String!\n scope: String\n namespace: String\n aspect: String\n ): [GenerateResult]\n }\n\n type TemplateDescriptor {\n aspectId: String!\n name: String!\n }\n\n type Generator {\n templates: [TemplateDescriptor]\n }\n\n type Query {\n generator: Generator\n }\n `,\n resolvers: {\n Mutation: {\n createComponent: async (req: any, { name, templateName, ...options }: CreateQueryOptions) => {\n const res = await generator.generateComponentTemplate([name], templateName, { name, ...options });\n return res.map((component) => ({\n id: component.id.toString(),\n dir: component.dir,\n files: component.files,\n }));\n },\n },\n Generator: {\n templates: async () => {\n return generator.listTemplates();\n },\n },\n Query: {\n generator: () => generator,\n },\n },\n };\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkC,MAAAE,SAAA;AAAA,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,QAAQ,EAAE;QACRC,eAAe,EAAE,MAAAA,CAAOC,GAAQ,EAAAC,IAAA,KAA6D;UAAA,IAA3D;cAAEC,IAAI;cAAEC;YAA6C,CAAC,GAAAF,IAAA;YAA7BG,OAAO,GAAAjB,wBAAA,CAAAc,IAAA,EAAAhD,SAAA;UAChE,MAAMoD,GAAG,GAAG,MAAMX,SAAS,CAACY,yBAAyB,CAAC,CAACJ,IAAI,CAAC,EAAEC,YAAY,EAAApC,aAAA;YAAImC;UAAI,GAAKE,OAAO,CAAE,CAAC;UACjG,OAAOC,GAAG,CAACE,GAAG,CAAEC,SAAS,KAAM;YAC7BC,EAAE,EAAED,SAAS,CAACC,EAAE,CAACC,QAAQ,CAAC,CAAC;YAC3BC,GAAG,EAAEH,SAAS,CAACG,GAAG;YAClBC,KAAK,EAAEJ,SAAS,CAACI;UACnB,CAAC,CAAC,CAAC;QACL;MACF,CAAC;MACDC,SAAS,EAAE;QACTC,SAAS,EAAE,MAAAA,CAAA,KAAY;UACrB,OAAOpB,SAAS,CAACqB,aAAa,CAAC,CAAC;QAClC;MACF,CAAC;MACDC,KAAK,EAAE;QACLtB,SAAS,EAAEA,CAAA,KAAMA;MACnB;IACF;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_graphqlTag","data","require","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","s","includes","propertyIsEnumerable","n","hasOwnProperty","generatorSchema","generator","typeDefs","gql","resolvers","Mutation","createComponent","req","_ref","name","templateName","options","res","generateComponentTemplate","map","component","id","toString","dir","files","Generator","templates","listTemplates","Query"],"sources":["generator.graphql.ts"],"sourcesContent":["import { Schema } from '@teambit/graphql';\nimport { gql } from 'graphql-tag';\nimport { GeneratorMain } from './generator.main.runtime';\nimport { CreateOptions } from './create.cmd';\n\nexport type CreateQueryOptions = CreateOptions & { templateName: string };\n\nexport function generatorSchema(generator: GeneratorMain): Schema {\n return {\n typeDefs: gql`\n type GenerateResult {\n id: String\n dir: String\n files: [String]\n }\n\n type Mutation {\n # create Component by template\n createComponent(\n name: String!\n templateName: String!\n scope: String\n namespace: String\n aspect: String\n ): [GenerateResult]\n }\n\n type TemplateDescriptor {\n aspectId: String!\n name: String!\n }\n\n type Generator {\n templates: [TemplateDescriptor]\n }\n\n type Query {\n generator: Generator\n }\n `,\n resolvers: {\n Mutation: {\n createComponent: async (req: any, { name, templateName, ...options }: CreateQueryOptions) => {\n const res = await generator.generateComponentTemplate([name], templateName, { name, ...options });\n return res.map((component) => ({\n id: component.id.toString(),\n dir: component.dir,\n files: component.files,\n }));\n },\n },\n Generator: {\n templates: async () => {\n return generator.listTemplates();\n },\n },\n Query: {\n generator: () => generator,\n },\n },\n };\n}\n"],"mappings":";;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkC,MAAAE,SAAA;AAAA,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,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EAAE,MAAAA,CAAOC,GAAQ,EAAAC,IAAA,KAA6D;UAAA,IAA3D;cAAEC,IAAI;cAAEC;YAA6C,CAAC,GAAAF,IAAA;YAA7BG,OAAO,GAAAlB,wBAAA,CAAAe,IAAA,EAAAjD,SAAA;UAChE,MAAMqD,GAAG,GAAG,MAAMX,SAAS,CAACY,yBAAyB,CAAC,CAACJ,IAAI,CAAC,EAAEC,YAAY,EAAArC,aAAA;YAAIoC;UAAI,GAAKE,OAAO,CAAE,CAAC;UACjG,OAAOC,GAAG,CAACE,GAAG,CAAEC,SAAS,KAAM;YAC7BC,EAAE,EAAED,SAAS,CAACC,EAAE,CAACC,QAAQ,CAAC,CAAC;YAC3BC,GAAG,EAAEH,SAAS,CAACG,GAAG;YAClBC,KAAK,EAAEJ,SAAS,CAACI;UACnB,CAAC,CAAC,CAAC;QACL;MACF,CAAC;MACDC,SAAS,EAAE;QACTC,SAAS,EAAE,MAAAA,CAAA,KAAY;UACrB,OAAOpB,SAAS,CAACqB,aAAa,CAAC,CAAC;QAClC;MACF,CAAC;MACDC,KAAK,EAAE;QACLtB,SAAS,EAAEA,CAAA,KAAMA;MACnB;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.334/dist/generator.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.334/dist/generator.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.335/dist/generator.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.335/dist/generator.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/generator",
3
- "version": "1.0.334",
3
+ "version": "1.0.335",
4
4
  "homepage": "https://bit.cloud/teambit/generator/generator",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.generator",
8
8
  "name": "generator",
9
- "version": "1.0.334"
9
+ "version": "1.0.335"
10
10
  },
11
11
  "dependencies": {
12
12
  "camelcase": "6.2.0",
@@ -21,30 +21,30 @@
21
21
  "@teambit/component-id": "1.2.0",
22
22
  "@teambit/harmony": "0.4.6",
23
23
  "@teambit/git.modules.git-ignore": "1.0.2",
24
- "@teambit/component.sources": "0.0.2",
25
- "@teambit/envs": "1.0.333",
26
- "@teambit/logger": "0.0.1003",
27
- "@teambit/new-component-helper": "1.0.333",
28
- "@teambit/pkg.modules.component-package-name": "0.0.2",
24
+ "@teambit/component.sources": "0.0.3",
25
+ "@teambit/envs": "1.0.334",
26
+ "@teambit/logger": "0.0.1004",
27
+ "@teambit/new-component-helper": "1.0.334",
28
+ "@teambit/pkg.modules.component-package-name": "0.0.3",
29
29
  "@teambit/toolbox.path.path": "0.0.2",
30
- "@teambit/tracker": "1.0.333",
31
- "@teambit/workspace-config-files": "1.0.333",
32
- "@teambit/workspace.modules.node-modules-linker": "0.0.177",
33
- "@teambit/workspace": "1.0.333",
34
- "@teambit/component": "1.0.333",
35
- "@teambit/cli": "0.0.910",
36
- "@teambit/graphql": "1.0.333",
37
- "@teambit/aspect-loader": "1.0.333",
38
- "@teambit/bit": "1.7.44",
39
- "@teambit/git": "1.0.333",
40
- "@teambit/compiler": "1.0.333",
41
- "@teambit/forking": "1.0.333",
30
+ "@teambit/tracker": "1.0.334",
31
+ "@teambit/workspace-config-files": "1.0.334",
32
+ "@teambit/workspace.modules.node-modules-linker": "0.0.178",
33
+ "@teambit/workspace": "1.0.334",
34
+ "@teambit/component": "1.0.334",
35
+ "@teambit/cli": "0.0.911",
36
+ "@teambit/graphql": "1.0.334",
37
+ "@teambit/aspect-loader": "1.0.334",
38
+ "@teambit/bit": "1.7.45",
39
+ "@teambit/git": "1.0.334",
40
+ "@teambit/compiler": "1.0.334",
41
+ "@teambit/forking": "1.0.334",
42
42
  "@teambit/git.modules.git-executable": "0.0.1",
43
- "@teambit/host-initializer": "0.0.46",
44
- "@teambit/importer": "1.0.333",
45
- "@teambit/install": "1.0.333",
46
- "@teambit/ui": "1.0.333",
47
- "@teambit/config": "0.0.1084"
43
+ "@teambit/host-initializer": "0.0.47",
44
+ "@teambit/importer": "1.0.334",
45
+ "@teambit/install": "1.0.334",
46
+ "@teambit/ui": "1.0.334",
47
+ "@teambit/config": "0.0.1085"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/fs-extra": "9.0.7",