@teambit/generator 0.0.1159 → 0.0.1161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -180,7 +180,7 @@ class ComponentGenerator {
180
180
  }));
181
181
  }
182
182
  async generateOneComponent(componentId, componentPath) {
183
- var _config, _config$EnvsAspect$id;
183
+ var _config;
184
184
  const name = componentId.name;
185
185
  const namePascalCase = (0, _camelcase().default)(name, {
186
186
  pascalCase: true
@@ -223,7 +223,7 @@ class ComponentGenerator {
223
223
  }
224
224
  };
225
225
  }
226
- const templateEnv = (_config = config) === null || _config === void 0 ? void 0 : (_config$EnvsAspect$id = _config[_envs().default.id]) === null || _config$EnvsAspect$id === void 0 ? void 0 : _config$EnvsAspect$id.env;
226
+ const templateEnv = (_config = config) === null || _config === void 0 || (_config = _config[_envs().default.id]) === null || _config === void 0 ? void 0 : _config.env;
227
227
  if (config && templateEnv && hasEnvConfiguredOriginally) {
228
228
  // remove the env we got from the template.
229
229
  delete config[templateEnv];
@@ -234,9 +234,9 @@ class ComponentGenerator {
234
234
  const configWithEnv = await this.addEnvIfProvidedByFlag(config);
235
235
  if (configWithEnv) this.workspace.bitMap.setEntireConfig(component.id, configWithEnv);
236
236
  const getEnvData = () => {
237
- var _config2, _config2$EnvsAspect$i;
237
+ var _config2;
238
238
  const envFromFlag = this.options.env; // env entered by the user when running `bit create --env`
239
- const envFromTemplate = (_config2 = config) === null || _config2 === void 0 ? void 0 : (_config2$EnvsAspect$i = _config2[_envs().default.id]) === null || _config2$EnvsAspect$i === void 0 ? void 0 : _config2$EnvsAspect$i.env;
239
+ const envFromTemplate = (_config2 = config) === null || _config2 === void 0 || (_config2 = _config2[_envs().default.id]) === null || _config2 === void 0 ? void 0 : _config2.env;
240
240
  if (envFromFlag) {
241
241
  return {
242
242
  envId: envFromFlag,
@@ -268,9 +268,9 @@ class ComponentGenerator {
268
268
  };
269
269
  }
270
270
  async addEnvIfProvidedByFlag(config) {
271
- var _config3, _config3$EnvsAspect$i;
271
+ var _config3;
272
272
  const userEnv = this.options.env; // env entered by the user when running `bit create --env`
273
- const templateEnv = (_config3 = config) === null || _config3 === void 0 ? void 0 : (_config3$EnvsAspect$i = _config3[_envs().default.id]) === null || _config3$EnvsAspect$i === void 0 ? void 0 : _config3$EnvsAspect$i.env;
273
+ const templateEnv = (_config3 = config) === null || _config3 === void 0 || (_config3 = _config3[_envs().default.id]) === null || _config3 === void 0 ? void 0 : _config3.env;
274
274
  if (!userEnv || userEnv === templateEnv) {
275
275
  return config;
276
276
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_vinyl","data","_interopRequireDefault","require","_fsExtra","_pMapSeries","_path","_envs","_camelcase","_bitError","_workspaceModules","_sources","_componentIdToPackageName","_dataToPersist","_componentId","obj","__esModule","default","ComponentGenerator","constructor","workspace","componentIds","options","template","envs","newComponentHelper","tracker","wsConfigFiles","logger","onComponentCreateSlot","aspectId","envId","generate","dirsToDeleteIfFailed","generateResults","pMapSeries","componentId","componentPath","getNewComponentPath","path","length","fs","existsSync","join","BitError","hasName","fullName","push","generateOneComponent","err","deleteGeneratedComponents","bitMap","write","ids","map","r","id","tryLinkToNodeModules","runOnComponentCreateHook","tryWriteConfigFiles","linkToNodeModulesByIds","_legacy","consoleFailure","message","fns","values","Promise","all","fn","shouldWrite","isWorkspaceConfigWriteEnabled","clearComponentCache","writeConfigFiles","clean","silent","dedupe","dirs","dir","absoluteDir","remove","code","_config","_config$EnvsAspect$id","name","namePascalCase","camelcase","pascalCase","nameCamelCase","ComponentID","fromString","files","generateFiles","mainFile","find","file","isMain","writeComponentFiles","addResults","track","rootDir","relativePath","componentName","defaultScope","scope","component","get","hasEnvConfiguredOriginally","hasEnvConfigured","envBeforeConfigChanges","getEnv","config","_this$template$config","boundConfig","bind","isInWorkspace","exists","toStringWithoutVersion","toString","env","templateEnv","EnvsAspect","Object","keys","undefined","configWithEnv","addEnvIfProvidedByFlag","setEntireConfig","getEnvData","_config2","_config2$EnvsAspect$i","envFromFlag","envFromTemplate","setBy","packageName","componentIdToPackageName","state","_consumer","envSetBy","_config3","_config3$EnvsAspect$i","userEnv","addEnvToConfig","templateFiles","dataToPersist","DataToPersist","vinylFiles","templateFile","templateFileVinyl","Vinyl","base","contents","Buffer","from","content","AbstractVinyl","fromVinyl","results","v","addManyFiles","addBasePath","persistAllToFS","exports"],"sources":["component-generator.ts"],"sourcesContent":["import Vinyl from 'vinyl';\nimport fs from 'fs-extra';\nimport pMapSeries from 'p-map-series';\nimport path from 'path';\nimport { Workspace } from '@teambit/workspace';\nimport EnvsAspect, { EnvsMain } from '@teambit/envs';\nimport camelcase from 'camelcase';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { TrackerMain } from '@teambit/tracker';\nimport { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker';\nimport { PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport { NewComponentHelperMain } from '@teambit/new-component-helper';\nimport { ComponentID } from '@teambit/component-id';\nimport { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';\n\nimport { ComponentTemplate, ComponentFile, ComponentConfig } from './component-template';\nimport { CreateOptions } from './create.cmd';\nimport { OnComponentCreateSlot } from './generator.main.runtime';\n\nexport type GenerateResult = {\n id: ComponentID;\n dir: string;\n files: string[];\n envId: string;\n envSetBy: string;\n packageName: string;\n};\n\nexport type OnComponentCreateFn = (generateResults: GenerateResult[]) => Promise<void>;\n\nexport class ComponentGenerator {\n constructor(\n private workspace: Workspace,\n private componentIds: ComponentID[],\n private options: CreateOptions,\n private template: ComponentTemplate,\n private envs: EnvsMain,\n private newComponentHelper: NewComponentHelperMain,\n private tracker: TrackerMain,\n private wsConfigFiles: WorkspaceConfigFilesMain,\n private logger: Logger,\n private onComponentCreateSlot: OnComponentCreateSlot,\n private aspectId: string,\n private envId?: ComponentID\n ) {}\n\n async generate(): Promise<GenerateResult[]> {\n const dirsToDeleteIfFailed: string[] = [];\n const generateResults = await pMapSeries(this.componentIds, async (componentId) => {\n try {\n const componentPath = this.newComponentHelper.getNewComponentPath(\n componentId,\n this.options.path,\n this.componentIds.length\n );\n if (fs.existsSync(path.join(this.workspace.path, componentPath))) {\n throw new BitError(`unable to create a component at \"${componentPath}\", this path already exist`);\n }\n if (await this.workspace.hasName(componentId.fullName)) {\n throw new BitError(\n `unable to create a component \"${componentId.fullName}\", a component with the same name already exist`\n );\n }\n dirsToDeleteIfFailed.push(componentPath);\n return await this.generateOneComponent(componentId, componentPath);\n } catch (err: any) {\n await this.deleteGeneratedComponents(dirsToDeleteIfFailed);\n throw err;\n }\n });\n\n await this.workspace.bitMap.write();\n\n const ids = generateResults.map((r) => r.id);\n await this.tryLinkToNodeModules(ids);\n await this.runOnComponentCreateHook(generateResults);\n // We are running this after the runOnComponentCreateHook as it require\n // the env to be installed to work properly, and the hook might install\n // the env.\n await this.tryWriteConfigFiles(ids);\n\n return generateResults;\n }\n\n private async tryLinkToNodeModules(ids: ComponentID[]) {\n try {\n await linkToNodeModulesByIds(\n this.workspace,\n ids.map((id) => id._legacy)\n );\n } catch (err: any) {\n this.logger.consoleFailure(\n `failed linking the new components to node_modules, please run \"bit link\" manually. error: ${err.message}`\n );\n }\n }\n\n private async runOnComponentCreateHook(generateResults: GenerateResult[]) {\n const fns = this.onComponentCreateSlot.values();\n if (!fns.length) return;\n await Promise.all(fns.map((fn) => fn(generateResults)));\n }\n\n /**\n * The function `tryWriteConfigFiles` attempts to write workspace config files, and if it fails, it logs an error\n * message.\n * @returns If the condition `!shouldWrite` is true, then nothing is being returned. Otherwise, if the `writeConfigFiles`\n * function is successfully executed, nothing is being returned. If an error occurs during the execution of\n * `writeConfigFiles`, an error message is being returned.\n */\n private async tryWriteConfigFiles(ids: ComponentID[]) {\n try {\n const shouldWrite = this.wsConfigFiles.isWorkspaceConfigWriteEnabled();\n if (!shouldWrite) return;\n ids.map((id) => this.workspace.clearComponentCache(id));\n await this.wsConfigFiles.writeConfigFiles({\n clean: true,\n silent: true,\n dedupe: true,\n });\n } catch (err: any) {\n this.logger.consoleFailure(\n `failed generating workspace config files, please run \"bit ws-config write\" manually. error: ${err.message}`\n );\n }\n }\n\n private async deleteGeneratedComponents(dirs: string[]) {\n await Promise.all(\n dirs.map(async (dir) => {\n const absoluteDir = path.join(this.workspace.path, dir);\n try {\n await fs.remove(absoluteDir);\n } catch (err: any) {\n if (err.code !== 'ENOENT') {\n // if not exist, it's fine\n throw err;\n }\n }\n })\n );\n }\n\n private async generateOneComponent(componentId: ComponentID, componentPath: string): Promise<GenerateResult> {\n const name = componentId.name;\n const namePascalCase = camelcase(name, { pascalCase: true });\n const nameCamelCase = camelcase(name);\n const aspectId = ComponentID.fromString(this.aspectId);\n\n const files = await this.template.generateFiles({\n name,\n namePascalCase,\n nameCamelCase,\n componentId,\n aspectId,\n envId: this.envId,\n });\n const mainFile = files.find((file) => file.isMain);\n await this.writeComponentFiles(componentPath, files);\n const addResults = await this.tracker.track({\n rootDir: componentPath,\n mainFile: mainFile?.relativePath,\n componentName: componentId.fullName,\n defaultScope: this.options.scope,\n });\n const component = await this.workspace.get(componentId);\n const hasEnvConfiguredOriginally = this.envs.hasEnvConfigured(component);\n const envBeforeConfigChanges = this.envs.getEnv(component);\n let config = this.template.config;\n if (config && typeof config === 'function') {\n const boundConfig = this.template.config?.bind(this.template);\n config = boundConfig({ aspectId: this.aspectId });\n }\n\n if (!config && this.envId) {\n const isInWorkspace = this.workspace.exists(this.envId);\n config = {\n [isInWorkspace ? this.envId.toStringWithoutVersion() : this.envId.toString()]: {},\n 'teambit.envs/envs': {\n env: this.envId.toStringWithoutVersion(),\n },\n };\n }\n\n const templateEnv = config?.[EnvsAspect.id]?.env;\n\n if (config && templateEnv && hasEnvConfiguredOriginally) {\n // remove the env we got from the template.\n delete config[templateEnv];\n delete config[EnvsAspect.id].env;\n if (Object.keys(config[EnvsAspect.id]).length === 0) delete config[EnvsAspect.id];\n if (Object.keys(config).length === 0) config = undefined;\n }\n\n const configWithEnv = await this.addEnvIfProvidedByFlag(config);\n if (configWithEnv) this.workspace.bitMap.setEntireConfig(component.id, configWithEnv);\n\n const getEnvData = () => {\n const envFromFlag = this.options.env; // env entered by the user when running `bit create --env`\n const envFromTemplate = config?.[EnvsAspect.id]?.env;\n if (envFromFlag) {\n return {\n envId: envFromFlag,\n setBy: '--env flag',\n };\n }\n if (envFromTemplate) {\n return {\n envId: envFromTemplate,\n setBy: 'template',\n };\n }\n return {\n envId: envBeforeConfigChanges.id,\n setBy: hasEnvConfiguredOriginally ? 'workspace variants' : '<default>',\n };\n };\n const { envId, setBy } = getEnvData();\n return {\n id: componentId,\n dir: componentPath,\n files: addResults.files,\n packageName: componentIdToPackageName(component.state._consumer),\n envId,\n envSetBy: setBy,\n };\n }\n\n private async addEnvIfProvidedByFlag(config?: ComponentConfig): Promise<ComponentConfig | undefined> {\n const userEnv = this.options.env; // env entered by the user when running `bit create --env`\n const templateEnv = config?.[EnvsAspect.id]?.env;\n if (!userEnv || userEnv === templateEnv) {\n return config;\n }\n config = config || {};\n if (templateEnv) {\n // the component template has an env and the user wants a different env.\n delete config[templateEnv];\n }\n await this.tracker.addEnvToConfig(userEnv, config);\n\n return config;\n }\n\n /**\n * writes the generated template files to the default directory set in the workspace config\n */\n private async writeComponentFiles(\n componentPath: string,\n templateFiles: ComponentFile[]\n ): Promise<PathOsBasedRelative[]> {\n const dataToPersist = new DataToPersist();\n const vinylFiles = templateFiles.map((templateFile) => {\n const templateFileVinyl = new Vinyl({\n base: componentPath,\n path: path.join(componentPath, templateFile.relativePath),\n contents: Buffer.from(templateFile.content),\n });\n return AbstractVinyl.fromVinyl(templateFileVinyl);\n });\n const results = vinylFiles.map((v) => v.path);\n dataToPersist.addManyFiles(vinylFiles);\n data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A;AACF;AACA;EACE,MAAcd,mBAAmBA,CAC/B3D,aAAqB,EACrByG,aAA8B,EACE;IAChC,MAAMC,aAAa,GAAG,KAAIC,wBAAa,EAAC,CAAC;IACzC,MAAMC,UAAU,GAAGH,aAAa,CAACxF,GAAG,CAAE4F,YAAY,IAAK;MACrD,MAAMC,iBAAiB,GAAG,KAAIC,gBAAK,EAAC;QAClCC,IAAI,EAAEhH,aAAa;QACnBE,IAAI,EAAEA,eAAI,CAACI,IAAI,CAACN,aAAa,EAAE6G,YAAY,CAAC9C,YAAY,CAAC;QACzDkD,QAAQ,EAAEC,MAAM,CAACC,IAAI,CAACN,YAAY,CAACO,OAAO;MAC5C,CAAC,CAAC;MACF,OAAOC,wBAAa,CAACC,SAAS,CAACR,iBAAiB,CAAC;IACnD,CAAC,CAAC;IACF,MAAMS,OAAO,GAAGX,UAAU,CAAC3F,GAAG,CAAEuG,CAAC,IAAKA,CAAC,CAACtH,IAAI,CAAC;IAC7CwG,aAAa,CAACe,YAAY,CAACb,UAAU,CAAC;IACtCF,aAAa,CAACgB,WAAW,CAAC,IAAI,CAAC3I,SAAS,CAACmB,IAAI,CAAC;IAC9C,MAAMwG,aAAa,CAACiB,cAAc,CAAC,CAAC;IACpC,OAAOJ,OAAO;EAChB;AACF;AAACK,OAAA,CAAA/I,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["_vinyl","data","_interopRequireDefault","require","_fsExtra","_pMapSeries","_path","_envs","_camelcase","_bitError","_workspaceModules","_sources","_componentIdToPackageName","_dataToPersist","_componentId","obj","__esModule","default","ComponentGenerator","constructor","workspace","componentIds","options","template","envs","newComponentHelper","tracker","wsConfigFiles","logger","onComponentCreateSlot","aspectId","envId","generate","dirsToDeleteIfFailed","generateResults","pMapSeries","componentId","componentPath","getNewComponentPath","path","length","fs","existsSync","join","BitError","hasName","fullName","push","generateOneComponent","err","deleteGeneratedComponents","bitMap","write","ids","map","r","id","tryLinkToNodeModules","runOnComponentCreateHook","tryWriteConfigFiles","linkToNodeModulesByIds","_legacy","consoleFailure","message","fns","values","Promise","all","fn","shouldWrite","isWorkspaceConfigWriteEnabled","clearComponentCache","writeConfigFiles","clean","silent","dedupe","dirs","dir","absoluteDir","remove","code","_config","name","namePascalCase","camelcase","pascalCase","nameCamelCase","ComponentID","fromString","files","generateFiles","mainFile","find","file","isMain","writeComponentFiles","addResults","track","rootDir","relativePath","componentName","defaultScope","scope","component","get","hasEnvConfiguredOriginally","hasEnvConfigured","envBeforeConfigChanges","getEnv","config","_this$template$config","boundConfig","bind","isInWorkspace","exists","toStringWithoutVersion","toString","env","templateEnv","EnvsAspect","Object","keys","undefined","configWithEnv","addEnvIfProvidedByFlag","setEntireConfig","getEnvData","_config2","envFromFlag","envFromTemplate","setBy","packageName","componentIdToPackageName","state","_consumer","envSetBy","_config3","userEnv","addEnvToConfig","templateFiles","dataToPersist","DataToPersist","vinylFiles","templateFile","templateFileVinyl","Vinyl","base","contents","Buffer","from","content","AbstractVinyl","fromVinyl","results","v","addManyFiles","addBasePath","persistAllToFS","exports"],"sources":["component-generator.ts"],"sourcesContent":["import Vinyl from 'vinyl';\nimport fs from 'fs-extra';\nimport pMapSeries from 'p-map-series';\nimport path from 'path';\nimport { Workspace } from '@teambit/workspace';\nimport EnvsAspect, { EnvsMain } from '@teambit/envs';\nimport camelcase from 'camelcase';\nimport { BitError } from '@teambit/bit-error';\nimport { Logger } from '@teambit/logger';\nimport { TrackerMain } from '@teambit/tracker';\nimport { linkToNodeModulesByIds } from '@teambit/workspace.modules.node-modules-linker';\nimport { PathOsBasedRelative } from '@teambit/legacy/dist/utils/path';\nimport { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport componentIdToPackageName from '@teambit/legacy/dist/utils/bit/component-id-to-package-name';\nimport DataToPersist from '@teambit/legacy/dist/consumer/component/sources/data-to-persist';\nimport { NewComponentHelperMain } from '@teambit/new-component-helper';\nimport { ComponentID } from '@teambit/component-id';\nimport { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';\n\nimport { ComponentTemplate, ComponentFile, ComponentConfig } from './component-template';\nimport { CreateOptions } from './create.cmd';\nimport { OnComponentCreateSlot } from './generator.main.runtime';\n\nexport type GenerateResult = {\n id: ComponentID;\n dir: string;\n files: string[];\n envId: string;\n envSetBy: string;\n packageName: string;\n};\n\nexport type OnComponentCreateFn = (generateResults: GenerateResult[]) => Promise<void>;\n\nexport class ComponentGenerator {\n constructor(\n private workspace: Workspace,\n private componentIds: ComponentID[],\n private options: CreateOptions,\n private template: ComponentTemplate,\n private envs: EnvsMain,\n private newComponentHelper: NewComponentHelperMain,\n private tracker: TrackerMain,\n private wsConfigFiles: WorkspaceConfigFilesMain,\n private logger: Logger,\n private onComponentCreateSlot: OnComponentCreateSlot,\n private aspectId: string,\n private envId?: ComponentID\n ) {}\n\n async generate(): Promise<GenerateResult[]> {\n const dirsToDeleteIfFailed: string[] = [];\n const generateResults = await pMapSeries(this.componentIds, async (componentId) => {\n try {\n const componentPath = this.newComponentHelper.getNewComponentPath(\n componentId,\n this.options.path,\n this.componentIds.length\n );\n if (fs.existsSync(path.join(this.workspace.path, componentPath))) {\n throw new BitError(`unable to create a component at \"${componentPath}\", this path already exist`);\n }\n if (await this.workspace.hasName(componentId.fullName)) {\n throw new BitError(\n `unable to create a component \"${componentId.fullName}\", a component with the same name already exist`\n );\n }\n dirsToDeleteIfFailed.push(componentPath);\n return await this.generateOneComponent(componentId, componentPath);\n } catch (err: any) {\n await this.deleteGeneratedComponents(dirsToDeleteIfFailed);\n throw err;\n }\n });\n\n await this.workspace.bitMap.write();\n\n const ids = generateResults.map((r) => r.id);\n await this.tryLinkToNodeModules(ids);\n await this.runOnComponentCreateHook(generateResults);\n // We are running this after the runOnComponentCreateHook as it require\n // the env to be installed to work properly, and the hook might install\n // the env.\n await this.tryWriteConfigFiles(ids);\n\n return generateResults;\n }\n\n private async tryLinkToNodeModules(ids: ComponentID[]) {\n try {\n await linkToNodeModulesByIds(\n this.workspace,\n ids.map((id) => id._legacy)\n );\n } catch (err: any) {\n this.logger.consoleFailure(\n `failed linking the new components to node_modules, please run \"bit link\" manually. error: ${err.message}`\n );\n }\n }\n\n private async runOnComponentCreateHook(generateResults: GenerateResult[]) {\n const fns = this.onComponentCreateSlot.values();\n if (!fns.length) return;\n await Promise.all(fns.map((fn) => fn(generateResults)));\n }\n\n /**\n * The function `tryWriteConfigFiles` attempts to write workspace config files, and if it fails, it logs an error\n * message.\n * @returns If the condition `!shouldWrite` is true, then nothing is being returned. Otherwise, if the `writeConfigFiles`\n * function is successfully executed, nothing is being returned. If an error occurs during the execution of\n * `writeConfigFiles`, an error message is being returned.\n */\n private async tryWriteConfigFiles(ids: ComponentID[]) {\n try {\n const shouldWrite = this.wsConfigFiles.isWorkspaceConfigWriteEnabled();\n if (!shouldWrite) return;\n ids.map((id) => this.workspace.clearComponentCache(id));\n await this.wsConfigFiles.writeConfigFiles({\n clean: true,\n silent: true,\n dedupe: true,\n });\n } catch (err: any) {\n this.logger.consoleFailure(\n `failed generating workspace config files, please run \"bit ws-config write\" manually. error: ${err.message}`\n );\n }\n }\n\n private async deleteGeneratedComponents(dirs: string[]) {\n await Promise.all(\n dirs.map(async (dir) => {\n const absoluteDir = path.join(this.workspace.path, dir);\n try {\n await fs.remove(absoluteDir);\n } catch (err: any) {\n if (err.code !== 'ENOENT') {\n // if not exist, it's fine\n throw err;\n }\n }\n })\n );\n }\n\n private async generateOneComponent(componentId: ComponentID, componentPath: string): Promise<GenerateResult> {\n const name = componentId.name;\n const namePascalCase = camelcase(name, { pascalCase: true });\n const nameCamelCase = camelcase(name);\n const aspectId = ComponentID.fromString(this.aspectId);\n\n const files = await this.template.generateFiles({\n name,\n namePascalCase,\n nameCamelCase,\n componentId,\n aspectId,\n envId: this.envId,\n });\n const mainFile = files.find((file) => file.isMain);\n await this.writeComponentFiles(componentPath, files);\n const addResults = await this.tracker.track({\n rootDir: componentPath,\n mainFile: mainFile?.relativePath,\n componentName: componentId.fullName,\n defaultScope: this.options.scope,\n });\n const component = await this.workspace.get(componentId);\n const hasEnvConfiguredOriginally = this.envs.hasEnvConfigured(component);\n const envBeforeConfigChanges = this.envs.getEnv(component);\n let config = this.template.config;\n if (config && typeof config === 'function') {\n const boundConfig = this.template.config?.bind(this.template);\n config = boundConfig({ aspectId: this.aspectId });\n }\n\n if (!config && this.envId) {\n const isInWorkspace = this.workspace.exists(this.envId);\n config = {\n [isInWorkspace ? this.envId.toStringWithoutVersion() : this.envId.toString()]: {},\n 'teambit.envs/envs': {\n env: this.envId.toStringWithoutVersion(),\n },\n };\n }\n\n const templateEnv = config?.[EnvsAspect.id]?.env;\n\n if (config && templateEnv && hasEnvConfiguredOriginally) {\n // remove the env we got from the template.\n delete config[templateEnv];\n delete config[EnvsAspect.id].env;\n if (Object.keys(config[EnvsAspect.id]).length === 0) delete config[EnvsAspect.id];\n if (Object.keys(config).length === 0) config = undefined;\n }\n\n const configWithEnv = await this.addEnvIfProvidedByFlag(config);\n if (configWithEnv) this.workspace.bitMap.setEntireConfig(component.id, configWithEnv);\n\n const getEnvData = () => {\n const envFromFlag = this.options.env; // env entered by the user when running `bit create --env`\n const envFromTemplate = config?.[EnvsAspect.id]?.env;\n if (envFromFlag) {\n return {\n envId: envFromFlag,\n setBy: '--env flag',\n };\n }\n if (envFromTemplate) {\n return {\n envId: envFromTemplate,\n setBy: 'template',\n };\n }\n return {\n envId: envBeforeConfigChanges.id,\n setBy: hasEnvConfiguredOriginally ? 'workspace variants' : '<default>',\n };\n };\n const { envId, setBy } = getEnvData();\n return {\n id: componentId,\n dir: componentPath,\n files: addResults.files,\n packageName: componentIdToPackageName(component.state._consumer),\n envId,\n envSetBy: setBy,\n };\n }\n\n private async addEnvIfProvidedByFlag(config?: ComponentConfig): Promise<ComponentConfig | undefined> {\n const userEnv = this.options.env; // env entered by the user when running `bit create --env`\n const templateEnv = config?.[EnvsAspect.id]?.env;\n if (!userEnv || userEnv === templateEnv) {\n return config;\n }\n config = config || {};\n if (templateEnv) {\n // the component template has an env and the user wants a different env.\n delete config[templateEnv];\n }\n await this.tracker.addEnvToConfig(userEnv, config);\n\n return config;\n }\n\n /**\n * writes the generated template files to the default directory set in the workspace config\n */\n private async writeComponentFiles(\n componentPath: string,\n templateFiles: ComponentFile[]\n ): Promise<PathOsBasedRelative[]> {\n const dataToPersist = new DataToPersist();\n const vinylFiles = templateFiles.map((templateFile) => {\n const templateFileVinyl = new Vinyl({\n base: componentPath,\n path: path.join(componentPath, templateFile.relativePath),\n contents: Buffer.from(templateFile.content),\n });\n return AbstractVinyl.fromVinyl(templateFileVinyl);\n });\n const results = vinylFiles.map((v) => v.path);\n dataToPersist.addManyFiles(vinylFiles);\n dataToPersist.addBasePath(this.workspace.path);\n await dataToPersist.persistAllToFS();\n return results;\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,SAAA;EAAA,MAAAH,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,YAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAG,KAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,WAA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7 @@ class GeneratorMain {
385
385
  };
386
386
  }
387
387
  if (!aspectId) {
388
- throw new (_bitError().BitError)(`template "${name}" was not found, if this is a custom-template, please use --aspect flag`);
388
+ throw new (_bitError().BitError)(`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`);
389
389
  }
390
390
  const {
391
391
  workspaceTemplate,
@@ -397,7 +397,7 @@ class GeneratorMain {
397
397
  aspect
398
398
  };
399
399
  }
400
- throw new (_bitError().BitError)(`template "${name}" was not found`);
400
+ throw new (_bitError().BitError)(`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`);
401
401
  }
402
402
  async searchRegisteredWorkspaceTemplate(name, aspectId, remoteEnvsAspect) {
403
403
  let fromEnv;
@@ -1 +1 @@
1
- {"version":3,"names":["_graphql","data","require","_cli","_workspace","_interopRequireWildcard","_envs","_config","_interopRequireDefault","_workspaceConfigFiles","_component","_bit","_harmony","_git","_bitError","_aspectLoader","_tracker","_newComponentHelper","_lodash","_logger","_generator","_create","_templates","_generator2","_componentGenerator","_workspaceGenerator","_new","_templates2","_basic","_starter","_generator3","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","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","getComponentTemplate","fromEnv","listEnvComponentTemplates","found","findTemplateByAspectIdAndName","getAllComponentTemplatesFlattened","find","idWithoutVersion","split","getGlobalGeneratorEnvs","globalScopeHarmony","components","loadAspectsFromGlobalScope","remoteGenerator","GeneratorAspect","remoteEnvsAspect","EnvsAspect","fullAspectId","toString","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","componentGenerator","ComponentGenerator","envName","ComponentID","fromString","generate","generateWorkspaceTemplate","workspaceName","loadFrom","workspaceGenerator","WorkspaceGenerator","appName","envTemplates","listEnvComponentTemplateDescriptors","filtered","flattened","getTemplateDescriptor","templatesByAspects","toArray","flatMap","componentTemplates","workspaceTemplates","envId","loadEnvs","env","getGeneratorStarters","envStarters","starter","componentId","compact","ids","envTemplate","toStringWithoutVersion","titlePrefix","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 { 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';\n\nimport ComponentAspect, { ComponentID } from '@teambit/component';\nimport type { ComponentMain, Component } from '@teambit/component';\n\nimport { isCoreAspect, loadBit } 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';\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 } = 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 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(`template \"${name}\" was not found, if this is a custom-template, please use --aspect flag`);\n }\n\n const { workspaceTemplate, aspect } = await this.findWorkspaceTemplateInGlobalScope(aspectId, name);\n if (workspaceTemplate) {\n return { workspaceTemplate, aspect };\n }\n throw new BitError(`template \"${name}\" was not found`);\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: 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 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 templateWithId.envName ? ComponentID.fromString(templateWithId.id) : undefined\n );\n return componentGenerator.generate();\n }\n\n async generateWorkspaceTemplate(\n workspaceName: string,\n templateName: string,\n options: NewOptions & { aspect?: string }\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 { 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, options, workspaceTemplate, aspect);\n const workspacePath = 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 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,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAI,uBAAA,CAAAH,OAAA;EAAAE,UAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,MAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,KA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AS,CAACnD,yBAAyB,CAAC,CAClCqI,wCAA0B,EAC1BC,kDAAoC,EACpCC,6BAAe,EACfC,uCAAyB,CAC1B,CAAC;IACJrF,SAAS,CAAChD,yBAAyB,CAAC,CAACsI,8BAAqB,CAAC,CAAC;IAE5D,OAAOtF,SAAS;EAClB;AACF;AAACuF,OAAA,CAAAlK,aAAA,GAAAA,aAAA;AAAAnB,eAAA,CA5eYmB,aAAa,WAoZT,CACbmK,eAAI,CAACC,QAAQ,CAAsB,CAAC,EACpCD,eAAI,CAACC,QAAQ,CAAsB,CAAC,EACpCD,eAAI,CAACC,QAAQ,CAAsB,CAAC,CACrC;AAAAvL,eAAA,CAxZUmB,aAAa,kBA0ZF,CACpBmE,oBAAe,EACfkG,gBAAS,EACTC,wBAAa,EACb/G,kBAAU,EACVgH,uBAAkB,EAClBC,6BAAwB,EACxBC,oBAAe,EACfC,kBAAa,EACbC,sBAAY,EACZC,cAAS,EACTC,+BAA0B,CAC3B;AAAAhM,eAAA,CAtaUmB,aAAa,aAwaP8K,kBAAW;AAsE9BzH,4BAAe,CAAC0H,UAAU,CAAC/K,aAAa,CAAC"}
1
+ {"version":3,"names":["_graphql","data","require","_cli","_workspace","_interopRequireWildcard","_envs","_config","_interopRequireDefault","_workspaceConfigFiles","_component","_bit","_harmony","_git","_bitError","_aspectLoader","_tracker","_newComponentHelper","_lodash","_logger","_generator","_create","_templates","_generator2","_componentGenerator","_workspaceGenerator","_new","_templates2","_basic","_starter","_generator3","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","TypeError","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","getComponentTemplate","fromEnv","listEnvComponentTemplates","found","findTemplateByAspectIdAndName","getAllComponentTemplatesFlattened","find","idWithoutVersion","split","getGlobalGeneratorEnvs","globalScopeHarmony","components","loadAspectsFromGlobalScope","remoteGenerator","GeneratorAspect","remoteEnvsAspect","EnvsAspect","fullAspectId","toString","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","componentGenerator","ComponentGenerator","envName","ComponentID","fromString","generate","generateWorkspaceTemplate","workspaceName","loadFrom","workspaceGenerator","WorkspaceGenerator","appName","envTemplates","listEnvComponentTemplateDescriptors","filtered","flattened","getTemplateDescriptor","templatesByAspects","toArray","flatMap","componentTemplates","workspaceTemplates","envId","loadEnvs","env","getGeneratorStarters","envStarters","starter","componentId","compact","ids","envTemplate","toStringWithoutVersion","titlePrefix","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 { 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';\n\nimport ComponentAspect, { ComponentID } from '@teambit/component';\nimport type { ComponentMain, Component } from '@teambit/component';\n\nimport { isCoreAspect, loadBit } 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';\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 } = 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 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(`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 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: 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 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 templateWithId.envName ? ComponentID.fromString(templateWithId.id) : undefined\n );\n return componentGenerator.generate();\n }\n\n async generateWorkspaceTemplate(\n workspaceName: string,\n templateName: string,\n options: NewOptions & { aspect?: string }\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 { 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, options, workspaceTemplate, aspect);\n const workspacePath = 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 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,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,KAAA;EAAA,MAAAF,IAAA,GAAAC,O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0H,QAAQ,CAAC;IACzBH,OAAO,CAACvH,QAAQ,CAAC,IAAA8H,6BAAe,EAAC7E,SAAS,CAAC,CAAC;IAC5CnE,YAAY,CAACiJ,eAAe,CAAC,CAAC,KAAIC,wBAAa,EAAC/E,SAAS,CAAC,CAAC,CAAC;IAC5DpE,IAAI,CAACoJ,eAAe,CAAC,KAAIC,8BAAgB,EAAC,CAAC,CAAC;IAE5C,IAAIjF,SAAS,EACXA,SAAS,CAACnD,yBAAyB,CAAC,CAClCqI,wCAA0B,EAC1BC,kDAAoC,EACpCC,6BAAe,EACfC,uCAAyB,CAC1B,CAAC;IACJrF,SAAS,CAAChD,yBAAyB,CAAC,CAACsI,8BAAqB,CAAC,CAAC;IAE5D,OAAOtF,SAAS;EAClB;AACF;AAACuF,OAAA,CAAAlK,aAAA,GAAAA,aAAA;AAAAnB,eAAA,CA9eYmB,aAAa,WAsZT,CACbmK,eAAI,CAACC,QAAQ,CAAsB,CAAC,EACpCD,eAAI,CAACC,QAAQ,CAAsB,CAAC,EACpCD,eAAI,CAACC,QAAQ,CAAsB,CAAC,CACrC;AAAAvL,eAAA,CA1ZUmB,aAAa,kBA4ZF,CACpBmE,oBAAe,EACfkG,gBAAS,EACTC,wBAAa,EACb/G,kBAAU,EACVgH,uBAAkB,EAClBC,6BAAwB,EACxBC,oBAAe,EACfC,kBAAa,EACbC,sBAAY,EACZC,cAAS,EACTC,+BAA0B,CAC3B;AAAAhM,eAAA,CAxaUmB,aAAa,aA0aP8K,kBAAW;AAsE9BzH,4BAAe,CAAC0H,UAAU,CAAC/K,aAAa,CAAC"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@0.0.1159/dist/generator.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@0.0.1159/dist/generator.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@0.0.1161/dist/generator.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@0.0.1161/dist/generator.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -29,11 +29,18 @@ async function workspaceConfig({
29
29
  dependencies: {
30
30
  '@teambit/node.node': 'latest',
31
31
  '@types/node': '16.18.44',
32
- '@types/jest': '29.5.4'
32
+ '@types/jest': '29.5.4',
33
+ "eslint": "7.32.0",
34
+ '@typescript-eslint/eslint-plugin': '5.35.1',
35
+ 'eslint-import-resolver-node': '0.3.6',
36
+ 'eslint-plugin-import': '2.22.1',
37
+ 'eslint-plugin-jest': '24.1.5',
38
+ 'eslint-plugin-jsx-a11y': '6.4.1',
39
+ 'eslint-plugin-mdx': '1.17.1',
40
+ 'eslint-plugin-react': '7.22.0'
33
41
  }
34
42
  }
35
43
  });
36
- delete configParsed['teambit.workspace/variants'];
37
44
  configParsed['teambit.generator/generator'] = {
38
45
  envs: ['teambit.node/node'
39
46
  // "teambit.angular/angular",
@@ -1 +1 @@
1
- {"version":3,"names":["_config","data","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","workspaceConfig","name","defaultScope","configParsed","getWorkspaceConfigTemplateParsed","packageManagerDefaultConfig","policy","dependencies","envs","stringifyWorkspaceConfig"],"sources":["workspace-config.ts"],"sourcesContent":["import { getWorkspaceConfigTemplateParsed, stringifyWorkspaceConfig } from '@teambit/config';\nimport { WorkspaceContext } from '../../../..';\n\nexport async function workspaceConfig({ name, defaultScope }: WorkspaceContext) {\n const configParsed = await getWorkspaceConfigTemplateParsed();\n const packageManagerDefaultConfig = configParsed['teambit.dependencies/dependency-resolver'];\n configParsed['teambit.workspace/workspace'].name = name;\n configParsed['teambit.workspace/workspace'].defaultScope = defaultScope || 'org.scope';\n configParsed['teambit.dependencies/dependency-resolver'] = {\n ...packageManagerDefaultConfig,\n policy: {\n dependencies: {\n '@teambit/node.node': 'latest',\n '@types/node': '16.18.44',\n '@types/jest': '29.5.4',\n },\n },\n };\n\n delete configParsed['teambit.workspace/variants'];\n\n configParsed['teambit.generator/generator'] = {\n envs: [\n 'teambit.node/node',\n // \"teambit.angular/angular\",\n // \"teambit.vue/vue\",\n // \"teambit.react/react-env\",\n // \"teambit.html/html-env\"\n ],\n };\n\n return stringifyWorkspaceConfig(configParsed);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6F,SAAAE,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU,cAAAC,MAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAC,SAAA,CAAAC,MAAA,EAAAF,CAAA,UAAAG,MAAA,WAAAF,SAAA,CAAA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AAA;AAGtF,eAAeU,eAAeA,CAAC;EAAEC,IAAI;EAAEC;AAA+B,CAAC,EAAE;EAC9E,MAAMC,YAAY,GAAG,MAAM,IAAAC,0CAAgC,EAAC,CAAC;EAC7D,MAAMC,2BAA2B,GAAGF,YAAY,CAAC,0CAA0C,CAAC;EAC5FA,YAAY,CAAC,6BAA6B,CAAC,CAACF,IAAI,GAAGA,IAAI;EACvDE,YAAY,CAAC,6BAA6B,CAAC,CAACD,YAAY,GAAGA,YAAY,IAAI,WAAW;EACtFC,YAAY,CAAC,0CAA0C,CAAC,GAAAjC,aAAA,CAAAA,aAAA,KACnDmC,2BAA2B;IAC9BC,MAAM,EAAE;MACNC,YAAY,EAAE;QACZ,oBAAoB,EAAE,QAAQ;QAC9B,aAAa,EAAE,UAAU;QACzB,aAAa,EAAE;MACjB;IACF;EAAC,EACF;EAED,OAAOJ,YAAY,CAAC,4BAA4B,CAAC;EAEjDA,YAAY,CAAC,6BAA6B,CAAC,GAAG;IAC5CK,IAAI,EAAE,CACJ;IACA;IACA;IACA;IACA;IAAA;EAEJ,CAAC;;EAED,OAAO,IAAAC,kCAAwB,EAACN,YAAY,CAAC;AAC/C"}
1
+ {"version":3,"names":["_config","data","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","obj","value","_toPropertyKey","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","workspaceConfig","name","defaultScope","configParsed","getWorkspaceConfigTemplateParsed","packageManagerDefaultConfig","policy","dependencies","envs","stringifyWorkspaceConfig"],"sources":["workspace-config.ts"],"sourcesContent":["import { getWorkspaceConfigTemplateParsed, stringifyWorkspaceConfig } from '@teambit/config';\nimport { WorkspaceContext } from '../../../..';\n\nexport async function workspaceConfig({ name, defaultScope }: WorkspaceContext) {\n const configParsed = await getWorkspaceConfigTemplateParsed();\n const packageManagerDefaultConfig = configParsed['teambit.dependencies/dependency-resolver'];\n configParsed['teambit.workspace/workspace'].name = name;\n configParsed['teambit.workspace/workspace'].defaultScope = defaultScope || 'org.scope';\n configParsed['teambit.dependencies/dependency-resolver'] = {\n ...packageManagerDefaultConfig,\n policy: {\n dependencies: {\n '@teambit/node.node': 'latest',\n '@types/node': '16.18.44',\n '@types/jest': '29.5.4',\n \"eslint\": \"7.32.0\",\n '@typescript-eslint/eslint-plugin': '5.35.1',\n 'eslint-import-resolver-node': '0.3.6',\n 'eslint-plugin-import': '2.22.1',\n 'eslint-plugin-jest': '24.1.5',\n 'eslint-plugin-jsx-a11y': '6.4.1',\n 'eslint-plugin-mdx': '1.17.1',\n 'eslint-plugin-react': '7.22.0',\n },\n },\n };\n\n configParsed['teambit.generator/generator'] = {\n envs: [\n 'teambit.node/node',\n // \"teambit.angular/angular\",\n // \"teambit.vue/vue\",\n // \"teambit.react/react-env\",\n // \"teambit.html/html-env\"\n ],\n };\n\n return stringifyWorkspaceConfig(configParsed);\n}\n"],"mappings":";;;;;;AAAA,SAAAA,QAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,OAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6F,SAAAE,QAAAC,MAAA,EAAAC,cAAA,QAAAC,IAAA,GAAAC,MAAA,CAAAD,IAAA,CAAAF,MAAA,OAAAG,MAAA,CAAAC,qBAAA,QAAAC,OAAA,GAAAF,MAAA,CAAAC,qBAAA,CAAAJ,MAAA,GAAAC,cAAA,KAAAI,OAAA,GAAAA,OAAA,CAAAC,MAAA,WAAAC,GAAA,WAAAJ,MAAA,CAAAK,wBAAA,CAAAR,MAAA,EAAAO,GAAA,EAAAE,UAAA,OAAAP,IAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,IAAA,EAAAG,OAAA,YAAAH,IAAA;AAAA,SAAAU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KAAA,EAAAC,IAAA,2BAAAK,GAAA,sBAAAA,GAAA,YAAAE,SAAA,4DAAAP,IAAA,gBAAAF,MAAA,GAAAU,MAAA,EAAAT,KAAA;AAGtF,eAAeU,eAAeA,CAAC;EAAEC,IAAI;EAAEC;AAA+B,CAAC,EAAE;EAC9E,MAAMC,YAAY,GAAG,MAAM,IAAAC,0CAAgC,EAAC,CAAC;EAC7D,MAAMC,2BAA2B,GAAGF,YAAY,CAAC,0CAA0C,CAAC;EAC5FA,YAAY,CAAC,6BAA6B,CAAC,CAACF,IAAI,GAAGA,IAAI;EACvDE,YAAY,CAAC,6BAA6B,CAAC,CAACD,YAAY,GAAGA,YAAY,IAAI,WAAW;EACtFC,YAAY,CAAC,0CAA0C,CAAC,GAAAjC,aAAA,CAAAA,aAAA,KACnDmC,2BAA2B;IAC9BC,MAAM,EAAE;MACNC,YAAY,EAAE;QACZ,oBAAoB,EAAE,QAAQ;QAC9B,aAAa,EAAE,UAAU;QACzB,aAAa,EAAE,QAAQ;QACvB,QAAQ,EAAE,QAAQ;QAClB,kCAAkC,EAAE,QAAQ;QAC5C,6BAA6B,EAAE,OAAO;QACtC,sBAAsB,EAAE,QAAQ;QAChC,oBAAoB,EAAE,QAAQ;QAC9B,wBAAwB,EAAE,OAAO;QACjC,mBAAmB,EAAE,QAAQ;QAC7B,qBAAqB,EAAE;MACzB;IACF;EAAC,EACF;EAEDJ,YAAY,CAAC,6BAA6B,CAAC,GAAG;IAC5CK,IAAI,EAAE,CACJ;IACA;IACA;IACA;IACA;IAAA;EAEJ,CAAC;;EAED,OAAO,IAAAC,kCAAwB,EAACN,YAAY,CAAC;AAC/C"}
@@ -184,7 +184,7 @@ class WorkspaceGenerator {
184
184
  await this.wsConfigFiles.writeConfigFiles({});
185
185
  } catch (err) {
186
186
  var _this$logger;
187
- (_this$logger = this.logger) === null || _this$logger === void 0 ? void 0 : _this$logger.error(`failed generating a new workspace, will delete the dir ${this.workspacePath}`, err);
187
+ (_this$logger = this.logger) === null || _this$logger === void 0 || _this$logger.error(`failed generating a new workspace, will delete the dir ${this.workspacePath}`, err);
188
188
  await _fsExtra().default.remove(this.workspacePath);
189
189
  throw err;
190
190
  }
@@ -260,7 +260,7 @@ class WorkspaceGenerator {
260
260
  var _this$template, _this$template$import, _this$template2, _this$template2$fork;
261
261
  if (this.options.empty) return;
262
262
  const workspaceContext = this.getWorkspaceContext();
263
- const componentsToFork = ((_this$template = this.template) === null || _this$template === void 0 ? void 0 : (_this$template$import = _this$template.importComponents) === null || _this$template$import === void 0 ? void 0 : _this$template$import.call(_this$template, workspaceContext)) || ((_this$template2 = this.template) === null || _this$template2 === void 0 ? void 0 : (_this$template2$fork = _this$template2.fork) === null || _this$template2$fork === void 0 ? void 0 : _this$template2$fork.call(_this$template2, workspaceContext)) || [];
263
+ const componentsToFork = ((_this$template = this.template) === null || _this$template === void 0 || (_this$template$import = _this$template.importComponents) === null || _this$template$import === void 0 ? void 0 : _this$template$import.call(_this$template, workspaceContext)) || ((_this$template2 = this.template) === null || _this$template2 === void 0 || (_this$template2$fork = _this$template2.fork) === null || _this$template2$fork === void 0 ? void 0 : _this$template2$fork.call(_this$template2, workspaceContext)) || [];
264
264
  if (!componentsToFork.length) return;
265
265
  const componentsToForkRestructured = componentsToFork.map(({
266
266
  id,
@@ -285,7 +285,7 @@ class WorkspaceGenerator {
285
285
  var _this$template3, _this$template3$impor;
286
286
  if (this.options.empty) return;
287
287
  const workspaceContext = this.getWorkspaceContext();
288
- const componentsToImport = ((_this$template3 = this.template) === null || _this$template3 === void 0 ? void 0 : (_this$template3$impor = _this$template3.import) === null || _this$template3$impor === void 0 ? void 0 : _this$template3$impor.call(_this$template3, workspaceContext)) || [];
288
+ const componentsToImport = ((_this$template3 = this.template) === null || _this$template3 === void 0 || (_this$template3$impor = _this$template3.import) === null || _this$template3$impor === void 0 ? void 0 : _this$template3$impor.call(_this$template3, workspaceContext)) || [];
289
289
  if (!componentsToImport.length) return;
290
290
  await (0, _pMapSeries().default)(componentsToImport, async componentToImport => {
291
291
  await this.importer.import({
@@ -1 +1 @@
1
- {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_bit","_execa","_pMapSeries","_ui","_logger","_workspace","_forking","_consumer","_importer","_compiler","_gitExecutable","_gitNotFound","_path","_git","_install","_workspaceConfigFiles","_generator","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","WorkspaceGenerator","constructor","workspaceName","options","template","aspectComponent","workspacePath","resolve","generate","fs","existsSync","Error","ensureDir","process","chdir","initGit","init","skipGit","writeWorkspaceFiles","reloadBitInWorkspaceDir","workspace","inInstallContext","setupGitBitmapMergeDriver","forkComponentsFromRemote","importComponentsFromRemote","clearCache","install","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","updateExisting","compileComponents","wsConfigFiles","writeConfigFiles","err","_this$logger","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","_this$template","_this$template$import","_this$template2","_this$template2$fork","componentsToFork","importComponents","fork","length","componentsToForkRestructured","targetName","path","env","config","sourceId","targetId","forkMultipleFromRemote","scope","refactor","_this$template3","_this$template3$impor","componentsToImport","pMapSeries","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 { init } from '@teambit/legacy/dist/api/consumer';\nimport ImporterAspect, { ImporterMain } from '@teambit/importer';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport getGitExecutablePath from '@teambit/legacy/dist/utils/git/git-executable';\nimport GitNotFound from '@teambit/legacy/dist/utils/git/exceptions/git-not-found';\nimport { resolve, join } from 'path';\nimport { ComponentID } from '@teambit/component-id';\nimport GitAspect, { GitMain } from '@teambit/git';\nimport { InstallAspect, InstallMain } from '@teambit/install';\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';\n\nexport type GenerateResult = { id: ComponentID; dir: string; files: string[]; envId: string };\n\nexport class WorkspaceGenerator {\n private workspacePath: string;\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 componentGenerator?: ComponentGenerator;\n\n constructor(\n private workspaceName: string,\n private options: NewOptions,\n private template: WorkspaceTemplate,\n private aspectComponent?: Component\n ) {\n this.workspacePath = resolve(this.workspaceName);\n }\n\n async generate(): Promise<string> {\n if (fs.existsSync(this.workspacePath)) {\n throw new Error(`unable to create a workspace at \"${this.workspaceName}\", this path already exist`);\n }\n await fs.ensureDir(this.workspacePath);\n try {\n process.chdir(this.workspacePath);\n await this.initGit();\n await init(this.workspacePath, this.options.skipGit, false, false, false, false, false, false, {});\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.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 }\n\n // WIP\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 // await ComponentGenerator.generate(componentToCreate);\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 }) => ({\n sourceId: id,\n targetId: targetName,\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 writeToPath: componentToImport.path,\n },\n []\n );\n });\n\n await this.workspace.bitMap.write();\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,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L,SAAS,CAACK,UAAU,CAAC,CAAC;IACnC;IACA,MAAMuF,QAAQ,GAAG,IAAI,CAAC7D,OAAO,CAACC,GAAG,CAAe6D,0BAAc,CAAC3D,EAAE,CAAC;IAClE,MAAM0D,QAAQ,CAACE,kBAAkB,CAAC,CAAC;EACrC;AACF;AAACC,OAAA,CAAAnH,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_bit","_execa","_pMapSeries","_ui","_logger","_workspace","_forking","_consumer","_importer","_compiler","_gitExecutable","_gitNotFound","_path","_git","_install","_workspaceConfigFiles","_generator","obj","__esModule","default","_defineProperty","key","value","_toPropertyKey","Object","defineProperty","enumerable","configurable","writable","arg","_toPrimitive","String","input","hint","prim","Symbol","toPrimitive","undefined","res","call","TypeError","Number","WorkspaceGenerator","constructor","workspaceName","options","template","aspectComponent","workspacePath","resolve","generate","fs","existsSync","Error","ensureDir","process","chdir","initGit","init","skipGit","writeWorkspaceFiles","reloadBitInWorkspaceDir","workspace","inInstallContext","setupGitBitmapMergeDriver","forkComponentsFromRemote","importComponentsFromRemote","clearCache","install","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","updateExisting","compileComponents","wsConfigFiles","writeConfigFiles","err","_this$logger","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","_this$template","_this$template$import","_this$template2","_this$template2$fork","componentsToFork","importComponents","fork","length","componentsToForkRestructured","targetName","path","env","config","sourceId","targetId","forkMultipleFromRemote","scope","refactor","_this$template3","_this$template3$impor","componentsToImport","pMapSeries","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 { init } from '@teambit/legacy/dist/api/consumer';\nimport ImporterAspect, { ImporterMain } from '@teambit/importer';\nimport { CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport getGitExecutablePath from '@teambit/legacy/dist/utils/git/git-executable';\nimport GitNotFound from '@teambit/legacy/dist/utils/git/exceptions/git-not-found';\nimport { resolve, join } from 'path';\nimport { ComponentID } from '@teambit/component-id';\nimport GitAspect, { GitMain } from '@teambit/git';\nimport { InstallAspect, InstallMain } from '@teambit/install';\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';\n\nexport type GenerateResult = { id: ComponentID; dir: string; files: string[]; envId: string };\n\nexport class WorkspaceGenerator {\n private workspacePath: string;\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 componentGenerator?: ComponentGenerator;\n\n constructor(\n private workspaceName: string,\n private options: NewOptions,\n private template: WorkspaceTemplate,\n private aspectComponent?: Component\n ) {\n this.workspacePath = resolve(this.workspaceName);\n }\n\n async generate(): Promise<string> {\n if (fs.existsSync(this.workspacePath)) {\n throw new Error(`unable to create a workspace at \"${this.workspaceName}\", this path already exist`);\n }\n await fs.ensureDir(this.workspacePath);\n try {\n process.chdir(this.workspacePath);\n await this.initGit();\n await init(this.workspacePath, this.options.skipGit, false, false, false, false, false, false, {});\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.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 }\n\n // WIP\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 // await ComponentGenerator.generate(componentToCreate);\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 }) => ({\n sourceId: id,\n targetId: targetName,\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 writeToPath: componentToImport.path,\n },\n []\n );\n });\n\n await this.workspace.bitMap.write();\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,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,GAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAO,QAAA;EAAA,MAAAP,IAAA,GAAAE,OAAA;EAAAK,OAAA,YAAAA,CAAA;IAAA,OAAAP,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAQ,WAAA;EAAA,MAAAR,IAAA,GAAAE,OAAA;EAAAM,UAAA,YAAAA,CAAA;IAAA,OAAAR,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAS,SAAA;EAAA,MAAAT,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAO,QAAA,YAAAA,CAAA;IAA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C,CAAC;IAEF,MAAM,IAAI,CAAC1E,SAAS,CAAC0F,MAAM,CAACC,KAAK,CAAC,CAAC;EACrC;EAEA,MAAc/E,iBAAiBA,CAACP,UAAU,GAAG,IAAI,EAAE;IACjD,IAAIA,UAAU,EAAE;MACd,MAAM,IAAI,CAACL,SAAS,CAACK,UAAU,CAAC,CAAC;IACnC;IACA,MAAMuF,QAAQ,GAAG,IAAI,CAAC7D,OAAO,CAACC,GAAG,CAAe6D,0BAAc,CAAC3D,EAAE,CAAC;IAClE,MAAM0D,QAAQ,CAACE,kBAAkB,CAAC,CAAC;EACrC;AACF;AAACC,OAAA,CAAAnH,kBAAA,GAAAA,kBAAA"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/generator",
3
- "version": "0.0.1159",
3
+ "version": "0.0.1161",
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": "0.0.1159"
9
+ "version": "0.0.1161"
10
10
  },
11
11
  "dependencies": {
12
12
  "camelcase": "6.2.0",
@@ -20,25 +20,25 @@
20
20
  "@teambit/component-id": "0.0.427",
21
21
  "@teambit/harmony": "0.4.6",
22
22
  "@teambit/bit-error": "0.0.402",
23
- "@teambit/envs": "0.0.1159",
24
- "@teambit/logger": "0.0.866",
25
- "@teambit/new-component-helper": "0.0.563",
26
- "@teambit/tracker": "0.0.190",
27
- "@teambit/workspace-config-files": "0.0.139",
28
- "@teambit/workspace.modules.node-modules-linker": "0.0.115",
29
- "@teambit/workspace": "0.0.1159",
30
- "@teambit/component": "0.0.1159",
31
- "@teambit/cli": "0.0.773",
32
- "@teambit/graphql": "0.0.1159",
33
- "@teambit/aspect-loader": "0.0.1159",
34
- "@teambit/bit": "0.2.52",
35
- "@teambit/git": "0.0.64",
36
- "@teambit/compiler": "0.0.1159",
37
- "@teambit/forking": "0.0.563",
38
- "@teambit/importer": "0.0.588",
39
- "@teambit/install": "0.0.243",
40
- "@teambit/ui": "0.0.1159",
41
- "@teambit/config": "0.0.788"
23
+ "@teambit/envs": "0.0.1161",
24
+ "@teambit/logger": "0.0.868",
25
+ "@teambit/new-component-helper": "0.0.565",
26
+ "@teambit/tracker": "0.0.192",
27
+ "@teambit/workspace-config-files": "0.0.141",
28
+ "@teambit/workspace.modules.node-modules-linker": "0.0.117",
29
+ "@teambit/workspace": "0.0.1161",
30
+ "@teambit/component": "0.0.1161",
31
+ "@teambit/cli": "0.0.775",
32
+ "@teambit/graphql": "0.0.1161",
33
+ "@teambit/aspect-loader": "0.0.1161",
34
+ "@teambit/bit": "0.2.54",
35
+ "@teambit/git": "0.0.66",
36
+ "@teambit/compiler": "0.0.1161",
37
+ "@teambit/forking": "0.0.565",
38
+ "@teambit/importer": "0.0.590",
39
+ "@teambit/install": "0.0.245",
40
+ "@teambit/ui": "0.0.1161",
41
+ "@teambit/config": "0.0.790"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/fs-extra": "9.0.7",
@@ -52,7 +52,7 @@
52
52
  "@teambit/generator.aspect-docs.generator": "0.0.161"
53
53
  },
54
54
  "peerDependencies": {
55
- "@teambit/legacy": "1.0.558",
55
+ "@teambit/legacy": "1.0.560",
56
56
  "react": "^16.8.0 || ^17.0.0",
57
57
  "react-dom": "^16.8.0 || ^17.0.0"
58
58
  },
@@ -13,12 +13,18 @@ export async function workspaceConfig({ name, defaultScope }: WorkspaceContext)
13
13
  '@teambit/node.node': 'latest',
14
14
  '@types/node': '16.18.44',
15
15
  '@types/jest': '29.5.4',
16
+ "eslint": "7.32.0",
17
+ '@typescript-eslint/eslint-plugin': '5.35.1',
18
+ 'eslint-import-resolver-node': '0.3.6',
19
+ 'eslint-plugin-import': '2.22.1',
20
+ 'eslint-plugin-jest': '24.1.5',
21
+ 'eslint-plugin-jsx-a11y': '6.4.1',
22
+ 'eslint-plugin-mdx': '1.17.1',
23
+ 'eslint-plugin-react': '7.22.0',
16
24
  },
17
25
  },
18
26
  };
19
27
 
20
- delete configParsed['teambit.workspace/variants'];
21
-
22
28
  configParsed['teambit.generator/generator'] = {
23
29
  envs: [
24
30
  'teambit.node/node',