@teambit/generator 0.0.1110 → 0.0.1112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/component-generator.js.map +1 -1
  2. package/dist/create.cmd.js.map +1 -1
  3. package/dist/generator.aspect.js.map +1 -1
  4. package/dist/generator.composition.js.map +1 -1
  5. package/dist/generator.graphql.js.map +1 -1
  6. package/dist/generator.main.runtime.js.map +1 -1
  7. package/dist/generator.service.js.map +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/new.cmd.js.map +1 -1
  10. package/dist/{preview-1689736586631.js → preview-1689909446382.js} +2 -2
  11. package/dist/starter-list.js.map +1 -1
  12. package/dist/starter.plugin.js.map +1 -1
  13. package/dist/template-list.js.map +1 -1
  14. package/dist/templates/component-generator/files/aspect-file.js.map +1 -1
  15. package/dist/templates/component-generator/files/docs-file.js.map +1 -1
  16. package/dist/templates/component-generator/files/index.js.map +1 -1
  17. package/dist/templates/component-generator/files/main-runtime.js.map +1 -1
  18. package/dist/templates/component-generator/index.js.map +1 -1
  19. package/dist/templates/starter/files/docs-file.js.map +1 -1
  20. package/dist/templates/starter/files/git-ignore-tpl.js.map +1 -1
  21. package/dist/templates/starter/files/index.js.map +1 -1
  22. package/dist/templates/starter/files/readme-tpl.js.map +1 -1
  23. package/dist/templates/starter/files/starter.js.map +1 -1
  24. package/dist/templates/starter/files/workspace-config-tpl.js.map +1 -1
  25. package/dist/templates/starter/index.js.map +1 -1
  26. package/dist/templates/workspace-generator/index.js.map +1 -1
  27. package/dist/templates.cmd.js.map +1 -1
  28. package/dist/workspace-generator.js.map +1 -1
  29. package/package-tar/teambit-generator-0.0.1112.tgz +0 -0
  30. package/package.json +22 -22
  31. package/package-tar/teambit-generator-0.0.1110.tgz +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["_vinyl","data","_interopRequireDefault","require","_fsExtra","_pMapSeries","_path","_envs","_camelcase","_bitError","_workspaceModules","_sources","_componentIdToPackageName","_dataToPersist","_componentId","ComponentGenerator","constructor","workspace","componentIds","options","template","envs","newComponentHelper","tracker","logger","aspectId","envId","generate","dirsToDeleteIfFailed","generateResults","pMapSeries","componentId","componentPath","getNewComponentPath","path","fs","existsSync","join","BitError","hasName","fullName","push","generateOneComponent","err","deleteGeneratedComponents","bitMap","write","ids","map","r","id","linkToNodeModulesByIds","_legacy","consoleFailure","message","dirs","Promise","all","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","length","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 { ComponentTemplate, ComponentFile, ComponentConfig } from './component-template';\nimport { CreateOptions } from './create.cmd';\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 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 logger: Logger,\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(componentId, this.options.path);\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 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 return generateResults;\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;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CAACC,SAAS,CAACR,iBAAiB,CAAC;IACnD,CAAC,CAAC;IACF,MAAMS,OAAO,GAAGX,UAAU,CAAC/E,GAAG,CAAE2F,CAAC,IAAKA,CAAC,CAACzG,IAAI,CAAC;IAC7C2F,aAAa,CAACe,YAAY,CAACb,UAAU,CAAC;IACtCF,aAAa,CAACgB,WAAW,CAAC,IAAI,CAAC5H,SAAS,CAACiB,IAAI,CAAC;IAC9C,MAAM2F,aAAa,CAACiB,cAAc,CAAC,CAAC;IACpC,OAAOJ,OAAO;EAChB;AACF;AAACK,OAAA,CAAAhI,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["ComponentGenerator","constructor","workspace","componentIds","options","template","envs","newComponentHelper","tracker","logger","aspectId","envId","generate","dirsToDeleteIfFailed","generateResults","pMapSeries","componentId","componentPath","getNewComponentPath","path","fs","existsSync","join","BitError","hasName","fullName","push","generateOneComponent","err","deleteGeneratedComponents","bitMap","write","ids","map","r","id","linkToNodeModulesByIds","_legacy","consoleFailure","message","dirs","Promise","all","dir","absoluteDir","remove","code","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","boundConfig","bind","isInWorkspace","exists","toStringWithoutVersion","toString","env","templateEnv","EnvsAspect","Object","keys","length","undefined","configWithEnv","addEnvIfProvidedByFlag","setEntireConfig","getEnvData","envFromFlag","envFromTemplate","setBy","packageName","componentIdToPackageName","state","_consumer","envSetBy","userEnv","addEnvToConfig","templateFiles","dataToPersist","DataToPersist","vinylFiles","templateFile","templateFileVinyl","Vinyl","base","contents","Buffer","from","content","AbstractVinyl","fromVinyl","results","v","addManyFiles","addBasePath","persistAllToFS"],"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 { ComponentTemplate, ComponentFile, ComponentConfig } from './component-template';\nimport { CreateOptions } from './create.cmd';\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 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 logger: Logger,\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(componentId, this.options.path);\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 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 return generateResults;\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();\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,CAAC,CAAC;IACF,MAAMS,OAAO,GAAGX,UAAU,CAACxE,GAAG,CAAEoF,CAAC,IAAKA,CAAC,CAAClG,IAAI,CAAC;IAC7CoF,aAAa,CAACe,YAAY,CAACb,UAAU,CAAC;IACtCF,aAAa,CAACgB,WAAW,CAAC,IAAI,CAACrH,SAAS,CAACiB,IAAI,CAAC;IAC9C,MAAMoF,aAAa,CAACiB,cAAc,EAAE;IACpC,OAAOJ,OAAO;EAChB;AACF;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","CreateCmd","constructor","generator","docsDomain","_defineProperty2","default","name","description","cmd","report","templateName","componentNames","options","_options$aspect","aspect","template","results","generateComponentTemplate","title","length","componentsData","map","result","chalk","bold","id","toString","dir","envId","envSetBy","packageName","join","footer","green","exports"],"sources":["create.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GeneratorMain } from './generator.main.runtime';\n\nexport type CreateOptions = {\n namespace?: string;\n aspect?: string;\n scope?: string;\n path?: string;\n env?: string;\n};\n\nexport class CreateCmd implements Command {\n name = 'create <template-name> <component-names...>';\n description = 'create a new component (source files and config) using a template.';\n alias = '';\n loader = true;\n helpUrl = 'reference/starters/create-starter';\n arguments = [\n {\n name: 'template-name',\n description:\n \"the template for generating the component \\n(run 'bit templates' for a list of available templates)\",\n },\n {\n name: 'component-names...',\n description: 'a list of component names to generate',\n },\n ];\n examples = [\n {\n cmd: 'bit create react ui/button',\n description: \"creates a component named 'ui/button' using the 'react' template\",\n },\n {\n cmd: 'bit create react ui/button pages/register',\n description: \"creates two components, 'ui/button' and 'pages/register', using the 'react' template\",\n },\n {\n cmd: 'bit create react ui/button --scope my-org.my-scope',\n description:\n \"creates a component named 'ui/button' and sets it scope to 'my-org.my-scope'. \\nby default, the scope is the `defaultScope` value, configured in your `workspace.jsonc`.\",\n },\n {\n cmd: 'bit create react ui/button --env teambit.community/envs/community-react@1.95.13',\n description:\n \"creates a component named 'ui/button' and sets it to use the 'community-react' env. \\n(the template's default env is 'teambit.react/react').\",\n },\n ];\n group = 'development';\n options = [\n ['n', 'namespace <string>', `sets the component's namespace and nested dirs inside the scope`],\n ['s', 'scope <string>', `sets the component's scope-name. if not entered, the default-scope will be used`],\n ['a', 'aspect <string>', 'aspect-id of the template. helpful when multiple aspects use the same template name'],\n ['t', 'template <string>', 'env-id of the template. alias for --aspect.'],\n ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`'],\n ['e', 'env <string>', \"set the component's environment. (overrides the env from variants and the template)\"],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain, private docsDomain: string) {}\n\n async report(\n [templateName, componentNames]: [string, string[]],\n options: CreateOptions & {\n template?: string;\n }\n ) {\n options.aspect = options.aspect ?? options.template;\n const results = await this.generator.generateComponentTemplate(componentNames, templateName, options);\n const title = `${results.length} component(s) were created`;\n\n const componentsData = results\n .map((result) => {\n return `${chalk.bold(result.id.toString())}\n location: ${result.dir}\n env: ${result.envId} (set by ${result.envSetBy})\n package: ${result.packageName}\n`;\n })\n .join('\\n');\n const footer = `env configuration is according to workspace variants, template config or --env flag. learn more at https://${this.docsDomain}/envs/using-envs`;\n\n return `${chalk.green(title)}\\n\\n${componentsData}\\n\\n${footer}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAWO,MAAMG,SAAS,CAAoB;EA+CxCC,WAAWA,CAASC,SAAwB,EAAUC,UAAkB,EAAE;IAAA,KAAtDD,SAAwB,GAAxBA,SAAwB;IAAA,KAAUC,UAAkB,GAAlBA,UAAkB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBA9CjE,6CAA6C;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBAC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AQ;IACnD,MAAMC,OAAO,GAAG,MAAM,IAAI,CAACd,SAAS,CAACe,yBAAyB,CAACN,cAAc,EAAED,YAAY,EAAEE,OAAO,CAAC;IACrG,MAAMM,KAAK,GAAI,GAAEF,OAAO,CAACG,MAAO,4BAA2B;IAE3D,MAAMC,cAAc,GAAGJ,OAAO,CAC3BK,GAAG,CAAEC,MAAM,IAAK;MACf,OAAQ,GAAEC,gBAAK,CAACC,IAAI,CAACF,MAAM,CAACG,EAAE,CAACC,QAAQ,CAAC,CAAC,CAAE;AACnD,gBAAgBJ,MAAM,CAACK,GAAI;AAC3B,gBAAgBL,MAAM,CAACM,KAAM,YAAWN,MAAM,CAACO,QAAS;AACxD,gBAAgBP,MAAM,CAACQ,WAAY;AACnC,CAAC;IACK,CAAC,CAAC,CACDC,IAAI,CAAC,IAAI,CAAC;IACb,MAAMC,MAAM,GAAI,8GAA6G,IAAI,CAAC7B,UAAW,kBAAiB;IAE9J,OAAQ,GAAEoB,gBAAK,CAACU,KAAK,CAACf,KAAK,CAAE,OAAME,cAAe,OAAMY,MAAO,EAAC;EAClE;AACF;AAACE,OAAA,CAAAlC,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"names":["CreateCmd","constructor","generator","docsDomain","name","description","cmd","report","templateName","componentNames","options","aspect","template","results","generateComponentTemplate","title","length","componentsData","map","result","chalk","bold","id","toString","dir","envId","envSetBy","packageName","join","footer","green"],"sources":["create.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GeneratorMain } from './generator.main.runtime';\n\nexport type CreateOptions = {\n namespace?: string;\n aspect?: string;\n scope?: string;\n path?: string;\n env?: string;\n};\n\nexport class CreateCmd implements Command {\n name = 'create <template-name> <component-names...>';\n description = 'create a new component (source files and config) using a template.';\n alias = '';\n loader = true;\n helpUrl = 'reference/starters/create-starter';\n arguments = [\n {\n name: 'template-name',\n description:\n \"the template for generating the component \\n(run 'bit templates' for a list of available templates)\",\n },\n {\n name: 'component-names...',\n description: 'a list of component names to generate',\n },\n ];\n examples = [\n {\n cmd: 'bit create react ui/button',\n description: \"creates a component named 'ui/button' using the 'react' template\",\n },\n {\n cmd: 'bit create react ui/button pages/register',\n description: \"creates two components, 'ui/button' and 'pages/register', using the 'react' template\",\n },\n {\n cmd: 'bit create react ui/button --scope my-org.my-scope',\n description:\n \"creates a component named 'ui/button' and sets it scope to 'my-org.my-scope'. \\nby default, the scope is the `defaultScope` value, configured in your `workspace.jsonc`.\",\n },\n {\n cmd: 'bit create react ui/button --env teambit.community/envs/community-react@1.95.13',\n description:\n \"creates a component named 'ui/button' and sets it to use the 'community-react' env. \\n(the template's default env is 'teambit.react/react').\",\n },\n ];\n group = 'development';\n options = [\n ['n', 'namespace <string>', `sets the component's namespace and nested dirs inside the scope`],\n ['s', 'scope <string>', `sets the component's scope-name. if not entered, the default-scope will be used`],\n ['a', 'aspect <string>', 'aspect-id of the template. helpful when multiple aspects use the same template name'],\n ['t', 'template <string>', 'env-id of the template. alias for --aspect.'],\n ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`'],\n ['e', 'env <string>', \"set the component's environment. (overrides the env from variants and the template)\"],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain, private docsDomain: string) {}\n\n async report(\n [templateName, componentNames]: [string, string[]],\n options: CreateOptions & {\n template?: string;\n }\n ) {\n options.aspect = options.aspect ?? options.template;\n const results = await this.generator.generateComponentTemplate(componentNames, templateName, options);\n const title = `${results.length} component(s) were created`;\n\n const componentsData = results\n .map((result) => {\n return `${chalk.bold(result.id.toString())}\n location: ${result.dir}\n env: ${result.envId} (set by ${result.envSetBy})\n package: ${result.packageName}\n`;\n })\n .join('\\n');\n const footer = `env configuration is according to workspace variants, template config or --env flag. learn more at https://${this.docsDomain}/envs/using-envs`;\n\n return `${chalk.green(title)}\\n\\n${componentsData}\\n\\n${footer}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA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AI,CAACX,SAAS,CAACY,yBAAyB,CAACL,cAAc,EAAED,YAAY,EAAEE,OAAO,CAAC;IACrG,MAAMK,KAAK,GAAI,GAAEF,OAAO,CAACG,MAAO,4BAA2B;IAE3D,MAAMC,cAAc,GAAGJ,OAAO,CAC3BK,GAAG,CAAEC,MAAM,IAAK;MACf,OAAQ,GAAEC,gBAAK,CAACC,IAAI,CAACF,MAAM,CAACG,EAAE,CAACC,QAAQ,EAAE,CAAE;AACnD,gBAAgBJ,MAAM,CAACK,GAAI;AAC3B,gBAAgBL,MAAM,CAACM,KAAM,YAAWN,MAAM,CAACO,QAAS;AACxD,gBAAgBP,MAAM,CAACQ,WAAY;AACnC,CAAC;IACK,CAAC,CAAC,CACDC,IAAI,CAAC,IAAI,CAAC;IACb,MAAMC,MAAM,GAAI,8GAA6G,IAAI,CAAC1B,UAAW,kBAAiB;IAE9J,OAAQ,GAAEiB,gBAAK,CAACU,KAAK,CAACf,KAAK,CAAE,OAAME,cAAe,OAAMY,MAAO,EAAC;EAClE;AACF;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["_harmony","data","require","GeneratorAspect","Aspect","create","id","exports"],"sources":["generator.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const GeneratorAspect = Aspect.create({\n id: 'teambit.generator/generator',\n});\n"],"mappings":";;;;;;AAAA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,eAAe,GAAGC,iBAAM,CAACC,MAAM,CAAC;EAC3CC,EAAE,EAAE;AACN,CAAC,CAAC;AAACC,OAAA,CAAAJ,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["GeneratorAspect","Aspect","create","id"],"sources":["generator.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const GeneratorAspect = Aspect.create({\n id: 'teambit.generator/generator',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,eAAe,GAAGC,iBAAM,CAACC,MAAM,CAAC;EAC3CC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["_react","data","_interopRequireDefault","require","Logo","default","createElement","style","height","display","justifyContent","width","src","exports"],"sources":["generator.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/generator-new.svg\" />\n </div>\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;AAEO,MAAMG,IAAI,GAAGA,CAAA,kBAClBJ,MAAA,GAAAK,OAAA,CAAAC,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEV,MAAA,GAAAK,OAAA,CAAAC,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAA2D,CAAE,CACzF,CACN;AAACC,OAAA,CAAAT,IAAA,GAAAA,IAAA"}
1
+ {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["generator.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/generator-new.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAA2D,EAAG,CAEhG;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["_graphqlTag","data","_interopRequireDefault","require","generatorSchema","generator","typeDefs","gql","resolvers","Mutation","createComponent","req","_ref","name","templateName","options","_objectWithoutProperties2","default","res","generateComponentTemplate","map","component","id","toString","dir","files","Generator","templates","listTemplates","Query"],"sources":["generator.graphql.ts"],"sourcesContent":["import { Schema } from '@teambit/graphql';\nimport gql from 'graphql-tag';\nimport { GeneratorMain } from './generator.main.runtime';\n\nexport function generatorSchema(generator: GeneratorMain): Schema {\n return {\n typeDefs: gql`\n type GenerateResult {\n id: String\n dir: String\n files: [String]\n }\n\n type Mutation {\n # create Component by template\n createComponent(\n name: String!\n templateName: String!\n scope: String\n namespace: String\n aspect: String\n ): [GenerateResult]\n }\n\n type TemplateDescriptor {\n aspectId: String!\n name: String!\n }\n\n type Generator {\n templates: [TemplateDescriptor]\n }\n\n type Query {\n generator: Generator\n }\n `,\n resolvers: {\n Mutation: {\n createComponent: async (\n req: any,\n {\n name,\n templateName,\n ...options\n }: { name: string; templateName: string; scope?: string; namespace?: string; aspect?: string }\n ) => {\n const res = await generator.generateComponentTemplate([name], templateName, options);\n return res.map((component) => ({\n id: component.id.toString(),\n dir: component.dir,\n files: component.files,\n }));\n },\n },\n Generator: {\n templates: async () => {\n return generator.listTemplates();\n },\n },\n Query: {\n generator: () => generator,\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA,SAAAA,YAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,SAASG,eAAeA,CAACC,SAAwB,EAAU;EAChE,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,QAAQ,EAAE;QACRC,eAAe,EAAE,MAAAA,CACfC,GAAQ,EAAAC,IAAA,KAML;UAAA,IALH;cACEC,IAAI;cACJC;YAE2F,CAAC,GAAAF,IAAA;YADzFG,OAAO,OAAAC,yBAAA,GAAAC,OAAA,EAAAL,IAAA;UAGZ,MAAMM,GAAG,GAAG,MAAMb,SAAS,CAACc,yBAAyB,CAAC,CAACN,IAAI,CAAC,EAAEC,YAAY,EAAEC,OAAO,CAAC;UACpF,OAAOG,GAAG,CAACE,GAAG,CAAEC,SAAS,KAAM;YAC7BC,EAAE,EAAED,SAAS,CAACC,EAAE,CAACC,QAAQ,CAAC,CAAC;YAC3BC,GAAG,EAAEH,SAAS,CAACG,GAAG;YAClBC,KAAK,EAAEJ,SAAS,CAACI;UACnB,CAAC,CAAC,CAAC;QACL;MACF,CAAC;MACDC,SAAS,EAAE;QACTC,SAAS,EAAE,MAAAA,CAAA,KAAY;UACrB,OAAOtB,SAAS,CAACuB,aAAa,CAAC,CAAC;QAClC;MACF,CAAC;MACDC,KAAK,EAAE;QACLxB,SAAS,EAAEA,CAAA,KAAMA;MACnB;IACF;EACF,CAAC;AACH"}
1
+ {"version":3,"names":["generatorSchema","generator","typeDefs","gql","resolvers","Mutation","createComponent","req","name","templateName","options","res","generateComponentTemplate","map","component","id","toString","dir","files","Generator","templates","listTemplates","Query"],"sources":["generator.graphql.ts"],"sourcesContent":["import { Schema } from '@teambit/graphql';\nimport gql from 'graphql-tag';\nimport { GeneratorMain } from './generator.main.runtime';\n\nexport function generatorSchema(generator: GeneratorMain): Schema {\n return {\n typeDefs: gql`\n type GenerateResult {\n id: String\n dir: String\n files: [String]\n }\n\n type Mutation {\n # create Component by template\n createComponent(\n name: String!\n templateName: String!\n scope: String\n namespace: String\n aspect: String\n ): [GenerateResult]\n }\n\n type TemplateDescriptor {\n aspectId: String!\n name: String!\n }\n\n type Generator {\n templates: [TemplateDescriptor]\n }\n\n type Query {\n generator: Generator\n }\n `,\n resolvers: {\n Mutation: {\n createComponent: async (\n req: any,\n {\n name,\n templateName,\n ...options\n }: { name: string; templateName: string; scope?: string; namespace?: string; aspect?: string }\n ) => {\n const res = await generator.generateComponentTemplate([name], templateName, options);\n return res.map((component) => ({\n id: component.id.toString(),\n dir: component.dir,\n files: component.files,\n }));\n },\n },\n Generator: {\n templates: async () => {\n return generator.listTemplates();\n },\n },\n Query: {\n generator: () => generator,\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,SAASA,eAAe,CAACC,SAAwB,EAAU;EAChE,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;IACDC,SAAS,EAAE;MACTC,QAAQ,EAAE;QACRC,eAAe,EAAE,OACfC,GAAQ,WAML;UAAA,IALH;cACEC,IAAI;cACJC;YAE2F,CAAC;YADzFC,OAAO;UAGZ,MAAMC,GAAG,GAAG,MAAMV,SAAS,CAACW,yBAAyB,CAAC,CAACJ,IAAI,CAAC,EAAEC,YAAY,EAAEC,OAAO,CAAC;UACpF,OAAOC,GAAG,CAACE,GAAG,CAAEC,SAAS,KAAM;YAC7BC,EAAE,EAAED,SAAS,CAACC,EAAE,CAACC,QAAQ,EAAE;YAC3BC,GAAG,EAAEH,SAAS,CAACG,GAAG;YAClBC,KAAK,EAAEJ,SAAS,CAACI;UACnB,CAAC,CAAC,CAAC;QACL;MACF,CAAC;MACDC,SAAS,EAAE;QACTC,SAAS,EAAE,YAAY;UACrB,OAAOnB,SAAS,CAACoB,aAAa,EAAE;QAClC;MACF,CAAC;MACDC,KAAK,EAAE;QACLrB,SAAS,EAAE,MAAMA;MACnB;IACF;EACF,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"names":["_graphql","data","require","_cli","_workspace","_interopRequireWildcard","_envs","_community","_config","_interopRequireDefault","_component","_bit","_harmony","_git","_bitError","_aspectLoader","_tracker","_newComponentHelper","_lodash","_logger","_generator","_create","_templates","_generator2","_componentGenerator","_workspaceGenerator","_new","_componentGenerator2","_workspaceGenerator2","_starter","_starter2","_generator3","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","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","_defineProperty2","getOwnPropertyDescriptors","defineProperties","GeneratorMain","constructor","componentTemplateSlot","workspaceTemplateSlot","config","workspace","envs","aspectLoader","newComponentHelper","componentAspect","tracker","logger","git","id","template","shouldBeHidden","hidden","hideCoreTemplates","isCoreAspect","aspectId","name","description","registerComponentTemplate","templates","register","registerWorkspaceTemplate","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","undefined","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","community","loggerMain","createLogger","commands","CreateCmd","getDocsDomain","TemplatesCmd","NewCmd","generatorSchema","registerPlugins","StarterPlugin","registerService","GeneratorService","componentGeneratorTemplate","starterTemplate","workspaceGeneratorTemplate","exports","Slot","withType","CLIAspect","GraphqlAspect","AspectLoaderAspect","NewComponentHelperAspect","CommunityAspect","ComponentAspect","TrackerAspect","LoggerAspect","GitAspect","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 { CommunityAspect } from '@teambit/community';\nimport type { CommunityMain } from '@teambit/community';\nimport ComponentConfig from '@teambit/legacy/dist/consumer/config';\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 } from './component-generator';\nimport { WorkspaceGenerator } from './workspace-generator';\nimport { WorkspaceTemplate } from './workspace-template';\nimport { NewCmd, NewOptions } from './new.cmd';\nimport { componentGeneratorTemplate } from './templates/component-generator';\nimport { workspaceGeneratorTemplate } from './templates/workspace-generator';\nimport { starterTemplate } from './templates/starter';\nimport { StarterPlugin } from './starter.plugin';\nimport { GeneratorService } from './generator.service';\n\nexport type ComponentTemplateSlot = SlotRegistry<ComponentTemplate[]>;\nexport type WorkspaceTemplateSlot = SlotRegistry<WorkspaceTemplate[]>;\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 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 ) {}\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 component template.\n */\n registerWorkspaceTemplate(templates: WorkspaceTemplate[]) {\n this.workspaceTemplateSlot.register(templates);\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: aspectId } = options;\n\n const componentConfigLoadingRegistry = ComponentConfig.componentConfigLoadingRegistry;\n\n const templateWithId = await this.getComponentTemplate(templateName, aspectId);\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.logger,\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\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\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 = [Slot.withType<ComponentTemplate[]>(), Slot.withType<WorkspaceTemplate[]>()];\n\n static dependencies = [\n WorkspaceAspect,\n CLIAspect,\n GraphqlAspect,\n EnvsAspect,\n AspectLoaderAspect,\n NewComponentHelperAspect,\n CommunityAspect,\n ComponentAspect,\n TrackerAspect,\n LoggerAspect,\n GitAspect,\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 community,\n componentAspect,\n tracker,\n loggerMain,\n git,\n ]: [\n Workspace,\n CLIMain,\n GraphqlMain,\n EnvsMain,\n AspectLoaderMain,\n NewComponentHelperMain,\n CommunityMain,\n ComponentMain,\n TrackerMain,\n LoggerMain,\n GitMain\n ],\n config: GeneratorConfig,\n [componentTemplateSlot, workspaceTemplateSlot]: [ComponentTemplateSlot, WorkspaceTemplateSlot]\n ) {\n const logger = loggerMain.createLogger(GeneratorAspect.id);\n const generator = new GeneratorMain(\n componentTemplateSlot,\n workspaceTemplateSlot,\n config,\n workspace,\n envs,\n aspectLoader,\n newComponentHelper,\n componentAspect,\n tracker,\n logger,\n git\n );\n const commands = [\n new CreateCmd(generator, community.getDocsDomain()),\n new TemplatesCmd(generator),\n new NewCmd(generator),\n ];\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([componentGeneratorTemplate, starterTemplate, workspaceGeneratorTemplate]);\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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CAAC5K,aAAa,CAAC"}
1
+ {"version":3,"names":["GeneratorMain","constructor","componentTemplateSlot","workspaceTemplateSlot","config","workspace","envs","aspectLoader","newComponentHelper","componentAspect","tracker","logger","git","id","template","shouldBeHidden","hidden","hideCoreTemplates","isCoreAspect","aspectId","name","description","registerComponentTemplate","templates","register","registerWorkspaceTemplate","listTemplates","aspect","isRunningInsideWorkspace","getAllComponentTemplatesDescriptorsFlattened","getAllWorkspaceTemplatesDescriptorFlattened","listComponentTemplates","opts","Boolean","getComponentTemplateByAspect","get","getComponentTemplate","fromEnv","listEnvComponentTemplates","length","found","findTemplateByAspectIdAndName","getAllComponentTemplatesFlattened","find","idWithoutVersion","split","getGlobalGeneratorEnvs","globalScopeHarmony","components","loadAspectsFromGlobalScope","remoteGenerator","GeneratorAspect","remoteEnvsAspect","EnvsAspect","fullAspectId","toString","findWorkspaceTemplateInGlobalScope","fromGlobal","searchRegisteredWorkspaceTemplate","call","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","undefined","generate","generateWorkspaceTemplate","workspaceName","loadFrom","workspaceGenerator","WorkspaceGenerator","appName","envTemplates","listEnvComponentTemplateDescriptors","filtered","filter","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","community","loggerMain","createLogger","commands","CreateCmd","getDocsDomain","TemplatesCmd","NewCmd","generatorSchema","registerPlugins","StarterPlugin","registerService","GeneratorService","componentGeneratorTemplate","starterTemplate","workspaceGeneratorTemplate","Slot","withType","CLIAspect","GraphqlAspect","AspectLoaderAspect","NewComponentHelperAspect","CommunityAspect","ComponentAspect","TrackerAspect","LoggerAspect","GitAspect","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 { CommunityAspect } from '@teambit/community';\nimport type { CommunityMain } from '@teambit/community';\nimport ComponentConfig from '@teambit/legacy/dist/consumer/config';\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 } from './component-generator';\nimport { WorkspaceGenerator } from './workspace-generator';\nimport { WorkspaceTemplate } from './workspace-template';\nimport { NewCmd, NewOptions } from './new.cmd';\nimport { componentGeneratorTemplate } from './templates/component-generator';\nimport { workspaceGeneratorTemplate } from './templates/workspace-generator';\nimport { starterTemplate } from './templates/starter';\nimport { StarterPlugin } from './starter.plugin';\nimport { GeneratorService } from './generator.service';\n\nexport type ComponentTemplateSlot = SlotRegistry<ComponentTemplate[]>;\nexport type WorkspaceTemplateSlot = SlotRegistry<WorkspaceTemplate[]>;\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 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 ) {}\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 component template.\n */\n registerWorkspaceTemplate(templates: WorkspaceTemplate[]) {\n this.workspaceTemplateSlot.register(templates);\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: aspectId } = options;\n\n const componentConfigLoadingRegistry = ComponentConfig.componentConfigLoadingRegistry;\n\n const templateWithId = await this.getComponentTemplate(templateName, aspectId);\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.logger,\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\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\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 = [Slot.withType<ComponentTemplate[]>(), Slot.withType<WorkspaceTemplate[]>()];\n\n static dependencies = [\n WorkspaceAspect,\n CLIAspect,\n GraphqlAspect,\n EnvsAspect,\n AspectLoaderAspect,\n NewComponentHelperAspect,\n CommunityAspect,\n ComponentAspect,\n TrackerAspect,\n LoggerAspect,\n GitAspect,\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 community,\n componentAspect,\n tracker,\n loggerMain,\n git,\n ]: [\n Workspace,\n CLIMain,\n GraphqlMain,\n EnvsMain,\n AspectLoaderMain,\n NewComponentHelperMain,\n CommunityMain,\n ComponentMain,\n TrackerMain,\n LoggerMain,\n GitMain\n ],\n config: GeneratorConfig,\n [componentTemplateSlot, workspaceTemplateSlot]: [ComponentTemplateSlot, WorkspaceTemplateSlot]\n ) {\n const logger = loggerMain.createLogger(GeneratorAspect.id);\n const generator = new GeneratorMain(\n componentTemplateSlot,\n workspaceTemplateSlot,\n config,\n workspace,\n envs,\n aspectLoader,\n newComponentHelper,\n componentAspect,\n tracker,\n logger,\n git\n );\n const commands = [\n new CreateCmd(generator, community.getDocsDomain()),\n new TemplatesCmd(generator),\n new NewCmd(generator),\n ];\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([componentGeneratorTemplate, starterTemplate, workspaceGeneratorTemplate]);\n return generator;\n }\n}\n\nGeneratorAspect.addRuntime(GeneratorMain);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAA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ACF;AAAC;AAAA,gCAvdY1E,aAAa,WA4YT,CAACmK,eAAI,CAACC,QAAQ,EAAuB,EAAED,eAAI,CAACC,QAAQ,EAAuB,CAAC;AAAA,gCA5YhFpK,aAAa,kBA8YF,CACpBkE,oBAAe,EACfmG,gBAAS,EACTC,wBAAa,EACbjH,kBAAU,EACVkH,uBAAkB,EAClBC,6BAAwB,EACxBC,4BAAe,EACfC,oBAAe,EACfC,kBAAa,EACbC,sBAAY,EACZC,cAAS,CACV;AAAA,gCA1ZU7K,aAAa,aA4ZP8K,kBAAW;AA6D9B3H,4BAAe,CAAC4H,UAAU,CAAC/K,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["GeneratorService","constructor","_defineProperty2","default","transform","env","context","generators","undefined","getGeneratorTemplates","generatorList","compute","getGeneratorStarters","starters","starterList","exports"],"sources":["generator.service.tsx"],"sourcesContent":["import { EnvService, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport { ComponentTemplate } from './component-template';\nimport { WorkspaceTemplate } from './workspace-template';\n\ntype GeneratorTransformationMap = ServiceTransformationMap & {\n getGeneratorTemplates: () => ComponentTemplate;\n getGeneratorStarters: () => WorkspaceTemplate;\n};\nexport class GeneratorService implements EnvService<any> {\n name = 'generator';\n\n transform(env: Env, context: EnvContext): GeneratorTransformationMap | undefined {\n // Old env\n if (!env?.generators) return undefined;\n return {\n getGeneratorTemplates: () => {\n if (!env.generators) return undefined;\n const generatorList = env.generators()(context);\n return generatorList.compute();\n },\n getGeneratorStarters: () => {\n if (!env.starters) return undefined;\n const starterList = env.starters()(context);\n return starterList.compute();\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAQO,MAAMA,gBAAgB,CAA4B;EAAAC,YAAA;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBAChD,WAAW;EAAA;EAElBC,SAASA,CAACC,GAAQ,EAAEC,OAAmB,EAA0C;IAC/E;IACA,IAAI,EAACD,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEE,UAAU,GAAE,OAAOC,SAAS;IACtC,OAAO;MACLC,qBAAqB,EAAEA,CAAA,KAAM;QAC3B,IAAI,CAACJ,GAAG,CAACE,UAAU,EAAE,OAAOC,SAAS;QACrC,MAAME,aAAa,GAAGL,GAAG,CAACE,UAAU,CAAC,CAAC,CAACD,OAAO,CAAC;QAC/C,OAAOI,aAAa,CAACC,OAAO,CAAC,CAAC;MAChC,CAAC;MACDC,oBAAoB,EAAEA,CAAA,KAAM;QAC1B,IAAI,CAACP,GAAG,CAACQ,QAAQ,EAAE,OAAOL,SAAS;QACnC,MAAMM,WAAW,GAAGT,GAAG,CAACQ,QAAQ,CAAC,CAAC,CAACP,OAAO,CAAC;QAC3C,OAAOQ,WAAW,CAACH,OAAO,CAAC,CAAC;MAC9B;IACF,CAAC;EACH;AACF;AAACI,OAAA,CAAAf,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["GeneratorService","transform","env","context","generators","undefined","getGeneratorTemplates","generatorList","compute","getGeneratorStarters","starters","starterList"],"sources":["generator.service.tsx"],"sourcesContent":["import { EnvService, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';\nimport { ComponentTemplate } from './component-template';\nimport { WorkspaceTemplate } from './workspace-template';\n\ntype GeneratorTransformationMap = ServiceTransformationMap & {\n getGeneratorTemplates: () => ComponentTemplate;\n getGeneratorStarters: () => WorkspaceTemplate;\n};\nexport class GeneratorService implements EnvService<any> {\n name = 'generator';\n\n transform(env: Env, context: EnvContext): GeneratorTransformationMap | undefined {\n // Old env\n if (!env?.generators) return undefined;\n return {\n getGeneratorTemplates: () => {\n if (!env.generators) return undefined;\n const generatorList = env.generators()(context);\n return generatorList.compute();\n },\n getGeneratorStarters: () => {\n if (!env.starters) return undefined;\n const starterList = env.starters()(context);\n return starterList.compute();\n },\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAQO,MAAMA,gBAAgB,CAA4B;EAAA;IAAA,8CAChD,WAAW;EAAA;EAElBC,SAAS,CAACC,GAAQ,EAAEC,OAAmB,EAA0C;IAC/E;IACA,IAAI,EAACD,GAAG,aAAHA,GAAG,eAAHA,GAAG,CAAEE,UAAU,GAAE,OAAOC,SAAS;IACtC,OAAO;MACLC,qBAAqB,EAAE,MAAM;QAC3B,IAAI,CAACJ,GAAG,CAACE,UAAU,EAAE,OAAOC,SAAS;QACrC,MAAME,aAAa,GAAGL,GAAG,CAACE,UAAU,EAAE,CAACD,OAAO,CAAC;QAC/C,OAAOI,aAAa,CAACC,OAAO,EAAE;MAChC,CAAC;MACDC,oBAAoB,EAAE,MAAM;QAC1B,IAAI,CAACP,GAAG,CAACQ,QAAQ,EAAE,OAAOL,SAAS;QACnC,MAAMM,WAAW,GAAGT,GAAG,CAACQ,QAAQ,EAAE,CAACP,OAAO,CAAC;QAC3C,OAAOQ,WAAW,CAACH,OAAO,EAAE;MAC9B;IACF,CAAC;EACH;AACF;AAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_componentTemplate","data","require","_workspaceTemplate","_generatorEnvType","_generator","_templateList","_starterList"],"sources":["index.ts"],"sourcesContent":["export type { GeneratorMain } from './generator.main.runtime';\nexport {\n ComponentContext,\n ComponentTemplate,\n ComponentFile,\n ComponentConfig,\n ConfigContext,\n} from './component-template';\nexport { WorkspaceContext, WorkspaceTemplate, WorkspaceTemplate as Starter, WorkspaceFile } from './workspace-template';\nexport { GeneratorEnv } from './generator-env-type';\nexport { GeneratorAspect } from './generator.aspect';\nexport { TemplateList } from './template-list';\nexport { StarterList } from './starter-list';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAOA,SAAAE,mBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,kBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,kBAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,iBAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,WAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,UAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,cAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,aAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,aAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,YAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export type { GeneratorMain } from './generator.main.runtime';\nexport {\n ComponentContext,\n ComponentTemplate,\n ComponentFile,\n ComponentConfig,\n ConfigContext,\n} from './component-template';\nexport { WorkspaceContext, WorkspaceTemplate, WorkspaceTemplate as Starter, WorkspaceFile } from './workspace-template';\nexport { GeneratorEnv } from './generator-env-type';\nexport { GeneratorAspect } from './generator.aspect';\nexport { TemplateList } from './template-list';\nexport { StarterList } from './starter-list';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAOA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","NewCmd","constructor","generator","_defineProperty2","default","name","description","report","templateName","workspaceName","options","_options$skipGit","_ref","_options$aspect","skipGit","standalone","aspect","env","template","workspacePath","appName","generateWorkspaceTemplate","chalk","white","green","yellow","bold","getBottomSection","exports","cdLine","parts","push","join"],"sources":["new.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GeneratorMain } from './generator.main.runtime';\n\nexport type NewOptions = {\n aspect?: string;\n defaultScope?: string;\n skipGit?: boolean;\n loadFrom?: string;\n empty?: boolean;\n};\n\nexport class NewCmd implements Command {\n name = 'new <template-name> <workspace-name>';\n description = 'create a new workspace from a template';\n arguments = [\n {\n name: 'template-name',\n description:\n \"the name of the workspace template (run 'bit templates', outside of a workspace, to get a list of available templates)\",\n },\n { name: 'workspace-name', description: 'the name for the new workspace and workspace directory' },\n ];\n alias = '';\n loader = true;\n group = 'start';\n options = [\n [\n 'a',\n 'aspect <aspect-id>',\n 'aspect-id of the template. mandatory for non-core aspects. helpful for core aspects in case of a name collision',\n ],\n ['t', 'template <env-id>', 'env-id of the template. alias for --env.'],\n ['', 'env <env-id>', 'env-id of the template'],\n ['d', 'default-scope <scope-name>', `set defaultScope in the new workspace.jsonc`],\n ['', 'standalone', 'DEPRECATED. use --skip-git instead'],\n ['s', 'skip-git', 'skip generation of Git repository'],\n ['e', 'empty', 'empty workspace with no components (relevant for templates that add components by default)'],\n [\n '',\n 'load-from <path-to-template>',\n 'path to the workspace containing the template. helpful during a development of a workspace-template',\n ],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n async report(\n [templateName, workspaceName]: [string, string],\n options: NewOptions & {\n standalone: boolean;\n env?: string;\n template?: string;\n }\n ) {\n options.skipGit = options.skipGit ?? options.standalone;\n options.aspect = options.aspect ?? options.env ?? options.template;\n const { workspacePath, appName } = await this.generator.generateWorkspaceTemplate(\n workspaceName,\n templateName,\n options\n );\n return chalk.white(\n `${chalk.green(`\n\nCongrats! A new workspace has been created successfully at '${workspacePath}'`)}\n\nInside the directory '${workspaceName}' you can run various commands including:\n\n ${chalk.yellow('bit start')}\n Starts the workspace in development mode\n\n ${chalk.yellow('bit install')}\n Installs any missing dependencies\n\n ${chalk.yellow('bit status')}\n Shows the status of the components\n\n ${chalk.yellow('bit compile')}\n Compiles the components\n\n ${chalk.yellow('bit test')}\n Runs the tests on all your components\n\n ${chalk.yellow('bit templates')}\n Shows all available component templates\n\n ${chalk.yellow('bit help')}\n Shows all available commands\n\n\n${chalk.green.bold(\"Let's get started!\")}\n\n ${getBottomSection(workspaceName, appName)}\n `\n );\n }\n}\n\nfunction getBottomSection(workspaceName: string, appName: string | undefined) {\n const cdLine = chalk.yellow(`cd ${workspaceName}`);\n const parts = [cdLine];\n if (appName) {\n parts.push(chalk.yellow(` bit run ${appName}`));\n }\n parts.push(chalk.yellow(` bit start`));\n return parts.join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAWO,MAAMG,MAAM,CAAoB;EAiCrCC,WAAWA,CAASC,SAAwB,EAAE;IAAA,KAA1BA,SAAwB,GAAxBA,SAAwB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,gBAhCrC,sCAAsC;IAAA,IAAAD,gBAAA,GAAAC,OAAA,uBAC/B,wCAAwC;IAAA,IAAAD,gBAAA,GAAAC,OAAA,qBAC1C,CACV;MACEC,IAAI,EAAE,eAAe;MACrBC,WAAW,EACT;IACJ,CAAC,EACD;MAAED,IAAI,EAAE,gBAAgB;MAAEC,WAAW,EAAE;IAAyD,CAAC,CAClG;IAAA,IAAAH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A8DL,aAAc,GAAE,CAAE;AAChF;AACA,wBAAwBV,aAAc;AACtC;AACA,QAAQa,gBAAK,CAACG,MAAM,CAAC,WAAW,CAAE;AAClC;AACA;AACA,QAAQH,gBAAK,CAACG,MAAM,CAAC,aAAa,CAAE;AACpC;AACA;AACA,QAAQH,gBAAK,CAACG,MAAM,CAAC,YAAY,CAAE;AACnC;AACA;AACA,QAAQH,gBAAK,CAACG,MAAM,CAAC,aAAa,CAAE;AACpC;AACA;AACA,QAAQH,gBAAK,CAACG,MAAM,CAAC,UAAU,CAAE;AACjC;AACA;AACA,QAAQH,gBAAK,CAACG,MAAM,CAAC,eAAe,CAAE;AACtC;AACA;AACA,QAAQH,gBAAK,CAACG,MAAM,CAAC,UAAU,CAAE;AACjC;AACA;AACA;AACA,EAAEH,gBAAK,CAACE,KAAK,CAACE,IAAI,CAAC,oBAAoB,CAAE;AACzC;AACA,QAAQC,gBAAgB,CAAClB,aAAa,EAAEW,OAAO,CAAE;AACjD,OACI,CAAC;EACH;AACF;AAACQ,OAAA,CAAA5B,MAAA,GAAAA,MAAA;AAED,SAAS2B,gBAAgBA,CAAClB,aAAqB,EAAEW,OAA2B,EAAE;EAC5E,MAAMS,MAAM,GAAGP,gBAAK,CAACG,MAAM,CAAE,MAAKhB,aAAc,EAAC,CAAC;EAClD,MAAMqB,KAAK,GAAG,CAACD,MAAM,CAAC;EACtB,IAAIT,OAAO,EAAE;IACXU,KAAK,CAACC,IAAI,CAACT,gBAAK,CAACG,MAAM,CAAE,iBAAgBL,OAAQ,EAAC,CAAC,CAAC;EACtD;EACAU,KAAK,CAACC,IAAI,CAACT,gBAAK,CAACG,MAAM,CAAE,iBAAgB,CAAC,CAAC;EAC3C,OAAOK,KAAK,CAACE,IAAI,CAAC,IAAI,CAAC;AACzB"}
1
+ {"version":3,"names":["NewCmd","constructor","generator","name","description","report","templateName","workspaceName","options","skipGit","standalone","aspect","env","template","workspacePath","appName","generateWorkspaceTemplate","chalk","white","green","yellow","bold","getBottomSection","cdLine","parts","push","join"],"sources":["new.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { GeneratorMain } from './generator.main.runtime';\n\nexport type NewOptions = {\n aspect?: string;\n defaultScope?: string;\n skipGit?: boolean;\n loadFrom?: string;\n empty?: boolean;\n};\n\nexport class NewCmd implements Command {\n name = 'new <template-name> <workspace-name>';\n description = 'create a new workspace from a template';\n arguments = [\n {\n name: 'template-name',\n description:\n \"the name of the workspace template (run 'bit templates', outside of a workspace, to get a list of available templates)\",\n },\n { name: 'workspace-name', description: 'the name for the new workspace and workspace directory' },\n ];\n alias = '';\n loader = true;\n group = 'start';\n options = [\n [\n 'a',\n 'aspect <aspect-id>',\n 'aspect-id of the template. mandatory for non-core aspects. helpful for core aspects in case of a name collision',\n ],\n ['t', 'template <env-id>', 'env-id of the template. alias for --env.'],\n ['', 'env <env-id>', 'env-id of the template'],\n ['d', 'default-scope <scope-name>', `set defaultScope in the new workspace.jsonc`],\n ['', 'standalone', 'DEPRECATED. use --skip-git instead'],\n ['s', 'skip-git', 'skip generation of Git repository'],\n ['e', 'empty', 'empty workspace with no components (relevant for templates that add components by default)'],\n [\n '',\n 'load-from <path-to-template>',\n 'path to the workspace containing the template. helpful during a development of a workspace-template',\n ],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n async report(\n [templateName, workspaceName]: [string, string],\n options: NewOptions & {\n standalone: boolean;\n env?: string;\n template?: string;\n }\n ) {\n options.skipGit = options.skipGit ?? options.standalone;\n options.aspect = options.aspect ?? options.env ?? options.template;\n const { workspacePath, appName } = await this.generator.generateWorkspaceTemplate(\n workspaceName,\n templateName,\n options\n );\n return chalk.white(\n `${chalk.green(`\n\nCongrats! A new workspace has been created successfully at '${workspacePath}'`)}\n\nInside the directory '${workspaceName}' you can run various commands including:\n\n ${chalk.yellow('bit start')}\n Starts the workspace in development mode\n\n ${chalk.yellow('bit install')}\n Installs any missing dependencies\n\n ${chalk.yellow('bit status')}\n Shows the status of the components\n\n ${chalk.yellow('bit compile')}\n Compiles the components\n\n ${chalk.yellow('bit test')}\n Runs the tests on all your components\n\n ${chalk.yellow('bit templates')}\n Shows all available component templates\n\n ${chalk.yellow('bit help')}\n Shows all available commands\n\n\n${chalk.green.bold(\"Let's get started!\")}\n\n ${getBottomSection(workspaceName, appName)}\n `\n );\n }\n}\n\nfunction getBottomSection(workspaceName: string, appName: string | undefined) {\n const cdLine = chalk.yellow(`cd ${workspaceName}`);\n const parts = [cdLine];\n if (appName) {\n parts.push(chalk.yellow(` bit run ${appName}`));\n }\n parts.push(chalk.yellow(` bit start`));\n return parts.join('\\n');\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAWO,MAAMA,MAAM,CAAoB;EAiCrCC,WAAW,CAASC,SAAwB,EAAE;IAAA,KAA1BA,SAAwB,GAAxBA,SAAwB;IAAA,8CAhCrC,sCAAsC;IAAA,qDAC/B,wCAAwC;IAAA,mDAC1C,CACV;MACEC,IAAI,EAAE,eAAe;MACrBC,WAAW,EACT;IACJ,CAAC,EACD;MAAED,IAAI,EAAE,gBAAgB;MAAEC,WAAW,EAAE;IAAyD,CAAC,CAClG;IAAA,+CACO,EAAE;IAAA,gDACD,IAAI;IAAA,+CACL,OAAO;IAAA,iDACL,CACR,CACE,GAAG,EACH,oBAAoB,EACpB,iHAAiH,CAClH,EACD,CAAC,GAAG,EAAE,mBAAmB,EAAE,0CAA0C,CAAC,EACtE,CAAC,EAAE,EAAE,cAAc,EAAE,wBAAwB,CAAC,EAC9C,CAAC,GAAG,EAAE,4BAA4B,EAAG,6CAA4C,CAAC,EAClF,CAAC,EAAE,EAAE,YAAY,EAAE,oCAAoC,CAAC,EACxD,CAAC,GAAG,EAAE,UAAU,EAAE,mCAAmC,CAAC,EACtD,CAAC,GAAG,EAAE,OAAO,EAAE,4FAA4F,CAAC,EAC5G,CACE,EAAE,EACF,8BAA8B,E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N,gBAAK,CAACG,MAAM,CAAE,MAAKb,aAAc,EAAC,CAAC;EAClD,MAAMiB,KAAK,GAAG,CAACD,MAAM,CAAC;EACtB,IAAIR,OAAO,EAAE;IACXS,KAAK,CAACC,IAAI,CAACR,gBAAK,CAACG,MAAM,CAAE,iBAAgBL,OAAQ,EAAC,CAAC,CAAC;EACtD;EACAS,KAAK,CAACC,IAAI,CAACR,gBAAK,CAACG,MAAM,CAAE,iBAAgB,CAAC,CAAC;EAC3C,OAAOI,KAAK,CAACE,IAAI,CAAC,IAAI,CAAC;AACzB"}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@0.0.1110/dist/generator.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@0.0.1110/dist/generator.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@0.0.1112/dist/generator.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@0.0.1112/dist/generator.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1 +1 @@
1
- {"version":3,"names":["StarterList","constructor","name","starters","context","compute","map","starter","from","options","exports"],"sources":["starter-list.ts"],"sourcesContent":["import { EnvContext, EnvHandler } from '@teambit/envs';\nimport { WorkspaceTemplate } from './workspace-template';\n\nexport type StarterListOptions = {\n name?: string;\n};\n\nexport class StarterList {\n constructor(readonly name: string, private starters: EnvHandler<WorkspaceTemplate>[], private context: EnvContext) {}\n\n compute(): WorkspaceTemplate[] {\n return this.starters.map((starter) => starter(this.context));\n }\n\n static from(starters: EnvHandler<WorkspaceTemplate>[], options: StarterListOptions = {}) {\n return (context: EnvContext) => {\n const name = options.name || 'starter-list';\n return new StarterList(name, starters, context);\n };\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,WAAW,CAAC;EACvBC,WAAWA,CAAUC,IAAY,EAAUC,QAAyC,EAAUC,OAAmB,EAAE;IAAA,KAA9FF,IAAY,GAAZA,IAAY;IAAA,KAAUC,QAAyC,GAAzCA,QAAyC;IAAA,KAAUC,OAAmB,GAAnBA,OAAmB;EAAG;EAEpHC,OAAOA,CAAA,EAAwB;IAC7B,OAAO,IAAI,CAACF,QAAQ,CAACG,GAAG,CAAEC,OAAO,IAAKA,OAAO,CAAC,IAAI,CAACH,OAAO,CAAC,CAAC;EAC9D;EAEA,OAAOI,IAAIA,CAACL,QAAyC,EAAEM,OAA2B,GAAG,CAAC,CAAC,EAAE;IACvF,OAAQL,OAAmB,IAAK;MAC9B,MAAMF,IAAI,GAAGO,OAAO,CAACP,IAAI,IAAI,cAAc;MAC3C,OAAO,IAAIF,WAAW,CAACE,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAAC;IACjD,CAAC;EACH;AACF;AAACM,OAAA,CAAAV,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["StarterList","constructor","name","starters","context","compute","map","starter","from","options"],"sources":["starter-list.ts"],"sourcesContent":["import { EnvContext, EnvHandler } from '@teambit/envs';\nimport { WorkspaceTemplate } from './workspace-template';\n\nexport type StarterListOptions = {\n name?: string;\n};\n\nexport class StarterList {\n constructor(readonly name: string, private starters: EnvHandler<WorkspaceTemplate>[], private context: EnvContext) {}\n\n compute(): WorkspaceTemplate[] {\n return this.starters.map((starter) => starter(this.context));\n }\n\n static from(starters: EnvHandler<WorkspaceTemplate>[], options: StarterListOptions = {}) {\n return (context: EnvContext) => {\n const name = options.name || 'starter-list';\n return new StarterList(name, starters, context);\n };\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,WAAW,CAAC;EACvBC,WAAW,CAAUC,IAAY,EAAUC,QAAyC,EAAUC,OAAmB,EAAE;IAAA,KAA9FF,IAAY,GAAZA,IAAY;IAAA,KAAUC,QAAyC,GAAzCA,QAAyC;IAAA,KAAUC,OAAmB,GAAnBA,OAAmB;EAAG;EAEpHC,OAAO,GAAwB;IAC7B,OAAO,IAAI,CAACF,QAAQ,CAACG,GAAG,CAAEC,OAAO,IAAKA,OAAO,CAAC,IAAI,CAACH,OAAO,CAAC,CAAC;EAC9D;EAEA,OAAOI,IAAI,CAACL,QAAyC,EAAEM,OAA2B,GAAG,CAAC,CAAC,EAAE;IACvF,OAAQL,OAAmB,IAAK;MAC9B,MAAMF,IAAI,GAAGO,OAAO,CAACP,IAAI,IAAI,cAAc;MAC3C,OAAO,IAAIF,WAAW,CAACE,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAAC;IACjD,CAAC;EACH;AACF;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["_cli","data","require","StarterPlugin","constructor","generator","_defineProperty2","default","MainRuntime","name","register","object","templates","Array","isArray","registerWorkspaceTemplate","exports"],"sources":["starter.plugin.ts"],"sourcesContent":["import { PluginDefinition } from '@teambit/aspect-loader';\nimport { MainRuntime } from '@teambit/cli';\nimport { GeneratorMain } from './generator.main.runtime';\n\nexport class StarterPlugin implements PluginDefinition {\n constructor(private generator: GeneratorMain) {}\n\n pattern = '*.starter.*';\n\n runtimes = [MainRuntime.name];\n\n register(object: any) {\n const templates = Array.isArray(object) ? object : [object];\n return this.generator.registerWorkspaceTemplate(templates);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGO,MAAME,aAAa,CAA6B;EACrDC,WAAWA,CAASC,SAAwB,EAAE;IAAA,KAA1BA,SAAwB,GAAxBA,SAAwB;IAAA,IAAAC,gBAAA,GAAAC,OAAA,mBAElC,aAAa;IAAA,IAAAD,gBAAA,GAAAC,OAAA,oBAEZ,CAACC,kBAAW,CAACC,IAAI,CAAC;EAJkB;EAM/CC,QAAQA,CAACC,MAAW,EAAE;IACpB,MAAMC,SAAS,GAAGC,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GAAGA,MAAM,GAAG,CAACA,MAAM,CAAC;IAC3D,OAAO,IAAI,CAACN,SAAS,CAACU,yBAAyB,CAACH,SAAS,CAAC;EAC5D;AACF;AAACI,OAAA,CAAAb,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["StarterPlugin","constructor","generator","MainRuntime","name","register","object","templates","Array","isArray","registerWorkspaceTemplate"],"sources":["starter.plugin.ts"],"sourcesContent":["import { PluginDefinition } from '@teambit/aspect-loader';\nimport { MainRuntime } from '@teambit/cli';\nimport { GeneratorMain } from './generator.main.runtime';\n\nexport class StarterPlugin implements PluginDefinition {\n constructor(private generator: GeneratorMain) {}\n\n pattern = '*.starter.*';\n\n runtimes = [MainRuntime.name];\n\n register(object: any) {\n const templates = Array.isArray(object) ? object : [object];\n return this.generator.registerWorkspaceTemplate(templates);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGO,MAAMA,aAAa,CAA6B;EACrDC,WAAW,CAASC,SAAwB,EAAE;IAAA,KAA1BA,SAAwB,GAAxBA,SAAwB;IAAA,iDAElC,aAAa;IAAA,kDAEZ,CAACC,kBAAW,CAACC,IAAI,CAAC;EAJkB;EAM/CC,QAAQ,CAACC,MAAW,EAAE;IACpB,MAAMC,SAAS,GAAGC,KAAK,CAACC,OAAO,CAACH,MAAM,CAAC,GAAGA,MAAM,GAAG,CAACA,MAAM,CAAC;IAC3D,OAAO,IAAI,CAACJ,SAAS,CAACQ,yBAAyB,CAACH,SAAS,CAAC;EAC5D;AACF;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["TemplateList","constructor","name","templates","context","compute","map","template","from","options","exports"],"sources":["template-list.ts"],"sourcesContent":["import { EnvContext, EnvHandler } from '@teambit/envs';\nimport { ComponentTemplate } from './component-template';\n\nexport type TemplateListOptions = {\n name?: string;\n};\n\nexport class TemplateList {\n constructor(readonly name: string, private templates: EnvHandler<ComponentTemplate>[], private context: EnvContext) {}\n\n compute(): ComponentTemplate[] {\n return this.templates.map((template) => template(this.context));\n }\n\n static from(templates: EnvHandler<ComponentTemplate>[], options: TemplateListOptions = {}) {\n return (context: EnvContext) => {\n const name = options.name || 'template-list';\n return new TemplateList(name, templates, context);\n };\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,YAAY,CAAC;EACxBC,WAAWA,CAAUC,IAAY,EAAUC,SAA0C,EAAUC,OAAmB,EAAE;IAAA,KAA/FF,IAAY,GAAZA,IAAY;IAAA,KAAUC,SAA0C,GAA1CA,SAA0C;IAAA,KAAUC,OAAmB,GAAnBA,OAAmB;EAAG;EAErHC,OAAOA,CAAA,EAAwB;IAC7B,OAAO,IAAI,CAACF,SAAS,CAACG,GAAG,CAAEC,QAAQ,IAAKA,QAAQ,CAAC,IAAI,CAACH,OAAO,CAAC,CAAC;EACjE;EAEA,OAAOI,IAAIA,CAACL,SAA0C,EAAEM,OAA4B,GAAG,CAAC,CAAC,EAAE;IACzF,OAAQL,OAAmB,IAAK;MAC9B,MAAMF,IAAI,GAAGO,OAAO,CAACP,IAAI,IAAI,eAAe;MAC5C,OAAO,IAAIF,YAAY,CAACE,IAAI,EAAEC,SAAS,EAAEC,OAAO,CAAC;IACnD,CAAC;EACH;AACF;AAACM,OAAA,CAAAV,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"names":["TemplateList","constructor","name","templates","context","compute","map","template","from","options"],"sources":["template-list.ts"],"sourcesContent":["import { EnvContext, EnvHandler } from '@teambit/envs';\nimport { ComponentTemplate } from './component-template';\n\nexport type TemplateListOptions = {\n name?: string;\n};\n\nexport class TemplateList {\n constructor(readonly name: string, private templates: EnvHandler<ComponentTemplate>[], private context: EnvContext) {}\n\n compute(): ComponentTemplate[] {\n return this.templates.map((template) => template(this.context));\n }\n\n static from(templates: EnvHandler<ComponentTemplate>[], options: TemplateListOptions = {}) {\n return (context: EnvContext) => {\n const name = options.name || 'template-list';\n return new TemplateList(name, templates, context);\n };\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,YAAY,CAAC;EACxBC,WAAW,CAAUC,IAAY,EAAUC,SAA0C,EAAUC,OAAmB,EAAE;IAAA,KAA/FF,IAAY,GAAZA,IAAY;IAAA,KAAUC,SAA0C,GAA1CA,SAA0C;IAAA,KAAUC,OAAmB,GAAnBA,OAAmB;EAAG;EAErHC,OAAO,GAAwB;IAC7B,OAAO,IAAI,CAACF,SAAS,CAACG,GAAG,CAAEC,QAAQ,IAAKA,QAAQ,CAAC,IAAI,CAACH,OAAO,CAAC,CAAC;EACjE;EAEA,OAAOI,IAAI,CAACL,SAA0C,EAAEM,OAA4B,GAAG,CAAC,CAAC,EAAE;IACzF,OAAQL,OAAmB,IAAK;MAC9B,MAAMF,IAAI,GAAGO,OAAO,CAACP,IAAI,IAAI,eAAe;MAC5C,OAAO,IAAIF,YAAY,CAACE,IAAI,EAAEC,SAAS,EAAEC,OAAO,CAAC;IACnD,CAAC;EACH;AACF;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["aspectFile","namePascalCase","componentId"],"sources":["aspect-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function aspectFile({ namePascalCase, componentId }: ComponentContext) {\n return `import { Aspect } from '@teambit/harmony';\n\nexport const ${namePascalCase}Aspect = Aspect.create({\n id: '${componentId}',\n});\n `;\n}\n"],"mappings":";;;;;;AAEO,SAASA,UAAUA,CAAC;EAAEC,cAAc;EAAEC;AAA8B,CAAC,EAAE;EAC5E,OAAQ;AACV;AACA,eAAeD,cAAe;AAC9B,SAASC,WAAY;AACrB;AACA,GAAG;AACH"}
1
+ {"version":3,"names":["aspectFile","namePascalCase","componentId"],"sources":["aspect-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function aspectFile({ namePascalCase, componentId }: ComponentContext) {\n return `import { Aspect } from '@teambit/harmony';\n\nexport const ${namePascalCase}Aspect = Aspect.create({\n id: '${componentId}',\n});\n `;\n}\n"],"mappings":";;;;;;AAEO,SAASA,UAAU,CAAC;EAAEC,cAAc;EAAEC;AAA8B,CAAC,EAAE;EAC5E,OAAQ;AACV;AACA,eAAeD,cAAe;AAC9B,SAASC,WAAY;AACrB;AACA,GAAG;AACH"}
@@ -1 +1 @@
1
- {"version":3,"names":["docsFile"],"sources":["docs-file.ts"],"sourcesContent":["export function docsFile() {\n return `### Configuring your Generator\n\nEdit your \\`workspace.jsonc\\` file and set this component to use the \\`teambit.harmony/aspect\\` env under the variants object.\n\n\\`\\`\\`json\n\"teambit.workspace/variants\": {\n \"{my-components}\": {\n \"teambit.harmony/aspect\": {}\n },\n}\n\\`\\`\\`\n\nTo check if your component is using the correct env you can run \\`bit envs\\` or \\`bit show my-components\\`\n\nEdit your \\`workspace.jsonc\\` file and add the component id, (scope name / component name) to teambit generator. This should go at root level. The component id can be found in the \\`aspect.ts\\` file:\n\n\\`\\`\\`json\n{\n \"teambit.generator/generator\": {\n \"aspects\": [\"my-scope-name/my-components\"]\n },\n}\n\\`\\`\\`\n\nThis registers the component aspect so that your templates will appear in the CLI when you run \\`bit templates\\`.\n\n### Modifying your Generator\n\nThe \\`my-components.main.runtime.ts\\` file contains an array of templates that you can modify and add to to create different templates and numerous files to be generated.\n\n### Using your Generator\n\nUse your generator to create the component files\n\n\\`\\`\\`bash\nbit create my-components component1\n\\`\\`\\`\n\n### Exporting your Generator\n\nTag and export your generator component so you can use it in any other workspace. Make sure the scope name is set correctly in the \\`aspect.ts\\` file before tagging and exporting. Once you have tagged and exported the component you can add it to the \\`workspace.jsonc\\` file in the workspace where you want to use this generator.\n\n\\`\\`\\`json\n{\n \"teambit.generator/generator\": {\n \"aspects\": [\"my-scope-name/my-components\"]\n },\n}\n\\`\\`\\`\n\nRun \\`bit templates\\` to see your generator and then use it to generate you components.\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,QAAQA,CAAA,EAAG;EACzB,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
1
+ {"version":3,"names":["docsFile"],"sources":["docs-file.ts"],"sourcesContent":["export function docsFile() {\n return `### Configuring your Generator\n\nEdit your \\`workspace.jsonc\\` file and set this component to use the \\`teambit.harmony/aspect\\` env under the variants object.\n\n\\`\\`\\`json\n\"teambit.workspace/variants\": {\n \"{my-components}\": {\n \"teambit.harmony/aspect\": {}\n },\n}\n\\`\\`\\`\n\nTo check if your component is using the correct env you can run \\`bit envs\\` or \\`bit show my-components\\`\n\nEdit your \\`workspace.jsonc\\` file and add the component id, (scope name / component name) to teambit generator. This should go at root level. The component id can be found in the \\`aspect.ts\\` file:\n\n\\`\\`\\`json\n{\n \"teambit.generator/generator\": {\n \"aspects\": [\"my-scope-name/my-components\"]\n },\n}\n\\`\\`\\`\n\nThis registers the component aspect so that your templates will appear in the CLI when you run \\`bit templates\\`.\n\n### Modifying your Generator\n\nThe \\`my-components.main.runtime.ts\\` file contains an array of templates that you can modify and add to to create different templates and numerous files to be generated.\n\n### Using your Generator\n\nUse your generator to create the component files\n\n\\`\\`\\`bash\nbit create my-components component1\n\\`\\`\\`\n\n### Exporting your Generator\n\nTag and export your generator component so you can use it in any other workspace. Make sure the scope name is set correctly in the \\`aspect.ts\\` file before tagging and exporting. Once you have tagged and exported the component you can add it to the \\`workspace.jsonc\\` file in the workspace where you want to use this generator.\n\n\\`\\`\\`json\n{\n \"teambit.generator/generator\": {\n \"aspects\": [\"my-scope-name/my-components\"]\n },\n}\n\\`\\`\\`\n\nRun \\`bit templates\\` to see your generator and then use it to generate you components.\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,QAAQ,GAAG;EACzB,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `import { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport type { ${namePascalCase}Main } from './${name}.main.runtime';\nexport default ${namePascalCase}Aspect;\nexport { ${namePascalCase}Aspect };\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAASA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAQ,YAAWD,cAAe,oBAAmBC,IAAK;AAC5D;AACA,gBAAgBD,cAAe,kBAAiBC,IAAK;AACrD,iBAAiBD,cAAe;AAChC,WAAWA,cAAe;AAC1B,CAAC;AACD"}
1
+ {"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `import { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport type { ${namePascalCase}Main } from './${name}.main.runtime';\nexport default ${namePascalCase}Aspect;\nexport { ${namePascalCase}Aspect };\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAAS,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAQ,YAAWD,cAAe,oBAAmBC,IAAK;AAC5D;AACA,gBAAgBD,cAAe,kBAAiBC,IAAK;AACrD,iBAAiBD,cAAe;AAChC,WAAWA,cAAe;AAC1B,CAAC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"names":["mainRuntime","name","namePascalCase"],"sources":["main-runtime.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function mainRuntime({ name, namePascalCase }: ComponentContext) {\n return `import { MainRuntime } from '@teambit/cli';\nimport { GeneratorMain, GeneratorAspect, ComponentContext } from '@teambit/generator';\nimport { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport class ${namePascalCase}Main {\n static slots = [];\n static dependencies = [GeneratorAspect];\n static runtime = MainRuntime;\n static async provider([generator]: [GeneratorMain]) {\n /**\n * Array of templates. Add as many templates as you want\n * Separate the templates to multiple files if you prefer\n * Modify, add or remove files as needed\n * See the docs file of this component for more info\n */\n\n if (generator) generator.registerComponentTemplate([\n {\n name: 'component1',\n description: 'description for component1',\n generateFiles: (context: ComponentContext) => {\n return [\n\n // index file\n {\n relativePath: 'index.ts',\n isMain: true,\n content: \\`export { \\${context.namePascalCase} } from './\\${context.name}';\nexport type { \\${context.namePascalCase}Props } from './\\${context.name}';\n\\`,\n },\n\n // component file\n {\n relativePath: \\`\\${context.name}.tsx\\`,\n content: \\`import React from 'react';\n\nexport type \\${context.namePascalCase}Props = {\n /**\n * a text to be rendered in the component.\n */\n text: string\n};\n\nexport function \\${context.namePascalCase}({ text }: \\${context.namePascalCase}Props) {\n return (\n <div>\n {text}\n </div>\n );\n}\\`,\n },\n\n // docs file\n {\n relativePath: \\`\\${context.name}.docs.mdx\\`,\n content: \\`---\ndescription: 'A React Component for rendering text.'\nlabels: ['text', 'ui']\n---\n\nimport { \\${context.namePascalCase} } from './\\${context.name}';\n\\`\n },\n\n // composition file\n {\n relativePath: \\`\\${context.name}.composition.tsx\\`,\n content: \\`import React from 'react';\nimport { \\${context.namePascalCase} } from './\\${context.name}';\n\nexport const Basic\\${context.namePascalCase} = () => (\n <\\${context.namePascalCase} text=\"hello from \\${context.namePascalCase} \" />\n);\n\\`\n },\n\n // test file\n {\n relativePath: \\`\\${context.name}.spec.tsx\\`,\n content: \\`import React from 'react';\nimport { render } from '@testing-library/react';\nimport { Basic\\${context.namePascalCase} } from './\\${context.name}.composition';\n\nit('should render with the correct text', () => {\n const { getByText } = render(<Basic\\${context.namePascalCase} />);\n const rendered = getByText('hello from \\${context.namePascalCase}');\n expect(rendered).toBeTruthy();\n});\n\\`\n },\n // add more files here such as css/sass\n ];\n },\n },\n\n // component 2\n {\n name: 'component2',\n description: 'description for component2',\n generateFiles: (context: ComponentContext) => {\n return [\n\n // index file\n {\n relativePath: 'index.ts',\n isMain: true,\n content: \\`export {} from '';\n\\`,\n },\n ]\n }\n }\n ]);\n\n return new ${namePascalCase}Main();\n }\n}\n\n${namePascalCase}Aspect.addRuntime(${namePascalCase}Main);\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,WAAWA,CAAC;EAAEC,IAAI;EAAEC;AAAiC,CAAC,EAAE;EACtE,OAAQ;AACV;AACA,WAAWA,cAAe,oBAAmBD,IAAK;AAClD;AACA,eAAeC,cAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiBA,cAAe;AAChC;AACA;AACA;AACA,EAAEA,cAAe,qBAAoBA,cAAe;AACpD,CAAC;AACD"}
1
+ {"version":3,"names":["mainRuntime","name","namePascalCase"],"sources":["main-runtime.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function mainRuntime({ name, namePascalCase }: ComponentContext) {\n return `import { MainRuntime } from '@teambit/cli';\nimport { GeneratorMain, GeneratorAspect, ComponentContext } from '@teambit/generator';\nimport { ${namePascalCase}Aspect } from './${name}.aspect';\n\nexport class ${namePascalCase}Main {\n static slots = [];\n static dependencies = [GeneratorAspect];\n static runtime = MainRuntime;\n static async provider([generator]: [GeneratorMain]) {\n /**\n * Array of templates. Add as many templates as you want\n * Separate the templates to multiple files if you prefer\n * Modify, add or remove files as needed\n * See the docs file of this component for more info\n */\n\n if (generator) generator.registerComponentTemplate([\n {\n name: 'component1',\n description: 'description for component1',\n generateFiles: (context: ComponentContext) => {\n return [\n\n // index file\n {\n relativePath: 'index.ts',\n isMain: true,\n content: \\`export { \\${context.namePascalCase} } from './\\${context.name}';\nexport type { \\${context.namePascalCase}Props } from './\\${context.name}';\n\\`,\n },\n\n // component file\n {\n relativePath: \\`\\${context.name}.tsx\\`,\n content: \\`import React from 'react';\n\nexport type \\${context.namePascalCase}Props = {\n /**\n * a text to be rendered in the component.\n */\n text: string\n};\n\nexport function \\${context.namePascalCase}({ text }: \\${context.namePascalCase}Props) {\n return (\n <div>\n {text}\n </div>\n );\n}\\`,\n },\n\n // docs file\n {\n relativePath: \\`\\${context.name}.docs.mdx\\`,\n content: \\`---\ndescription: 'A React Component for rendering text.'\nlabels: ['text', 'ui']\n---\n\nimport { \\${context.namePascalCase} } from './\\${context.name}';\n\\`\n },\n\n // composition file\n {\n relativePath: \\`\\${context.name}.composition.tsx\\`,\n content: \\`import React from 'react';\nimport { \\${context.namePascalCase} } from './\\${context.name}';\n\nexport const Basic\\${context.namePascalCase} = () => (\n <\\${context.namePascalCase} text=\"hello from \\${context.namePascalCase} \" />\n);\n\\`\n },\n\n // test file\n {\n relativePath: \\`\\${context.name}.spec.tsx\\`,\n content: \\`import React from 'react';\nimport { render } from '@testing-library/react';\nimport { Basic\\${context.namePascalCase} } from './\\${context.name}.composition';\n\nit('should render with the correct text', () => {\n const { getByText } = render(<Basic\\${context.namePascalCase} />);\n const rendered = getByText('hello from \\${context.namePascalCase}');\n expect(rendered).toBeTruthy();\n});\n\\`\n },\n // add more files here such as css/sass\n ];\n },\n },\n\n // component 2\n {\n name: 'component2',\n description: 'description for component2',\n generateFiles: (context: ComponentContext) => {\n return [\n\n // index file\n {\n relativePath: 'index.ts',\n isMain: true,\n content: \\`export {} from '';\n\\`,\n },\n ]\n }\n }\n ]);\n\n return new ${namePascalCase}Main();\n }\n}\n\n${namePascalCase}Aspect.addRuntime(${namePascalCase}Main);\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,WAAW,CAAC;EAAEC,IAAI;EAAEC;AAAiC,CAAC,EAAE;EACtE,OAAQ;AACV;AACA,WAAWA,cAAe,oBAAmBD,IAAK;AAClD;AACA,eAAeC,cAAe;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiBA,cAAe;AAChC;AACA;AACA;AACA,EAAEA,cAAe,qBAAoBA,cAAe;AACpD,CAAC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"names":["_index","data","require","_aspectFile","_docsFile","_mainRuntime","componentGeneratorTemplate","name","description","generateFiles","context","relativePath","content","indexFile","isMain","aspectFile","docsFile","mainRuntime","config","env","exports"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { aspectFile } from './files/aspect-file';\nimport { docsFile } from './files/docs-file';\nimport { mainRuntime } from './files/main-runtime';\n\nexport const componentGeneratorTemplate: ComponentTemplate = {\n name: 'component-generator',\n description:\n 'create your own component generator \\nDocs: https://bit.dev/docs/dev-services/generator/generate-component',\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.aspect.ts`,\n content: aspectFile(context),\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docsFile(),\n },\n {\n relativePath: `${context.name}.main.runtime.ts`,\n content: mainRuntime(context),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,YAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,WAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,UAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,SAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,aAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,YAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMK,0BAA6C,GAAG;EAC3DC,IAAI,EAAE,qBAAqB;EAC3BC,WAAW,EACT,4GAA4G;EAC9GC,aAAa,EAAGC,OAAyB,IAAK;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UAAU;MACxBC,OAAO,EAAE,IAAAC,kBAAS,EAACH,OAAO,CAAC;MAC3BI,MAAM,EAAE;IACV,CAAC,EACD;MACEH,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,YAAW;MACzCK,OAAO,EAAE,IAAAG,wBAAU,EAACL,OAAO;IAC7B,CAAC,EACD;MACEC,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,WAAU;MACxCK,OAAO,EAAE,IAAAI,oBAAQ,EAAC;IACpB,CAAC,EACD;MACEL,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,kBAAiB;MAC/CK,OAAO,EAAE,IAAAK,0BAAW,EAACP,OAAO;IAC9B,CAAC,CACF;EACH,CAAC;EACDQ,MAAM,EAAE;IACN,wBAAwB,EAAE,CAAC,CAAC;IAC5B,mBAAmB,EAAE;MACnBC,GAAG,EAAE;IACP;EACF;AACF,CAAC;AAACC,OAAA,CAAAd,0BAAA,GAAAA,0BAAA"}
1
+ {"version":3,"names":["componentGeneratorTemplate","name","description","generateFiles","context","relativePath","content","indexFile","isMain","aspectFile","docsFile","mainRuntime","config","env"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { aspectFile } from './files/aspect-file';\nimport { docsFile } from './files/docs-file';\nimport { mainRuntime } from './files/main-runtime';\n\nexport const componentGeneratorTemplate: ComponentTemplate = {\n name: 'component-generator',\n description:\n 'create your own component generator \\nDocs: https://bit.dev/docs/dev-services/generator/generate-component',\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.aspect.ts`,\n content: aspectFile(context),\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docsFile(),\n },\n {\n relativePath: `${context.name}.main.runtime.ts`,\n content: mainRuntime(context),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,0BAA6C,GAAG;EAC3DC,IAAI,EAAE,qBAAqB;EAC3BC,WAAW,EACT,4GAA4G;EAC9GC,aAAa,EAAGC,OAAyB,IAAK;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UAAU;MACxBC,OAAO,EAAE,IAAAC,kBAAS,EAACH,OAAO,CAAC;MAC3BI,MAAM,EAAE;IACV,CAAC,EACD;MACEH,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,YAAW;MACzCK,OAAO,EAAE,IAAAG,wBAAU,EAACL,OAAO;IAC7B,CAAC,EACD;MACEC,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,WAAU;MACxCK,OAAO,EAAE,IAAAI,oBAAQ;IACnB,CAAC,EACD;MACEL,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,kBAAiB;MAC/CK,OAAO,EAAE,IAAAK,0BAAW,EAACP,OAAO;IAC9B,CAAC,CACF;EACH,CAAC;EACDQ,MAAM,EAAE;IACN,wBAAwB,EAAE,CAAC,CAAC;IAC5B,mBAAmB,EAAE;MACnBC,GAAG,EAAE;IACP;EACF;AACF,CAAC;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["docsFile"],"sources":["docs-file.ts"],"sourcesContent":["export function docsFile() {\n return `---\ndescription: Generator for generating a workspace\nlabels: ['generator', 'templates', 'workspace']\n---\n\n## Registering your Workspace\n\nRegister your workspace template under the aspect environment in the variants section of the workspace.jsonc file.\n\n\\`\\`\\`json\n\"teambit.workspace/variants\": {\n \"{workspace-name}\": {\n \"teambit.harmony/aspect\": {}\n }\n }\n\\`\\`\\`\n\n## Customizing your Workspace\n\nSee the docs for more info on [Customizing your Generator](https://harmony-docs.bit.dev/extending-bit/creating-a-custom-workspace-generator)\n\n## Using the Workspace Generator\n\nHow to use this generator locally, essentially for development purposes:\n\n\\`\\`\\`js\nbit new <template-name> <workspace-name> --load-from /Users/me/path/to/this/dir --aspect <workspace-template-id>\n\\`\\`\\`\n\nHow to use this generator after exporting to a remote scope:\n\n\\`\\`\\`js\nbit new <template-name> <workspace-name> --aspect <workspace-template-id>\n\\`\\`\\`\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,QAAQA,CAAA,EAAG;EACzB,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
1
+ {"version":3,"names":["docsFile"],"sources":["docs-file.ts"],"sourcesContent":["export function docsFile() {\n return `---\ndescription: Generator for generating a workspace\nlabels: ['generator', 'templates', 'workspace']\n---\n\n## Registering your Workspace\n\nRegister your workspace template under the aspect environment in the variants section of the workspace.jsonc file.\n\n\\`\\`\\`json\n\"teambit.workspace/variants\": {\n \"{workspace-name}\": {\n \"teambit.harmony/aspect\": {}\n }\n }\n\\`\\`\\`\n\n## Customizing your Workspace\n\nSee the docs for more info on [Customizing your Generator](https://harmony-docs.bit.dev/extending-bit/creating-a-custom-workspace-generator)\n\n## Using the Workspace Generator\n\nHow to use this generator locally, essentially for development purposes:\n\n\\`\\`\\`js\nbit new <template-name> <workspace-name> --load-from /Users/me/path/to/this/dir --aspect <workspace-template-id>\n\\`\\`\\`\n\nHow to use this generator after exporting to a remote scope:\n\n\\`\\`\\`js\nbit new <template-name> <workspace-name> --aspect <workspace-template-id>\n\\`\\`\\`\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,QAAQ,GAAG;EACzB,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"names":["gitIgnoreTemplate"],"sources":["git-ignore-tpl.ts"],"sourcesContent":["export function gitIgnoreTemplate() {\n return `export function gitIgnore() {\n return \\`# Bit\n.bit\npublic\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n*.lcov\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# TypeScript v1 declaration files\ntypings/\n\n# TypeScript cache\n*.tsbuildinfo\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Microbundle cache\n.rpt2_cache/\n.rts2_cache_cjs/\n.rts2_cache_es/\n.rts2_cache_umd/\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n.env.test\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n\n# Next.js build output\n.next\n\n# Nuxt.js build / generate output\n.nuxt\ndist\n\n# Gatsby files\n.cache/\n\n# vuepress build output\n.vuepress/dist\n\n# Serverless directories\n.serverless/\n\n# FuseBox cache\n.fusebox/\n\n# DynamoDB Local files\n.dynamodb/\n\n# TernJS port file\n.tern-port\n\n.history\n\\`;\n}\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,iBAAiBA,CAAA,EAAG;EAClC,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
1
+ {"version":3,"names":["gitIgnoreTemplate"],"sources":["git-ignore-tpl.ts"],"sourcesContent":["export function gitIgnoreTemplate() {\n return `export function gitIgnore() {\n return \\`# Bit\n.bit\npublic\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\nlerna-debug.log*\n\n# Diagnostic reports (https://nodejs.org/api/report.html)\nreport.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json\n\n# Runtime data\npids\n*.pid\n*.seed\n*.pid.lock\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\n*.lcov\n\n# nyc test coverage\n.nyc_output\n\n# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# Bower dependency directory (https://bower.io/)\nbower_components\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (https://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules/\njspm_packages/\n\n# TypeScript v1 declaration files\ntypings/\n\n# TypeScript cache\n*.tsbuildinfo\n\n# Optional npm cache directory\n.npm\n\n# Optional eslint cache\n.eslintcache\n\n# Microbundle cache\n.rpt2_cache/\n.rts2_cache_cjs/\n.rts2_cache_es/\n.rts2_cache_umd/\n\n# Optional REPL history\n.node_repl_history\n\n# Output of 'npm pack'\n*.tgz\n\n# Yarn Integrity file\n.yarn-integrity\n\n# dotenv environment variables file\n.env\n.env.test\n\n# parcel-bundler cache (https://parceljs.org/)\n.cache\n\n# Next.js build output\n.next\n\n# Nuxt.js build / generate output\n.nuxt\ndist\n\n# Gatsby files\n.cache/\n\n# vuepress build output\n.vuepress/dist\n\n# Serverless directories\n.serverless/\n\n# FuseBox cache\n.fusebox/\n\n# DynamoDB Local files\n.dynamodb/\n\n# TernJS port file\n.tern-port\n\n.history\n\\`;\n}\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,iBAAiB,GAAG;EAClC,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `export { starter as ${namePascalCase}Starter } from './${name}.starter';\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAASA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAQ,uBAAsBD,cAAe,qBAAoBC,IAAK;AACxE,CAAC;AACD"}
1
+ {"version":3,"names":["indexFile","namePascalCase","name"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `export { starter as ${namePascalCase}Starter } from './${name}.starter';\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAAS,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAQ,uBAAsBD,cAAe,qBAAoBC,IAAK;AACxE,CAAC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"names":["readmeTemplate"],"sources":["readme-tpl.ts"],"sourcesContent":["export function readmeTemplate() {\n return `export function readme() {\n return \\`## Workspace Generator\n\nEasily generate a new workspace with a single command.\n\n## Registering your Workspace\n\nRegister your workspace template under the aspect environment in the variants section of the workspace.jsonc file.\n\n\\\\\\`\\\\\\`\\\\\\`json\n\"teambit.workspace/variants\": {\n \"{workspace-name}\": {\n \"teambit.harmony/aspect\": {}\n }\n }\n\\\\\\`\\\\\\`\\\\\\`\n\n## Customizing your Workspace\n\nSee the docs for more info on [Customizing your Generator](https://harmony-docs.bit.dev/extending-bit/creating-a-custom-workspace-generator)\n\n## Using the Workspace Generator\n\nHow to use this generator locally, essentially for development purposes:\n\n\\\\\\`\\\\\\`\\\\\\`js\nbit new <template-name> <workspace-name> --load-from /Users/me/path/to/this/dir --aspect <workspace-template-id>\n\\\\\\`\\\\\\`\\\\\\`\n\nHow to use this generator after exporting to a remote scope:\n\n\\\\\\`\\\\\\`\\\\\\`js\nbit new <template-name> <workspace-name> --aspect <workspace-template-id>\n\\\\\\`\\\\\\`\\\\\\`\n\\`;\n}\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,cAAcA,CAAA,EAAG;EAC/B,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
1
+ {"version":3,"names":["readmeTemplate"],"sources":["readme-tpl.ts"],"sourcesContent":["export function readmeTemplate() {\n return `export function readme() {\n return \\`## Workspace Generator\n\nEasily generate a new workspace with a single command.\n\n## Registering your Workspace\n\nRegister your workspace template under the aspect environment in the variants section of the workspace.jsonc file.\n\n\\\\\\`\\\\\\`\\\\\\`json\n\"teambit.workspace/variants\": {\n \"{workspace-name}\": {\n \"teambit.harmony/aspect\": {}\n }\n }\n\\\\\\`\\\\\\`\\\\\\`\n\n## Customizing your Workspace\n\nSee the docs for more info on [Customizing your Generator](https://harmony-docs.bit.dev/extending-bit/creating-a-custom-workspace-generator)\n\n## Using the Workspace Generator\n\nHow to use this generator locally, essentially for development purposes:\n\n\\\\\\`\\\\\\`\\\\\\`js\nbit new <template-name> <workspace-name> --load-from /Users/me/path/to/this/dir --aspect <workspace-template-id>\n\\\\\\`\\\\\\`\\\\\\`\n\nHow to use this generator after exporting to a remote scope:\n\n\\\\\\`\\\\\\`\\\\\\`js\nbit new <template-name> <workspace-name> --aspect <workspace-template-id>\n\\\\\\`\\\\\\`\\\\\\`\n\\`;\n}\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,cAAc,GAAG;EAC/B,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"names":["starterFile"],"sources":["starter.ts"],"sourcesContent":["export function starterFile() {\n return `import { WorkspaceContext, Starter } from '@teambit/generator';\nimport { workspaceConfig } from './template/files/workspace-config';\nimport { readme } from './template/files/readme-file';\nimport { gitIgnore } from './template/files/git-ignore';\n\nexport const starter: Starter = {\n name: 'template-example',\n description: 'demonstration of a workspace template',\n generateFiles: async (context: WorkspaceContext) => [\n {\n relativePath: 'workspace.jsonc',\n content: await workspaceConfig(context),\n },\n {\n relativePath: '.gitignore',\n content: gitIgnore(),\n },\n {\n relativePath: 'README.md',\n content: readme(),\n },\n ],\n importComponents: () => [\n { id: 'teambit.react/templates/ui/text', path: 'ui/text' },\n ],\n};\n\nexport default starter;\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,WAAWA,CAAA,EAAG;EAC5B,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
1
+ {"version":3,"names":["starterFile"],"sources":["starter.ts"],"sourcesContent":["export function starterFile() {\n return `import { WorkspaceContext, Starter } from '@teambit/generator';\nimport { workspaceConfig } from './template/files/workspace-config';\nimport { readme } from './template/files/readme-file';\nimport { gitIgnore } from './template/files/git-ignore';\n\nexport const starter: Starter = {\n name: 'template-example',\n description: 'demonstration of a workspace template',\n generateFiles: async (context: WorkspaceContext) => [\n {\n relativePath: 'workspace.jsonc',\n content: await workspaceConfig(context),\n },\n {\n relativePath: '.gitignore',\n content: gitIgnore(),\n },\n {\n relativePath: 'README.md',\n content: readme(),\n },\n ],\n importComponents: () => [\n { id: 'teambit.react/templates/ui/text', path: 'ui/text' },\n ],\n};\n\nexport default starter;\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,WAAW,GAAG;EAC5B,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"names":["workspaceConfigTemplate"],"sources":["workspace-config-tpl.ts"],"sourcesContent":["export function workspaceConfigTemplate() {\n return `import { WorkspaceContext } from '@teambit/generator';\nimport { getWorkspaceConfigTemplateParsed, stringifyWorkspaceConfig } from '@teambit/config';\n\nexport async function workspaceConfig({ name, defaultScope }: WorkspaceContext) {\n const configParsed = await getWorkspaceConfigTemplateParsed();\n configParsed['teambit.workspace/workspace'].name = name;\n configParsed['teambit.workspace/workspace'].defaultScope = defaultScope || 'company.scope';\n configParsed['teambit.workspace/variants'] = {\n '*': {},\n };\n\n return stringifyWorkspaceConfig(configParsed);\n}\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,uBAAuBA,CAAA,EAAG;EACxC,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
1
+ {"version":3,"names":["workspaceConfigTemplate"],"sources":["workspace-config-tpl.ts"],"sourcesContent":["export function workspaceConfigTemplate() {\n return `import { WorkspaceContext } from '@teambit/generator';\nimport { getWorkspaceConfigTemplateParsed, stringifyWorkspaceConfig } from '@teambit/config';\n\nexport async function workspaceConfig({ name, defaultScope }: WorkspaceContext) {\n const configParsed = await getWorkspaceConfigTemplateParsed();\n configParsed['teambit.workspace/workspace'].name = name;\n configParsed['teambit.workspace/workspace'].defaultScope = defaultScope || 'company.scope';\n configParsed['teambit.workspace/variants'] = {\n '*': {},\n };\n\n return stringifyWorkspaceConfig(configParsed);\n}\n`;\n}\n"],"mappings":";;;;;;AAAO,SAASA,uBAAuB,GAAG;EACxC,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
@@ -1 +1 @@
1
- {"version":3,"names":["_index","data","require","_starter","_docsFile","_gitIgnoreTpl","_readmeTpl","_workspaceConfigTpl","starterTemplate","name","description","generateFiles","context","relativePath","content","indexFile","isMain","starterFile","docsFile","gitIgnoreTemplate","readmeTemplate","workspaceConfigTemplate","config","env","exports"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { starterFile } from './files/starter';\nimport { docsFile } from './files/docs-file';\nimport { gitIgnoreTemplate } from './files/git-ignore-tpl';\nimport { readmeTemplate } from './files/readme-tpl';\nimport { workspaceConfigTemplate } from './files/workspace-config-tpl';\n\nexport const starterTemplate: ComponentTemplate = {\n name: 'starter',\n description: 'create your own starter - \\nDocs: https://bit.dev/docs/dev-services/generator/generate-workspace',\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.starter.ts`,\n content: starterFile(),\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docsFile(),\n },\n {\n relativePath: 'template/files/git-ignore.ts',\n content: gitIgnoreTemplate(),\n },\n {\n relativePath: 'template/files/readme-file.ts',\n content: readmeTemplate(),\n },\n {\n relativePath: 'template/files/workspace-config.ts',\n content: workspaceConfigTemplate(),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":";;;;;;AACA,SAAAA,OAAA;EAAA,M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CC,OAAO,EAAE,IAAAK,iCAAiB,EAAC;IAC7B,CAAC,EACD;MACEN,YAAY,EAAE,+BAA+B;MAC7CC,OAAO,EAAE,IAAAM,2BAAc,EAAC;IAC1B,CAAC,EACD;MACEP,YAAY,EAAE,oCAAoC;MAClDC,OAAO,EAAE,IAAAO,6CAAuB,EAAC;IACnC,CAAC,CACF;EACH,CAAC;EACDC,MAAM,EAAE;IACN,wBAAwB,EAAE,CAAC,CAAC;IAC5B,mBAAmB,EAAE;MACnBC,GAAG,EAAE;IACP;EACF;AACF,CAAC;AAACC,OAAA,CAAAhB,eAAA,GAAAA,eAAA"}
1
+ {"version":3,"names":["starterTemplate","name","description","generateFiles","context","relativePath","content","indexFile","isMain","starterFile","docsFile","gitIgnoreTemplate","readmeTemplate","workspaceConfigTemplate","config","env"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '@teambit/generator';\nimport { indexFile } from './files/index';\nimport { starterFile } from './files/starter';\nimport { docsFile } from './files/docs-file';\nimport { gitIgnoreTemplate } from './files/git-ignore-tpl';\nimport { readmeTemplate } from './files/readme-tpl';\nimport { workspaceConfigTemplate } from './files/workspace-config-tpl';\n\nexport const starterTemplate: ComponentTemplate = {\n name: 'starter',\n description: 'create your own starter - \\nDocs: https://bit.dev/docs/dev-services/generator/generate-workspace',\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n {\n relativePath: `${context.name}.starter.ts`,\n content: starterFile(),\n },\n {\n relativePath: `${context.name}.docs.mdx`,\n content: docsFile(),\n },\n {\n relativePath: 'template/files/git-ignore.ts',\n content: gitIgnoreTemplate(),\n },\n {\n relativePath: 'template/files/readme-file.ts',\n content: readmeTemplate(),\n },\n {\n relativePath: 'template/files/workspace-config.ts',\n content: workspaceConfigTemplate(),\n },\n ];\n },\n config: {\n 'teambit.harmony/aspect': {},\n 'teambit.envs/envs': {\n env: 'teambit.harmony/aspect',\n },\n },\n};\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,eAAkC,GAAG;EAChDC,IAAI,EAAE,SAAS;EACfC,WAAW,EAAE,kGAAkG;EAC/GC,aAAa,EAAGC,OAAyB,IAAK;IAC5C,OAAO,CACL;MACEC,YAAY,EAAE,UAAU;MACxBC,OAAO,EAAE,IAAAC,kBAAS,EAACH,OAAO,CAAC;MAC3BI,MAAM,EAAE;IACV,CAAC,EACD;MACEH,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,aAAY;MAC1CK,OAAO,EAAE,IAAAG,sBAAW;IACtB,CAAC,EACD;MACEJ,YAAY,EAAG,GAAED,OAAO,CAACH,IAAK,WAAU;MACxCK,OAAO,EAAE,IAAAI,oBAAQ;IACnB,CAAC,EACD;MACEL,YAAY,EAAE,8BAA8B;MAC5CC,OAAO,EAAE,IAAAK,iCAAiB;IAC5B,CAAC,EACD;MACEN,YAAY,EAAE,+BAA+B;MAC7CC,OAAO,EAAE,IAAAM,2BAAc;IACzB,CAAC,EACD;MACEP,YAAY,EAAE,oCAAoC;MAClDC,OAAO,EAAE,IAAAO,6CAAuB;IAClC,CAAC,CACF;EACH,CAAC;EACDC,MAAM,EAAE;IACN,wBAAwB,EAAE,CAAC,CAAC;IAC5B,mBAAmB,EAAE;MACnBC,GAAG,EAAE;IACP;EACF;AACF,CAAC;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["_starter","data","require","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","default","getOwnPropertyDescriptors","defineProperties","defineProperty","workspaceGeneratorTemplate","starterTemplate","name","description","exports"],"sources":["index.ts"],"sourcesContent":["import { ComponentTemplate } from '@teambit/generator';\nimport { starterTemplate } from '../starter';\n\n// TODO: This is deprecated and should be removed once we update the docs to use the new starter template.\nexport const workspaceGeneratorTemplate: ComponentTemplate = {\n ...starterTemplate,\n name: 'workspace-generator',\n description:\n 'DEPRECATED: use \"starter\" instead.\\ncreate your own workspace generator - \\nDocs: https://bit.dev/docs/dev-services/generator/generate-workspace',\n};\n"],"mappings":";;;;;;;;;;;;;;AACA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA6C,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,CAAAD,CAAA,IAAAC,SAAA,CAAAD,CAAA,QAAAA,CAAA,OAAAf,OAAA,CAAAI,MAAA,CAAAc,MAAA,OAAAC,OAAA,WAAAC,GAAA,QAAAC,gBAAA,GAAAC,OAAA,EAAAR,MAAA,EAAAM,GAAA,EAAAF,MAAA,CAAAE,GAAA,SAAAhB,MAAA,CAAAmB,yBAAA,GAAAnB,MAAA,CAAAoB,gBAAA,CAAAV,MAAA,EAAAV,MAAA,CAAAmB,yBAAA,CAAAL,MAAA,KAAAlB,OAAA,CAAAI,MAAA,CAAAc,MAAA,GAAAC,OAAA,WAAAC,GAAA,IAAAhB,MAAA,CAAAqB,cAAA,CAAAX,MAAA,EAAAM,GAAA,EAAAhB,MAAA,CAAAK,wBAAA,CAAAS,MAAA,EAAAE,GAAA,iBAAAN,MAAA;AAE7C;AACO,MAAMY,0BAA6C,GAAAb,aAAA,CAAAA,aAAA,KACrDc,0BAAe;EAClBC,IAAI,EAAE,qBAAqB;EAC3BC,WAAW,EACT;AAAkJ,EACrJ;AAACC,OAAA,CAAAJ,0BAAA,GAAAA,0BAAA"}
1
+ {"version":3,"names":["workspaceGeneratorTemplate","starterTemplate","name","description"],"sources":["index.ts"],"sourcesContent":["import { ComponentTemplate } from '@teambit/generator';\nimport { starterTemplate } from '../starter';\n\n// TODO: This is deprecated and should be removed once we update the docs to use the new starter template.\nexport const workspaceGeneratorTemplate: ComponentTemplate = {\n ...starterTemplate,\n name: 'workspace-generator',\n description:\n 'DEPRECATED: use \"starter\" instead.\\ncreate your own workspace generator - \\nDocs: https://bit.dev/docs/dev-services/generator/generate-workspace',\n};\n"],"mappings":";;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA6C;AAAA;AAE7C;AACO,MAAMA,0BAA6C,mCACrDC,0BAAe;EAClBC,IAAI,EAAE,qBAAqB;EAC3BC,WAAW,EACT;AAAkJ,EACrJ;AAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["_chalk","data","_interopRequireDefault","require","_lodash","TemplatesCmd","constructor","generator","_defineProperty2","default","report","args","templatesOptions","results","listTemplates","showAll","filter","template","hidden","grouped","groupBy","titleStr","isRunningInsideWorkspace","title","chalk","green","templateOutput","desc","description","name","dim","output","Object","keys","map","aspectId","names","join","groupTitle","titlePrefix","blue","bold","exports"],"sources":["templates.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { groupBy } from 'lodash';\nimport { GeneratorMain, TemplateDescriptor } from './generator.main.runtime';\n\nexport type TemplatesOptions = {\n showAll?: boolean;\n aspect?: string;\n};\n\nexport class TemplatesCmd implements Command {\n name = 'templates';\n description = 'list templates for \"bit create\" and \"bit new\"';\n extendedDescription =\n 'list components templates when inside bit-workspace (for bit-create), otherwise, list workspace templates (for bit-new)';\n alias = '';\n loader = true;\n group = 'development';\n options = [\n ['s', 'show-all', 'show hidden templates'],\n ['a', 'aspect <aspect-id>', 'show templates provided by the aspect-id'],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async report(args: [], templatesOptions: TemplatesOptions) {\n let results = await this.generator.listTemplates(templatesOptions);\n\n // Make sure that we don't list hidden templates\n if (!templatesOptions.showAll) {\n results = results.filter((template) => !template.hidden);\n }\n\n const grouped = groupBy(results, 'aspectId');\n const titleStr = this.generator.isRunningInsideWorkspace()\n ? `The following template(s) are available with the command bit create: \\nExample - bit create <template-name> <component-name>`\n : `The following template(s) are available with the command bit new: \\nExample - bit new <template-name> <workspace-name>`;\n const title = chalk.green(`\\n${titleStr}\\n`);\n const templateOutput = (template: TemplateDescriptor) => {\n const desc = template.description ? ` (${template.description})` : '';\n return ` ${template.name}${chalk.dim(desc)}`;\n };\n const output = Object.keys(grouped)\n .map((aspectId) => {\n const names = grouped[aspectId].map(templateOutput).join('\\n');\n const groupTitle = grouped[aspectId][0].titlePrefix\n ? `${grouped[aspectId][0].titlePrefix} (${aspectId})`\n : aspectId;\n return `${chalk.blue.bold(groupTitle)}\\n${names}\\n`;\n })\n .join('\\n');\n return title + output;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;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S,IAAG,CAAC;IAC5C,MAAMK,cAAc,GAAIT,QAA4B,IAAK;MACvD,MAAMU,IAAI,GAAGV,QAAQ,CAACW,WAAW,GAAI,KAAIX,QAAQ,CAACW,WAAY,GAAE,GAAG,EAAE;MACrE,OAAQ,OAAMX,QAAQ,CAACY,IAAK,GAAEL,gBAAK,CAACM,GAAG,CAACH,IAAI,CAAE,EAAC;IACjD,CAAC;IACD,MAAMI,MAAM,GAAGC,MAAM,CAACC,IAAI,CAACd,OAAO,CAAC,CAChCe,GAAG,CAAEC,QAAQ,IAAK;MACjB,MAAMC,KAAK,GAAGjB,OAAO,CAACgB,QAAQ,CAAC,CAACD,GAAG,CAACR,cAAc,CAAC,CAACW,IAAI,CAAC,IAAI,CAAC;MAC9D,MAAMC,UAAU,GAAGnB,OAAO,CAACgB,QAAQ,CAAC,CAAC,CAAC,CAAC,CAACI,WAAW,GAC9C,GAAEpB,OAAO,CAACgB,QAAQ,CAAC,CAAC,CAAC,CAAC,CAACI,WAAY,KAAIJ,QAAS,GAAE,GACnDA,QAAQ;MACZ,OAAQ,GAAEX,gBAAK,CAACgB,IAAI,CAACC,IAAI,CAACH,UAAU,CAAE,KAAIF,KAAM,IAAG;IACrD,CAAC,CAAC,CACDC,IAAI,CAAC,IAAI,CAAC;IACb,OAAOd,KAAK,GAAGQ,MAAM;EACvB;AACF;AAACW,OAAA,CAAArC,YAAA,GAAAA,YAAA"}
1
+ {"version":3,"names":["TemplatesCmd","constructor","generator","report","args","templatesOptions","results","listTemplates","showAll","filter","template","hidden","grouped","groupBy","titleStr","isRunningInsideWorkspace","title","chalk","green","templateOutput","desc","description","name","dim","output","Object","keys","map","aspectId","names","join","groupTitle","titlePrefix","blue","bold"],"sources":["templates.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport chalk from 'chalk';\nimport { groupBy } from 'lodash';\nimport { GeneratorMain, TemplateDescriptor } from './generator.main.runtime';\n\nexport type TemplatesOptions = {\n showAll?: boolean;\n aspect?: string;\n};\n\nexport class TemplatesCmd implements Command {\n name = 'templates';\n description = 'list templates for \"bit create\" and \"bit new\"';\n extendedDescription =\n 'list components templates when inside bit-workspace (for bit-create), otherwise, list workspace templates (for bit-new)';\n alias = '';\n loader = true;\n group = 'development';\n options = [\n ['s', 'show-all', 'show hidden templates'],\n ['a', 'aspect <aspect-id>', 'show templates provided by the aspect-id'],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async report(args: [], templatesOptions: TemplatesOptions) {\n let results = await this.generator.listTemplates(templatesOptions);\n\n // Make sure that we don't list hidden templates\n if (!templatesOptions.showAll) {\n results = results.filter((template) => !template.hidden);\n }\n\n const grouped = groupBy(results, 'aspectId');\n const titleStr = this.generator.isRunningInsideWorkspace()\n ? `The following template(s) are available with the command bit create: \\nExample - bit create <template-name> <component-name>`\n : `The following template(s) are available with the command bit new: \\nExample - bit new <template-name> <workspace-name>`;\n const title = chalk.green(`\\n${titleStr}\\n`);\n const templateOutput = (template: TemplateDescriptor) => {\n const desc = template.description ? ` (${template.description})` : '';\n return ` ${template.name}${chalk.dim(desc)}`;\n };\n const output = Object.keys(grouped)\n .map((aspectId) => {\n const names = grouped[aspectId].map(templateOutput).join('\\n');\n const groupTitle = grouped[aspectId][0].titlePrefix\n ? `${grouped[aspectId][0].titlePrefix} (${aspectId})`\n : aspectId;\n return `${chalk.blue.bold(groupTitle)}\\n${names}\\n`;\n })\n .join('\\n');\n return title + output;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQO,MAAMA,YAAY,CAAoB;EAa3CC,WAAW,CAASC,SAAwB,EAAE;IAAA,KAA1BA,SAAwB,GAAxBA,SAAwB;IAAA,8CAZrC,WAAW;IAAA,qDACJ,+CAA+C;IAAA,6DAE3D,yHAAyH;IAAA,+CACnH,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C,CAACI,WAAW,GAC9C,GAAEpB,OAAO,CAACgB,QAAQ,CAAC,CAAC,CAAC,CAAC,CAACI,WAAY,KAAIJ,QAAS,GAAE,GACnDA,QAAQ;MACZ,OAAQ,GAAEX,gBAAK,CAACgB,IAAI,CAACC,IAAI,CAACH,UAAU,CAAE,KAAIF,KAAM,IAAG;IACrD,CAAC,CAAC,CACDC,IAAI,CAAC,IAAI,CAAC;IACb,OAAOd,KAAK,GAAGQ,MAAM;EACvB;AACF;AAAC"}
@@ -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","WorkspaceGenerator","constructor","workspaceName","options","template","aspectComponent","_defineProperty2","default","workspacePath","resolve","generate","fs","existsSync","Error","ensureDir","process","chdir","initGit","init","skipGit","writeWorkspaceFiles","reloadBitInWorkspaceDir","setupGitBitmapMergeDriver","forkComponentsFromRemote","importComponentsFromRemote","install","undefined","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","updateExisting","err","logger","error","remove","gitExecutablePath","getGitExecutablePath","params","execa","exitCodeName","GitNotFound","git","setGitMergeDriver","global","buildUI","uiMain","harmony","get","UIAspect","id","createRuntime","getWorkspaceContext","name","defaultScope","empty","workspaceContext","templateFiles","generateFiles","Promise","all","map","templateFile","outputFile","join","relativePath","content","loadBit","workspace","WorkspaceAspect","InstallAspect","loggerMain","LoggerAspect","createLogger","GeneratorAspect","importer","ImporterAspect","forking","ForkingAspect","GitAspect","wsConfigFiles","WorkspaceConfigFilesAspect","_this$template","_this$template$import","_this$template2","_this$template2$fork","componentsToFork","importComponents","call","fork","length","componentsToForkRestructured","targetName","path","env","config","sourceId","targetId","forkMultipleFromRemote","scope","refactor","clearCache","compileComponents","_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\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\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 await this.setupGitBitmapMergeDriver();\n await this.forkComponentsFromRemote();\n await this.importComponentsFromRemote();\n await this.install.install(undefined, {\n dedupe: true,\n import: false,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n updateExisting: false,\n });\n // await this.wsConfigFiles.writeConfigFiles({});\n // await this.buildUI(); // disabled for now. it takes too long\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 };\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 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 this.workspace.clearCache();\n await this.compileComponents();\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 this.workspace.clearCache();\n await this.compileComponents();\n }\n\n private async compileComponents() {\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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C,CAAC;IAC3B,MAAM,IAAI,CAACC,iBAAiB,CAAC,CAAC;EAChC;EAEA,MAAcA,iBAAiBA,CAAA,EAAG;IAChC,MAAMW,QAAQ,GAAG,IAAI,CAAClE,OAAO,CAACC,GAAG,CAAekE,0BAAc,CAAChE,EAAE,CAAC;IAClE,MAAM+D,QAAQ,CAACE,kBAAkB,CAAC,CAAC;EACrC;AACF;AAACC,OAAA,CAAApH,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["WorkspaceGenerator","constructor","workspaceName","options","template","aspectComponent","workspacePath","resolve","generate","fs","existsSync","Error","ensureDir","process","chdir","initGit","init","skipGit","writeWorkspaceFiles","reloadBitInWorkspaceDir","setupGitBitmapMergeDriver","forkComponentsFromRemote","importComponentsFromRemote","install","undefined","dedupe","import","copyPeerToRuntimeOnRoot","copyPeerToRuntimeOnComponents","updateExisting","err","logger","error","remove","gitExecutablePath","getGitExecutablePath","params","execa","exitCodeName","GitNotFound","git","setGitMergeDriver","global","buildUI","uiMain","harmony","get","UIAspect","id","createRuntime","getWorkspaceContext","name","defaultScope","empty","workspaceContext","templateFiles","generateFiles","Promise","all","map","templateFile","outputFile","join","relativePath","content","loadBit","workspace","WorkspaceAspect","InstallAspect","loggerMain","LoggerAspect","createLogger","GeneratorAspect","importer","ImporterAspect","forking","ForkingAspect","GitAspect","wsConfigFiles","WorkspaceConfigFilesAspect","componentsToFork","importComponents","fork","length","componentsToForkRestructured","targetName","path","env","config","sourceId","targetId","forkMultipleFromRemote","scope","refactor","clearCache","compileComponents","componentsToImport","pMapSeries","componentToImport","ids","installNpmPackages","writeToPath","bitMap","write","compiler","CompilerAspect","compileOnWorkspace"],"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\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\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 await this.setupGitBitmapMergeDriver();\n await this.forkComponentsFromRemote();\n await this.importComponentsFromRemote();\n await this.install.install(undefined, {\n dedupe: true,\n import: false,\n copyPeerToRuntimeOnRoot: true,\n copyPeerToRuntimeOnComponents: false,\n updateExisting: false,\n });\n // await this.wsConfigFiles.writeConfigFiles({});\n // await this.buildUI(); // disabled for now. it takes too long\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 };\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 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 this.workspace.clearCache();\n await this.compileComponents();\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 this.workspace.clearCache();\n await this.compileComponents();\n }\n\n private async compileComponents() {\n const compiler = this.harmony.get<CompilerMain>(CompilerAspect.id);\n await compiler.compileOnWorkspace();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;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"name": "@teambit/generator",
3
- "version": "0.0.1110",
3
+ "version": "0.0.1112",
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.1110"
9
+ "version": "0.0.1112"
10
10
  },
11
11
  "dependencies": {
12
12
  "camelcase": "6.2.0",
@@ -22,25 +22,25 @@
22
22
  "@teambit/component-id": "0.0.427",
23
23
  "@teambit/harmony": "0.4.6",
24
24
  "@teambit/bit-error": "0.0.402",
25
- "@teambit/envs": "0.0.1110",
26
- "@teambit/logger": "0.0.835",
27
- "@teambit/new-component-helper": "0.0.514",
28
- "@teambit/tracker": "0.0.141",
29
- "@teambit/workspace.modules.node-modules-linker": "0.0.85",
30
- "@teambit/workspace": "0.0.1110",
31
- "@teambit/cli": "0.0.742",
32
- "@teambit/graphql": "0.0.1110",
33
- "@teambit/aspect-loader": "0.0.1110",
34
- "@teambit/bit": "0.2.3",
35
- "@teambit/community": "0.0.290",
36
- "@teambit/component": "0.0.1110",
37
- "@teambit/git": "0.0.15",
38
- "@teambit/compiler": "0.0.1110",
39
- "@teambit/forking": "0.0.514",
40
- "@teambit/importer": "0.0.539",
41
- "@teambit/install": "0.0.201",
42
- "@teambit/ui": "0.0.1110",
43
- "@teambit/workspace-config-files": "0.0.90"
25
+ "@teambit/envs": "0.0.1112",
26
+ "@teambit/logger": "0.0.837",
27
+ "@teambit/new-component-helper": "0.0.516",
28
+ "@teambit/tracker": "0.0.143",
29
+ "@teambit/workspace.modules.node-modules-linker": "0.0.87",
30
+ "@teambit/workspace": "0.0.1112",
31
+ "@teambit/cli": "0.0.744",
32
+ "@teambit/graphql": "0.0.1112",
33
+ "@teambit/aspect-loader": "0.0.1112",
34
+ "@teambit/bit": "0.2.5",
35
+ "@teambit/community": "0.0.292",
36
+ "@teambit/component": "0.0.1112",
37
+ "@teambit/git": "0.0.17",
38
+ "@teambit/compiler": "0.0.1112",
39
+ "@teambit/forking": "0.0.516",
40
+ "@teambit/importer": "0.0.541",
41
+ "@teambit/install": "0.0.203",
42
+ "@teambit/ui": "0.0.1112",
43
+ "@teambit/workspace-config-files": "0.0.92"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@types/fs-extra": "9.0.7",
@@ -54,7 +54,7 @@
54
54
  "@teambit/generator.aspect-docs.generator": "0.0.158"
55
55
  },
56
56
  "peerDependencies": {
57
- "@teambit/legacy": "1.0.522",
57
+ "@teambit/legacy": "1.0.524",
58
58
  "react": "^16.8.0 || ^17.0.0",
59
59
  "react-dom": "^16.8.0 || ^17.0.0"
60
60
  },