@teambit/generator 1.0.424 → 1.0.426
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.
|
3
|
+
<testsuite name="teambit.generator/generator@1.0.426" 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={14335:(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.includes(n)||{}.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.includes(a))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},72771:(e,t,n)=>{Object.defineProperty(t,"W",{enumerable:!0,get:function(){return a.default}});var a=o(n(14335));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}},
|
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={14335:(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.includes(n)||{}.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.includes(a))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},72771:(e,t,n)=>{Object.defineProperty(t,"W",{enumerable:!0,get:function(){return a.default}});var a=o(n(14335));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}},1364:(e,t,n)=>{var a={id:"teambit.generator/generator@1.0.426",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(1364),l=(n(41594),n(5016));const m=TeambitMdxUiMdxScopeContext;var p=n(72771),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})()));
|
package/artifacts/schema.json
CHANGED
@@ -14159,7 +14159,7 @@
|
|
14159
14159
|
"componentId": {
|
14160
14160
|
"scope": "teambit.generator",
|
14161
14161
|
"name": "generator",
|
14162
|
-
"version": "1.0.
|
14162
|
+
"version": "1.0.426"
|
14163
14163
|
},
|
14164
14164
|
"taggedModuleExports": []
|
14165
14165
|
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.426/dist/generator.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.426/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.
|
3
|
+
"version": "1.0.426",
|
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.
|
9
|
+
"version": "1.0.426"
|
10
10
|
},
|
11
11
|
"dependencies": {
|
12
12
|
"camelcase": "6.2.0",
|
@@ -22,30 +22,30 @@
|
|
22
22
|
"@teambit/harmony": "0.4.6",
|
23
23
|
"@teambit/git.modules.git-ignore": "1.0.2",
|
24
24
|
"@teambit/component.sources": "0.0.33",
|
25
|
-
"@teambit/envs": "1.0.
|
26
|
-
"@teambit/logger": "0.0.
|
27
|
-
"@teambit/new-component-helper": "1.0.
|
25
|
+
"@teambit/envs": "1.0.425",
|
26
|
+
"@teambit/logger": "0.0.1095",
|
27
|
+
"@teambit/new-component-helper": "1.0.425",
|
28
28
|
"@teambit/pkg.modules.component-package-name": "0.0.5",
|
29
29
|
"@teambit/toolbox.path.path": "0.0.4",
|
30
|
-
"@teambit/tracker": "1.0.
|
31
|
-
"@teambit/workspace-config-files": "1.0.
|
30
|
+
"@teambit/tracker": "1.0.425",
|
31
|
+
"@teambit/workspace-config-files": "1.0.425",
|
32
32
|
"@teambit/workspace.modules.node-modules-linker": "0.0.208",
|
33
|
-
"@teambit/workspace": "1.0.
|
34
|
-
"@teambit/component": "1.0.
|
35
|
-
"@teambit/cli": "0.0.
|
36
|
-
"@teambit/graphql": "1.0.
|
37
|
-
"@teambit/aspect-loader": "1.0.
|
38
|
-
"@teambit/bit": "1.8.
|
39
|
-
"@teambit/deprecation": "1.0.
|
40
|
-
"@teambit/git": "1.0.
|
41
|
-
"@teambit/compiler": "1.0.
|
42
|
-
"@teambit/forking": "1.0.
|
33
|
+
"@teambit/workspace": "1.0.425",
|
34
|
+
"@teambit/component": "1.0.425",
|
35
|
+
"@teambit/cli": "0.0.1002",
|
36
|
+
"@teambit/graphql": "1.0.425",
|
37
|
+
"@teambit/aspect-loader": "1.0.425",
|
38
|
+
"@teambit/bit": "1.8.76",
|
39
|
+
"@teambit/deprecation": "1.0.425",
|
40
|
+
"@teambit/git": "1.0.425",
|
41
|
+
"@teambit/compiler": "1.0.425",
|
42
|
+
"@teambit/forking": "1.0.425",
|
43
43
|
"@teambit/git.modules.git-executable": "0.0.1",
|
44
|
-
"@teambit/host-initializer": "0.0.
|
45
|
-
"@teambit/importer": "1.0.
|
46
|
-
"@teambit/install": "1.0.
|
47
|
-
"@teambit/ui": "1.0.
|
48
|
-
"@teambit/config": "0.0.
|
44
|
+
"@teambit/host-initializer": "0.0.138",
|
45
|
+
"@teambit/importer": "1.0.425",
|
46
|
+
"@teambit/install": "1.0.425",
|
47
|
+
"@teambit/ui": "1.0.425",
|
48
|
+
"@teambit/config": "0.0.1176"
|
49
49
|
},
|
50
50
|
"devDependencies": {
|
51
51
|
"@types/fs-extra": "9.0.7",
|