@teambit/generator 0.0.0-0207b202349a42efdb1a89d8bcc4a0deb2be689b

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 (188) hide show
  1. package/dist/component-generator.d.ts +60 -0
  2. package/dist/component-generator.js +370 -0
  3. package/dist/component-generator.js.map +1 -0
  4. package/dist/component-template.d.ts +169 -0
  5. package/dist/component-template.js +3 -0
  6. package/dist/component-template.js.map +1 -0
  7. package/dist/create.cmd.d.ts +36 -0
  8. package/dist/create.cmd.js +74 -0
  9. package/dist/create.cmd.js.map +1 -0
  10. package/dist/esm.mjs +8 -0
  11. package/dist/exceptions/workspace-path-exists.d.ts +5 -0
  12. package/dist/exceptions/workspace-path-exists.js +22 -0
  13. package/dist/exceptions/workspace-path-exists.js.map +1 -0
  14. package/dist/generator-env-type.d.ts +13 -0
  15. package/dist/generator-env-type.js +3 -0
  16. package/dist/generator-env-type.js.map +1 -0
  17. package/dist/generator.aspect.d.ts +2 -0
  18. package/dist/generator.aspect.js +18 -0
  19. package/dist/generator.aspect.js.map +1 -0
  20. package/dist/generator.composition.d.ts +1 -0
  21. package/dist/generator.composition.js +29 -0
  22. package/dist/generator.composition.js.map +1 -0
  23. package/dist/generator.docs.mdx +8 -0
  24. package/dist/generator.graphql.d.ts +7 -0
  25. package/dist/generator.graphql.js +85 -0
  26. package/dist/generator.graphql.js.map +1 -0
  27. package/dist/generator.main.runtime.d.ts +212 -0
  28. package/dist/generator.main.runtime.js +813 -0
  29. package/dist/generator.main.runtime.js.map +1 -0
  30. package/dist/generator.service.d.ts +20 -0
  31. package/dist/generator.service.js +92 -0
  32. package/dist/generator.service.js.map +1 -0
  33. package/dist/index.d.ts +8 -0
  34. package/dist/index.js +46 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/new.cmd.d.ts +29 -0
  37. package/dist/new.cmd.js +94 -0
  38. package/dist/new.cmd.js.map +1 -0
  39. package/dist/preview-1764611393951.js +7 -0
  40. package/dist/starter-list.d.ts +13 -0
  41. package/dist/starter-list.js +25 -0
  42. package/dist/starter-list.js.map +1 -0
  43. package/dist/starter.plugin.d.ts +9 -0
  44. package/dist/starter.plugin.js +30 -0
  45. package/dist/starter.plugin.js.map +1 -0
  46. package/dist/template-list.d.ts +13 -0
  47. package/dist/template-list.js +25 -0
  48. package/dist/template-list.js.map +1 -0
  49. package/dist/templates/basic/basic.starter.d.ts +3 -0
  50. package/dist/templates/basic/basic.starter.js +46 -0
  51. package/dist/templates/basic/basic.starter.js.map +1 -0
  52. package/dist/templates/basic/index.d.ts +1 -0
  53. package/dist/templates/basic/index.js +20 -0
  54. package/dist/templates/basic/index.js.map +1 -0
  55. package/dist/templates/basic/template/files/package-json.d.ts +1 -0
  56. package/dist/templates/basic/template/files/package-json.js +14 -0
  57. package/dist/templates/basic/template/files/package-json.js.map +1 -0
  58. package/dist/templates/basic/template/files/workspace-config.d.ts +2 -0
  59. package/dist/templates/basic/template/files/workspace-config.js +49 -0
  60. package/dist/templates/basic/template/files/workspace-config.js.map +1 -0
  61. package/dist/templates/component-generator/files/component-template-files/component.d.ts +1 -0
  62. package/dist/templates/component-generator/files/component-template-files/component.js +35 -0
  63. package/dist/templates/component-generator/files/component-template-files/component.js.map +1 -0
  64. package/dist/templates/component-generator/files/component-template-files/composition.d.ts +1 -0
  65. package/dist/templates/component-generator/files/component-template-files/composition.js +29 -0
  66. package/dist/templates/component-generator/files/component-template-files/composition.js.map +1 -0
  67. package/dist/templates/component-generator/files/component-template-files/index-file.d.ts +1 -0
  68. package/dist/templates/component-generator/files/component-template-files/index-file.js +24 -0
  69. package/dist/templates/component-generator/files/component-template-files/index-file.js.map +1 -0
  70. package/dist/templates/component-generator/files/component-template-files/test.d.ts +1 -0
  71. package/dist/templates/component-generator/files/component-template-files/test.js +31 -0
  72. package/dist/templates/component-generator/files/component-template-files/test.js.map +1 -0
  73. package/dist/templates/component-generator/files/component-template.d.ts +2 -0
  74. package/dist/templates/component-generator/files/component-template.js +67 -0
  75. package/dist/templates/component-generator/files/component-template.js.map +1 -0
  76. package/dist/templates/component-generator/files/index.d.ts +2 -0
  77. package/dist/templates/component-generator/files/index.js +15 -0
  78. package/dist/templates/component-generator/files/index.js.map +1 -0
  79. package/dist/templates/component-generator/index.d.ts +2 -0
  80. package/dist/templates/component-generator/index.js +83 -0
  81. package/dist/templates/component-generator/index.js.map +1 -0
  82. package/dist/templates/component-generator-standalone/files/aspect-file.d.ts +2 -0
  83. package/dist/templates/component-generator-standalone/files/aspect-file.js +19 -0
  84. package/dist/templates/component-generator-standalone/files/aspect-file.js.map +1 -0
  85. package/dist/templates/component-generator-standalone/files/docs-file.d.ts +1 -0
  86. package/dist/templates/component-generator-standalone/files/docs-file.js +62 -0
  87. package/dist/templates/component-generator-standalone/files/docs-file.js.map +1 -0
  88. package/dist/templates/component-generator-standalone/files/index.d.ts +2 -0
  89. package/dist/templates/component-generator-standalone/files/index.js +19 -0
  90. package/dist/templates/component-generator-standalone/files/index.js.map +1 -0
  91. package/dist/templates/component-generator-standalone/files/main-runtime.d.ts +2 -0
  92. package/dist/templates/component-generator-standalone/files/main-runtime.js +134 -0
  93. package/dist/templates/component-generator-standalone/files/main-runtime.js.map +1 -0
  94. package/dist/templates/component-generator-standalone/index.d.ts +2 -0
  95. package/dist/templates/component-generator-standalone/index.js +63 -0
  96. package/dist/templates/component-generator-standalone/index.js.map +1 -0
  97. package/dist/templates/index.d.ts +4 -0
  98. package/dist/templates/index.js +59 -0
  99. package/dist/templates/index.js.map +1 -0
  100. package/dist/templates/starter/files/doc-file.d.ts +2 -0
  101. package/dist/templates/starter/files/doc-file.js +33 -0
  102. package/dist/templates/starter/files/doc-file.js.map +1 -0
  103. package/dist/templates/starter/files/generate-files.d.ts +1 -0
  104. package/dist/templates/starter/files/generate-files.js +35 -0
  105. package/dist/templates/starter/files/generate-files.js.map +1 -0
  106. package/dist/templates/starter/files/git-ignore-tpl.d.ts +1 -0
  107. package/dist/templates/starter/files/git-ignore-tpl.js +121 -0
  108. package/dist/templates/starter/files/git-ignore-tpl.js.map +1 -0
  109. package/dist/templates/starter/files/index.d.ts +2 -0
  110. package/dist/templates/starter/files/index.js +15 -0
  111. package/dist/templates/starter/files/index.js.map +1 -0
  112. package/dist/templates/starter/files/starter.d.ts +2 -0
  113. package/dist/templates/starter/files/starter.js +49 -0
  114. package/dist/templates/starter/files/starter.js.map +1 -0
  115. package/dist/templates/starter/files/workspace-config-tpl.d.ts +1 -0
  116. package/dist/templates/starter/files/workspace-config-tpl.js +30 -0
  117. package/dist/templates/starter/files/workspace-config-tpl.js.map +1 -0
  118. package/dist/templates/starter/index.d.ts +2 -0
  119. package/dist/templates/starter/index.js +83 -0
  120. package/dist/templates/starter/index.js.map +1 -0
  121. package/dist/templates/starter-standalone/files/doc-file.d.ts +2 -0
  122. package/dist/templates/starter-standalone/files/doc-file.js +33 -0
  123. package/dist/templates/starter-standalone/files/doc-file.js.map +1 -0
  124. package/dist/templates/starter-standalone/files/git-ignore-tpl.d.ts +1 -0
  125. package/dist/templates/starter-standalone/files/git-ignore-tpl.js +121 -0
  126. package/dist/templates/starter-standalone/files/git-ignore-tpl.js.map +1 -0
  127. package/dist/templates/starter-standalone/files/index.d.ts +2 -0
  128. package/dist/templates/starter-standalone/files/index.js +15 -0
  129. package/dist/templates/starter-standalone/files/index.js.map +1 -0
  130. package/dist/templates/starter-standalone/files/starter.d.ts +2 -0
  131. package/dist/templates/starter-standalone/files/starter.js +44 -0
  132. package/dist/templates/starter-standalone/files/starter.js.map +1 -0
  133. package/dist/templates/starter-standalone/files/workspace-config-tpl.d.ts +1 -0
  134. package/dist/templates/starter-standalone/files/workspace-config-tpl.js +30 -0
  135. package/dist/templates/starter-standalone/files/workspace-config-tpl.js.map +1 -0
  136. package/dist/templates/starter-standalone/index.d.ts +2 -0
  137. package/dist/templates/starter-standalone/index.js +73 -0
  138. package/dist/templates/starter-standalone/index.js.map +1 -0
  139. package/dist/templates.cmd.d.ts +20 -0
  140. package/dist/templates.cmd.js +74 -0
  141. package/dist/templates.cmd.js.map +1 -0
  142. package/dist/types.d.ts +3 -0
  143. package/dist/types.js +3 -0
  144. package/dist/types.js.map +1 -0
  145. package/dist/workspace-generator.d.ts +46 -0
  146. package/dist/workspace-generator.js +330 -0
  147. package/dist/workspace-generator.js.map +1 -0
  148. package/dist/workspace-template.d.ts +158 -0
  149. package/dist/workspace-template.js +3 -0
  150. package/dist/workspace-template.js.map +1 -0
  151. package/esm.mjs +8 -0
  152. package/exceptions/workspace-path-exists.ts +7 -0
  153. package/generator.composition.tsx +7 -0
  154. package/generator.docs.mdx +8 -0
  155. package/generator.service.tsx +104 -0
  156. package/package.json +94 -0
  157. package/templates/basic/basic.starter.ts +27 -0
  158. package/templates/basic/index.ts +1 -0
  159. package/templates/basic/template/files/package-json.ts +6 -0
  160. package/templates/basic/template/files/workspace-config.ts +30 -0
  161. package/templates/component-generator/files/component-template-files/component.ts +26 -0
  162. package/templates/component-generator/files/component-template-files/composition.ts +20 -0
  163. package/templates/component-generator/files/component-template-files/index-file.ts +15 -0
  164. package/templates/component-generator/files/component-template-files/test.ts +22 -0
  165. package/templates/component-generator/files/component-template.ts +58 -0
  166. package/templates/component-generator/files/index.ts +6 -0
  167. package/templates/component-generator/index.ts +49 -0
  168. package/templates/component-generator-standalone/files/aspect-file.ts +10 -0
  169. package/templates/component-generator-standalone/files/docs-file.ts +54 -0
  170. package/templates/component-generator-standalone/files/index.ts +10 -0
  171. package/templates/component-generator-standalone/files/main-runtime.ts +125 -0
  172. package/templates/component-generator-standalone/index.ts +39 -0
  173. package/templates/index.ts +4 -0
  174. package/templates/starter/files/doc-file.ts +24 -0
  175. package/templates/starter/files/generate-files.ts +27 -0
  176. package/templates/starter/files/git-ignore-tpl.ts +113 -0
  177. package/templates/starter/files/index.ts +6 -0
  178. package/templates/starter/files/starter.ts +40 -0
  179. package/templates/starter/files/workspace-config-tpl.ts +22 -0
  180. package/templates/starter/index.ts +50 -0
  181. package/templates/starter-standalone/files/doc-file.ts +24 -0
  182. package/templates/starter-standalone/files/git-ignore-tpl.ts +113 -0
  183. package/templates/starter-standalone/files/index.ts +6 -0
  184. package/templates/starter-standalone/files/starter.ts +35 -0
  185. package/templates/starter-standalone/files/workspace-config-tpl.ts +22 -0
  186. package/templates/starter-standalone/index.ts +45 -0
  187. package/types/asset.d.ts +41 -0
  188. package/types/style.d.ts +42 -0
