@teambit/generator 1.0.142 → 1.0.144

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.
Files changed (39) hide show
  1. package/artifacts/__bit_junit.xml +4 -0
  2. package/artifacts/preview/teambit_generator_generator-preview.js +1 -1
  3. package/dist/component-generator.d.ts +1 -1
  4. package/dist/generator.composition.d.ts +1 -0
  5. package/dist/generator.main.runtime.d.ts +1 -1
  6. package/dist/{preview-1705720522529.js → preview-1706194779559.js} +2 -2
  7. package/dist/templates/component-generator/files/component-template.d.ts +1 -1
  8. package/dist/templates/component-generator/files/component-template.js +7 -7
  9. package/dist/templates/component-generator/files/component-template.js.map +1 -1
  10. package/dist/templates/component-generator-standalone/files/index.d.ts +1 -1
  11. package/dist/templates/component-generator-standalone/files/index.js.map +1 -1
  12. package/dist/templates/component-generator-standalone/index.d.ts +1 -1
  13. package/dist/templates/component-generator-standalone/index.js.map +1 -1
  14. package/dist/templates/starter/files/doc-file.d.ts +1 -1
  15. package/dist/templates/starter/files/doc-file.js.map +1 -1
  16. package/dist/templates/starter/files/starter.d.ts +1 -1
  17. package/dist/templates/starter/files/starter.js +6 -6
  18. package/dist/templates/starter/files/starter.js.map +1 -1
  19. package/dist/templates/starter-standalone/files/doc-file.d.ts +1 -1
  20. package/dist/templates/starter-standalone/files/doc-file.js.map +1 -1
  21. package/dist/templates/starter-standalone/files/index.d.ts +1 -1
  22. package/dist/templates/starter-standalone/files/index.js.map +1 -1
  23. package/dist/templates/starter-standalone/files/starter.d.ts +1 -1
  24. package/dist/templates/starter-standalone/files/starter.js +4 -4
  25. package/dist/templates/starter-standalone/files/starter.js.map +1 -1
  26. package/dist/templates/starter-standalone/index.d.ts +1 -1
  27. package/dist/templates/starter-standalone/index.js.map +1 -1
  28. package/dist/workspace-generator.d.ts +1 -1
  29. package/package.json +26 -26
  30. package/templates/component-generator/files/component-template.ts +8 -8
  31. package/templates/component-generator-standalone/files/index.ts +1 -1
  32. package/templates/component-generator-standalone/index.ts +1 -1
  33. package/templates/starter/files/doc-file.ts +1 -1
  34. package/templates/starter/files/starter.ts +7 -7
  35. package/templates/starter-standalone/files/doc-file.ts +1 -1
  36. package/templates/starter-standalone/files/index.ts +1 -1
  37. package/templates/starter-standalone/files/starter.ts +5 -5
  38. package/templates/starter-standalone/index.ts +1 -1
  39. package/tsconfig.json +4 -1
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <testsuites>
3
+ <testsuite name="teambit.generator/generator@1.0.144" tests="0" failures="0" errors="0" skipped="0"/>
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={84646:(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(87363));var a=n(40040),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},43088:(e,t,n)=>{Object.defineProperty(t,"R",{enumerable:!0,get:function(){return o.default}});var o=a(n(84646));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}},85041:(e,t,n)=>{var o={id:"teambit.generator/generator@1.0.142",homepage:"https://bit.cloud/teambit/generator/generator",exported:!0};function a(){const e=r(n(87363));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},40040:e=>{e.exports=MdxJsReact},87363: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(85041),a=(n(87363),n(40040));const r=TeambitMdxUiMdxScopeContext;var l=n(43088),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.R},mdxType:"MDXScopeProvider"},(0,a.mdx)(l.R,{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={11953:(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(87363));var a=n(40040),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},16132:(e,t,n)=>{Object.defineProperty(t,"R",{enumerable:!0,get:function(){return o.default}});var o=a(n(11953));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}},6892:(e,t,n)=>{var o={id:"teambit.generator/generator@1.0.144",homepage:"https://bit.cloud/teambit/generator/generator",exported:!0};function a(){const e=r(n(87363));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},40040:e=>{e.exports=MdxJsReact},87363: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(6892),a=(n(87363),n(40040));const r=TeambitMdxUiMdxScopeContext;var l=n(16132),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.R},mdxType:"MDXScopeProvider"},(0,a.mdx)(l.R,{mdxType:"Generator"})))}d.isMDXComponent=!0;const c=[t],u=[e],h={compositions:[{displayName:"Logo",identifier:"Logo"}]}})(),o})()));
@@ -34,7 +34,7 @@ export declare class ComponentGenerator {
34
34
  private onComponentCreateSlot;
35
35
  private aspectId;
36
36
  private envId?;
37
- constructor(workspace: Workspace, componentIds: ComponentID[], options: Partial<CreateOptions>, template: ComponentTemplate, envs: EnvsMain, newComponentHelper: NewComponentHelperMain, tracker: TrackerMain, wsConfigFiles: WorkspaceConfigFilesMain, logger: Logger, onComponentCreateSlot: OnComponentCreateSlot, aspectId: string, envId?: ComponentID);
37
+ constructor(workspace: Workspace, componentIds: ComponentID[], options: Partial<CreateOptions>, template: ComponentTemplate, envs: EnvsMain, newComponentHelper: NewComponentHelperMain, tracker: TrackerMain, wsConfigFiles: WorkspaceConfigFilesMain, logger: Logger, onComponentCreateSlot: OnComponentCreateSlot, aspectId: string, envId?: ComponentID | undefined);
38
38
  generate(): Promise<GenerateResult[]>;
39
39
  private tryLinkToNodeModules;
40
40
  private runOnComponentCreateHook;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const Logo: () => JSX.Element;
@@ -116,7 +116,7 @@ export declare class GeneratorMain {
116
116
  aspect?: Component;
117
117
  }>;
118
118
  findTemplateInOtherWorkspace(workspacePath: string, name: string, aspectId?: string): Promise<{
119
- workspaceTemplate: WorkspaceTemplate;
119
+ workspaceTemplate: WorkspaceTemplate | undefined;
120
120
  aspect: Component;
121
121
  }>;
122
122
  /**
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@1.0.142/dist/generator.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@1.0.142/dist/generator.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@1.0.144/dist/generator.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@1.0.144/dist/generator.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1,2 +1,2 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
  export declare function componentTemplate({ namePascalCase, name }: ComponentContext): string;
@@ -17,31 +17,31 @@ function componentTemplate({
17
17
  import { componentFile } from './files/component-file';
18
18
  import { testFile } from './files/test-file';
19
19
  import { compositionFile } from './files/composition-file';
20
-
20
+
21
21
  export type ${namePascalCase}ComponentTemplateOptions = {
22
22
  /**
23
23
  * name of the template
24
24
  */
25
25
  name?: string;
26
-
26
+
27
27
  /**
28
28
  * description of the template.
29
29
  */
30
30
  description?: string;
31
-
31
+
32
32
  /**
33
33
  * hide the template from the templates command.
34
34
  */
35
35
  hidden?: boolean;
36
36
  };
