@teambit/generator 1.0.338 → 1.0.340
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_generator_generator-preview.js +1 -1
- package/artifacts/schema.json +1 -1
- package/dist/generator.main.runtime.js +1 -1
- package/dist/generator.main.runtime.js.map +1 -1
- package/dist/{preview-1721099996991.js → preview-1721223204715.js} +2 -2
- package/dist/workspace-generator.d.ts +1 -0
- package/dist/workspace-generator.js +30 -1
- package/dist/workspace-generator.js.map +1 -1
- package/package.json +23 -23
@@ -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.340" 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={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}},
|
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}},417:(e,t,n)=>{var a={id:"teambit.generator/generator@1.0.340",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(417),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})()));
|
package/artifacts/schema.json
CHANGED
@@ -13101,7 +13101,7 @@
|
|
13101
13101
|
"componentId": {
|
13102
13102
|
"scope": "teambit.generator",
|
13103
13103
|
"name": "generator",
|
13104
|
-
"version": "1.0.
|
13104
|
+
"version": "1.0.340"
|
13105
13105
|
},
|
13106
13106
|
"taggedModuleExports": []
|
13107
13107
|
}
|
@@ -592,7 +592,7 @@ the reason is that after refactoring, the code will have this invalid class: "cl
|
|
592
592
|
remoteEnvsAspect = globals.remoteEnvsAspect;
|
593
593
|
fullAspectId = globals.fullAspectId;
|
594
594
|
}
|
595
|
-
const allIds = configEnvs?.concat(ids).concat([aspectId, fullAspectId]).filter(Boolean);
|
595
|
+
const allIds = (0, _lodash().uniq)(configEnvs?.concat(ids).concat([aspectId, fullAspectId]).filter(Boolean));
|
596
596
|
const envs = await this.loadEnvs(allIds, remoteEnvsAspect);
|
597
597
|
const templates = envs.flatMap(env => {
|
598
598
|
if (!env.env.getGeneratorTemplates) return [];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_camelcase","_path","_graphql","_cli","_workspace","_envs","_config","_workspaceConfigFiles","_component","_bit","_harmony","_git","_bitError","_aspectLoader","_tracker","_newComponentHelper","_lodash","_logger","_generator","_create","_templates","_generator2","_componentGenerator","_workspaceGenerator","_new","_templates2","_basic","_starter","_generator3","_workspacePathExists","e","__esModule","default","ownKeys","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","GeneratorMain","constructor","componentTemplateSlot","workspaceTemplateSlot","onComponentCreateSlot","config","workspace","envs","aspectLoader","newComponentHelper","componentAspect","tracker","logger","git","wsConfigFiles","id","template","shouldBeHidden","hidden","hideCoreTemplates","isCoreAspect","aspectId","name","description","registerComponentTemplate","templates","register","registerWorkspaceTemplate","registerOnComponentCreate","fn","listTemplates","aspect","isRunningInsideWorkspace","getAllComponentTemplatesDescriptorsFlattened","getAllWorkspaceTemplatesDescriptorFlattened","listComponentTemplates","opts","Boolean","getComponentTemplateByAspect","get","getComponentTemplate","fromEnv","listEnvComponentTemplates","found","findTemplateByAspectIdAndName","getAllComponentTemplatesFlattened","find","idWithoutVersion","split","getGlobalGeneratorEnvs","globalScopeHarmony","components","legacyGlobalsSnapshot","loadAspectsFromGlobalScope","remoteGenerator","GeneratorAspect","remoteEnvsAspect","EnvsAspect","fullAspectId","toString","restoreGlobalsFromSnapshot","findWorkspaceTemplateInGlobalScope","fromGlobal","searchRegisteredWorkspaceTemplate","workspaceTemplate","findTemplateInOtherWorkspace","workspacePath","BitError","harmony","loadBit","WorkspaceAspect","err","Error","aspectComponentId","resolveComponentId","loadAspects","aspectComponent","aspectFullId","generator","getWorkspaceTemplate","registeredTemplate","listEnvWorkspaceTemplates","getAllWorkspaceTemplatesFlattened","tpl","generateComponentTemplate","componentNames","templateName","options","OutsideWorkspaceError","namespace","componentConfigLoadingRegistry","ComponentConfig","templateWithId","componentIds","map","componentName","getNewComponentId","scope","componentNameSameAsTemplateName","componentId","compNamePascal","camelCase","pascalCase","envId","getEnvIdFromTemplateWithId","componentGenerator","ComponentGenerator","generate","force","envIdFromTemplate","env","parsedFromTemplate","ComponentID","tryFromString","resolvedId","resolveEnvIdWithPotentialVersionForConfig","fromString","envName","Promise","resolve","undefined","generateWorkspaceTemplate","workspaceName","currentDir","process","cwd","fs","existsSync","WorkspacePathExists","loadFrom","workspaceGenerator","WorkspaceGenerator","appName","envTemplates","listEnvComponentTemplateDescriptors","filtered","flattened","getTemplateDescriptor","templatesByAspects","toArray","flatMap","componentTemplates","workspaceTemplates","loadEnvs","getGeneratorStarters","envStarters","starter","compact","ids","envTemplate","toStringWithoutVersion","titlePrefix","getConfiguredEnvs","configEnvs","includes","globals","allIds","concat","getGeneratorTemplates","tpls","host","getHost","envsAspect","potentialEnvs","getEnvDefinition","aspectLoaded","aspects","provider","cli","graphql","loggerMain","createLogger","commands","CreateCmd","TemplatesCmd","NewCmd","generatorSchema","registerPlugins","StarterPlugin","registerService","GeneratorService","componentGeneratorTemplate","componentGeneratorTemplateStandalone","starterTemplate","starterTemplateStandalone","BasicWorkspaceStarter","exports","Slot","withType","CLIAspect","GraphqlAspect","AspectLoaderAspect","NewComponentHelperAspect","ComponentAspect","TrackerAspect","LoggerAspect","GitAspect","WorkspaceConfigFilesAspect","MainRuntime","addRuntime"],"sources":["generator.main.runtime.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport camelCase from 'camelcase';\nimport { resolve } from 'path';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { EnvDefinition, EnvsAspect, EnvsMain } from '@teambit/envs';\nimport ComponentConfig from '@teambit/legacy/dist/consumer/config';\nimport { WorkspaceConfigFilesAspect, WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';\nimport { ComponentAspect, ComponentID } from '@teambit/component';\nimport type { ComponentMain, Component } from '@teambit/component';\nimport { isCoreAspect, loadBit, restoreGlobalsFromSnapshot } from '@teambit/bit';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { GitAspect, GitMain } from '@teambit/git';\nimport { BitError } from '@teambit/bit-error';\nimport { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader';\nimport { TrackerAspect, TrackerMain } from '@teambit/tracker';\nimport { NewComponentHelperAspect, NewComponentHelperMain } from '@teambit/new-component-helper';\nimport { compact } from 'lodash';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { ComponentTemplate } from './component-template';\nimport { GeneratorAspect } from './generator.aspect';\nimport { CreateCmd, CreateOptions } from './create.cmd';\nimport { TemplatesCmd } from './templates.cmd';\nimport { generatorSchema } from './generator.graphql';\nimport { ComponentGenerator, GenerateResult, OnComponentCreateFn } from './component-generator';\nimport { WorkspaceGenerator } from './workspace-generator';\nimport { WorkspaceTemplate } from './workspace-template';\nimport { NewCmd, NewOptions } from './new.cmd';\nimport {\n componentGeneratorTemplate,\n componentGeneratorTemplateStandalone,\n starterTemplate,\n starterTemplateStandalone,\n} from './templates';\nimport { BasicWorkspaceStarter } from './templates/basic';\nimport { StarterPlugin } from './starter.plugin';\nimport { GeneratorService } from './generator.service';\nimport { WorkspacePathExists } from './exceptions/workspace-path-exists';\n\nexport type ComponentTemplateSlot = SlotRegistry<ComponentTemplate[]>;\nexport type WorkspaceTemplateSlot = SlotRegistry<WorkspaceTemplate[]>;\nexport type OnComponentCreateSlot = SlotRegistry<OnComponentCreateFn>;\n\nexport type TemplateDescriptor = {\n aspectId: string;\n titlePrefix?: string;\n name: string;\n description?: string;\n hidden?: boolean;\n};\n\ntype TemplateWithId = { id: string; envName?: string };\ntype WorkspaceTemplateWithId = TemplateWithId & { template: WorkspaceTemplate };\ntype ComponentTemplateWithId = TemplateWithId & { template: ComponentTemplate };\ntype AnyTemplateWithId = TemplateWithId & { template: ComponentTemplate | WorkspaceTemplate };\n\nexport type GenerateWorkspaceTemplateResult = { workspacePath: string; appName?: string };\n\nexport type GeneratorConfig = {\n /**\n * array of aspects to include in the list of templates.\n */\n aspects: string[];\n\n /**\n * by default core templates are shown.\n * use this to hide them unless `--show-all` flag of `bit templates` was used\n */\n hideCoreTemplates: boolean;\n\n /**\n * default envs.\n */\n envs?: string[];\n};\n\nexport class GeneratorMain {\n private aspectLoaded = false;\n constructor(\n private componentTemplateSlot: ComponentTemplateSlot,\n private workspaceTemplateSlot: WorkspaceTemplateSlot,\n private onComponentCreateSlot: OnComponentCreateSlot,\n private config: GeneratorConfig,\n private workspace: Workspace,\n private envs: EnvsMain,\n private aspectLoader: AspectLoaderMain,\n private newComponentHelper: NewComponentHelperMain,\n private componentAspect: ComponentMain,\n private tracker: TrackerMain,\n private logger: Logger,\n private git: GitMain,\n private wsConfigFiles: WorkspaceConfigFilesMain\n ) {}\n\n /**\n * register a new component template.\n */\n registerComponentTemplate(templates: ComponentTemplate[]) {\n this.componentTemplateSlot.register(templates);\n return this;\n }\n\n /**\n * register a new workspace starter.\n */\n registerWorkspaceTemplate(templates: WorkspaceTemplate[]) {\n this.workspaceTemplateSlot.register(templates);\n return this;\n }\n\n registerOnComponentCreate(fn: OnComponentCreateFn) {\n this.onComponentCreateSlot.register(fn);\n return this;\n }\n\n /**\n * list all component templates registered in the workspace or workspace templates in case the\n * workspace is not available\n */\n async listTemplates({ aspect }: { aspect?: string } = {}): Promise<TemplateDescriptor[]> {\n if (this.isRunningInsideWorkspace()) {\n return this.getAllComponentTemplatesDescriptorsFlattened(aspect);\n }\n return this.getAllWorkspaceTemplatesDescriptorFlattened(aspect);\n }\n\n private getTemplateDescriptor = ({ id, template }: AnyTemplateWithId): TemplateDescriptor => {\n const shouldBeHidden = () => {\n if (template.hidden) return true;\n if (this.config.hideCoreTemplates && isCoreAspect(id)) return true;\n return false;\n };\n return {\n aspectId: id,\n name: template.name,\n description: template.description,\n hidden: shouldBeHidden(),\n };\n };\n\n /**\n * @deprecated use this.listTemplates()\n */\n async listComponentTemplates(opts: { aspect?: string }): Promise<TemplateDescriptor[]> {\n return this.listTemplates(opts);\n }\n\n isRunningInsideWorkspace(): boolean {\n return Boolean(this.workspace);\n }\n\n /**\n * get all component templates registered by a specific aspect ID.\n */\n getComponentTemplateByAspect(aspectId: string): ComponentTemplate[] {\n return this.componentTemplateSlot.get(aspectId) || [];\n }\n\n /**\n * returns a specific component template.\n */\n async getComponentTemplate(name: string, aspectId?: string): Promise<ComponentTemplateWithId | undefined> {\n const fromEnv = await this.listEnvComponentTemplates([], aspectId);\n if (fromEnv && fromEnv.length) {\n const found = this.findTemplateByAspectIdAndName<ComponentTemplateWithId>(aspectId, name, fromEnv);\n if (found) return found;\n }\n // fallback to aspect id not from env if provided\n const templates = await this.getAllComponentTemplatesFlattened();\n const found = this.findTemplateByAspectIdAndName<ComponentTemplateWithId>(aspectId, name, templates);\n return found;\n }\n\n private findTemplateByAspectIdAndName<T>(\n aspectId: string | undefined,\n name: string,\n templates: Array<T>\n ): T | undefined {\n // @ts-ignore (should set T to be extends ComponentTemplateWithId or WorkspaceTemplateWithId)\n const found = templates.find(({ id, template }) => {\n // When doing something like:\n // bit create react-env my-env --aspect teambit.react/react-env\n // we will get the aspectId without version\n // but the env might be loaded from the global scope then it will be with a version\n // so it won't found if we don't look for it like this\n const idWithoutVersion = id.split('@')[0];\n if (aspectId && id !== aspectId && idWithoutVersion !== aspectId) return false;\n return template.name === name;\n });\n return found;\n }\n\n /**\n * Get the generator aspect and the envs aspect from an harmony instance of the global scope\n */\n private async getGlobalGeneratorEnvs(\n aspectId: string\n ): Promise<{ remoteGenerator: GeneratorMain; fullAspectId: string; remoteEnvsAspect: EnvsMain; aspect: any }> {\n const { globalScopeHarmony, components, legacyGlobalsSnapshot } =\n await this.aspectLoader.loadAspectsFromGlobalScope([aspectId]);\n const remoteGenerator = globalScopeHarmony.get<GeneratorMain>(GeneratorAspect.id);\n const remoteEnvsAspect = globalScopeHarmony.get<EnvsMain>(EnvsAspect.id);\n const aspect = components[0];\n const fullAspectId = aspect.id.toString();\n restoreGlobalsFromSnapshot(legacyGlobalsSnapshot);\n\n return { remoteGenerator, fullAspectId, remoteEnvsAspect, aspect };\n }\n\n /**\n * in the case the aspect-id is given and this aspect doesn't exist locally, import it to the\n * global scope and load it from the capsule\n */\n async findWorkspaceTemplateInGlobalScope(\n aspectId: string,\n name?: string\n ): Promise<{ workspaceTemplate?: WorkspaceTemplate; aspect?: Component }> {\n const { remoteGenerator, fullAspectId, remoteEnvsAspect, aspect } = await this.getGlobalGeneratorEnvs(aspectId);\n const fromGlobal = await remoteGenerator.searchRegisteredWorkspaceTemplate.call(\n remoteGenerator,\n name,\n fullAspectId,\n remoteEnvsAspect\n );\n return { workspaceTemplate: fromGlobal, aspect };\n }\n\n async findTemplateInOtherWorkspace(workspacePath: string, name: string, aspectId?: string) {\n if (!aspectId)\n throw new BitError(\n `to load a template from a different workspace, please provide the aspect-id using --aspect flag`\n );\n const harmony = await loadBit(workspacePath);\n let workspace: Workspace;\n try {\n workspace = harmony.get<Workspace>(WorkspaceAspect.id);\n } catch (err: any) {\n throw new Error(`fatal: \"${workspacePath}\" is not a valid Bit workspace, make sure the path is correct`);\n }\n const aspectComponentId = await workspace.resolveComponentId(aspectId);\n await workspace.loadAspects([aspectId], true);\n const aspectComponent = await workspace.get(aspectComponentId);\n const aspectFullId = aspectComponentId.toString();\n const generator = harmony.get<GeneratorMain>(GeneratorAspect.id);\n const workspaceTemplate = await generator.searchRegisteredWorkspaceTemplate(name, aspectFullId);\n return { workspaceTemplate, aspect: aspectComponent };\n }\n\n /**\n * returns a specific workspace template.\n */\n async getWorkspaceTemplate(\n name: string,\n aspectId?: string\n ): Promise<{ workspaceTemplate: WorkspaceTemplate; aspect?: Component }> {\n const registeredTemplate = await this.searchRegisteredWorkspaceTemplate(name, aspectId);\n if (registeredTemplate) {\n return { workspaceTemplate: registeredTemplate };\n }\n if (!aspectId) {\n throw new BitError(\n `template \"${name}\" was not found, please use --aspect flag to load from an env i.e --aspect teambit.react/react-env\\n Learn more about component templates here: https://bit.dev/reference/generator/create-generator`\n );\n }\n\n const { workspaceTemplate, aspect } = await this.findWorkspaceTemplateInGlobalScope(aspectId, name);\n if (workspaceTemplate) {\n return { workspaceTemplate, aspect };\n }\n throw new BitError(\n `template \"${name}\" was not found, please use --aspect flag to load from an env i.e --aspect teambit.react/react-env\\n Learn more about component templates here: https://bit.dev/reference/generator/create-generator`\n );\n }\n\n async searchRegisteredWorkspaceTemplate(\n name?: string,\n aspectId?: string,\n remoteEnvsAspect?: EnvsMain\n ): Promise<WorkspaceTemplate | undefined> {\n let fromEnv;\n\n if (aspectId) {\n fromEnv = await this.listEnvWorkspaceTemplates(aspectId, remoteEnvsAspect);\n }\n const templates = fromEnv && fromEnv.length ? fromEnv : this.getAllWorkspaceTemplatesFlattened();\n const found = templates.find(({ id, template: tpl }) => {\n if (aspectId && name) return aspectId === id && name === tpl.name;\n if (aspectId) return aspectId === id;\n if (name) return name === tpl.name;\n throw new Error(`searchRegisteredWorkspaceTemplate expects to get \"name\" or \"aspectId\"`);\n });\n\n return found?.template;\n }\n\n async generateComponentTemplate(\n componentNames: string[],\n templateName: string,\n options: Partial<CreateOptions>\n ): Promise<GenerateResult[]> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n await this.loadAspects();\n const { namespace, aspect } = options;\n\n const componentConfigLoadingRegistry = ComponentConfig.componentConfigLoadingRegistry;\n\n const templateWithId = await this.getComponentTemplate(templateName, aspect);\n\n ComponentConfig.componentConfigLoadingRegistry = componentConfigLoadingRegistry;\n\n if (!templateWithId) throw new BitError(`template \"${templateName}\" was not found`);\n\n const componentIds = componentNames.map((componentName) =>\n this.newComponentHelper.getNewComponentId(componentName, namespace, options.scope)\n );\n\n const componentNameSameAsTemplateName = componentIds.find((componentId) => componentId.name === templateName);\n if (componentNameSameAsTemplateName) {\n const compNamePascal = camelCase(templateName, { pascalCase: true });\n throw new BitError(\n `unable to create a component with the same name as the template \"${templateName}\", please use a different name.\nthe reason is that after refactoring, the code will have this invalid class: \"class ${compNamePascal} extends ${compNamePascal} {}\"`\n );\n }\n\n const envId = await this.getEnvIdFromTemplateWithId(templateWithId);\n\n const componentGenerator = new ComponentGenerator(\n this.workspace,\n componentIds,\n options,\n templateWithId.template,\n this.envs,\n this.newComponentHelper,\n this.tracker,\n this.wsConfigFiles,\n this.logger,\n this.onComponentCreateSlot,\n templateWithId.id,\n envId\n );\n return componentGenerator.generate(options.force);\n }\n\n private async getEnvIdFromTemplateWithId(templateWithId: ComponentTemplateWithId): Promise<ComponentID | undefined> {\n const envIdFromTemplate = templateWithId.template.env;\n if (envIdFromTemplate) {\n const parsedFromTemplate = ComponentID.tryFromString(envIdFromTemplate);\n if (!parsedFromTemplate) {\n throw new BitError(\n `Error: unable to parse envId from template. template name: ${templateWithId.template.name}, envId: ${envIdFromTemplate}`\n );\n }\n const resolvedId = await this.workspace.resolveEnvIdWithPotentialVersionForConfig(parsedFromTemplate);\n return ComponentID.fromString(resolvedId);\n }\n if (templateWithId.envName) {\n return ComponentID.fromString(templateWithId.id);\n }\n return Promise.resolve(undefined);\n }\n\n async generateWorkspaceTemplate(\n workspaceName: string,\n templateName: string,\n options: NewOptions & { aspect?: string; currentDir?: boolean }\n ): Promise<GenerateWorkspaceTemplateResult> {\n if (this.workspace) {\n throw new BitError('Error: unable to generate a new workspace inside of an existing workspace');\n }\n const workspacePath = options.currentDir ? process.cwd() : resolve(workspaceName);\n if (!options.currentDir && fs.existsSync(workspacePath)) {\n throw new WorkspacePathExists(workspacePath);\n }\n const { aspect: aspectId, loadFrom } = options;\n const { workspaceTemplate, aspect } = loadFrom\n ? await this.findTemplateInOtherWorkspace(loadFrom, templateName, aspectId)\n : await this.getWorkspaceTemplate(templateName, aspectId);\n\n if (!workspaceTemplate) throw new BitError(`template \"${templateName}\" was not found`);\n const workspaceGenerator = new WorkspaceGenerator(workspaceName, workspacePath, options, workspaceTemplate, aspect);\n await workspaceGenerator.generate();\n return { workspacePath, appName: workspaceTemplate.appName };\n }\n\n private async getAllComponentTemplatesDescriptorsFlattened(aspectId?: string): Promise<Array<TemplateDescriptor>> {\n const envTemplates = await this.listEnvComponentTemplateDescriptors([], aspectId);\n if (envTemplates && envTemplates.length) {\n if (!aspectId) return envTemplates;\n const filtered = envTemplates.filter((template) => template.aspectId === aspectId);\n if (filtered.length) return filtered;\n }\n\n const flattened = this.getAllComponentTemplatesFlattened();\n const filtered = aspectId ? flattened.filter((template) => template.id === aspectId) : flattened;\n return filtered.map((template) => this.getTemplateDescriptor(template));\n }\n\n private getAllComponentTemplatesFlattened(): Array<{ id: string; template: ComponentTemplate }> {\n const templatesByAspects = this.componentTemplateSlot.toArray();\n const flattened = templatesByAspects.flatMap(([id, componentTemplates]) => {\n return componentTemplates.map((template) => ({\n id,\n template,\n }));\n });\n return flattened;\n }\n\n private async getAllWorkspaceTemplatesDescriptorFlattened(aspectId?: string): Promise<Array<TemplateDescriptor>> {\n let envTemplates;\n if (aspectId) {\n envTemplates = await this.listEnvWorkspaceTemplates(aspectId);\n }\n\n const templates = envTemplates && envTemplates.length ? envTemplates : this.getAllWorkspaceTemplatesFlattened();\n return templates.map((template) => this.getTemplateDescriptor(template));\n }\n\n private getAllWorkspaceTemplatesFlattened(): Array<{ id: string; template: WorkspaceTemplate }> {\n const templatesByAspects = this.workspaceTemplateSlot.toArray();\n return templatesByAspects.flatMap(([id, workspaceTemplates]) => {\n return workspaceTemplates.map((template) => ({\n id,\n template,\n }));\n });\n }\n\n /**\n * list all starter templates registered by an env.\n */\n async listEnvWorkspaceTemplates(envId: string, remoteEnvsAspect?: EnvsMain): Promise<Array<WorkspaceTemplateWithId>> {\n const envs = await this.loadEnvs([envId], remoteEnvsAspect);\n const workspaceTemplates = envs.flatMap((env) => {\n if (!env.env.getGeneratorStarters) return undefined;\n const envStarters = env.env.getGeneratorStarters();\n return envStarters.map((starter) => {\n const componentId = ComponentID.fromString(env.id);\n return {\n id: componentId.toString(),\n envName: env.name,\n template: starter,\n };\n });\n });\n\n return compact(workspaceTemplates);\n }\n\n /**\n * list all component templates registered by an env.\n */\n async listEnvComponentTemplateDescriptors(ids: string[] = [], aspectId?: string): Promise<TemplateDescriptor[]> {\n const envTemplates = await this.listEnvComponentTemplates(ids, aspectId);\n const templates: TemplateDescriptor[] = envTemplates.map((envTemplate) => {\n const componentId = ComponentID.fromString(envTemplate.id);\n return {\n aspectId: componentId.toStringWithoutVersion(),\n titlePrefix: envTemplate.envName,\n ...envTemplate.template,\n };\n });\n\n return templates;\n }\n\n getConfiguredEnvs(): string[] {\n return this.config.envs ?? [];\n }\n\n async listEnvComponentTemplates(ids: string[] = [], aspectId?: string): Promise<Array<ComponentTemplateWithId>> {\n const configEnvs = this.config.envs || [];\n let remoteEnvsAspect;\n let fullAspectId;\n if (aspectId && !configEnvs.includes(aspectId)) {\n const globals = await this.getGlobalGeneratorEnvs(aspectId);\n remoteEnvsAspect = globals.remoteEnvsAspect;\n fullAspectId = globals.fullAspectId;\n }\n const allIds = configEnvs?.concat(ids).concat([aspectId, fullAspectId]).filter(Boolean);\n const envs = await this.loadEnvs(allIds, remoteEnvsAspect);\n const templates = envs.flatMap((env) => {\n if (!env.env.getGeneratorTemplates) return [];\n const tpls = env.env.getGeneratorTemplates() || [];\n const componentId = ComponentID.fromString(env.id);\n return tpls.map((template) => {\n return {\n id: componentId.toString(),\n envName: env.name,\n template,\n };\n });\n });\n\n return templates;\n }\n\n async loadEnvs(ids: string[] = this.config.envs || [], remoteEnvsAspect?: EnvsMain): Promise<EnvDefinition[]> {\n // In case we have remoteEnvsAspect it means that we are running from the global scope\n // in that case the aspect / env were already loaded before to the global scope harmony instance\n // so no reason to load it here\n if (!remoteEnvsAspect) {\n const host = this.componentAspect.getHost();\n if (!host) return [];\n await host.loadAspects(ids);\n }\n\n const envsAspect = remoteEnvsAspect || this.envs;\n\n const potentialEnvs = ids.map((id) => {\n const componentId = ComponentID.fromString(id);\n return envsAspect.getEnvDefinition(componentId);\n });\n\n return compact(potentialEnvs);\n }\n\n async loadAspects() {\n if (this.aspectLoaded) return;\n await this.workspace.loadAspects(this.config.aspects);\n this.aspectLoaded = true;\n }\n\n static slots = [\n Slot.withType<ComponentTemplate[]>(),\n Slot.withType<WorkspaceTemplate[]>(),\n Slot.withType<OnComponentCreateFn>(),\n ];\n\n static dependencies = [\n WorkspaceAspect,\n CLIAspect,\n GraphqlAspect,\n EnvsAspect,\n AspectLoaderAspect,\n NewComponentHelperAspect,\n ComponentAspect,\n TrackerAspect,\n LoggerAspect,\n GitAspect,\n WorkspaceConfigFilesAspect,\n ];\n\n static runtime = MainRuntime;\n\n static async provider(\n [\n workspace,\n cli,\n graphql,\n envs,\n aspectLoader,\n newComponentHelper,\n componentAspect,\n tracker,\n loggerMain,\n git,\n wsConfigFiles,\n ]: [\n Workspace,\n CLIMain,\n GraphqlMain,\n EnvsMain,\n AspectLoaderMain,\n NewComponentHelperMain,\n ComponentMain,\n TrackerMain,\n LoggerMain,\n GitMain,\n WorkspaceConfigFilesMain\n ],\n config: GeneratorConfig,\n [componentTemplateSlot, workspaceTemplateSlot, onComponentCreateSlot]: [\n ComponentTemplateSlot,\n WorkspaceTemplateSlot,\n OnComponentCreateSlot\n ]\n ) {\n const logger = loggerMain.createLogger(GeneratorAspect.id);\n const generator = new GeneratorMain(\n componentTemplateSlot,\n workspaceTemplateSlot,\n onComponentCreateSlot,\n config,\n workspace,\n envs,\n aspectLoader,\n newComponentHelper,\n componentAspect,\n tracker,\n logger,\n git,\n wsConfigFiles\n );\n const commands = [new CreateCmd(generator), new TemplatesCmd(generator), new NewCmd(generator)];\n cli.register(...commands);\n graphql.register(generatorSchema(generator));\n aspectLoader.registerPlugins([new StarterPlugin(generator)]);\n envs.registerService(new GeneratorService());\n\n if (generator)\n generator.registerComponentTemplate([\n componentGeneratorTemplate,\n componentGeneratorTemplateStandalone,\n starterTemplate,\n starterTemplateStandalone,\n ]);\n generator.registerWorkspaceTemplate([BasicWorkspaceStarter]);\n\n return generator;\n }\n}\n\nGeneratorAspect.addRuntime(GeneratorMain);\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,KAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,IAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EA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_interopRequireDefault","require","_camelcase","_path","_graphql","_cli","_workspace","_envs","_config","_workspaceConfigFiles","_component","_bit","_harmony","_git","_bitError","_aspectLoader","_tracker","_newComponentHelper","_lodash","_logger","_generator","_create","_templates","_generator2","_componentGenerator","_workspaceGenerator","_new","_templates2","_basic","_starter","_generator3","_workspacePathExists","e","__esModule","default","ownKeys","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","GeneratorMain","constructor","componentTemplateSlot","workspaceTemplateSlot","onComponentCreateSlot","config","workspace","envs","aspectLoader","newComponentHelper","componentAspect","tracker","logger","git","wsConfigFiles","id","template","shouldBeHidden","hidden","hideCoreTemplates","isCoreAspect","aspectId","name","description","registerComponentTemplate","templates","register","registerWorkspaceTemplate","registerOnComponentCreate","fn","listTemplates","aspect","isRunningInsideWorkspace","getAllComponentTemplatesDescriptorsFlattened","getAllWorkspaceTemplatesDescriptorFlattened","listComponentTemplates","opts","Boolean","getComponentTemplateByAspect","get","getComponentTemplate","fromEnv","listEnvComponentTemplates","found","findTemplateByAspectIdAndName","getAllComponentTemplatesFlattened","find","idWithoutVersion","split","getGlobalGeneratorEnvs","globalScopeHarmony","components","legacyGlobalsSnapshot","loadAspectsFromGlobalScope","remoteGenerator","GeneratorAspect","remoteEnvsAspect","EnvsAspect","fullAspectId","toString","restoreGlobalsFromSnapshot","findWorkspaceTemplateInGlobalScope","fromGlobal","searchRegisteredWorkspaceTemplate","workspaceTemplate","findTemplateInOtherWorkspace","workspacePath","BitError","harmony","loadBit","WorkspaceAspect","err","Error","aspectComponentId","resolveComponentId","loadAspects","aspectComponent","aspectFullId","generator","getWorkspaceTemplate","registeredTemplate","listEnvWorkspaceTemplates","getAllWorkspaceTemplatesFlattened","tpl","generateComponentTemplate","componentNames","templateName","options","OutsideWorkspaceError","namespace","componentConfigLoadingRegistry","ComponentConfig","templateWithId","componentIds","map","componentName","getNewComponentId","scope","componentNameSameAsTemplateName","componentId","compNamePascal","camelCase","pascalCase","envId","getEnvIdFromTemplateWithId","componentGenerator","ComponentGenerator","generate","force","envIdFromTemplate","env","parsedFromTemplate","ComponentID","tryFromString","resolvedId","resolveEnvIdWithPotentialVersionForConfig","fromString","envName","Promise","resolve","undefined","generateWorkspaceTemplate","workspaceName","currentDir","process","cwd","fs","existsSync","WorkspacePathExists","loadFrom","workspaceGenerator","WorkspaceGenerator","appName","envTemplates","listEnvComponentTemplateDescriptors","filtered","flattened","getTemplateDescriptor","templatesByAspects","toArray","flatMap","componentTemplates","workspaceTemplates","loadEnvs","getGeneratorStarters","envStarters","starter","compact","ids","envTemplate","toStringWithoutVersion","titlePrefix","getConfiguredEnvs","configEnvs","includes","globals","allIds","uniq","concat","getGeneratorTemplates","tpls","host","getHost","envsAspect","potentialEnvs","getEnvDefinition","aspectLoaded","aspects","provider","cli","graphql","loggerMain","createLogger","commands","CreateCmd","TemplatesCmd","NewCmd","generatorSchema","registerPlugins","StarterPlugin","registerService","GeneratorService","componentGeneratorTemplate","componentGeneratorTemplateStandalone","starterTemplate","starterTemplateStandalone","BasicWorkspaceStarter","exports","Slot","withType","CLIAspect","GraphqlAspect","AspectLoaderAspect","NewComponentHelperAspect","ComponentAspect","TrackerAspect","LoggerAspect","GitAspect","WorkspaceConfigFilesAspect","MainRuntime","addRuntime"],"sources":["generator.main.runtime.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport camelCase from 'camelcase';\nimport { resolve } from 'path';\nimport { GraphqlAspect, GraphqlMain } from '@teambit/graphql';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { WorkspaceAspect, OutsideWorkspaceError, Workspace } from '@teambit/workspace';\nimport { EnvDefinition, EnvsAspect, EnvsMain } from '@teambit/envs';\nimport ComponentConfig from '@teambit/legacy/dist/consumer/config';\nimport { WorkspaceConfigFilesAspect, WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';\nimport { ComponentAspect, ComponentID } from '@teambit/component';\nimport type { ComponentMain, Component } from '@teambit/component';\nimport { isCoreAspect, loadBit, restoreGlobalsFromSnapshot } from '@teambit/bit';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { GitAspect, GitMain } from '@teambit/git';\nimport { BitError } from '@teambit/bit-error';\nimport { AspectLoaderAspect, AspectLoaderMain } from '@teambit/aspect-loader';\nimport { TrackerAspect, TrackerMain } from '@teambit/tracker';\nimport { NewComponentHelperAspect, NewComponentHelperMain } from '@teambit/new-component-helper';\nimport { compact, uniq } from 'lodash';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { ComponentTemplate } from './component-template';\nimport { GeneratorAspect } from './generator.aspect';\nimport { CreateCmd, CreateOptions } from './create.cmd';\nimport { TemplatesCmd } from './templates.cmd';\nimport { generatorSchema } from './generator.graphql';\nimport { ComponentGenerator, GenerateResult, OnComponentCreateFn } from './component-generator';\nimport { WorkspaceGenerator } from './workspace-generator';\nimport { WorkspaceTemplate } from './workspace-template';\nimport { NewCmd, NewOptions } from './new.cmd';\nimport {\n componentGeneratorTemplate,\n componentGeneratorTemplateStandalone,\n starterTemplate,\n starterTemplateStandalone,\n} from './templates';\nimport { BasicWorkspaceStarter } from './templates/basic';\nimport { StarterPlugin } from './starter.plugin';\nimport { GeneratorService } from './generator.service';\nimport { WorkspacePathExists } from './exceptions/workspace-path-exists';\n\nexport type ComponentTemplateSlot = SlotRegistry<ComponentTemplate[]>;\nexport type WorkspaceTemplateSlot = SlotRegistry<WorkspaceTemplate[]>;\nexport type OnComponentCreateSlot = SlotRegistry<OnComponentCreateFn>;\n\nexport type TemplateDescriptor = {\n aspectId: string;\n titlePrefix?: string;\n name: string;\n description?: string;\n hidden?: boolean;\n};\n\ntype TemplateWithId = { id: string; envName?: string };\ntype WorkspaceTemplateWithId = TemplateWithId & { template: WorkspaceTemplate };\ntype ComponentTemplateWithId = TemplateWithId & { template: ComponentTemplate };\ntype AnyTemplateWithId = TemplateWithId & { template: ComponentTemplate | WorkspaceTemplate };\n\nexport type GenerateWorkspaceTemplateResult = { workspacePath: string; appName?: string };\n\nexport type GeneratorConfig = {\n /**\n * array of aspects to include in the list of templates.\n */\n aspects: string[];\n\n /**\n * by default core templates are shown.\n * use this to hide them unless `--show-all` flag of `bit templates` was used\n */\n hideCoreTemplates: boolean;\n\n /**\n * default envs.\n */\n envs?: string[];\n};\n\nexport class GeneratorMain {\n private aspectLoaded = false;\n constructor(\n private componentTemplateSlot: ComponentTemplateSlot,\n private workspaceTemplateSlot: WorkspaceTemplateSlot,\n private onComponentCreateSlot: OnComponentCreateSlot,\n private config: GeneratorConfig,\n private workspace: Workspace,\n private envs: EnvsMain,\n private aspectLoader: AspectLoaderMain,\n private newComponentHelper: NewComponentHelperMain,\n private componentAspect: ComponentMain,\n private tracker: TrackerMain,\n private logger: Logger,\n private git: GitMain,\n private wsConfigFiles: WorkspaceConfigFilesMain\n ) {}\n\n /**\n * register a new component template.\n */\n registerComponentTemplate(templates: ComponentTemplate[]) {\n this.componentTemplateSlot.register(templates);\n return this;\n }\n\n /**\n * register a new workspace starter.\n */\n registerWorkspaceTemplate(templates: WorkspaceTemplate[]) {\n this.workspaceTemplateSlot.register(templates);\n return this;\n }\n\n registerOnComponentCreate(fn: OnComponentCreateFn) {\n this.onComponentCreateSlot.register(fn);\n return this;\n }\n\n /**\n * list all component templates registered in the workspace or workspace templates in case the\n * workspace is not available\n */\n async listTemplates({ aspect }: { aspect?: string } = {}): Promise<TemplateDescriptor[]> {\n if (this.isRunningInsideWorkspace()) {\n return this.getAllComponentTemplatesDescriptorsFlattened(aspect);\n }\n return this.getAllWorkspaceTemplatesDescriptorFlattened(aspect);\n }\n\n private getTemplateDescriptor = ({ id, template }: AnyTemplateWithId): TemplateDescriptor => {\n const shouldBeHidden = () => {\n if (template.hidden) return true;\n if (this.config.hideCoreTemplates && isCoreAspect(id)) return true;\n return false;\n };\n return {\n aspectId: id,\n name: template.name,\n description: template.description,\n hidden: shouldBeHidden(),\n };\n };\n\n /**\n * @deprecated use this.listTemplates()\n */\n async listComponentTemplates(opts: { aspect?: string }): Promise<TemplateDescriptor[]> {\n return this.listTemplates(opts);\n }\n\n isRunningInsideWorkspace(): boolean {\n return Boolean(this.workspace);\n }\n\n /**\n * get all component templates registered by a specific aspect ID.\n */\n getComponentTemplateByAspect(aspectId: string): ComponentTemplate[] {\n return this.componentTemplateSlot.get(aspectId) || [];\n }\n\n /**\n * returns a specific component template.\n */\n async getComponentTemplate(name: string, aspectId?: string): Promise<ComponentTemplateWithId | undefined> {\n const fromEnv = await this.listEnvComponentTemplates([], aspectId);\n if (fromEnv && fromEnv.length) {\n const found = this.findTemplateByAspectIdAndName<ComponentTemplateWithId>(aspectId, name, fromEnv);\n if (found) return found;\n }\n // fallback to aspect id not from env if provided\n const templates = await this.getAllComponentTemplatesFlattened();\n const found = this.findTemplateByAspectIdAndName<ComponentTemplateWithId>(aspectId, name, templates);\n return found;\n }\n\n private findTemplateByAspectIdAndName<T>(\n aspectId: string | undefined,\n name: string,\n templates: Array<T>\n ): T | undefined {\n // @ts-ignore (should set T to be extends ComponentTemplateWithId or WorkspaceTemplateWithId)\n const found = templates.find(({ id, template }) => {\n // When doing something like:\n // bit create react-env my-env --aspect teambit.react/react-env\n // we will get the aspectId without version\n // but the env might be loaded from the global scope then it will be with a version\n // so it won't found if we don't look for it like this\n const idWithoutVersion = id.split('@')[0];\n if (aspectId && id !== aspectId && idWithoutVersion !== aspectId) return false;\n return template.name === name;\n });\n return found;\n }\n\n /**\n * Get the generator aspect and the envs aspect from an harmony instance of the global scope\n */\n private async getGlobalGeneratorEnvs(\n aspectId: string\n ): Promise<{ remoteGenerator: GeneratorMain; fullAspectId: string; remoteEnvsAspect: EnvsMain; aspect: any }> {\n const { globalScopeHarmony, components, legacyGlobalsSnapshot } =\n await this.aspectLoader.loadAspectsFromGlobalScope([aspectId]);\n const remoteGenerator = globalScopeHarmony.get<GeneratorMain>(GeneratorAspect.id);\n const remoteEnvsAspect = globalScopeHarmony.get<EnvsMain>(EnvsAspect.id);\n const aspect = components[0];\n const fullAspectId = aspect.id.toString();\n restoreGlobalsFromSnapshot(legacyGlobalsSnapshot);\n\n return { remoteGenerator, fullAspectId, remoteEnvsAspect, aspect };\n }\n\n /**\n * in the case the aspect-id is given and this aspect doesn't exist locally, import it to the\n * global scope and load it from the capsule\n */\n async findWorkspaceTemplateInGlobalScope(\n aspectId: string,\n name?: string\n ): Promise<{ workspaceTemplate?: WorkspaceTemplate; aspect?: Component }> {\n const { remoteGenerator, fullAspectId, remoteEnvsAspect, aspect } = await this.getGlobalGeneratorEnvs(aspectId);\n const fromGlobal = await remoteGenerator.searchRegisteredWorkspaceTemplate.call(\n remoteGenerator,\n name,\n fullAspectId,\n remoteEnvsAspect\n );\n return { workspaceTemplate: fromGlobal, aspect };\n }\n\n async findTemplateInOtherWorkspace(workspacePath: string, name: string, aspectId?: string) {\n if (!aspectId)\n throw new BitError(\n `to load a template from a different workspace, please provide the aspect-id using --aspect flag`\n );\n const harmony = await loadBit(workspacePath);\n let workspace: Workspace;\n try {\n workspace = harmony.get<Workspace>(WorkspaceAspect.id);\n } catch (err: any) {\n throw new Error(`fatal: \"${workspacePath}\" is not a valid Bit workspace, make sure the path is correct`);\n }\n const aspectComponentId = await workspace.resolveComponentId(aspectId);\n await workspace.loadAspects([aspectId], true);\n const aspectComponent = await workspace.get(aspectComponentId);\n const aspectFullId = aspectComponentId.toString();\n const generator = harmony.get<GeneratorMain>(GeneratorAspect.id);\n const workspaceTemplate = await generator.searchRegisteredWorkspaceTemplate(name, aspectFullId);\n return { workspaceTemplate, aspect: aspectComponent };\n }\n\n /**\n * returns a specific workspace template.\n */\n async getWorkspaceTemplate(\n name: string,\n aspectId?: string\n ): Promise<{ workspaceTemplate: WorkspaceTemplate; aspect?: Component }> {\n const registeredTemplate = await this.searchRegisteredWorkspaceTemplate(name, aspectId);\n if (registeredTemplate) {\n return { workspaceTemplate: registeredTemplate };\n }\n if (!aspectId) {\n throw new BitError(\n `template \"${name}\" was not found, please use --aspect flag to load from an env i.e --aspect teambit.react/react-env\\n Learn more about component templates here: https://bit.dev/reference/generator/create-generator`\n );\n }\n\n const { workspaceTemplate, aspect } = await this.findWorkspaceTemplateInGlobalScope(aspectId, name);\n if (workspaceTemplate) {\n return { workspaceTemplate, aspect };\n }\n throw new BitError(\n `template \"${name}\" was not found, please use --aspect flag to load from an env i.e --aspect teambit.react/react-env\\n Learn more about component templates here: https://bit.dev/reference/generator/create-generator`\n );\n }\n\n async searchRegisteredWorkspaceTemplate(\n name?: string,\n aspectId?: string,\n remoteEnvsAspect?: EnvsMain\n ): Promise<WorkspaceTemplate | undefined> {\n let fromEnv;\n\n if (aspectId) {\n fromEnv = await this.listEnvWorkspaceTemplates(aspectId, remoteEnvsAspect);\n }\n const templates = fromEnv && fromEnv.length ? fromEnv : this.getAllWorkspaceTemplatesFlattened();\n const found = templates.find(({ id, template: tpl }) => {\n if (aspectId && name) return aspectId === id && name === tpl.name;\n if (aspectId) return aspectId === id;\n if (name) return name === tpl.name;\n throw new Error(`searchRegisteredWorkspaceTemplate expects to get \"name\" or \"aspectId\"`);\n });\n\n return found?.template;\n }\n\n async generateComponentTemplate(\n componentNames: string[],\n templateName: string,\n options: Partial<CreateOptions>\n ): Promise<GenerateResult[]> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n await this.loadAspects();\n const { namespace, aspect } = options;\n\n const componentConfigLoadingRegistry = ComponentConfig.componentConfigLoadingRegistry;\n\n const templateWithId = await this.getComponentTemplate(templateName, aspect);\n\n ComponentConfig.componentConfigLoadingRegistry = componentConfigLoadingRegistry;\n\n if (!templateWithId) throw new BitError(`template \"${templateName}\" was not found`);\n\n const componentIds = componentNames.map((componentName) =>\n this.newComponentHelper.getNewComponentId(componentName, namespace, options.scope)\n );\n\n const componentNameSameAsTemplateName = componentIds.find((componentId) => componentId.name === templateName);\n if (componentNameSameAsTemplateName) {\n const compNamePascal = camelCase(templateName, { pascalCase: true });\n throw new BitError(\n `unable to create a component with the same name as the template \"${templateName}\", please use a different name.\nthe reason is that after refactoring, the code will have this invalid class: \"class ${compNamePascal} extends ${compNamePascal} {}\"`\n );\n }\n\n const envId = await this.getEnvIdFromTemplateWithId(templateWithId);\n\n const componentGenerator = new ComponentGenerator(\n this.workspace,\n componentIds,\n options,\n templateWithId.template,\n this.envs,\n this.newComponentHelper,\n this.tracker,\n this.wsConfigFiles,\n this.logger,\n this.onComponentCreateSlot,\n templateWithId.id,\n envId\n );\n return componentGenerator.generate(options.force);\n }\n\n private async getEnvIdFromTemplateWithId(templateWithId: ComponentTemplateWithId): Promise<ComponentID | undefined> {\n const envIdFromTemplate = templateWithId.template.env;\n if (envIdFromTemplate) {\n const parsedFromTemplate = ComponentID.tryFromString(envIdFromTemplate);\n if (!parsedFromTemplate) {\n throw new BitError(\n `Error: unable to parse envId from template. template name: ${templateWithId.template.name}, envId: ${envIdFromTemplate}`\n );\n }\n const resolvedId = await this.workspace.resolveEnvIdWithPotentialVersionForConfig(parsedFromTemplate);\n return ComponentID.fromString(resolvedId);\n }\n if (templateWithId.envName) {\n return ComponentID.fromString(templateWithId.id);\n }\n return Promise.resolve(undefined);\n }\n\n async generateWorkspaceTemplate(\n workspaceName: string,\n templateName: string,\n options: NewOptions & { aspect?: string; currentDir?: boolean }\n ): Promise<GenerateWorkspaceTemplateResult> {\n if (this.workspace) {\n throw new BitError('Error: unable to generate a new workspace inside of an existing workspace');\n }\n const workspacePath = options.currentDir ? process.cwd() : resolve(workspaceName);\n if (!options.currentDir && fs.existsSync(workspacePath)) {\n throw new WorkspacePathExists(workspacePath);\n }\n const { aspect: aspectId, loadFrom } = options;\n const { workspaceTemplate, aspect } = loadFrom\n ? await this.findTemplateInOtherWorkspace(loadFrom, templateName, aspectId)\n : await this.getWorkspaceTemplate(templateName, aspectId);\n\n if (!workspaceTemplate) throw new BitError(`template \"${templateName}\" was not found`);\n const workspaceGenerator = new WorkspaceGenerator(workspaceName, workspacePath, options, workspaceTemplate, aspect);\n await workspaceGenerator.generate();\n return { workspacePath, appName: workspaceTemplate.appName };\n }\n\n private async getAllComponentTemplatesDescriptorsFlattened(aspectId?: string): Promise<Array<TemplateDescriptor>> {\n const envTemplates = await this.listEnvComponentTemplateDescriptors([], aspectId);\n if (envTemplates && envTemplates.length) {\n if (!aspectId) return envTemplates;\n const filtered = envTemplates.filter((template) => template.aspectId === aspectId);\n if (filtered.length) return filtered;\n }\n\n const flattened = this.getAllComponentTemplatesFlattened();\n const filtered = aspectId ? flattened.filter((template) => template.id === aspectId) : flattened;\n return filtered.map((template) => this.getTemplateDescriptor(template));\n }\n\n private getAllComponentTemplatesFlattened(): Array<{ id: string; template: ComponentTemplate }> {\n const templatesByAspects = this.componentTemplateSlot.toArray();\n const flattened = templatesByAspects.flatMap(([id, componentTemplates]) => {\n return componentTemplates.map((template) => ({\n id,\n template,\n }));\n });\n return flattened;\n }\n\n private async getAllWorkspaceTemplatesDescriptorFlattened(aspectId?: string): Promise<Array<TemplateDescriptor>> {\n let envTemplates;\n if (aspectId) {\n envTemplates = await this.listEnvWorkspaceTemplates(aspectId);\n }\n\n const templates = envTemplates && envTemplates.length ? envTemplates : this.getAllWorkspaceTemplatesFlattened();\n return templates.map((template) => this.getTemplateDescriptor(template));\n }\n\n private getAllWorkspaceTemplatesFlattened(): Array<{ id: string; template: WorkspaceTemplate }> {\n const templatesByAspects = this.workspaceTemplateSlot.toArray();\n return templatesByAspects.flatMap(([id, workspaceTemplates]) => {\n return workspaceTemplates.map((template) => ({\n id,\n template,\n }));\n });\n }\n\n /**\n * list all starter templates registered by an env.\n */\n async listEnvWorkspaceTemplates(envId: string, remoteEnvsAspect?: EnvsMain): Promise<Array<WorkspaceTemplateWithId>> {\n const envs = await this.loadEnvs([envId], remoteEnvsAspect);\n const workspaceTemplates = envs.flatMap((env) => {\n if (!env.env.getGeneratorStarters) return undefined;\n const envStarters = env.env.getGeneratorStarters();\n return envStarters.map((starter) => {\n const componentId = ComponentID.fromString(env.id);\n return {\n id: componentId.toString(),\n envName: env.name,\n template: starter,\n };\n });\n });\n\n return compact(workspaceTemplates);\n }\n\n /**\n * list all component templates registered by an env.\n */\n async listEnvComponentTemplateDescriptors(ids: string[] = [], aspectId?: string): Promise<TemplateDescriptor[]> {\n const envTemplates = await this.listEnvComponentTemplates(ids, aspectId);\n const templates: TemplateDescriptor[] = envTemplates.map((envTemplate) => {\n const componentId = ComponentID.fromString(envTemplate.id);\n return {\n aspectId: componentId.toStringWithoutVersion(),\n titlePrefix: envTemplate.envName,\n ...envTemplate.template,\n };\n });\n\n return templates;\n }\n\n getConfiguredEnvs(): string[] {\n return this.config.envs ?? [];\n }\n\n async listEnvComponentTemplates(ids: string[] = [], aspectId?: string): Promise<Array<ComponentTemplateWithId>> {\n const configEnvs = this.config.envs || [];\n let remoteEnvsAspect;\n let fullAspectId;\n if (aspectId && !configEnvs.includes(aspectId)) {\n const globals = await this.getGlobalGeneratorEnvs(aspectId);\n remoteEnvsAspect = globals.remoteEnvsAspect;\n fullAspectId = globals.fullAspectId;\n }\n const allIds = uniq(configEnvs?.concat(ids).concat([aspectId, fullAspectId]).filter(Boolean));\n const envs = await this.loadEnvs(allIds, remoteEnvsAspect);\n const templates = envs.flatMap((env) => {\n if (!env.env.getGeneratorTemplates) return [];\n const tpls = env.env.getGeneratorTemplates() || [];\n const componentId = ComponentID.fromString(env.id);\n return tpls.map((template) => {\n return {\n id: componentId.toString(),\n envName: env.name,\n template,\n };\n });\n });\n\n return templates;\n }\n\n async loadEnvs(ids: string[] = this.config.envs || [], remoteEnvsAspect?: EnvsMain): Promise<EnvDefinition[]> {\n // In case we have remoteEnvsAspect it means that we are running from the global scope\n // in that case the aspect / env were already loaded before to the global scope harmony instance\n // so no reason to load it here\n if (!remoteEnvsAspect) {\n const host = this.componentAspect.getHost();\n if (!host) return [];\n await host.loadAspects(ids);\n }\n\n const envsAspect = remoteEnvsAspect || this.envs;\n\n const potentialEnvs = ids.map((id) => {\n const componentId = ComponentID.fromString(id);\n return envsAspect.getEnvDefinition(componentId);\n });\n\n return compact(potentialEnvs);\n }\n\n async loadAspects() {\n if (this.aspectLoaded) return;\n await this.workspace.loadAspects(this.config.aspects);\n this.aspectLoaded = true;\n }\n\n static slots = [\n Slot.withType<ComponentTemplate[]>(),\n Slot.withType<WorkspaceTemplate[]>(),\n Slot.withType<OnComponentCreateFn>(),\n ];\n\n static dependencies = [\n WorkspaceAspect,\n CLIAspect,\n GraphqlAspect,\n EnvsAspect,\n AspectLoaderAspect,\n NewComponentHelperAspect,\n ComponentAspect,\n TrackerAspect,\n LoggerAspect,\n GitAspect,\n WorkspaceConfigFilesAspect,\n ];\n\n static runtime = MainRuntime;\n\n static async provider(\n [\n workspace,\n cli,\n graphql,\n envs,\n aspectLoader,\n newComponentHelper,\n componentAspect,\n tracker,\n loggerMain,\n git,\n wsConfigFiles,\n ]: [\n Workspace,\n CLIMain,\n GraphqlMain,\n EnvsMain,\n AspectLoaderMain,\n NewComponentHelperMain,\n ComponentMain,\n TrackerMain,\n LoggerMain,\n GitMain,\n WorkspaceConfigFilesMain\n ],\n config: GeneratorConfig,\n [componentTemplateSlot, workspaceTemplateSlot, onComponentCreateSlot]: [\n ComponentTemplateSlot,\n WorkspaceTemplateSlot,\n OnComponentCreateSlot\n ]\n ) {\n const logger = loggerMain.createLogger(GeneratorAspect.id);\n const generator = new GeneratorMain(\n componentTemplateSlot,\n workspaceTemplateSlot,\n onComponentCreateSlot,\n config,\n workspace,\n envs,\n aspectLoader,\n newComponentHelper,\n componentAspect,\n tracker,\n logger,\n git,\n wsConfigFiles\n );\n const commands = [new CreateCmd(generator), new TemplatesCmd(generator), new NewCmd(generator)];\n cli.register(...commands);\n graphql.register(generatorSchema(generator));\n aspectLoader.registerPlugins([new StarterPlugin(generator)]);\n envs.registerService(new GeneratorService());\n\n if (generator)\n generator.registerComponentTemplate([\n componentGeneratorTemplate,\n componentGeneratorTemplateStandalone,\n starterTemplate,\n starterTemplateStandalone,\n ]);\n generator.registerWorkspaceTemplate([BasicWorkspaceStarter]);\n\n return generator;\n }\n}\n\nGeneratorAspect.addRuntime(GeneratorMain);\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,SAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,QAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,KAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,IAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,WAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,UAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,MAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,KAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,QAAA;EAAA,MAAAT,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAO,OAAA,YAAAA,CAAA;IAAA,OAAAT,IAAA;EAAA;EAAA,OAAAA,IA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5DvE,IAAI,CAAC6K,eAAe,CAAC,KAAIC,8BAAgB,EAAC,CAAC,CAAC;IAE5C,IAAIvG,SAAS,EACXA,SAAS,CAACtD,yBAAyB,CAAC,CAClC8J,wCAA0B,EAC1BC,kDAAoC,EACpCC,6BAAe,EACfC,uCAAyB,CAC1B,CAAC;IACJ3G,SAAS,CAACnD,yBAAyB,CAAC,CAAC+J,8BAAqB,CAAC,CAAC;IAE5D,OAAO5G,SAAS;EAClB;AACF;AAAC6G,OAAA,CAAA3L,aAAA,GAAAA,aAAA;AAAAhB,eAAA,CAxhBYgB,aAAa,WAgcT,CACb4L,eAAI,CAACC,QAAQ,CAAsB,CAAC,EACpCD,eAAI,CAACC,QAAQ,CAAsB,CAAC,EACpCD,eAAI,CAACC,QAAQ,CAAsB,CAAC,CACrC;AAAA7M,eAAA,CApcUgB,aAAa,kBAscF,CACpBsE,4BAAe,EACfwH,gBAAS,EACTC,wBAAa,EACbtI,kBAAU,EACVuI,kCAAkB,EAClBC,8CAAwB,EACxBC,4BAAe,EACfC,wBAAa,EACbC,sBAAY,EACZC,gBAAS,EACTC,kDAA0B,CAC3B;AAAAtN,eAAA,CAldUgB,aAAa,aAodPuM,kBAAW;AAsE9BhJ,4BAAe,CAACiJ,UAAU,CAACxM,aAAa,CAAC","ignoreList":[]}
|
@@ -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.340/dist/generator.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.340/dist/generator.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
@@ -36,6 +36,7 @@ export declare class WorkspaceGenerator {
|
|
36
36
|
*/
|
37
37
|
private writeWorkspaceFiles;
|
38
38
|
private reloadBitInWorkspaceDir;
|
39
|
+
private installBeforeCreateComponentsIfNeeded;
|
39
40
|
private createComponentsFromRemote;
|
40
41
|
private forkComponentsFromRemote;
|
41
42
|
private importComponentsFromRemote;
|
@@ -88,6 +88,13 @@ function _path() {
|
|
88
88
|
};
|
89
89
|
return data;
|
90
90
|
}
|
91
|
+
function _lodash() {
|
92
|
+
const data = require("lodash");
|
93
|
+
_lodash = function () {
|
94
|
+
return data;
|
95
|
+
};
|
96
|
+
return data;
|
97
|
+
}
|
91
98
|
function _git() {
|
92
99
|
const data = require("@teambit/git");
|
93
100
|
_git = function () {
|
@@ -156,8 +163,9 @@ class WorkspaceGenerator {
|
|
156
163
|
// the workspace will be in install context until the end of the generation install process
|
157
164
|
this.workspace.inInstallContext = true;
|
158
165
|
await this.setupGitBitmapMergeDriver();
|
159
|
-
await this.createComponentsFromRemote();
|
160
166
|
await this.forkComponentsFromRemote();
|
167
|
+
await this.installBeforeCreateComponentsIfNeeded();
|
168
|
+
await this.createComponentsFromRemote();
|
161
169
|
await this.importComponentsFromRemote();
|
162
170
|
await this.workspace.clearCache();
|
163
171
|
await this.install.install(undefined, {
|
@@ -234,6 +242,27 @@ class WorkspaceGenerator {
|
|
234
242
|
this.wsConfigFiles = this.harmony.get(_workspaceConfigFiles().WorkspaceConfigFilesAspect.id);
|
235
243
|
this.generator = this.harmony.get(_generator().GeneratorAspect.id);
|
236
244
|
}
|
245
|
+
async installBeforeCreateComponentsIfNeeded() {
|
246
|
+
if (this.options.empty || !this.template.create) return;
|
247
|
+
const configuredEnvs = this.generator.getConfiguredEnvs();
|
248
|
+
if (!configuredEnvs.length) return;
|
249
|
+
const workspaceContext = this.getWorkspaceContext();
|
250
|
+
const componentsToCreate = this.template.create(workspaceContext);
|
251
|
+
const aspectsForComponentsToCreate = (0, _lodash().compact)(componentsToCreate.map(componentToCreate => componentToCreate.aspect));
|
252
|
+
const needInstall = (0, _lodash().some)(aspectsForComponentsToCreate, aspect => {
|
253
|
+
return configuredEnvs.includes(aspect);
|
254
|
+
});
|
255
|
+
if (needInstall) {
|
256
|
+
this.logger?.console(`installing dependencies in workspace using to load components templates from the following envs: ${configuredEnvs.join(', ')}`);
|
257
|
+
await this.install.install(undefined, {
|
258
|
+
dedupe: true,
|
259
|
+
import: false,
|
260
|
+
copyPeerToRuntimeOnRoot: true,
|
261
|
+
copyPeerToRuntimeOnComponents: false,
|
262
|
+
updateExisting: false
|
263
|
+
});
|
264
|
+
}
|
265
|
+
}
|
237
266
|
async createComponentsFromRemote() {
|
238
267
|
if (this.options.empty || !this.template.create) return;
|
239
268
|
const workspaceContext = this.getWorkspaceContext();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_bit","_execa","_pMapSeries","_ui","_logger","_workspace","_forking","_importer","_compiler","_gitModules","_path","_git","_install","_hostInitializer","_workspaceConfigFiles","_generator","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WorkspaceGenerator","constructor","workspaceName","workspacePath","options","template","aspectComponent","generate","fs","ensureDir","process","chdir","initGit","HostInitializerMain","init","skipGit","writeWorkspaceFiles","reloadBitInWorkspaceDir","workspace","inInstallContext","setupGitBitmapMergeDriver","createComponentsFromRemote","forkComponentsFromRemote","importComponentsFromRemote","clearCache","install","undefined","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","updateExisting","compileComponents","wsConfigFiles","writeConfigFiles","err","logger","error","remove","gitExecutablePath","getGitExecutablePath","params","execa","exitCodeName","GitNotFound","git","setGitMergeDriver","global","buildUI","uiMain","harmony","get","UIAspect","id","createRuntime","getWorkspaceContext","name","defaultScope","empty","workspaceContext","templateFiles","generateFiles","Promise","all","map","templateFile","outputFile","join","relativePath","content","loadBit","WorkspaceAspect","InstallAspect","loggerMain","LoggerAspect","createLogger","GeneratorAspect","importer","ImporterAspect","forking","ForkingAspect","GitAspect","WorkspaceConfigFilesAspect","generator","create","componentsToCreate","pMapSeries","componentToCreate","generateComponentTemplate","componentName","templateName","aspect","env","path","scope","componentsToFork","importComponents","fork","length","componentsToForkRestructured","targetName","config","targetScope","sourceId","targetId","forkMultipleFromRemote","refactor","componentsToImport","componentToImport","ids","installNpmPackages","writeToPath","bitMap","write","compiler","CompilerAspect","compileOnWorkspace","exports"],"sources":["workspace-generator.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport { loadBit } from '@teambit/bit';\nimport { Harmony } from '@teambit/harmony';\nimport { Component } from '@teambit/component';\nimport execa from 'execa';\nimport pMapSeries from 'p-map-series';\nimport { UIAspect, UiMain } from '@teambit/ui';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { WorkspaceAspect, Workspace } from '@teambit/workspace';\nimport { ForkingAspect, ForkingMain } from '@teambit/forking';\nimport { ImporterAspect, ImporterMain } from '@teambit/importer';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { getGitExecutablePath, GitNotFound } from '@teambit/git.modules.git-executable';\nimport { join } from 'path';\nimport { ComponentID } from '@teambit/component-id';\nimport { GitAspect, GitMain } from '@teambit/git';\nimport { InstallAspect, InstallMain } from '@teambit/install';\nimport { HostInitializerMain } from '@teambit/host-initializer';\nimport { WorkspaceConfigFilesAspect, WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';\n// import { ComponentGenerator } from './component-generator';\nimport { WorkspaceTemplate, WorkspaceContext } from './workspace-template';\nimport { NewOptions } from './new.cmd';\nimport { GeneratorAspect } from './generator.aspect';\nimport { GeneratorMain } from './generator.main.runtime';\n\nexport type GenerateResult = { id: ComponentID; dir: string; files: string[]; envId: string };\n\nexport class WorkspaceGenerator {\n private harmony: Harmony;\n private workspace: Workspace;\n private install: InstallMain;\n private importer: ImporterMain;\n private logger?: Logger;\n private forking: ForkingMain;\n private git: GitMain;\n private wsConfigFiles: WorkspaceConfigFilesMain;\n private generator: GeneratorMain;\n\n constructor(\n private workspaceName: string,\n private workspacePath: string,\n private options: NewOptions & { currentDir?: boolean },\n private template: WorkspaceTemplate,\n private aspectComponent?: Component\n ) {}\n\n async generate(): Promise<string> {\n await fs.ensureDir(this.workspacePath);\n try {\n process.chdir(this.workspacePath);\n await this.initGit();\n await HostInitializerMain.init(\n this.workspacePath,\n this.options.skipGit,\n false,\n false,\n false,\n false,\n false,\n false,\n false,\n {}\n );\n await this.writeWorkspaceFiles();\n await this.reloadBitInWorkspaceDir();\n // Setting the workspace to be in install context to prevent errors during the workspace generation\n // the workspace will be in install context until the end of the generation install process\n this.workspace.inInstallContext = true;\n await this.setupGitBitmapMergeDriver();\n await this.createComponentsFromRemote();\n await this.forkComponentsFromRemote();\n await this.importComponentsFromRemote();\n await this.workspace.clearCache();\n await this.install.install(undefined, {\n dedupe: true,\n import: false,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n updateExisting: false,\n });\n\n // compile the components again now that we have the dependencies installed\n await this.compileComponents(true);\n await this.wsConfigFiles.writeConfigFiles({});\n } catch (err: any) {\n this.logger?.error(`failed generating a new workspace, will delete the dir ${this.workspacePath}`, err);\n await fs.remove(this.workspacePath);\n throw err;\n }\n\n return this.workspacePath;\n }\n\n private async initGit() {\n if (this.options.skipGit) return;\n const gitExecutablePath = getGitExecutablePath();\n const params = ['init'];\n try {\n await execa(gitExecutablePath, params);\n } catch (err: any) {\n if (err.exitCodeName === 'ENOENT') {\n throw new GitNotFound(gitExecutablePath, err);\n }\n throw err;\n }\n }\n\n private async setupGitBitmapMergeDriver() {\n if (this.options.skipGit) return;\n await this.git.setGitMergeDriver({ global: false });\n }\n\n private async buildUI() {\n const uiMain = this.harmony.get<UiMain>(UIAspect.id);\n await uiMain.createRuntime({});\n }\n\n private getWorkspaceContext(): WorkspaceContext {\n return {\n name: this.workspaceName,\n defaultScope: this.options.defaultScope,\n empty: this.options.empty,\n aspectComponent: this.aspectComponent,\n template: this.template,\n skipGit: this.options.skipGit,\n };\n }\n\n /**\n * writes the generated template files to the default directory set in the workspace config\n */\n private async writeWorkspaceFiles(): Promise<void> {\n const workspaceContext = this.getWorkspaceContext();\n const templateFiles = await this.template.generateFiles(workspaceContext);\n await Promise.all(\n templateFiles.map(async (templateFile) => {\n await fs.outputFile(join(this.workspacePath, templateFile.relativePath), templateFile.content);\n })\n );\n }\n\n private async reloadBitInWorkspaceDir() {\n this.harmony = await loadBit(this.workspacePath);\n this.workspace = this.harmony.get<Workspace>(WorkspaceAspect.id);\n this.install = this.harmony.get<InstallMain>(InstallAspect.id);\n const loggerMain = this.harmony.get<LoggerMain>(LoggerAspect.id);\n this.logger = loggerMain.createLogger(GeneratorAspect.id);\n this.importer = this.harmony.get<ImporterMain>(ImporterAspect.id);\n this.forking = this.harmony.get<ForkingMain>(ForkingAspect.id);\n this.git = this.harmony.get<GitMain>(GitAspect.id);\n this.wsConfigFiles = this.harmony.get<WorkspaceConfigFilesMain>(WorkspaceConfigFilesAspect.id);\n this.generator = this.harmony.get<GeneratorMain>(GeneratorAspect.id);\n }\n\n private async createComponentsFromRemote() {\n if (this.options.empty || !this.template.create) return;\n const workspaceContext = this.getWorkspaceContext();\n const componentsToCreate = this.template.create(workspaceContext);\n await pMapSeries(componentsToCreate, async (componentToCreate) => {\n return this.generator.generateComponentTemplate(\n [componentToCreate.componentName],\n componentToCreate.templateName,\n {\n aspect: componentToCreate.aspect,\n env: componentToCreate.env,\n path: componentToCreate.path,\n scope: componentToCreate.scope,\n }\n );\n });\n }\n\n private async forkComponentsFromRemote() {\n if (this.options.empty) return;\n const workspaceContext = this.getWorkspaceContext();\n const componentsToFork =\n this.template?.importComponents?.(workspaceContext) || this.template?.fork?.(workspaceContext) || [];\n if (!componentsToFork.length) return;\n const componentsToForkRestructured = componentsToFork.map(({ id, targetName, path, env, config, targetScope }) => ({\n sourceId: id,\n targetId: targetName,\n targetScope,\n path,\n env,\n config,\n }));\n await this.forking.forkMultipleFromRemote(componentsToForkRestructured, {\n scope: this.workspace.defaultScope,\n refactor: true,\n install: false,\n });\n }\n\n private async importComponentsFromRemote() {\n if (this.options.empty) return;\n const workspaceContext = this.getWorkspaceContext();\n const componentsToImport = this.template?.import?.(workspaceContext) || [];\n\n if (!componentsToImport.length) return;\n\n await pMapSeries(componentsToImport, async (componentToImport) => {\n await this.importer.import(\n {\n ids: [componentToImport.id],\n installNpmPackages: false,\n writeConfigFiles: false,\n writeToPath: componentToImport.path,\n },\n []\n );\n });\n\n await this.workspace.bitMap.write('new');\n }\n\n private async compileComponents(clearCache = true) {\n if (clearCache) {\n await this.workspace.clearCache();\n }\n const compiler = this.harmony.get<CompilerMain>(CompilerAspect.id);\n await compiler.compileOnWorkspace();\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAI,OAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,MAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,YAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,WAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,IAAA;EAAA,MAAAN,IAAA,GAAAE,OAAA;EAAAI,GAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA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ChE,MAAM,IAAI,CAAC/B,QAAQ,CAACjD,MAAM,CACxB;QACEiF,GAAG,EAAE,CAACD,iBAAiB,CAACvD,EAAE,CAAC;QAC3ByD,kBAAkB,EAAE,KAAK;QACzB5E,gBAAgB,EAAE,KAAK;QACvB6E,WAAW,EAAEH,iBAAiB,CAACf;MACjC,CAAC,EACD,EACF,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,IAAI,CAAC3E,SAAS,CAAC8F,MAAM,CAACC,KAAK,CAAC,KAAK,CAAC;EAC1C;EAEA,MAAcjF,iBAAiBA,CAACR,UAAU,GAAG,IAAI,EAAE;IACjD,IAAIA,UAAU,EAAE;MACd,MAAM,IAAI,CAACN,SAAS,CAACM,UAAU,CAAC,CAAC;IACnC;IACA,MAAM0F,QAAQ,GAAG,IAAI,CAAChE,OAAO,CAACC,GAAG,CAAegE,0BAAc,CAAC9D,EAAE,CAAC;IAClE,MAAM6D,QAAQ,CAACE,kBAAkB,CAAC,CAAC;EACrC;AACF;AAACC,OAAA,CAAArH,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
1
|
+
{"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_bit","_execa","_pMapSeries","_ui","_logger","_workspace","_forking","_importer","_compiler","_gitModules","_path","_lodash","_git","_install","_hostInitializer","_workspaceConfigFiles","_generator","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","WorkspaceGenerator","constructor","workspaceName","workspacePath","options","template","aspectComponent","generate","fs","ensureDir","process","chdir","initGit","HostInitializerMain","init","skipGit","writeWorkspaceFiles","reloadBitInWorkspaceDir","workspace","inInstallContext","setupGitBitmapMergeDriver","forkComponentsFromRemote","installBeforeCreateComponentsIfNeeded","createComponentsFromRemote","importComponentsFromRemote","clearCache","install","undefined","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","updateExisting","compileComponents","wsConfigFiles","writeConfigFiles","err","logger","error","remove","gitExecutablePath","getGitExecutablePath","params","execa","exitCodeName","GitNotFound","git","setGitMergeDriver","global","buildUI","uiMain","harmony","get","UIAspect","id","createRuntime","getWorkspaceContext","name","defaultScope","empty","workspaceContext","templateFiles","generateFiles","Promise","all","map","templateFile","outputFile","join","relativePath","content","loadBit","WorkspaceAspect","InstallAspect","loggerMain","LoggerAspect","createLogger","GeneratorAspect","importer","ImporterAspect","forking","ForkingAspect","GitAspect","WorkspaceConfigFilesAspect","generator","create","configuredEnvs","getConfiguredEnvs","length","componentsToCreate","aspectsForComponentsToCreate","compact","componentToCreate","aspect","needInstall","some","includes","console","pMapSeries","generateComponentTemplate","componentName","templateName","env","path","scope","componentsToFork","importComponents","fork","componentsToForkRestructured","targetName","config","targetScope","sourceId","targetId","forkMultipleFromRemote","refactor","componentsToImport","componentToImport","ids","installNpmPackages","writeToPath","bitMap","write","compiler","CompilerAspect","compileOnWorkspace","exports"],"sources":["workspace-generator.ts"],"sourcesContent":["import fs from 'fs-extra';\nimport { loadBit } from '@teambit/bit';\nimport { Harmony } from '@teambit/harmony';\nimport { Component } from '@teambit/component';\nimport execa from 'execa';\nimport pMapSeries from 'p-map-series';\nimport { UIAspect, UiMain } from '@teambit/ui';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { WorkspaceAspect, Workspace } from '@teambit/workspace';\nimport { ForkingAspect, ForkingMain } from '@teambit/forking';\nimport { ImporterAspect, ImporterMain } from '@teambit/importer';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { getGitExecutablePath, GitNotFound } from '@teambit/git.modules.git-executable';\nimport { join } from 'path';\nimport { compact, some } from 'lodash';\nimport { ComponentID } from '@teambit/component-id';\nimport { GitAspect, GitMain } from '@teambit/git';\nimport { InstallAspect, InstallMain } from '@teambit/install';\nimport { HostInitializerMain } from '@teambit/host-initializer';\nimport { WorkspaceConfigFilesAspect, WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';\n// import { ComponentGenerator } from './component-generator';\nimport { WorkspaceTemplate, WorkspaceContext } from './workspace-template';\nimport { NewOptions } from './new.cmd';\nimport { GeneratorAspect } from './generator.aspect';\nimport { GeneratorMain } from './generator.main.runtime';\n\nexport type GenerateResult = { id: ComponentID; dir: string; files: string[]; envId: string };\n\nexport class WorkspaceGenerator {\n private harmony: Harmony;\n private workspace: Workspace;\n private install: InstallMain;\n private importer: ImporterMain;\n private logger?: Logger;\n private forking: ForkingMain;\n private git: GitMain;\n private wsConfigFiles: WorkspaceConfigFilesMain;\n private generator: GeneratorMain;\n\n constructor(\n private workspaceName: string,\n private workspacePath: string,\n private options: NewOptions & { currentDir?: boolean },\n private template: WorkspaceTemplate,\n private aspectComponent?: Component\n ) {}\n\n async generate(): Promise<string> {\n await fs.ensureDir(this.workspacePath);\n try {\n process.chdir(this.workspacePath);\n await this.initGit();\n await HostInitializerMain.init(\n this.workspacePath,\n this.options.skipGit,\n false,\n false,\n false,\n false,\n false,\n false,\n false,\n {}\n );\n await this.writeWorkspaceFiles();\n await this.reloadBitInWorkspaceDir();\n // Setting the workspace to be in install context to prevent errors during the workspace generation\n // the workspace will be in install context until the end of the generation install process\n this.workspace.inInstallContext = true;\n await this.setupGitBitmapMergeDriver();\n await this.forkComponentsFromRemote();\n await this.installBeforeCreateComponentsIfNeeded();\n await this.createComponentsFromRemote();\n await this.importComponentsFromRemote();\n await this.workspace.clearCache();\n await this.install.install(undefined, {\n dedupe: true,\n import: false,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n updateExisting: false,\n });\n\n // compile the components again now that we have the dependencies installed\n await this.compileComponents(true);\n await this.wsConfigFiles.writeConfigFiles({});\n } catch (err: any) {\n this.logger?.error(`failed generating a new workspace, will delete the dir ${this.workspacePath}`, err);\n await fs.remove(this.workspacePath);\n throw err;\n }\n\n return this.workspacePath;\n }\n\n private async initGit() {\n if (this.options.skipGit) return;\n const gitExecutablePath = getGitExecutablePath();\n const params = ['init'];\n try {\n await execa(gitExecutablePath, params);\n } catch (err: any) {\n if (err.exitCodeName === 'ENOENT') {\n throw new GitNotFound(gitExecutablePath, err);\n }\n throw err;\n }\n }\n\n private async setupGitBitmapMergeDriver() {\n if (this.options.skipGit) return;\n await this.git.setGitMergeDriver({ global: false });\n }\n\n private async buildUI() {\n const uiMain = this.harmony.get<UiMain>(UIAspect.id);\n await uiMain.createRuntime({});\n }\n\n private getWorkspaceContext(): WorkspaceContext {\n return {\n name: this.workspaceName,\n defaultScope: this.options.defaultScope,\n empty: this.options.empty,\n aspectComponent: this.aspectComponent,\n template: this.template,\n skipGit: this.options.skipGit,\n };\n }\n\n /**\n * writes the generated template files to the default directory set in the workspace config\n */\n private async writeWorkspaceFiles(): Promise<void> {\n const workspaceContext = this.getWorkspaceContext();\n const templateFiles = await this.template.generateFiles(workspaceContext);\n await Promise.all(\n templateFiles.map(async (templateFile) => {\n await fs.outputFile(join(this.workspacePath, templateFile.relativePath), templateFile.content);\n })\n );\n }\n\n private async reloadBitInWorkspaceDir() {\n this.harmony = await loadBit(this.workspacePath);\n this.workspace = this.harmony.get<Workspace>(WorkspaceAspect.id);\n this.install = this.harmony.get<InstallMain>(InstallAspect.id);\n const loggerMain = this.harmony.get<LoggerMain>(LoggerAspect.id);\n this.logger = loggerMain.createLogger(GeneratorAspect.id);\n this.importer = this.harmony.get<ImporterMain>(ImporterAspect.id);\n this.forking = this.harmony.get<ForkingMain>(ForkingAspect.id);\n this.git = this.harmony.get<GitMain>(GitAspect.id);\n this.wsConfigFiles = this.harmony.get<WorkspaceConfigFilesMain>(WorkspaceConfigFilesAspect.id);\n this.generator = this.harmony.get<GeneratorMain>(GeneratorAspect.id);\n }\n\n private async installBeforeCreateComponentsIfNeeded() {\n if (this.options.empty || !this.template.create) return;\n const configuredEnvs = this.generator.getConfiguredEnvs();\n if (!configuredEnvs.length) return;\n const workspaceContext = this.getWorkspaceContext();\n const componentsToCreate = this.template.create(workspaceContext);\n const aspectsForComponentsToCreate = compact(\n componentsToCreate.map((componentToCreate) => componentToCreate.aspect)\n );\n const needInstall = some(aspectsForComponentsToCreate, (aspect) => {\n return configuredEnvs.includes(aspect);\n });\n if (needInstall) {\n this.logger?.console(\n `installing dependencies in workspace using to load components templates from the following envs: ${configuredEnvs.join(\n ', '\n )}`\n );\n await this.install.install(undefined, {\n dedupe: true,\n import: false,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n updateExisting: false,\n });\n }\n }\n\n private async createComponentsFromRemote() {\n if (this.options.empty || !this.template.create) return;\n const workspaceContext = this.getWorkspaceContext();\n const componentsToCreate = this.template.create(workspaceContext);\n await pMapSeries(componentsToCreate, async (componentToCreate) => {\n return this.generator.generateComponentTemplate(\n [componentToCreate.componentName],\n componentToCreate.templateName,\n {\n aspect: componentToCreate.aspect,\n env: componentToCreate.env,\n path: componentToCreate.path,\n scope: componentToCreate.scope,\n }\n );\n });\n }\n\n private async forkComponentsFromRemote() {\n if (this.options.empty) return;\n const workspaceContext = this.getWorkspaceContext();\n const componentsToFork =\n this.template?.importComponents?.(workspaceContext) || this.template?.fork?.(workspaceContext) || [];\n if (!componentsToFork.length) return;\n const componentsToForkRestructured = componentsToFork.map(({ id, targetName, path, env, config, targetScope }) => ({\n sourceId: id,\n targetId: targetName,\n targetScope,\n path,\n env,\n config,\n }));\n await this.forking.forkMultipleFromRemote(componentsToForkRestructured, {\n scope: this.workspace.defaultScope,\n refactor: true,\n install: false,\n });\n }\n\n private async importComponentsFromRemote() {\n if (this.options.empty) return;\n const workspaceContext = this.getWorkspaceContext();\n const componentsToImport = this.template?.import?.(workspaceContext) || [];\n\n if (!componentsToImport.length) return;\n\n await pMapSeries(componentsToImport, async (componentToImport) => {\n await this.importer.import(\n {\n ids: [componentToImport.id],\n installNpmPackages: false,\n writeConfigFiles: false,\n writeToPath: componentToImport.path,\n },\n []\n );\n });\n\n await this.workspace.bitMap.write('new');\n }\n\n private async compileComponents(clearCache = true) {\n if (clearCache) {\n await this.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E,OAAO,CAACC,GAAG,CAAewE,0BAAc,CAACtE,EAAE,CAAC;IAClE,MAAMqE,QAAQ,CAACE,kBAAkB,CAAC,CAAC;EACrC;AACF;AAACC,OAAA,CAAA9H,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
package/package.json
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
{
|
2
2
|
"name": "@teambit/generator",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.340",
|
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.340"
|
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.
|
25
|
-
"@teambit/envs": "1.0.
|
26
|
-
"@teambit/logger": "0.0.
|
27
|
-
"@teambit/new-component-helper": "1.0.
|
24
|
+
"@teambit/component.sources": "0.0.6",
|
25
|
+
"@teambit/envs": "1.0.339",
|
26
|
+
"@teambit/logger": "0.0.1009",
|
27
|
+
"@teambit/new-component-helper": "1.0.339",
|
28
28
|
"@teambit/pkg.modules.component-package-name": "0.0.3",
|
29
29
|
"@teambit/toolbox.path.path": "0.0.2",
|
30
|
-
"@teambit/tracker": "1.0.
|
31
|
-
"@teambit/workspace-config-files": "1.0.
|
32
|
-
"@teambit/workspace.modules.node-modules-linker": "0.0.
|
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.7.
|
39
|
-
"@teambit/git": "1.0.
|
40
|
-
"@teambit/compiler": "1.0.
|
41
|
-
"@teambit/forking": "1.0.
|
30
|
+
"@teambit/tracker": "1.0.339",
|
31
|
+
"@teambit/workspace-config-files": "1.0.339",
|
32
|
+
"@teambit/workspace.modules.node-modules-linker": "0.0.181",
|
33
|
+
"@teambit/workspace": "1.0.339",
|
34
|
+
"@teambit/component": "1.0.339",
|
35
|
+
"@teambit/cli": "0.0.916",
|
36
|
+
"@teambit/graphql": "1.0.339",
|
37
|
+
"@teambit/aspect-loader": "1.0.339",
|
38
|
+
"@teambit/bit": "1.7.50",
|
39
|
+
"@teambit/git": "1.0.339",
|
40
|
+
"@teambit/compiler": "1.0.339",
|
41
|
+
"@teambit/forking": "1.0.339",
|
42
42
|
"@teambit/git.modules.git-executable": "0.0.1",
|
43
|
-
"@teambit/host-initializer": "0.0.
|
44
|
-
"@teambit/importer": "1.0.
|
45
|
-
"@teambit/install": "1.0.
|
46
|
-
"@teambit/ui": "1.0.
|
47
|
-
"@teambit/config": "0.0.
|
43
|
+
"@teambit/host-initializer": "0.0.52",
|
44
|
+
"@teambit/importer": "1.0.339",
|
45
|
+
"@teambit/install": "1.0.339",
|
46
|
+
"@teambit/ui": "1.0.339",
|
47
|
+
"@teambit/config": "0.0.1090"
|
48
48
|
},
|
49
49
|
"devDependencies": {
|
50
50
|
"@types/fs-extra": "9.0.7",
|