@@ -0,0 +1,36 @@
1
+ import type { Command, CommandOptions } from '@teambit/cli';
2
+ import type { ComponentID } from '@teambit/component';
3
+ import type { GeneratorMain } from './generator.main.runtime';
4
+ import type { BaseComponentTemplateOptions } from './component-template';
5
+ /**
6
+ * CreateOptions combines foundational properties with additional options for creating a component.
7
+ */
8
+ export type CreateOptions = BaseComponentTemplateOptions & {
9
+ env?: string;
10
+ aspect?: string;
11
+ force?: boolean;
12
+ };
13
+ export declare class CreateCmd implements Command {
14
+ private generator;
15
+ name: string;
16
+ description: string;
17
+ extendedDescription: string;
18
+ alias: string;
19
+ loader: boolean;
20
+ helpUrl: string;
21
+ arguments: {
22
+ name: string;
23
+ description: string;
24
+ }[];
25
+ examples: {
26
+ cmd: string;
27
+ description: string;
28
+ }[];
29
+ group: string;
30
+ options: CommandOptions;
31
+ constructor(generator: GeneratorMain);
32
+ report([templateName, componentNames]: [string, string[]], options: Partial<CreateOptions> & {
33
+ template?: string | ComponentID;
34
+ force?: boolean;
35
+ }): Promise<string>;
36
+ }
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CreateCmd = void 0;
7
+ function _chalk() {
8
+ const data = _interopRequireDefault(require("chalk"));
9
+ _chalk = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ /**
19
+ * CreateOptions combines foundational properties with additional options for creating a component.
20
+ */
21
+
22
+ class CreateCmd {
23
+ constructor(generator) {
24
+ this.generator = generator;
25
+ _defineProperty(this, "name", 'create <template-name> <component-names...>');
26
+ _defineProperty(this, "description", 'scaffold new component(s) from a template (sources, config, and env)');
27
+ _defineProperty(this, "extendedDescription", "Generates one or more components from a chosen template with ready-to-use source files, configuration, and environment. Use it to quickly scaffold consistent components across your workspace. Run 'bit templates' to discover available templates.");
28
+ _defineProperty(this, "alias", '');
29
+ _defineProperty(this, "loader", true);
30
+ _defineProperty(this, "helpUrl", 'reference/starters/create-starter');
31
+ _defineProperty(this, "arguments", [{
32
+ name: 'template-name',
33
+ description: "the template for generating the component \n(run 'bit templates' for a list of available templates)"
34
+ }, {
35
+ name: 'component-names...',
36
+ description: 'a list of component names to generate'
37
+ }]);
38
+ _defineProperty(this, "examples", [{
39
+ cmd: 'bit create react ui/button --aspect teambit.react/react-env',
40
+ description: "creates a component named 'ui/button' using the 'react' template"
41
+ }, {
42
+ cmd: 'bit create module utils/is-string utils/is-number --aspect teambit.node/node',
43
+ description: "creates two components, 'utils/is-string' and 'utils/is-number' using the 'node' template from the 'node' aspect(env)"
44
+ }, {
45
+ cmd: 'bit create mdx docs/create-components --aspect teambit.mdx/mdx-env --scope my-org.my-scope',
46
+ description: "creates an mdx component named 'docs/create-components' and sets it scope to 'my-org.my-scope'. \nby default, the scope is the `defaultScope` value, configured in your `workspace.jsonc`."
47
+ }, {
48
+ cmd: 'bit create react my-org.my-scope/hooks/use-session',
49
+ description: "creates a component named 'hooks/use-session' with scope 'my-org.my-scope'. \nthe scope is parsed from the component name (bit.cloud scopes contain a dot)."
50
+ }, {
51
+ cmd: 'bit create react ui/button --aspect teambit.react/react-env --env teambit.community/envs/community-react@3.0.3',
52
+ description: "creates a component named 'ui/button' from the teambit.react/react-env env and sets it to use the 'community-react' env. \n(the template's default env is 'teambit.react/react-env')."
53
+ }]);
54
+ _defineProperty(this, "group", 'component-development');
55
+ _defineProperty(this, "options", [['n', 'namespace <string>', `sets the component's namespace and nested dirs inside the scope`], ['s', 'scope <string>', `sets the component's scope-name. if not entered, the default-scope will be used`], ['a', 'aspect <string>', 'aspect-id of the template. helpful when multiple aspects use the same template name'], ['t', 'template <string>', 'env-id of the template. alias for --aspect.'], ['p', 'path <string>', 'relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`'], ['e', 'env <string>', "set the component's environment. (overrides the env from variants and the template)"], ['f', 'force', 'replace existing files at the target location']]);
56
+ }
57
+ async report([templateName, componentNames], options) {
58
+ options.aspectId = options.aspectId ?? options.template;
59
+ const results = await this.generator.generateComponentTemplate(componentNames, templateName, options);
60
+ const title = `${results.length} component(s) were created`;
61
+ const componentsData = results.map(result => {
62
+ return `${_chalk().default.bold(result.id.toString())}
63
+ location: ${result.dir}
64
+ env: ${result.envId} (set by ${result.envSetBy})
65
+ package: ${result.packageName}
66
+ `;
67
+ }).join('\n');
68
+ const footer = `env configuration is according to workspace variants, template config or --env flag.`;
69
+ return `${_chalk().default.green(title)}\n\n${componentsData}\n\n${footer}`;
70
+ }
71
+ }
72
+ exports.CreateCmd = CreateCmd;
73
+
74
+ //# sourceMappingURL=create.cmd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_chalk","data","_interopRequireDefault","require","e","__esModule","default","_defineProperty","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CreateCmd","constructor","generator","name","description","cmd","report","templateName","componentNames","options","aspectId","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 type { Command, CommandOptions } from '@teambit/cli';\nimport type { ComponentID } from '@teambit/component';\nimport chalk from 'chalk';\nimport type { GeneratorMain } from './generator.main.runtime';\nimport type { BaseComponentTemplateOptions } from './component-template';\n\n/**\n * CreateOptions combines foundational properties with additional options for creating a component.\n */\nexport type CreateOptions = BaseComponentTemplateOptions & {\n env?: string;\n aspect?: string;\n force?: boolean;\n};\n\nexport class CreateCmd implements Command {\n name = 'create <template-name> <component-names...>';\n description = 'scaffold new component(s) from a template (sources, config, and env)';\n extendedDescription =\n \"Generates one or more components from a chosen template with ready-to-use source files, configuration, and environment. Use it to quickly scaffold consistent components across your workspace. Run 'bit templates' to discover available templates.\";\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 --aspect teambit.react/react-env',\n description: \"creates a component named 'ui/button' using the 'react' template\",\n },\n {\n cmd: 'bit create module utils/is-string utils/is-number --aspect teambit.node/node',\n description:\n \"creates two components, 'utils/is-string' and 'utils/is-number' using the 'node' template from the 'node' aspect(env)\",\n },\n {\n cmd: 'bit create mdx docs/create-components --aspect teambit.mdx/mdx-env --scope my-org.my-scope',\n description:\n \"creates an mdx component named 'docs/create-components' 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 my-org.my-scope/hooks/use-session',\n description:\n \"creates a component named 'hooks/use-session' with scope 'my-org.my-scope'. \\nthe scope is parsed from the component name (bit.cloud scopes contain a dot).\",\n },\n {\n cmd: 'bit create react ui/button --aspect teambit.react/react-env --env teambit.community/envs/community-react@3.0.3',\n description:\n \"creates a component named 'ui/button' from the teambit.react/react-env env and sets it to use the 'community-react' env. \\n(the template's default env is 'teambit.react/react-env').\",\n },\n ];\n group = 'component-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 ['f', 'force', 'replace existing files at the target location'],\n ] as CommandOptions;\n\n constructor(private generator: GeneratorMain) {}\n\n async report(\n [templateName, componentNames]: [string, string[]],\n options: Partial<CreateOptions> & {\n template?: string | ComponentID;\n force?: boolean;\n }\n ) {\n options.aspectId = options.aspectId ?? 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.`;\n\n return `${chalk.green(title)}\\n\\n${componentsData}\\n\\n${footer}`;\n }\n}\n"],"mappings":";;;;;;AAEA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAG,gBAAAH,CAAA,EAAAI,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAJ,CAAA,GAAAO,MAAA,C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AAM,GAAG,sFAAsF;IAErG,OAAO,GAAGT,gBAAK,CAACU,KAAK,CAACf,KAAK,CAAC,OAAOE,cAAc,OAAOY,MAAM,EAAE;EAClE;AACF;AAACE,OAAA,CAAA9B,SAAA,GAAAA,SAAA","ignoreList":[]}
package/dist/esm.mjs ADDED
@@ -0,0 +1,8 @@
1
+ // eslint-disable-next-line import/no-unresolved
2
+ import cjsModule from './index.js';
3
+
4
+ export const GeneratorAspect = cjsModule.GeneratorAspect;
5
+ export const TemplateList = cjsModule.TemplateList;
6
+ export const StarterList = cjsModule.StarterList;
7
+
8
+ export default cjsModule;
@@ -0,0 +1,5 @@
1
+ import { BitError } from '@teambit/bit-error';
2
+ export declare class WorkspacePathExists extends BitError {
3
+ readonly path: string;
4
+ constructor(path: string);
5
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.WorkspacePathExists = void 0;
7
+ function _bitError() {
8
+ const data = require("@teambit/bit-error");
9
+ _bitError = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ class WorkspacePathExists extends _bitError().BitError {
15
+ constructor(path) {
16
+ super(`unable to create a workspace at "${path}", this path already exists`);
17
+ this.path = path;
18
+ }
19
+ }
20
+ exports.WorkspacePathExists = WorkspacePathExists;
21
+
22
+ //# sourceMappingURL=workspace-path-exists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_bitError","data","require","WorkspacePathExists","BitError","constructor","path","exports"],"sources":["workspace-path-exists.ts"],"sourcesContent":["import { BitError } from '@teambit/bit-error';\n\nexport class WorkspacePathExists extends BitError {\n constructor(readonly path: string) {\n super(`unable to create a workspace at \"${path}\", this path already exists`);\n }\n}\n"],"mappings":";;;;;;AAAA,SAAAA,UAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,SAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,mBAAmB,SAASC,oBAAQ,CAAC;EAChDC,WAAWA,CAAUC,IAAY,EAAE;IACjC,KAAK,CAAC,oCAAoCA,IAAI,6BAA6B,CAAC;IAAC,KAD1DA,IAAY,GAAZA,IAAY;EAEjC;AACF;AAACC,OAAA,CAAAJ,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ import type { EnvHandler } from '@teambit/envs';
2
+ import type { TemplateList } from './template-list';
3
+ import type { StarterList } from './starter-list';
4
+ export interface GeneratorEnv {
5
+ /**
6
+ * return a template list instance.
7
+ */
8
+ generators(): EnvHandler<TemplateList>;
9
+ /**
10
+ * return a starter list instance.
11
+ */
12
+ starters(): EnvHandler<StarterList>;
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+
3
+ //# sourceMappingURL=generator-env-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["generator-env-type.ts"],"sourcesContent":["import type { EnvHandler } from '@teambit/envs';\nimport type { TemplateList } from './template-list';\nimport type { StarterList } from './starter-list';\n\nexport interface GeneratorEnv {\n /**\n * return a template list instance.\n */\n generators(): EnvHandler<TemplateList>;\n /**\n * return a starter list instance.\n */\n starters(): EnvHandler<StarterList>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ import { Aspect } from '@teambit/harmony';
2
+ export declare const GeneratorAspect: Aspect;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.GeneratorAspect = void 0;
7
+ function _harmony() {
8
+ const data = require("@teambit/harmony");
9
+ _harmony = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ const GeneratorAspect = exports.GeneratorAspect = _harmony().Aspect.create({
15
+ id: 'teambit.generator/generator'
16
+ });
17
+
18
+ //# sourceMappingURL=generator.aspect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_harmony","data","require","GeneratorAspect","exports","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,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAME,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAGE,iBAAM,CAACC,MAAM,CAAC;EAC3CC,EAAE,EAAE;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Logo = void 0;
7
+ function _react() {
8
+ const data = _interopRequireDefault(require("react"));
9
+ _react = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
16
+ style: {
17
+ height: '100%',
18
+ display: 'flex',
19
+ justifyContent: 'center'
20
+ }
21
+ }, /*#__PURE__*/_react().default.createElement("img", {
22
+ style: {
23
+ width: 70
24
+ },
25
+ src: "https://static.bit.dev/extensions-icons/generator-new.svg"
26
+ }));
27
+ exports.Logo = Logo;
28
+
29
+ //# sourceMappingURL=generator.composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","data","_interopRequireDefault","require","e","__esModule","default","Logo","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;AAA0B,SAAAC,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEnB,MAAMG,IAAI,GAAGA,CAAA,kBAClBP,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxEZ,MAAA,GAAAM,OAAA,CAAAE,aAAA;EAAKC,KAAK,EAAE;IAAEI,KAAK,EAAE;EAAG,CAAE;EAACC,GAAG,EAAC;AAA2D,CAAE,CACzF,CACN;AAACC,OAAA,CAAAR,IAAA,GAAAA,IAAA","ignoreList":[]}
@@ -0,0 +1,8 @@
1
+ ---
2
+ description: A simple interface for generating component templates.
3
+ labels: ['generator', 'templates']
4
+ ---
5
+
6
+ import { Generator } from '@teambit/generator.aspect-docs.generator';
7
+
8
+ <Generator />
@@ -0,0 +1,7 @@
1
+ import type { Schema } from '@teambit/graphql';
2
+ import type { GeneratorMain } from './generator.main.runtime';
3
+ import type { CreateOptions } from './create.cmd';
4
+ export type CreateQueryOptions = CreateOptions & {
5
+ templateName: string;
6
+ };
7
+ export declare function generatorSchema(generator: GeneratorMain): Schema;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generatorSchema = generatorSchema;
7
+ function _graphqlTag() {
8
+ const data = require("graphql-tag");
9
+ _graphqlTag = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ const _excluded = ["name", "templateName"];
15
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
16
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
18
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
19
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
20
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
21
+ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
22
+ function generatorSchema(generator) {
23
+ return {
24
+ typeDefs: (0, _graphqlTag().gql)`
25
+ type GenerateResult {
26
+ id: String
27
+ dir: String
28
+ files: [String]
29
+ }
30
+
31
+ type Mutation {
32
+ # create Component by template
33
+ createComponent(
34
+ name: String!
35
+ templateName: String!
36
+ scope: String
37
+ namespace: String
38
+ aspect: String
39
+ ): [GenerateResult]
40
+ }
41
+
42
+ type TemplateDescriptor {
43
+ aspectId: String!
44
+ name: String!
45
+ }
46
+
47
+ type Generator {
48
+ templates: [TemplateDescriptor]
49
+ }
50
+
51
+ type Query {
52
+ generator: Generator
53
+ }
54
+ `,
55
+ resolvers: {
56
+ Mutation: {
57
+ createComponent: async (req, _ref) => {
58
+ let {
59
+ name,
60
+ templateName
61
+ } = _ref,
62
+ options = _objectWithoutProperties(_ref, _excluded);
63
+ const res = await generator.generateComponentTemplate([name], templateName, _objectSpread({
64
+ name
65
+ }, options));
66
+ return res.map(component => ({
67
+ id: component.id.toString(),
68
+ dir: component.dir,
69
+ files: component.files
70
+ }));
71
+ }
72
+ },
73
+ Generator: {
74
+ templates: async () => {
75
+ return generator.listTemplates();
76
+ }
77
+ },
78
+ Query: {
79
+ generator: () => generator
80
+ }
81
+ }
82
+ };
83
+ }
84
+
85
+ //# sourceMappingURL=generator.graphql.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_graphqlTag","data","require","_excluded","ownKeys","e","r","t","Object","keys","getOwnPropertySymbols","o","filter","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty","getOwnPropertyDescriptors","defineProperties","defineProperty","_toPropertyKey","value","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","_objectWithoutProperties","_objectWithoutPropertiesLoose","n","indexOf","propertyIsEnumerable","hasOwnProperty","generatorSchema","generator","typeDefs","gql","resolvers","Mutation","createComponent","req","_ref","name","templateName","options","res","generateComponentTemplate","map","component","id","toString","dir","files","Generator","templates","listTemplates","Query"],"sources":["generator.graphql.ts"],"sourcesContent":["import type { Schema } from '@teambit/graphql';\nimport { gql } from 'graphql-tag';\nimport type { GeneratorMain } from './generator.main.runtime';\nimport type { CreateOptions } from './create.cmd';\n\nexport type CreateQueryOptions = CreateOptions & { templateName: string };\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 (req: any, { name, templateName, ...options }: CreateQueryOptions) => {\n const res = await generator.generateComponentTemplate([name], templateName, { name, ...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,OAAA;EAAAF,WAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAkC,MAAAE,SAAA;AAAA,SAAAC,QAAAC,CAAA,EAAAC,CAAA,QAAAC,CAAA,GAAAC,MAAA,CAAAC,IAAA,CAAAJ,CAAA,OAAAG,MAAA,CAAAE,qBAAA,QAAAC,CAAA,GAAAH,MAAA,CAAAE,qBAAA,CAAAL,CAAA,GAAAC,CAAA,KAAAK,CAAA,GAAAA,CAAA,CAAAC,MAAA,WAAAN,CAAA,WAAAE,MAAA,CAAAK,wBAAA,CAAAR,CAAA,EAAAC,CAAA,EAAAQ,UAAA,OAAAP,CAAA,CAAAQ,IAAA,CAAAC,KAAA,CAAAT,CAAA,EAAAI,CAAA,YAAAJ,CAAA;AAAA,SAAAU,cAAAZ,CAAA,aAAAC,CAAA,MAAAA,CAAA,GAAAY,SAAA,CAAAC,MAAA,EAAAb,CAAA,UAAAC,CAAA,WAAAW,SAAA,CAAAZ,CAAA,IAAAY,SAAA,CAAAZ,CAAA,QAAAA,CAAA,OAAAF,OA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EC,YAAY,EAAApC,aAAA;YAAImC;UAAI,GAAKE,OAAO,CAAE,CAAC;UACjG,OAAOC,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,OAAOpB,SAAS,CAACqB,aAAa,CAAC,CAAC;QAClC;MACF,CAAC;MACDC,KAAK,EAAE;QACLtB,SAAS,EAAEA,CAAA,KAAMA;MACnB;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,212 @@
1
+ import type { GraphqlMain } from '@teambit/graphql';
2
+ import type { CLIMain } from '@teambit/cli';
3
+ import type { Workspace } from '@teambit/workspace';
4
+ import type { EnvDefinition, EnvsMain } from '@teambit/envs';
5
+ import type { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';
6
+ import type { ComponentMain, Component } from '@teambit/component';
7
+ import type { Harmony, SlotRegistry } from '@teambit/harmony';
8
+ import type { GitMain } from '@teambit/git';
9
+ import type { AspectLoaderMain } from '@teambit/aspect-loader';
10
+ import type { TrackerMain } from '@teambit/tracker';
11
+ import type { NewComponentHelperMain } from '@teambit/new-component-helper';
12
+ import type { Logger, LoggerMain } from '@teambit/logger';
13
+ import type { DeprecationMain } from '@teambit/deprecation';
14
+ import type { ComponentTemplate, GetComponentTemplates, PromptResults } from './component-template';
15
+ import type { CreateOptions } from './create.cmd';
16
+ import type { GenerateResult, InstallOptions, OnComponentCreateFn } from './component-generator';
17
+ import type { WorkspaceTemplate } from './workspace-template';
18
+ import type { NewOptions } from './new.cmd';
19
+ export type ComponentTemplateSlot = SlotRegistry<ComponentTemplate[] | GetComponentTemplates>;
20
+ export type WorkspaceTemplateSlot = SlotRegistry<WorkspaceTemplate[]>;
21
+ export type OnComponentCreateSlot = SlotRegistry<OnComponentCreateFn>;
22
+ export type TemplateDescriptor = {
23
+ aspectId: string;
24
+ titlePrefix?: string;
25
+ name: string;
26
+ description?: string;
27
+ hidden?: boolean;
28
+ };
29
+ type TemplateWithId = {
30
+ id: string;
31
+ envName?: string;
32
+ };
33
+ type WorkspaceTemplateWithId = TemplateWithId & {
34
+ template: WorkspaceTemplate;
35
+ };
36
+ type ComponentTemplateWithId = TemplateWithId & {
37
+ template: ComponentTemplate;
38
+ };
39
+ type LegacyGlobal = {
40
+ classInstance: any;
41
+ methodName: string;
42
+ value: any;
43
+ empty: any;
44
+ };
45
+ export type BitApi = {
46
+ isCoreAspect: (id: string) => boolean;
47
+ loadBit: (path?: string) => Promise<Harmony>;
48
+ restoreGlobalsFromSnapshot: (globals: LegacyGlobal[]) => void;
49
+ takeLegacyGlobalsSnapshot: () => LegacyGlobal[];
50
+ };
51
+ export type GenerateWorkspaceTemplateResult = {
52
+ workspacePath: string;
53
+ appName?: string;
54
+ };
55
+ export type GeneratorConfig = {
56
+ /**
57
+ * array of aspects to include in the list of templates.
58
+ */
59
+ aspects: string[];
60
+ /**
61
+ * by default core templates are shown.
62
+ * use this to hide them unless `--show-all` flag of `bit templates` was used
63
+ */
64
+ hideCoreTemplates: boolean;
65
+ /**
66
+ * default envs.
67
+ */
68
+ envs?: string[];
69
+ };
70
+ export declare class GeneratorMain {
71
+ private componentTemplateSlot;
72
+ private workspaceTemplateSlot;
73
+ private onComponentCreateSlot;
74
+ private config;
75
+ private workspace;
76
+ private envs;
77
+ private aspectLoader;
78
+ private newComponentHelper;
79
+ private componentAspect;
80
+ private tracker;
81
+ private logger;
82
+ private git;
83
+ private wsConfigFiles;
84
+ private deprecation;
85
+ private aspectLoaded;
86
+ private bitApi;
87
+ constructor(componentTemplateSlot: ComponentTemplateSlot, workspaceTemplateSlot: WorkspaceTemplateSlot, onComponentCreateSlot: OnComponentCreateSlot, config: GeneratorConfig, workspace: Workspace, envs: EnvsMain, aspectLoader: AspectLoaderMain, newComponentHelper: NewComponentHelperMain, componentAspect: ComponentMain, tracker: TrackerMain, logger: Logger, git: GitMain, wsConfigFiles: WorkspaceConfigFilesMain, deprecation: DeprecationMain);
88
+ setBitApi(bitApi: BitApi): void;
89
+ /**
90
+ * register a new component template.
91
+ * @param templates array of component templates or a function that returns an array of component templates.
92
+ * prefer to use the function to improve performance by loading the templates only when needed.
93
+ */
94
+ registerComponentTemplate(templates: ComponentTemplate[] | GetComponentTemplates): this;
95
+ /**
96
+ * register a new workspace starter.
97
+ */
98
+ registerWorkspaceTemplate(templates: WorkspaceTemplate[]): this;
99
+ registerOnComponentCreate(fn: OnComponentCreateFn): this;
100
+ /**
101
+ * list all component templates registered in the workspace or workspace templates in case the
102
+ * workspace is not available
103
+ */
104
+ listTemplates({ aspect }?: {
105
+ aspect?: string;
106
+ }): Promise<TemplateDescriptor[]>;
107
+ private getTemplateDescriptor;
108
+ /**
109
+ * @deprecated use this.listTemplates()
110
+ */
111
+ listComponentTemplates(opts: {
112
+ aspect?: string;
113
+ }): Promise<TemplateDescriptor[]>;
114
+ isRunningInsideWorkspace(): boolean;
115
+ /**
116
+ * get all component templates registered by a specific aspect ID.
117
+ */
118
+ getComponentTemplateByAspect(aspectId: string): ComponentTemplate[];
119
+ /**
120
+ * returns a specific component template.
121
+ */
122
+ getComponentTemplate(name: string, aspectId?: string): Promise<ComponentTemplateWithId | undefined>;
123
+ private findTemplateByAspectIdAndName;
124
+ /**
125
+ * get or create a global scope, import the non-core aspects, load bit from that scope, create
126
+ * capsules for the aspects and load them from the capsules.
127
+ */
128
+ private loadAspectsFromGlobalScope;
129
+ /**
130
+ * Get the generator aspect and the envs aspect from an harmony instance of the global scope
131
+ */
132
+ private getGlobalGeneratorEnvs;
133
+ /**
134
+ * in the case the aspect-id is given and this aspect doesn't exist locally, import it to the
135
+ * global scope and load it from the capsule
136
+ */
137
+ findWorkspaceTemplateInGlobalScope(aspectId: string, name?: string): Promise<{
138
+ workspaceTemplate?: WorkspaceTemplate;
139
+ aspect?: Component;
140
+ }>;
141
+ findTemplateInOtherWorkspace(workspacePath: string, name: string, aspectId?: string): Promise<{
142
+ workspaceTemplate: WorkspaceTemplate | undefined;
143
+ aspect: Component;
144
+ }>;
145
+ /**
146
+ * returns a specific workspace template.
147
+ */
148
+ getWorkspaceTemplate(name: string, aspectId?: string): Promise<{
149
+ workspaceTemplate: WorkspaceTemplate;
150
+ aspect?: Component;
151
+ }>;
152
+ searchRegisteredWorkspaceTemplate(name?: string, aspectId?: string, remoteEnvsAspect?: EnvsMain): Promise<WorkspaceTemplate | undefined>;
153
+ getTemplateWithId(templateName: string, aspect?: string): Promise<ComponentTemplateWithId>;
154
+ /**
155
+ * Parse the scope from a component name if provided in the format: scope/name
156
+ * This only works for bit.cloud scopes (containing a dot), e.g., "my-org.my-scope/hooks/use-session"
157
+ * Local bare-scopes don't contain a dot, so we can't distinguish between scope/name and namespace/name.
158
+ * @returns { scope, name } where scope is the extracted scope (or undefined) and name is the remaining component name
159
+ */
160
+ private parseScopeFromComponentIdStr;
161
+ generateComponentTemplate(componentNames: string[], templateName: string, options: Partial<CreateOptions>, installOptions?: InstallOptions, promptResults?: PromptResults): Promise<GenerateResult[]>;
162
+ private getEnvIdFromTemplateWithId;
163
+ generateWorkspaceTemplate(workspaceName: string, templateName: string, options: NewOptions & {
164
+ aspect?: string;
165
+ currentDir?: boolean;
166
+ }): Promise<GenerateWorkspaceTemplateResult>;
167
+ private warnAboutDeprecation;
168
+ private getAllComponentTemplatesDescriptorsFlattened;
169
+ private getAllComponentTemplatesFlattened;
170
+ private getAllWorkspaceTemplatesDescriptorFlattened;
171
+ private getAllWorkspaceTemplatesFlattened;
172
+ /**
173
+ * list all starter templates registered by an env.
174
+ */
175
+ listEnvWorkspaceTemplates(envId: string, remoteEnvsAspect?: EnvsMain): Promise<Array<WorkspaceTemplateWithId>>;
176
+ /**
177
+ * list all component templates registered by an env.
178
+ */
179
+ listEnvComponentTemplateDescriptors(ids?: string[], aspectId?: string): Promise<TemplateDescriptor[]>;
180
+ getConfiguredEnvs(): string[];
181
+ listEnvComponentTemplates(ids?: string[], aspectId?: string): Promise<Array<ComponentTemplateWithId>>;
182
+ loadEnvs(ids?: string[], remoteEnvsAspect?: EnvsMain): Promise<EnvDefinition[]>;
183
+ loadAspects(): Promise<void>;
184
+ /**
185
+ * Reload the generator config when workspace config changes.
186
+ * This ensures that changes to envs configuration in workspace.jsonc are reflected
187
+ * in long-running processes like "bit server".
188
+ */
189
+ onWorkspaceConfigChange(): Promise<void>;
190
+ static slots: (((registerFn: () => string) => SlotRegistry<ComponentTemplate[]>) | ((registerFn: () => string) => SlotRegistry<WorkspaceTemplate[]>) | ((registerFn: () => string) => SlotRegistry<OnComponentCreateFn>))[];
191
+ static dependencies: import("@teambit/harmony").Aspect[];
192
+ static runtime: import("@teambit/harmony").RuntimeDefinition;
193
+ static provider([workspace, cli, graphql, envs, aspectLoader, newComponentHelper, componentAspect, tracker, loggerMain, git, wsConfigFiles, deprecation,]: [
194
+ Workspace,
195
+ CLIMain,
196
+ GraphqlMain,
197
+ EnvsMain,
198
+ AspectLoaderMain,
199
+ NewComponentHelperMain,
200
+ ComponentMain,
201
+ TrackerMain,
202
+ LoggerMain,
203
+ GitMain,
204
+ WorkspaceConfigFilesMain,
205
+ DeprecationMain
206
+ ], config: GeneratorConfig, [componentTemplateSlot, workspaceTemplateSlot, onComponentCreateSlot]: [
207
+ ComponentTemplateSlot,
208
+ WorkspaceTemplateSlot,
209
+ OnComponentCreateSlot
210
+ ]): Promise<GeneratorMain>;
211
+ }
212
+ export {};