37
-
37
+
38
38
  export class ${namePascalCase}ComponentTemplate implements ComponentTemplate {
39
39
  constructor(
40
40
  readonly name = '${name}',
41
41
  readonly description = 'a template for ${name} components',
42
42
  readonly hidden = false
43
43
  ) {}
44
-
44
+
45
45
  generateFiles(context: ComponentContext): ComponentFile[] {
46
46
  return [
47
47
  indexFile(context),
@@ -50,7 +50,7 @@ function componentTemplate({
50
50
  testFile(context),
51
51
  ];
52
52
  }
53
-
53
+
54
54
  static from(options: ${namePascalCase}ComponentTemplateOptions = {}) {
55
55
  return () =>
56
56
  new ${namePascalCase}ComponentTemplate(
@@ -60,7 +60,7 @@ function componentTemplate({
60
60
  );
61
61
  }
62
62
  }
63
-
63
+
64
64
  `;
65
65
  }
66
66
 
@@ -1 +1 @@
1
- {"version":3,"names":["componentTemplate","namePascalCase","name"],"sources":["component-template.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function componentTemplate({ namePascalCase, name }: ComponentContext) {\n return `import {\n ComponentContext,\n ComponentFile,\n ComponentTemplate,\n } from '@teambit/generator';\n import { indexFile } from './files/index-file';\n import { componentFile } from './files/component-file';\n import { testFile } from './files/test-file';\n import { compositionFile } from './files/composition-file';\n \n export type ${namePascalCase}ComponentTemplateOptions = {\n /**\n * name of the template\n */\n name?: string;\n \n /**\n * description of the template.\n */\n description?: string;\n \n /**\n * hide the template from the templates command.\n */\n hidden?: boolean;\n };\n \n export class ${namePascalCase}ComponentTemplate implements ComponentTemplate {\n constructor(\n readonly name = '${name}',\n readonly description = 'a template for ${name} components',\n readonly hidden = false\n ) {}\n \n generateFiles(context: ComponentContext): ComponentFile[] {\n return [\n indexFile(context),\n compositionFile(context),\n componentFile(context),\n testFile(context),\n ];\n }\n \n static from(options: ${namePascalCase}ComponentTemplateOptions = {}) {\n return () =>\n new ${namePascalCase}ComponentTemplate(\n options.name,\n options.description,\n options.hidden\n );\n }\n }\n \n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,iBAAiBA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EAC5E,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgBD,cAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiBA,cAAe;AAChC;AACA,yBAAyBC,IAAK;AAC9B,+CAA+CA,IAAK;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2BD,cAAe;AAC1C;AACA,cAAcA,cAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
1
+ {"version":3,"names":["componentTemplate","namePascalCase","name"],"sources":["component-template.ts"],"sourcesContent":["import { ComponentContext } from '../../../component-template';\n\nexport function componentTemplate({ namePascalCase, name }: ComponentContext) {\n return `import {\n ComponentContext,\n ComponentFile,\n ComponentTemplate,\n } from '@teambit/generator';\n import { indexFile } from './files/index-file';\n import { componentFile } from './files/component-file';\n import { testFile } from './files/test-file';\n import { compositionFile } from './files/composition-file';\n\n export type ${namePascalCase}ComponentTemplateOptions = {\n /**\n * name of the template\n */\n name?: string;\n\n /**\n * description of the template.\n */\n description?: string;\n\n /**\n * hide the template from the templates command.\n */\n hidden?: boolean;\n };\n\n export class ${namePascalCase}ComponentTemplate implements ComponentTemplate {\n constructor(\n readonly name = '${name}',\n readonly description = 'a template for ${name} components',\n readonly hidden = false\n ) {}\n\n generateFiles(context: ComponentContext): ComponentFile[] {\n return [\n indexFile(context),\n compositionFile(context),\n componentFile(context),\n testFile(context),\n ];\n }\n\n static from(options: ${namePascalCase}ComponentTemplateOptions = {}) {\n return () =>\n new ${namePascalCase}ComponentTemplate(\n options.name,\n options.description,\n options.hidden\n );\n }\n }\n\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,iBAAiBA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EAC5E,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgBD,cAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiBA,cAAe;AAChC;AACA,yBAAyBC,IAAK;AAC9B,+CAA+CA,IAAK;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2BD,cAAe;AAC1C;AACA,cAAcA,cAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
@@ -1,2 +1,2 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
  export declare function indexFile({ namePascalCase, name }: ComponentContext): string;
@@ -1 +1 @@
1
- {"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `import { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport type { ${namePascalCase}Main } from './${name}.main.runtime';\nexport default ${namePascalCase}Aspect;\nexport { ${namePascalCase}Aspect };\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAASA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAQ,YAAWD,cAAe,oBAAmBC,IAAK;AAC5D;AACA,gBAAgBD,cAAe,kBAAiBC,IAAK;AACrD,iBAAiBD,cAAe;AAChC,WAAWA,cAAe;AAC1B,CAAC;AACD"}
1
+ {"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext } from '../../../component-template';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `import { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport type { ${namePascalCase}Main } from './${name}.main.runtime';\nexport default ${namePascalCase}Aspect;\nexport { ${namePascalCase}Aspect };\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAASA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAQ,YAAWD,cAAe,oBAAmBC,IAAK;AAC5D;AACA,gBAAgBD,cAAe,kBAAiBC,IAAK;AACrD,iBAAiBD,cAAe;AAChC,WAAWA,cAAe;AAC1B,CAAC;AACD"}
@@ -1,2 +1,2 @@
1
- import { ComponentTemplate } from '@teambit/generator';
1
+ import { ComponentTemplate } from '../../component-template';
2
2
  export declare const componentGeneratorTemplate: ComponentTemplate;
@@ -1 +1 @@
1
- {"version":3,"names":["_index","data","require","_aspectFile","_docsFile","_mainRuntime","componentGeneratorTemplate","exports","name","description","hidden","generateFiles","context","relativePath","content","indexFile","isMain","aspectFile","docsFile","mainRuntime","config","env"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { aspectFile } from './files/aspect-file';\nimport { docsFile } from './files/docs-file';\nimport { mainRuntime } from './files/main-runtime';\n\nexport const componentGeneratorTemplate: ComponentTemplate = {\n name: 'component-generator',\n description:\n 'create your own component generator \\nDocs: https://bit.dev/docs/dev-services/generator/generate-component',\n hidden: true,\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.aspect.ts`,\n content: aspectFile(context),\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docsFile(),\n },\n {\n relativePath: `${context.name}.main.runtime.ts`,\n content: mainRuntime(context),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMK,0BAA6C,GAAAC,OAAA,CAAAD,0BAAA,GAAG;EAC3DE,IAAI,EAAE,qBAAqB;EAC3BC,WAAW,EACT,4GAA4G;EAC9GC,MAAM,EAAE,IAAI;EACZC,aAAa,EAAGC,OAAyB,IAAK;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UAAU;MACxBC,OAAO,EAAE,IAAAC,kBAAS,EAACH,OAAO,CAAC;MAC3BI,MAAM,EAAE;IACV,CAAC,EACD;MACEH,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,YAAW;MACzCM,OAAO,EAAE,IAAAG,wBAAU,EAACL,OAAO;IAC7B,CAAC,EACD;MACEC,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,WAAU;MACxCM,OAAO,EAAE,IAAAI,oBAAQ,EAAC;IACpB,CAAC,EACD;MACEL,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,kBAAiB;MAC/CM,OAAO,EAAE,IAAAK,0BAAW,EAACP,OAAO;IAC9B,CAAC,CACF;EACH,CAAC;EACDQ,MAAM,EAAE;IACN,wBAAwB,EAAE,CAAC,CAAC;IAC5B,mBAAmB,EAAE;MACnBC,GAAG,EAAE;IACP;EACF;AACF,CAAC"}
1
+ {"version":3,"names":["_index","data","require","_aspectFile","_docsFile","_mainRuntime","componentGeneratorTemplate","exports","name","description","hidden","generateFiles","context","relativePath","content","indexFile","isMain","aspectFile","docsFile","mainRuntime","config","env"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '../../component-template';\nimport { indexFile } from './files/index';\nimport { aspectFile } from './files/aspect-file';\nimport { docsFile } from './files/docs-file';\nimport { mainRuntime } from './files/main-runtime';\n\nexport const componentGeneratorTemplate: ComponentTemplate = {\n name: 'component-generator',\n description:\n 'create your own component generator \\nDocs: https://bit.dev/docs/dev-services/generator/generate-component',\n hidden: true,\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.aspect.ts`,\n content: aspectFile(context),\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docsFile(),\n },\n {\n relativePath: `${context.name}.main.runtime.ts`,\n content: mainRuntime(context),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMK,0BAA6C,GAAAC,OAAA,CAAAD,0BAAA,GAAG;EAC3DE,IAAI,EAAE,qBAAqB;EAC3BC,WAAW,EACT,4GAA4G;EAC9GC,MAAM,EAAE,IAAI;EACZC,aAAa,EAAGC,OAAyB,IAAK;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UAAU;MACxBC,OAAO,EAAE,IAAAC,kBAAS,EAACH,OAAO,CAAC;MAC3BI,MAAM,EAAE;IACV,CAAC,EACD;MACEH,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,YAAW;MACzCM,OAAO,EAAE,IAAAG,wBAAU,EAACL,OAAO;IAC7B,CAAC,EACD;MACEC,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,WAAU;MACxCM,OAAO,EAAE,IAAAI,oBAAQ,EAAC;IACpB,CAAC,EACD;MACEL,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,kBAAiB;MAC/CM,OAAO,EAAE,IAAAK,0BAAW,EAACP,OAAO;IAC9B,CAAC,CACF;EACH,CAAC;EACDQ,MAAM,EAAE;IACN,wBAAwB,EAAE,CAAC,CAAC;IAC5B,mBAAmB,EAAE;MACnBC,GAAG,EAAE;IACP;EACF;AACF,CAAC"}
@@ -1,2 +1,2 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
  export declare function docFile(context: ComponentContext): string;
@@ -1 +1 @@
1
- {"version":3,"names":["docFile","context","name","componentId","toString"],"sources":["doc-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function docFile(context: ComponentContext) {\n const { name, componentId } = context;\n return `---\ndescription: Starter for generating a ${name} workspace\nlabels: ['generator', 'templates', '${name}-workspace']\n---\n\n## Using the ${name} Workspace Starter\n\nHow to use this generator locally, essentially for development purposes:\n\n\\`\\`\\`js\nbit new ${name} my-${name}-workspace --load-from /Users/me/path/to/this/dir --aspect ${componentId.toString()}\n\\`\\`\\`\n\nHow to use this generator after exporting to a remote scope:\n\n\\`\\`\\`js\nbit new ${name} my-${name}-workspace --aspect ${componentId.toString()}\n\\`\\`\\`\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,OAAOA,CAACC,OAAyB,EAAE;EACjD,MAAM;IAAEC,IAAI;IAAEC;EAAY,CAAC,GAAGF,OAAO;EACrC,OAAQ;AACV,wCAAwCC,IAAK;AAC7C,sCAAsCA,IAAK;AAC3C;AACA;AACA,eAAeA,IAAK;AACpB;AACA;AACA;AACA;AACA,UAAUA,IAAK,OAAMA,IAAK,8DAA6DC,WAAW,CAACC,QAAQ,CAAC,CAAE;AAC9G;AACA;AACA;AACA;AACA;AACA,UAAUF,IAAK,OAAMA,IAAK,uBAAsBC,WAAW,CAACC,QAAQ,CAAC,CAAE;AACvE;AACA,CAAC;AACD"}
1
+ {"version":3,"names":["docFile","context","name","componentId","toString"],"sources":["doc-file.ts"],"sourcesContent":["import { ComponentContext } from '../../../component-template';\n\nexport function docFile(context: ComponentContext) {\n const { name, componentId } = context;\n return `---\ndescription: Starter for generating a ${name} workspace\nlabels: ['generator', 'templates', '${name}-workspace']\n---\n\n## Using the ${name} Workspace Starter\n\nHow to use this generator locally, essentially for development purposes:\n\n\\`\\`\\`js\nbit new ${name} my-${name}-workspace --load-from /Users/me/path/to/this/dir --aspect ${componentId.toString()}\n\\`\\`\\`\n\nHow to use this generator after exporting to a remote scope:\n\n\\`\\`\\`js\nbit new ${name} my-${name}-workspace --aspect ${componentId.toString()}\n\\`\\`\\`\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,OAAOA,CAACC,OAAyB,EAAE;EACjD,MAAM;IAAEC,IAAI;IAAEC;EAAY,CAAC,GAAGF,OAAO;EACrC,OAAQ;AACV,wCAAwCC,IAAK;AAC7C,sCAAsCA,IAAK;AAC3C;AACA;AACA,eAAeA,IAAK;AACpB;AACA;AACA;AACA;AACA,UAAUA,IAAK,OAAMA,IAAK,8DAA6DC,WAAW,CAACC,QAAQ,CAAC,CAAE;AAC9G;AACA;AACA;AACA;AACA;AACA,UAAUF,IAAK,OAAMA,IAAK,uBAAsBC,WAAW,CAACC,QAAQ,CAAC,CAAE;AACvE;AACA,CAAC;AACD"}
@@ -1,2 +1,2 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
  export declare function starterFile({ namePascalCase, name }: ComponentContext): string;
@@ -10,20 +10,20 @@ function starterFile({
10
10
  }) {
11
11
  return `import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator';
12
12
  import { generateFiles as generateCommonFiles } from './template/files/generate-files';
13
-
13
+
14
14
  export type ${namePascalCase}StarterOptions = Pick<WorkspaceTemplate, 'name' | 'description' | 'hidden'>;
15
-
15
+
16
16
  export class ${namePascalCase}WorkspaceStarter implements WorkspaceTemplate {
17
17
  constructor(
18
18
  readonly name = '${name}-workspace',
19
19
  readonly description = '${namePascalCase} workspace with a custom react env',
20
20
  readonly hidden = false
21
21
  ) {}
22
-
22
+
23
23
  async generateFiles(context: WorkspaceContext) {
24
24
  return generateCommonFiles(context);
25
25
  }
26
-
26
+
27
27
  fork() {
28
28
  return [
29
29
  {
@@ -32,7 +32,7 @@ function starterFile({
32
32
  },
33
33
  ];
34
34
  }
35
-
35
+
36
36
  static from(options: Partial<${namePascalCase}StarterOptions>) {
37
37
  return () =>
38
38
  new ${namePascalCase}WorkspaceStarter(
@@ -42,7 +42,7 @@ function starterFile({
42
42
  );
43
43
  }
44
44
  }
45
-
45
+
46
46
  `;
47
47
  }
48
48
 
@@ -1 +1 @@
1
- {"version":3,"names":["starterFile","namePascalCase","name"],"sources":["starter.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function starterFile({ namePascalCase, name }: ComponentContext) {\n return `import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator';\n import { generateFiles as generateCommonFiles } from './template/files/generate-files';\n \n export type ${namePascalCase}StarterOptions = Pick<WorkspaceTemplate, 'name' | 'description' | 'hidden'>;\n \n export class ${namePascalCase}WorkspaceStarter implements WorkspaceTemplate {\n constructor(\n readonly name = '${name}-workspace',\n readonly description = '${namePascalCase} workspace with a custom react env',\n readonly hidden = false\n ) {}\n \n async generateFiles(context: WorkspaceContext) {\n return generateCommonFiles(context);\n }\n \n fork() {\n return [\n {\n id: 'teambit.react/react-env-extension',\n targetName: 'envs/my-react-env',\n },\n ];\n }\n \n static from(options: Partial<${namePascalCase}StarterOptions>) {\n return () =>\n new ${namePascalCase}WorkspaceStarter(\n options.name,\n options.description,\n options.hidden\n );\n }\n }\n \n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,WAAWA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACtE,OAAQ;AACV;AACA;AACA,gBAAgBD,cAAe;AAC/B;AACA,iBAAiBA,cAAe;AAChC;AACA,yBAAyBC,IAAK;AAC9B,gCAAgCD,cAAe;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmCA,cAAe;AAClD;AACA,cAAcA,cAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
1
+ {"version":3,"names":["starterFile","namePascalCase","name"],"sources":["starter.ts"],"sourcesContent":["import { ComponentContext } from '../../../component-template';\n\nexport function starterFile({ namePascalCase, name }: ComponentContext) {\n return `import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator';\n import { generateFiles as generateCommonFiles } from './template/files/generate-files';\n\n export type ${namePascalCase}StarterOptions = Pick<WorkspaceTemplate, 'name' | 'description' | 'hidden'>;\n\n export class ${namePascalCase}WorkspaceStarter implements WorkspaceTemplate {\n constructor(\n readonly name = '${name}-workspace',\n readonly description = '${namePascalCase} workspace with a custom react env',\n readonly hidden = false\n ) {}\n\n async generateFiles(context: WorkspaceContext) {\n return generateCommonFiles(context);\n }\n\n fork() {\n return [\n {\n id: 'teambit.react/react-env-extension',\n targetName: 'envs/my-react-env',\n },\n ];\n }\n\n static from(options: Partial<${namePascalCase}StarterOptions>) {\n return () =>\n new ${namePascalCase}WorkspaceStarter(\n options.name,\n options.description,\n options.hidden\n );\n }\n }\n\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,WAAWA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACtE,OAAQ;AACV;AACA;AACA,gBAAgBD,cAAe;AAC/B;AACA,iBAAiBA,cAAe;AAChC;AACA,yBAAyBC,IAAK;AAC9B,gCAAgCD,cAAe;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mCAAmCA,cAAe;AAClD;AACA,cAAcA,cAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
@@ -1,2 +1,2 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
  export declare function docFile(context: ComponentContext): string;
@@ -1 +1 @@
1
- {"version":3,"names":["docFile","context","name","componentId","toString"],"sources":["doc-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function docFile(context: ComponentContext) {\n const { name, componentId } = context;\n return `---\ndescription: Starter for generating a ${name} workspace\nlabels: ['generator', 'templates', '${name}-workspace']\n---\n\n## Using the ${name} Workspace Starter\n\nHow to use this generator locally, essentially for development purposes:\n\n\\`\\`\\`js\nbit new ${name} my-${name}-workspace --load-from /Users/me/path/to/this/dir --aspect ${componentId.toString()}\n\\`\\`\\`\n\nHow to use this generator after exporting to a remote scope:\n\n\\`\\`\\`js\nbit new ${name} my-${name}-workspace --aspect ${componentId.toString()}\n\\`\\`\\`\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,OAAOA,CAACC,OAAyB,EAAE;EACjD,MAAM;IAAEC,IAAI;IAAEC;EAAY,CAAC,GAAGF,OAAO;EACrC,OAAQ;AACV,wCAAwCC,IAAK;AAC7C,sCAAsCA,IAAK;AAC3C;AACA;AACA,eAAeA,IAAK;AACpB;AACA;AACA;AACA;AACA,UAAUA,IAAK,OAAMA,IAAK,8DAA6DC,WAAW,CAACC,QAAQ,CAAC,CAAE;AAC9G;AACA;AACA;AACA;AACA;AACA,UAAUF,IAAK,OAAMA,IAAK,uBAAsBC,WAAW,CAACC,QAAQ,CAAC,CAAE;AACvE;AACA,CAAC;AACD"}
1
+ {"version":3,"names":["docFile","context","name","componentId","toString"],"sources":["doc-file.ts"],"sourcesContent":["import { ComponentContext } from '../../../component-template';\n\nexport function docFile(context: ComponentContext) {\n const { name, componentId } = context;\n return `---\ndescription: Starter for generating a ${name} workspace\nlabels: ['generator', 'templates', '${name}-workspace']\n---\n\n## Using the ${name} Workspace Starter\n\nHow to use this generator locally, essentially for development purposes:\n\n\\`\\`\\`js\nbit new ${name} my-${name}-workspace --load-from /Users/me/path/to/this/dir --aspect ${componentId.toString()}\n\\`\\`\\`\n\nHow to use this generator after exporting to a remote scope:\n\n\\`\\`\\`js\nbit new ${name} my-${name}-workspace --aspect ${componentId.toString()}\n\\`\\`\\`\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,OAAOA,CAACC,OAAyB,EAAE;EACjD,MAAM;IAAEC,IAAI;IAAEC;EAAY,CAAC,GAAGF,OAAO;EACrC,OAAQ;AACV,wCAAwCC,IAAK;AAC7C,sCAAsCA,IAAK;AAC3C;AACA;AACA,eAAeA,IAAK;AACpB;AACA;AACA;AACA;AACA,UAAUA,IAAK,OAAMA,IAAK,8DAA6DC,WAAW,CAACC,QAAQ,CAAC,CAAE;AAC9G;AACA;AACA;AACA;AACA;AACA,UAAUF,IAAK,OAAMA,IAAK,uBAAsBC,WAAW,CAACC,QAAQ,CAAC,CAAE;AACvE;AACA,CAAC;AACD"}
@@ -1,2 +1,2 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
  export declare function indexFile({ namePascalCase, name }: ComponentContext): string;
@@ -1 +1 @@
1
- {"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `export { ${namePascalCase}WorkspaceStarter } from './${name}.starter';\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAASA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAQ,YAAWD,cAAe,8BAA6BC,IAAK;AACtE,CAAC;AACD"}
1
+ {"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext } from '../../../component-template';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `export { ${namePascalCase}WorkspaceStarter } from './${name}.starter';\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAASA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAQ,YAAWD,cAAe,8BAA6BC,IAAK;AACtE,CAAC;AACD"}
@@ -1,2 +1,2 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
  export declare function starterFile({ namePascalCase, name }: ComponentContext): string;
@@ -11,7 +11,7 @@ function starterFile({
11
11
  return `import { WorkspaceContext, Starter } from '@teambit/generator';
12
12
  import { workspaceConfig } from './template/files/workspace-config';
13
13
  import { gitIgnore } from './template/files/git-ignore';
14
-
14
+
15
15
  export const ${namePascalCase}WorkspaceStarter: Starter = {
16
16
  name: '${name}-workspace',
17
17
  description: 'a ${name} workspace',
@@ -22,21 +22,21 @@ function starterFile({
22
22
  content: await workspaceConfig(context),
23
23
  },
24
24
  ];
25
-
25
+
26
26
  if (!context.skipGit) {
27
27
  files.push({
28
28
  relativePath: '.gitignore',
29
29
  content: gitIgnore(),
30
30
  });
31
31
  }
32
-
32
+
33
33
  return files;
34
34
  },
35
35
  import: () => [
36
36
  { id: 'teambit.community/component-showcase' },
37
37
  ]
38
38
  };
39
-
39
+
40
40
  export default ${namePascalCase}WorkspaceStarter;
41
41
  `;
42
42
  }
@@ -1 +1 @@
1
- {"version":3,"names":["starterFile","namePascalCase","name"],"sources":["starter.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function starterFile({ namePascalCase, name }: ComponentContext) {\n return `import { WorkspaceContext, Starter } from '@teambit/generator';\n import { workspaceConfig } from './template/files/workspace-config';\n import { gitIgnore } from './template/files/git-ignore';\n \n export const ${namePascalCase}WorkspaceStarter: Starter = {\n name: '${name}-workspace',\n description: 'a ${name} workspace',\n generateFiles: async (context: WorkspaceContext) => {\n const files = [\n {\n relativePath: 'workspace.jsonc',\n content: await workspaceConfig(context),\n },\n ];\n \n if (!context.skipGit) {\n files.push({\n relativePath: '.gitignore',\n content: gitIgnore(),\n });\n }\n \n return files;\n },\n import: () => [\n { id: 'teambit.community/component-showcase' },\n ]\n };\n \n export default ${namePascalCase}WorkspaceStarter;\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,WAAWA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACtE,OAAQ;AACV;AACA;AACA;AACA,iBAAiBD,cAAe;AAChC,aAAaC,IAAK;AAClB,sBAAsBA,IAAK;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmBD,cAAe;AAClC,CAAC;AACD"}
1
+ {"version":3,"names":["starterFile","namePascalCase","name"],"sources":["starter.ts"],"sourcesContent":["import { ComponentContext } from '../../../component-template';\n\nexport function starterFile({ namePascalCase, name }: ComponentContext) {\n return `import { WorkspaceContext, Starter } from '@teambit/generator';\n import { workspaceConfig } from './template/files/workspace-config';\n import { gitIgnore } from './template/files/git-ignore';\n\n export const ${namePascalCase}WorkspaceStarter: Starter = {\n name: '${name}-workspace',\n description: 'a ${name} workspace',\n generateFiles: async (context: WorkspaceContext) => {\n const files = [\n {\n relativePath: 'workspace.jsonc',\n content: await workspaceConfig(context),\n },\n ];\n\n if (!context.skipGit) {\n files.push({\n relativePath: '.gitignore',\n content: gitIgnore(),\n });\n }\n\n return files;\n },\n import: () => [\n { id: 'teambit.community/component-showcase' },\n ]\n };\n\n export default ${namePascalCase}WorkspaceStarter;\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,WAAWA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACtE,OAAQ;AACV;AACA;AACA;AACA,iBAAiBD,cAAe;AAChC,aAAaC,IAAK;AAClB,sBAAsBA,IAAK;AAC3B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mBAAmBD,cAAe;AAClC,CAAC;AACD"}
@@ -1,2 +1,2 @@
1
- import { ComponentTemplate } from '@teambit/generator';
1
+ import { ComponentTemplate } from '../../component-template';
2
2
  export declare const starterTemplate: ComponentTemplate;
@@ -1 +1 @@
1
- {"version":3,"names":["_index","data","require","_starter","_docFile","_gitIgnoreTpl","_workspaceConfigTpl","starterTemplate","exports","name","hidden","description","generateFiles","context","relativePath","content","indexFile","isMain","starterFile","docFile","gitIgnoreTemplate","workspaceConfigTemplate","config","env"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { starterFile } from './files/starter';\nimport { docFile } from './files/doc-file';\nimport { gitIgnoreTemplate } from './files/git-ignore-tpl';\nimport { workspaceConfigTemplate } from './files/workspace-config-tpl';\n\nexport const starterTemplate: ComponentTemplate = {\n name: 'standalone-starter',\n hidden: true,\n description:\n 'create your own workspace starter (standalone) - \\nDocs: https://bit.dev/reference/starters/create-starter',\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.starter.ts`,\n content: starterFile(context),\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docFile(context),\n },\n {\n relativePath: 'template/files/git-ignore.ts',\n content: gitIgnoreTemplate(),\n },\n\n {\n relativePath: 'template/files/workspace-config.ts',\n content: workspaceConfigTemplate(),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,oBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,mBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMM,eAAkC,GAAAC,OAAA,CAAAD,eAAA,GAAG;EAChDE,IAAI,EAAE,oBAAoB;EAC1BC,MAAM,EAAE,IAAI;EACZC,WAAW,EACT,4GAA4G;EAC9GC,aAAa,EAAGC,OAAyB,IAAK;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UAAU;MACxBC,OAAO,EAAE,IAAAC,kBAAS,EAACH,OAAO,CAAC;MAC3BI,MAAM,EAAE;IACV,CAAC,EACD;MACEH,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,aAAY;MAC1CM,OAAO,EAAE,IAAAG,sBAAW,EAACL,OAAO;IAC9B,CAAC,EACD;MACEC,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,WAAU;MACxCM,OAAO,EAAE,IAAAI,kBAAO,EAACN,OAAO;IAC1B,CAAC,EACD;MACEC,YAAY,EAAE,8BAA8B;MAC5CC,OAAO,EAAE,IAAAK,iCAAiB,EAAC;IAC7B,CAAC,EAED;MACEN,YAAY,EAAE,oCAAoC;MAClDC,OAAO,EAAE,IAAAM,6CAAuB,EAAC;IACnC,CAAC,CACF;EACH,CAAC;EACDC,MAAM,EAAE;IACN,wBAAwB,EAAE,CAAC,CAAC;IAC5B,mBAAmB,EAAE;MACnBC,GAAG,EAAE;IACP;EACF;AACF,CAAC"}
1
+ {"version":3,"names":["_index","data","require","_starter","_docFile","_gitIgnoreTpl","_workspaceConfigTpl","starterTemplate","exports","name","hidden","description","generateFiles","context","relativePath","content","indexFile","isMain","starterFile","docFile","gitIgnoreTemplate","workspaceConfigTemplate","config","env"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '../../component-template';\nimport { indexFile } from './files/index';\nimport { starterFile } from './files/starter';\nimport { docFile } from './files/doc-file';\nimport { gitIgnoreTemplate } from './files/git-ignore-tpl';\nimport { workspaceConfigTemplate } from './files/workspace-config-tpl';\n\nexport const starterTemplate: ComponentTemplate = {\n name: 'standalone-starter',\n hidden: true,\n description:\n 'create your own workspace starter (standalone) - \\nDocs: https://bit.dev/reference/starters/create-starter',\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.starter.ts`,\n content: starterFile(context),\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docFile(context),\n },\n {\n relativePath: 'template/files/git-ignore.ts',\n content: gitIgnoreTemplate(),\n },\n\n {\n relativePath: 'template/files/workspace-config.ts',\n content: workspaceConfigTemplate(),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,cAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,aAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,oBAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,mBAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMM,eAAkC,GAAAC,OAAA,CAAAD,eAAA,GAAG;EAChDE,IAAI,EAAE,oBAAoB;EAC1BC,MAAM,EAAE,IAAI;EACZC,WAAW,EACT,4GAA4G;EAC9GC,aAAa,EAAGC,OAAyB,IAAK;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UAAU;MACxBC,OAAO,EAAE,IAAAC,kBAAS,EAACH,OAAO,CAAC;MAC3BI,MAAM,EAAE;IACV,CAAC,EACD;MACEH,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,aAAY;MAC1CM,OAAO,EAAE,IAAAG,sBAAW,EAACL,OAAO;IAC9B,CAAC,EACD;MACEC,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,WAAU;MACxCM,OAAO,EAAE,IAAAI,kBAAO,EAACN,OAAO;IAC1B,CAAC,EACD;MACEC,YAAY,EAAE,8BAA8B;MAC5CC,OAAO,EAAE,IAAAK,iCAAiB,EAAC;IAC7B,CAAC,EAED;MACEN,YAAY,EAAE,oCAAoC;MAClDC,OAAO,EAAE,IAAAM,6CAAuB,EAAC;IACnC,CAAC,CACF;EACH,CAAC;EACDC,MAAM,EAAE;IACN,wBAAwB,EAAE,CAAC,CAAC;IAC5B,mBAAmB,EAAE;MACnBC,GAAG,EAAE;IACP;EACF;AACF,CAAC"}
@@ -25,7 +25,7 @@ export declare class WorkspaceGenerator {
25
25
  private generator;
26
26
  constructor(workspaceName: string, options: NewOptions & {
27
27
  currentDir?: boolean;
28
- }, template: WorkspaceTemplate, aspectComponent?: Component);
28
+ }, template: WorkspaceTemplate, aspectComponent?: Component | undefined);
29
29
  generate(): Promise<string>;
30
30
  private initGit;
31
31
  private setupGitBitmapMergeDriver;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/generator",
3
- "version": "1.0.142",
3
+ "version": "1.0.144",
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.142"
9
+ "version": "1.0.144"
10
10
  },
11
11
  "dependencies": {
12
12
  "camelcase": "6.2.0",
@@ -21,38 +21,37 @@
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/envs": "1.0.141",
25
- "@teambit/logger": "0.0.941",
26
- "@teambit/new-component-helper": "1.0.141",
27
- "@teambit/tracker": "1.0.141",
28
- "@teambit/workspace-config-files": "1.0.141",
29
- "@teambit/workspace.modules.node-modules-linker": "0.0.162",
30
- "@teambit/workspace": "1.0.141",
31
- "@teambit/component": "1.0.141",
32
- "@teambit/cli": "0.0.848",
33
- "@teambit/graphql": "1.0.141",
34
- "@teambit/aspect-loader": "1.0.141",
35
- "@teambit/bit": "1.6.34",
36
- "@teambit/git": "1.0.141",
37
- "@teambit/compiler": "1.0.141",
38
- "@teambit/forking": "1.0.141",
39
- "@teambit/importer": "1.0.141",
40
- "@teambit/install": "1.0.141",
41
- "@teambit/ui": "1.0.141",
42
- "@teambit/config": "0.0.892"
24
+ "@teambit/envs": "1.0.143",
25
+ "@teambit/logger": "0.0.942",
26
+ "@teambit/new-component-helper": "1.0.143",
27
+ "@teambit/tracker": "1.0.143",
28
+ "@teambit/workspace-config-files": "1.0.143",
29
+ "@teambit/workspace.modules.node-modules-linker": "0.0.163",
30
+ "@teambit/workspace": "1.0.143",
31
+ "@teambit/component": "1.0.143",
32
+ "@teambit/cli": "0.0.849",
33
+ "@teambit/graphql": "1.0.143",
34
+ "@teambit/aspect-loader": "1.0.143",
35
+ "@teambit/bit": "1.6.36",
36
+ "@teambit/git": "1.0.143",
37
+ "@teambit/compiler": "1.0.143",
38
+ "@teambit/forking": "1.0.143",
39
+ "@teambit/importer": "1.0.143",
40
+ "@teambit/install": "1.0.143",
41
+ "@teambit/ui": "1.0.143",
42
+ "@teambit/config": "0.0.894"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/fs-extra": "9.0.7",
46
46
  "@types/lodash": "4.14.165",
47
47
  "@types/mocha": "9.1.0",
48
- "@types/jest": "^29.2.2",
49
- "@types/testing-library__jest-dom": "^5.9.5",
50
- "@teambit/harmony.envs.core-aspect-env": "0.0.19",
48
+ "chai": "4.3.0",
49
+ "@teambit/harmony.envs.core-aspect-env": "0.0.24",
51
50
  "@teambit/generator.aspect-docs.generator": "0.0.171"
52
51
  },
53
52
  "peerDependencies": {
54
53
  "react": "^17.0.0 || ^18.0.0",
55
- "@types/react": "17.0.8",
54
+ "@types/react": "^17.0.73",
56
55
  "@teambit/legacy": "1.0.624"
57
56
  },
58
57
  "license": "Apache-2.0",
@@ -67,7 +66,8 @@
67
66
  "default": "./dist/index.js"
68
67
  },
69
68
  "./dist/*": "./dist/*",
70
- "./artifacts/*": "./artifacts/*"
69
+ "./artifacts/*": "./artifacts/*",
70
+ "./*": "./*.ts"
71
71
  },
72
72
  "private": false,
73
73
  "engines": {
@@ -1,4 +1,4 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
 
3
3
  export function componentTemplate({ namePascalCase, name }: ComponentContext) {
4
4
  return `import {
@@ -10,31 +10,31 @@ export function componentTemplate({ namePascalCase, name }: ComponentContext) {
10
10
  import { componentFile } from './files/component-file';
11
11
  import { testFile } from './files/test-file';
12
12
  import { compositionFile } from './files/composition-file';
13
-
13
+
14
14
  export type ${namePascalCase}ComponentTemplateOptions = {
15
15
  /**
16
16
  * name of the template
17
17
  */
18
18
  name?: string;
19
-
19
+
20
20
  /**
21
21
  * description of the template.
22
22
  */
23
23
  description?: string;
24
-
24
+
25
25
  /**
26
26
  * hide the template from the templates command.
27
27
  */
28
28
  hidden?: boolean;
29
29
  };
30
-
30
+
31
31
  export class ${namePascalCase}ComponentTemplate implements ComponentTemplate {
32
32
  constructor(
33
33
  readonly name = '${name}',
34
34
  readonly description = 'a template for ${name} components',
35
35
  readonly hidden = false
36
36
  ) {}
37
-
37
+
38
38
  generateFiles(context: ComponentContext): ComponentFile[] {
39
39
  return [
40
40
  indexFile(context),
@@ -43,7 +43,7 @@ export function componentTemplate({ namePascalCase, name }: ComponentContext) {
43
43
  testFile(context),
44
44
  ];
45
45
  }
46
-
46
+
47
47
  static from(options: ${namePascalCase}ComponentTemplateOptions = {}) {
48
48
  return () =>
49
49
  new ${namePascalCase}ComponentTemplate(
@@ -53,6 +53,6 @@ export function componentTemplate({ namePascalCase, name }: ComponentContext) {
53
53
  );
54
54
  }
55
55
  }
56
-
56
+
57
57
  `;
58
58
  }
@@ -1,4 +1,4 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
 
3
3
  export function indexFile({ namePascalCase, name }: ComponentContext) {
4
4
  return `import { ${namePascalCase}Aspect } from './${name}.aspect';
@@ -1,4 +1,4 @@
1
- import { ComponentContext, ComponentTemplate } from '@teambit/generator';
1
+ import { ComponentContext, ComponentTemplate } from '../../component-template';
2
2
  import { indexFile } from './files/index';
3
3
  import { aspectFile } from './files/aspect-file';
4
4
  import { docsFile } from './files/docs-file';
@@ -1,4 +1,4 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
 
3
3
  export function docFile(context: ComponentContext) {
4
4
  const { name, componentId } = context;
@@ -1,22 +1,22 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
 
3
3
  export function starterFile({ namePascalCase, name }: ComponentContext) {
4
4
  return `import { WorkspaceContext, WorkspaceTemplate } from '@teambit/generator';
5
5
  import { generateFiles as generateCommonFiles } from './template/files/generate-files';
6
-
6
+
7
7
  export type ${namePascalCase}StarterOptions = Pick<WorkspaceTemplate, 'name' | 'description' | 'hidden'>;
8
-
8
+
9
9
  export class ${namePascalCase}WorkspaceStarter implements WorkspaceTemplate {
10
10
  constructor(
11
11
  readonly name = '${name}-workspace',
12
12
  readonly description = '${namePascalCase} workspace with a custom react env',
13
13
  readonly hidden = false
14
14
  ) {}
15
-
15
+
16
16
  async generateFiles(context: WorkspaceContext) {
17
17
  return generateCommonFiles(context);
18
18
  }
19
-
19
+
20
20
  fork() {
21
21
  return [
22
22
  {
@@ -25,7 +25,7 @@ export function starterFile({ namePascalCase, name }: ComponentContext) {
25
25
  },
26
26
  ];
27
27
  }
28
-
28
+
29
29
  static from(options: Partial<${namePascalCase}StarterOptions>) {
30
30
  return () =>
31
31
  new ${namePascalCase}WorkspaceStarter(
@@ -35,6 +35,6 @@ export function starterFile({ namePascalCase, name }: ComponentContext) {
35
35
  );
36
36
  }
37
37
  }
38
-
38
+
39
39
  `;
40
40
  }
@@ -1,4 +1,4 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
 
3
3
  export function docFile(context: ComponentContext) {
4
4
  const { name, componentId } = context;
@@ -1,4 +1,4 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
 
3
3
  export function indexFile({ namePascalCase, name }: ComponentContext) {
4
4
  return `export { ${namePascalCase}WorkspaceStarter } from './${name}.starter';
@@ -1,10 +1,10 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../../component-template';
2
2
 
3
3
  export function starterFile({ namePascalCase, name }: ComponentContext) {
4
4
  return `import { WorkspaceContext, Starter } from '@teambit/generator';
5
5
  import { workspaceConfig } from './template/files/workspace-config';
6
6
  import { gitIgnore } from './template/files/git-ignore';
7
-
7
+
8
8
  export const ${namePascalCase}WorkspaceStarter: Starter = {
9
9
  name: '${name}-workspace',
10
10
  description: 'a ${name} workspace',
@@ -15,21 +15,21 @@ export function starterFile({ namePascalCase, name }: ComponentContext) {
15
15
  content: await workspaceConfig(context),
16
16
  },
17
17
  ];
18
-
18
+
19
19
  if (!context.skipGit) {
20
20
  files.push({
21
21
  relativePath: '.gitignore',
22
22
  content: gitIgnore(),
23
23
  });
24
24
  }
25
-
25
+
26
26
  return files;
27
27
  },
28
28
  import: () => [
29
29
  { id: 'teambit.community/component-showcase' },
30
30
  ]
31
31
  };
32
-
32
+
33
33
  export default ${namePascalCase}WorkspaceStarter;
34
34
  `;
35
35
  }
@@ -1,4 +1,4 @@
1
- import { ComponentContext, ComponentTemplate } from '@teambit/generator';
1
+ import { ComponentContext, ComponentTemplate } from '../../component-template';
2
2
  import { indexFile } from './files/index';
3
3
  import { starterFile } from './files/starter';
4
4
  import { docFile } from './files/doc-file';
package/tsconfig.json CHANGED
@@ -17,7 +17,10 @@
17
17
  "resolveJsonModule": true,
18
18
  "allowJs": true,
19
19
  "outDir": "dist",
20
- "emitDeclarationOnly": true
20
+ "emitDeclarationOnly": true,
21
+ "strict": true,
22
+ "strictPropertyInitialization": false,
23
+ "noImplicitAny": false
21
24
  },
22
25
  "exclude": [
23
26
  "artifacts",