@teambit/generator 0.0.1144 → 0.0.1145

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 (148) hide show
  1. package/dist/component-template.d.ts +39 -22
  2. package/dist/component-template.js.map +1 -1
  3. package/dist/create.cmd.d.ts +10 -9
  4. package/dist/create.cmd.js +15 -12
  5. package/dist/create.cmd.js.map +1 -1
  6. package/dist/generator.graphql.d.ts +4 -0
  7. package/dist/generator.graphql.js +12 -1
  8. package/dist/generator.graphql.js.map +1 -1
  9. package/dist/generator.main.runtime.d.ts +5 -5
  10. package/dist/generator.main.runtime.js +16 -29
  11. package/dist/generator.main.runtime.js.map +1 -1
  12. package/dist/new.cmd.d.ts +6 -7
  13. package/dist/new.cmd.js +4 -0
  14. package/dist/new.cmd.js.map +1 -1
  15. package/dist/{preview-1693279117198.js → preview-1693474270980.js} +2 -2
  16. package/dist/templates/basic/basic.starter.d.ts +3 -0
  17. package/dist/templates/basic/basic.starter.js +39 -0
  18. package/dist/templates/basic/basic.starter.js.map +1 -0
  19. package/dist/templates/basic/index.d.ts +1 -0
  20. package/dist/templates/basic/index.js +20 -0
  21. package/dist/templates/basic/index.js.map +1 -0
  22. package/dist/templates/basic/template/files/git-ignore.d.ts +1 -0
  23. package/dist/templates/basic/template/files/git-ignore.js +118 -0
  24. package/dist/templates/basic/template/files/git-ignore.js.map +1 -0
  25. package/dist/templates/basic/template/files/workspace-config.d.ts +2 -0
  26. package/dist/templates/{workspace-generator/index.js → basic/template/files/workspace-config.js} +35 -11
  27. package/dist/templates/basic/template/files/workspace-config.js.map +1 -0
  28. package/dist/templates/component-generator/files/component-template-files/component.d.ts +1 -0
  29. package/dist/templates/component-generator/files/component-template-files/component.js +35 -0
  30. package/dist/templates/component-generator/files/component-template-files/component.js.map +1 -0
  31. package/dist/templates/component-generator/files/component-template-files/composition.d.ts +1 -0
  32. package/dist/templates/component-generator/files/component-template-files/composition.js +29 -0
  33. package/dist/templates/component-generator/files/component-template-files/composition.js.map +1 -0
  34. package/dist/templates/component-generator/files/component-template-files/index-file.d.ts +1 -0
  35. package/dist/templates/component-generator/files/component-template-files/index-file.js +24 -0
  36. package/dist/templates/component-generator/files/component-template-files/index-file.js.map +1 -0
  37. package/dist/templates/component-generator/files/component-template-files/test.d.ts +1 -0
  38. package/dist/templates/component-generator/files/component-template-files/test.js +31 -0
  39. package/dist/templates/component-generator/files/component-template-files/test.js.map +1 -0
  40. package/dist/templates/component-generator/files/component-template.d.ts +2 -0
  41. package/dist/templates/component-generator/files/component-template.js +67 -0
  42. package/dist/templates/component-generator/files/component-template.js.map +1 -0
  43. package/dist/templates/component-generator/files/index.d.ts +1 -1
  44. package/dist/templates/component-generator/files/index.js +1 -5
  45. package/dist/templates/component-generator/files/index.js.map +1 -1
  46. package/dist/templates/component-generator/index.d.ts +1 -1
  47. package/dist/templates/component-generator/index.js +36 -16
  48. package/dist/templates/component-generator/index.js.map +1 -1
  49. package/dist/templates/{component-generator → component-generator-standalone}/files/aspect-file.d.ts +1 -1
  50. package/dist/templates/component-generator-standalone/files/aspect-file.js.map +1 -0
  51. package/dist/templates/component-generator-standalone/files/index.d.ts +2 -0
  52. package/dist/templates/component-generator-standalone/files/index.js +19 -0
  53. package/dist/templates/component-generator-standalone/files/index.js.map +1 -0
  54. package/dist/templates/{component-generator → component-generator-standalone}/files/main-runtime.d.ts +1 -1
  55. package/dist/templates/component-generator-standalone/files/main-runtime.js.map +1 -0
  56. package/dist/templates/component-generator-standalone/index.d.ts +2 -0
  57. package/dist/templates/component-generator-standalone/index.js +64 -0
  58. package/dist/templates/component-generator-standalone/index.js.map +1 -0
  59. package/dist/templates/index.d.ts +4 -0
  60. package/dist/templates/index.js +59 -0
  61. package/dist/templates/index.js.map +1 -0
  62. package/dist/templates/starter/files/doc-file.d.ts +2 -0
  63. package/dist/templates/starter/files/doc-file.js +33 -0
  64. package/dist/templates/starter/files/doc-file.js.map +1 -0
  65. package/dist/templates/starter/files/generate-files.d.ts +1 -0
  66. package/dist/templates/starter/files/generate-files.js +35 -0
  67. package/dist/templates/starter/files/generate-files.js.map +1 -0
  68. package/dist/templates/starter/files/index.d.ts +1 -1
  69. package/dist/templates/starter/files/index.js +1 -1
  70. package/dist/templates/starter/files/index.js.map +1 -1
  71. package/dist/templates/starter/files/starter.d.ts +2 -1
  72. package/dist/templates/starter/files/starter.js +39 -29
  73. package/dist/templates/starter/files/starter.js.map +1 -1
  74. package/dist/templates/starter/files/workspace-config-tpl.js +7 -1
  75. package/dist/templates/starter/files/workspace-config-tpl.js.map +1 -1
  76. package/dist/templates/starter/index.d.ts +1 -1
  77. package/dist/templates/starter/index.js +16 -16
  78. package/dist/templates/starter/index.js.map +1 -1
  79. package/dist/templates/starter-standalone/files/doc-file.d.ts +2 -0
  80. package/dist/templates/starter-standalone/files/doc-file.js +33 -0
  81. package/dist/templates/starter-standalone/files/doc-file.js.map +1 -0
  82. package/dist/templates/starter-standalone/files/git-ignore-tpl.d.ts +1 -0
  83. package/dist/templates/starter-standalone/files/git-ignore-tpl.js +121 -0
  84. package/dist/templates/starter-standalone/files/git-ignore-tpl.js.map +1 -0
  85. package/dist/templates/starter-standalone/files/index.d.ts +2 -0
  86. package/dist/templates/starter-standalone/files/index.js +15 -0
  87. package/dist/templates/starter-standalone/files/index.js.map +1 -0
  88. package/dist/templates/starter-standalone/files/starter.d.ts +2 -0
  89. package/dist/templates/starter-standalone/files/starter.js +44 -0
  90. package/dist/templates/starter-standalone/files/starter.js.map +1 -0
  91. package/dist/templates/starter-standalone/files/workspace-config-tpl.d.ts +1 -0
  92. package/dist/templates/starter-standalone/files/workspace-config-tpl.js +30 -0
  93. package/dist/templates/starter-standalone/files/workspace-config-tpl.js.map +1 -0
  94. package/dist/templates/starter-standalone/index.d.ts +2 -0
  95. package/dist/templates/starter-standalone/index.js +73 -0
  96. package/dist/templates/starter-standalone/index.js.map +1 -0
  97. package/dist/workspace-generator.js +17 -1
  98. package/dist/workspace-generator.js.map +1 -1
  99. package/dist/workspace-template.d.ts +37 -29
  100. package/dist/workspace-template.js.map +1 -1
  101. package/package.json +22 -22
  102. package/templates/basic/basic.starter.ts +22 -0
  103. package/templates/basic/index.ts +1 -0
  104. package/templates/basic/template/files/git-ignore.ts +110 -0
  105. package/templates/basic/template/files/workspace-config.ts +33 -0
  106. package/templates/component-generator/files/component-template-files/component.ts +26 -0
  107. package/templates/component-generator/files/component-template-files/composition.ts +20 -0
  108. package/templates/component-generator/files/component-template-files/index-file.ts +15 -0
  109. package/templates/component-generator/files/component-template-files/test.ts +22 -0
  110. package/templates/component-generator/files/component-template.ts +58 -0
  111. package/templates/component-generator/files/index.ts +2 -6
  112. package/templates/component-generator/index.ts +22 -12
  113. package/templates/{component-generator → component-generator-standalone}/files/aspect-file.ts +1 -1
  114. package/templates/component-generator-standalone/files/index.ts +10 -0
  115. package/templates/{component-generator → component-generator-standalone}/files/main-runtime.ts +1 -1
  116. package/templates/component-generator-standalone/index.ts +39 -0
  117. package/templates/index.ts +4 -0
  118. package/templates/starter/files/doc-file.ts +24 -0
  119. package/templates/starter/files/generate-files.ts +27 -0
  120. package/templates/starter/files/index.ts +2 -2
  121. package/templates/starter/files/starter.ts +37 -28
  122. package/templates/starter/files/workspace-config-tpl.ts +7 -1
  123. package/templates/starter/index.ts +13 -11
  124. package/templates/starter-standalone/files/doc-file.ts +24 -0
  125. package/templates/starter-standalone/files/git-ignore-tpl.ts +113 -0
  126. package/templates/starter-standalone/files/index.ts +6 -0
  127. package/templates/starter-standalone/files/starter.ts +35 -0
  128. package/templates/starter-standalone/files/workspace-config-tpl.ts +22 -0
  129. package/templates/starter-standalone/index.ts +44 -0
  130. package/dist/templates/component-generator/files/aspect-file.js.map +0 -1
  131. package/dist/templates/component-generator/files/main-runtime.js.map +0 -1
  132. package/dist/templates/starter/files/docs-file.d.ts +0 -1
  133. package/dist/templates/starter/files/docs-file.js +0 -45
  134. package/dist/templates/starter/files/docs-file.js.map +0 -1
  135. package/dist/templates/starter/files/readme-tpl.d.ts +0 -1
  136. package/dist/templates/starter/files/readme-tpl.js +0 -47
  137. package/dist/templates/starter/files/readme-tpl.js.map +0 -1
  138. package/dist/templates/workspace-generator/index.d.ts +0 -2
  139. package/dist/templates/workspace-generator/index.js.map +0 -1
  140. package/templates/starter/files/docs-file.ts +0 -37
  141. package/templates/starter/files/readme-tpl.ts +0 -39
  142. package/templates/workspace-generator/index.ts +0 -10
  143. /package/dist/templates/{component-generator → component-generator-standalone}/files/aspect-file.js +0 -0
  144. /package/dist/templates/{component-generator → component-generator-standalone}/files/docs-file.d.ts +0 -0
  145. /package/dist/templates/{component-generator → component-generator-standalone}/files/docs-file.js +0 -0
  146. /package/dist/templates/{component-generator → component-generator-standalone}/files/docs-file.js.map +0 -0
  147. /package/dist/templates/{component-generator → component-generator-standalone}/files/main-runtime.js +0 -0
  148. /package/templates/{component-generator → component-generator-standalone}/files/docs-file.ts +0 -0
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generateComponentFileContent = void 0;
7
+ const generateComponentFileContent = () => {
8
+ return `import { ComponentContext } from '@teambit/generator';
9
+
10
+ export const componentFile = (context: ComponentContext) => {
11
+ const { name, namePascalCase: Name } = context;
12
+
13
+ return {
14
+ relativePath: \`\${name}.tsx\`,
15
+ content: \`import type { ReactNode } from 'react';
16
+
17
+ export type \${Name}Props = {
18
+ children?: ReactNode;
19
+ };
20
+
21
+ export function \${Name}({ children }: \${Name}Props) {
22
+ return (
23
+ <div>
24
+ {children}
25
+ </div>
26
+ );
27
+ }
28
+ \`,
29
+ };
30
+ };
31
+ `;
32
+ };
33
+ exports.generateComponentFileContent = generateComponentFileContent;
34
+
35
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["generateComponentFileContent","exports"],"sources":["component.ts"],"sourcesContent":["export const generateComponentFileContent = () => {\n return `import { ComponentContext } from '@teambit/generator';\n\nexport const componentFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n\n return {\n relativePath: \\`\\${name}.tsx\\`,\n content: \\`import type { ReactNode } from 'react';\n\nexport type \\${Name}Props = {\n children?: ReactNode;\n};\n\nexport function \\${Name}({ children }: \\${Name}Props) {\n return (\n <div>\n {children}\n </div>\n );\n}\n\\`,\n };\n};\n`;\n};\n"],"mappings":";;;;;;AAAO,MAAMA,4BAA4B,GAAGA,CAAA,KAAM;EAChD,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,CAAC;AAACC,OAAA,CAAAD,4BAAA,GAAAA,4BAAA"}
@@ -0,0 +1 @@
1
+ export declare const generateCompositionFileContent: () => string;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generateCompositionFileContent = void 0;
7
+ const generateCompositionFileContent = () => {
8
+ return `import { ComponentContext } from '@teambit/generator';
9
+
10
+ export const compositionFile = (context: ComponentContext) => {
11
+ const { name, namePascalCase: Name } = context;
12
+
13
+ return {
14
+ relativePath: \`\${name}.composition.tsx\`,
15
+ content: \`import { \${Name} } from './\${name}';
16
+
17
+ export const Basic\${Name} = () => {
18
+ return (
19
+ <\${Name}>hello world!</\${Name}>
20
+ );
21
+ }
22
+ \`,
23
+ };
24
+ };
25
+ `;
26
+ };
27
+ exports.generateCompositionFileContent = generateCompositionFileContent;
28
+
29
+ //# sourceMappingURL=composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["generateCompositionFileContent","exports"],"sources":["composition.ts"],"sourcesContent":["export const generateCompositionFileContent = () => {\n return `import { ComponentContext } from '@teambit/generator';\n\nexport const compositionFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n\n return {\n relativePath: \\`\\${name}.composition.tsx\\`,\n content: \\`import { \\${Name} } from './\\${name}';\n\nexport const Basic\\${Name} = () => {\n return (\n <\\${Name}>hello world!</\\${Name}>\n );\n}\n\\`,\n };\n};\n`;\n};\n"],"mappings":";;;;;;AAAO,MAAMA,8BAA8B,GAAGA,CAAA,KAAM;EAClD,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,CAAC;AAACC,OAAA,CAAAD,8BAAA,GAAAA,8BAAA"}
@@ -0,0 +1 @@
1
+ export declare const generateIndexFileContent: () => string;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generateIndexFileContent = void 0;
7
+ const generateIndexFileContent = () => {
8
+ return `import { ComponentContext } from '@teambit/generator';
9
+
10
+ export const indexFile = (context: ComponentContext) => {
11
+ const { name, namePascalCase: Name } = context;
12
+
13
+ return {
14
+ relativePath: 'index.ts',
15
+ content: \`export { \${Name} } from './\${name}';
16
+ export type { \${Name}Props } from './\${name}';
17
+ \`,
18
+ };
19
+ };
20
+ `;
21
+ };
22
+ exports.generateIndexFileContent = generateIndexFileContent;
23
+
24
+ //# sourceMappingURL=index-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["generateIndexFileContent","exports"],"sources":["index-file.ts"],"sourcesContent":["export const generateIndexFileContent = () => {\n return `import { ComponentContext } from '@teambit/generator';\n\nexport const indexFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n\n return {\n relativePath: 'index.ts',\n content: \\`export { \\${Name} } from './\\${name}';\nexport type { \\${Name}Props } from './\\${name}';\n\\`,\n };\n};\n`;\n};\n"],"mappings":";;;;;;AAAO,MAAMA,wBAAwB,GAAGA,CAAA,KAAM;EAC5C,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,CAAC;AAACC,OAAA,CAAAD,wBAAA,GAAAA,wBAAA"}
@@ -0,0 +1 @@
1
+ export declare const generateTestFileContent: () => string;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.generateTestFileContent = void 0;
7
+ const generateTestFileContent = () => {
8
+ return `import { ComponentContext } from '@teambit/generator';
9
+
10
+ export const testFile = (context: ComponentContext) => {
11
+ const { name, namePascalCase: Name } = context;
12
+
13
+ return {
14
+ relativePath: name + '.spec.tsx',
15
+ content: \`import React from 'react';
16
+ import { render } from '@testing-library/react';
17
+ import { Basic\${Name} } from './\${name}.composition';
18
+
19
+ it('renders with the correct text', () => {
20
+ const { getByText } = render(<Basic\${Name} />);
21
+ const rendered = getByText('hello world!');
22
+ expect(rendered).toBeTruthy();
23
+ });
24
+ \`,
25
+ };
26
+ };
27
+ `;
28
+ };
29
+ exports.generateTestFileContent = generateTestFileContent;
30
+
31
+ //# sourceMappingURL=test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["generateTestFileContent","exports"],"sources":["test.ts"],"sourcesContent":["export const generateTestFileContent = () => {\n return `import { ComponentContext } from '@teambit/generator';\n\nexport const testFile = (context: ComponentContext) => {\n const { name, namePascalCase: Name } = context;\n\n return {\n relativePath: name + '.spec.tsx',\n content: \\`import React from 'react';\nimport { render } from '@testing-library/react';\nimport { Basic\\${Name} } from './\\${name}.composition';\n\nit('renders with the correct text', () => {\n const { getByText } = render(<Basic\\${Name} />);\n const rendered = getByText('hello world!');\n expect(rendered).toBeTruthy();\n});\n\\`,\n };\n};\n`;\n};\n"],"mappings":";;;;;;AAAO,MAAMA,uBAAuB,GAAGA,CAAA,KAAM;EAC3C,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,CAAC;AAACC,OAAA,CAAAD,uBAAA,GAAAA,uBAAA"}
@@ -0,0 +1,2 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function componentTemplate({ namePascalCase, name }: ComponentContext): string;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.componentTemplate = componentTemplate;
7
+ function componentTemplate({
8
+ namePascalCase,
9
+ name
10
+ }) {
11
+ return `import {
12
+ ComponentContext,
13
+ ComponentFile,
14
+ ComponentTemplate,
15
+ } from '@teambit/generator';
16
+ import { indexFile } from './files/index-file';
17
+ import { componentFile } from './files/component-file';
18
+ import { testFile } from './files/test-file';
19
+ import { compositionFile } from './files/composition-file';
20
+
21
+ export type ${namePascalCase}ComponentTemplateOptions = {
22
+ /**
23
+ * name of the template
24
+ */
25
+ name?: string;
26
+
27
+ /**
28
+ * description of the template.
29
+ */
30
+ description?: string;
31
+
32
+ /**
33
+ * hide the template from the templates command.
34
+ */
35
+ hidden?: boolean;
36
+ };
37
+
38
+ export class ${namePascalCase}ComponentTemplate implements ComponentTemplate {
39
+ constructor(
40
+ readonly name = '${name}',
41
+ readonly description = 'a template for ${name} components',
42
+ readonly hidden = false
43
+ ) {}
44
+
45
+ generateFiles(context: ComponentContext): ComponentFile[] {
46
+ return [
47
+ indexFile(context),
48
+ compositionFile(context),
49
+ componentFile(context),
50
+ testFile(context),
51
+ ];
52
+ }
53
+
54
+ static from(options: ${namePascalCase}ComponentTemplateOptions = {}) {
55
+ return () =>
56
+ new ${namePascalCase}ComponentTemplate(
57
+ options.name,
58
+ options.description,
59
+ options.hidden
60
+ );
61
+ }
62
+ }
63
+
64
+ `;
65
+ }
66
+
67
+ //# sourceMappingURL=component-template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["componentTemplate","namePascalCase","name"],"sources":["component-template.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function componentTemplate({ namePascalCase, name }: ComponentContext) {\n return `import {\n ComponentContext,\n ComponentFile,\n ComponentTemplate,\n } from '@teambit/generator';\n import { indexFile } from './files/index-file';\n import { componentFile } from './files/component-file';\n import { testFile } from './files/test-file';\n import { compositionFile } from './files/composition-file';\n \n export type ${namePascalCase}ComponentTemplateOptions = {\n /**\n * name of the template\n */\n name?: string;\n \n /**\n * description of the template.\n */\n description?: string;\n \n /**\n * hide the template from the templates command.\n */\n hidden?: boolean;\n };\n \n export class ${namePascalCase}ComponentTemplate implements ComponentTemplate {\n constructor(\n readonly name = '${name}',\n readonly description = 'a template for ${name} components',\n readonly hidden = false\n ) {}\n \n generateFiles(context: ComponentContext): ComponentFile[] {\n return [\n indexFile(context),\n compositionFile(context),\n componentFile(context),\n testFile(context),\n ];\n }\n \n static from(options: ${namePascalCase}ComponentTemplateOptions = {}) {\n return () =>\n new ${namePascalCase}ComponentTemplate(\n options.name,\n options.description,\n options.hidden\n );\n }\n }\n \n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,iBAAiBA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EAC5E,OAAQ;AACV;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAgBD,cAAe;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAiBA,cAAe;AAChC;AACA,yBAAyBC,IAAK;AAC9B,+CAA+CA,IAAK;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,2BAA2BD,cAAe;AAC1C;AACA,cAAcA,cAAe;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD"}
@@ -1,2 +1,2 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../..';
2
2
  export declare function indexFile({ namePascalCase, name }: ComponentContext): string;
@@ -8,11 +8,7 @@ function indexFile({
8
8
  namePascalCase,
9
9
  name
10
10
  }) {
11
- return `import { ${namePascalCase}Aspect } from './${name}.aspect';
12
-
13
- export type { ${namePascalCase}Main } from './${name}.main.runtime';
14
- export default ${namePascalCase}Aspect;
15
- export { ${namePascalCase}Aspect };
11
+ return `export { ${namePascalCase}ComponentTemplate } from './${name}';
16
12
  `;
17
13
  }
18
14
 
@@ -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 '../../..';\n\nexport function indexFile({ namePascalCase, name }: ComponentContext) {\n return `export { ${namePascalCase}ComponentTemplate } from './${name}';\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,SAASA,CAAC;EAAEC,cAAc;EAAEC;AAAuB,CAAC,EAAE;EACpE,OAAQ,YAAWD,cAAe,+BAA8BC,IAAK;AACvE,CAAC;AACD"}
@@ -1,2 +1,2 @@
1
- import { ComponentTemplate } from '@teambit/generator';
1
+ import { ComponentTemplate } from '../..';
2
2
  export declare const componentGeneratorTemplate: ComponentTemplate;
@@ -11,44 +11,64 @@ function _index() {
11
11
  };
12
12
  return data;
13
13
  }
14
- function _aspectFile() {
15
- const data = require("./files/aspect-file");
16
- _aspectFile = function () {
14
+ function _test() {
15
+ const data = require("./files/component-template-files/test");
16
+ _test = function () {
17
17
  return data;
18
18
  };
19
19
  return data;
20
20
  }
21
- function _docsFile() {
22
- const data = require("./files/docs-file");
23
- _docsFile = function () {
21
+ function _component() {
22
+ const data = require("./files/component-template-files/component");
23
+ _component = function () {
24
24
  return data;
25
25
  };
26
26
  return data;
27
27
  }
28
- function _mainRuntime() {
29
- const data = require("./files/main-runtime");
30
- _mainRuntime = function () {
28
+ function _composition() {
29
+ const data = require("./files/component-template-files/composition");
30
+ _composition = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ function _indexFile() {
36
+ const data = require("./files/component-template-files/index-file");
37
+ _indexFile = function () {
38
+ return data;
39
+ };
40
+ return data;
41
+ }
42
+ function _componentTemplate() {
43
+ const data = require("./files/component-template");
44
+ _componentTemplate = function () {
31
45
  return data;
32
46
  };
33
47
  return data;
34
48
  }
35
49
  const componentGeneratorTemplate = {
36
50
  name: 'component-generator',
37
- description: 'create your own component generator \nDocs: https://bit.dev/docs/dev-services/generator/generate-component',
51
+ description: 'create your own component generator \nDocs: https://bit.dev/reference/generator/create-generator',
38
52
  generateFiles: context => {
39
53
  return [{
40
54
  relativePath: 'index.ts',
41
55
  content: (0, _index().indexFile)(context),
42
56
  isMain: true
43
57
  }, {
44
- relativePath: `${context.name}.aspect.ts`,
45
- content: (0, _aspectFile().aspectFile)(context)
58
+ relativePath: `./${context.name}.ts`,
59
+ content: (0, _componentTemplate().componentTemplate)(context)
60
+ }, {
61
+ relativePath: `./files/test-file.ts`,
62
+ content: (0, _test().generateTestFileContent)()
63
+ }, {
64
+ relativePath: `./files/composition-file.ts`,
65
+ content: (0, _composition().generateCompositionFileContent)()
46
66
  }, {
47
- relativePath: `${context.name}.docs.mdx`,
48
- content: (0, _docsFile().docsFile)()
67
+ relativePath: `./files/component-file.ts`,
68
+ content: (0, _component().generateComponentFileContent)()
49
69
  }, {
50
- relativePath: `${context.name}.main.runtime.ts`,
51
- content: (0, _mainRuntime().mainRuntime)(context)
70
+ relativePath: `./files/index-file.ts`,
71
+ content: (0, _indexFile().generateIndexFileContent)()
52
72
  }];
53
73
  },
54
74
  config: {
@@ -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":["_index","data","require","_test","_component","_composition","_indexFile","_componentTemplate","componentGeneratorTemplate","name","description","generateFiles","context","relativePath","content","indexFile","isMain","componentTemplate","generateTestFileContent","generateCompositionFileContent","generateComponentFileContent","generateIndexFileContent","config","env","exports"],"sources":["index.ts"],"sourcesContent":["import { ComponentContext, ComponentTemplate } from '../..';\nimport { indexFile } from './files/index';\nimport { generateTestFileContent } from './files/component-template-files/test';\nimport { generateComponentFileContent } from './files/component-template-files/component';\nimport { generateCompositionFileContent } from './files/component-template-files/composition';\nimport { generateIndexFileContent } from './files/component-template-files/index-file';\nimport { componentTemplate } from './files/component-template';\n\nexport const componentGeneratorTemplate: ComponentTemplate = {\n name: 'component-generator',\n description: 'create your own component generator \\nDocs: https://bit.dev/reference/generator/create-generator',\n generateFiles: (context: ComponentContext) => {\n return [\n {\n relativePath: 'index.ts',\n content: indexFile(context),\n isMain: true,\n },\n\n {\n relativePath: `./${context.name}.ts`,\n content: componentTemplate(context),\n },\n {\n relativePath: `./files/test-file.ts`,\n content: generateTestFileContent(),\n },\n {\n relativePath: `./files/composition-file.ts`,\n content: generateCompositionFileContent(),\n },\n {\n relativePath: `./files/component-file.ts`,\n content: generateComponentFileContent(),\n },\n {\n relativePath: `./files/index-file.ts`,\n content: generateIndexFileContent(),\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,MAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,WAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,UAAA,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;AACA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAC,OAAA;EAAAI,UAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,mBAAA;EAAA,MAAAN,IAAA,GAAAC,OAAA;EAAAK,kBAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEO,MAAMO,0BAA6C,GAAG;EAC3DC,IAAI,EAAE,qBAAqB;EAC3BC,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,EAED;MACEH,YAAY,EAAG,KAAID,OAAO,CAACH,IAAK,KAAI;MACpCK,OAAO,EAAE,IAAAG,sCAAiB,EAACL,OAAO;IACpC,CAAC,EACD;MACEC,YAAY,EAAG,sBAAqB;MACpCC,OAAO,EAAE,IAAAI,+BAAuB,EAAC;IACnC,CAAC,EACD;MACEL,YAAY,EAAG,6BAA4B;MAC3CC,OAAO,EAAE,IAAAK,6CAA8B,EAAC;IAC1C,CAAC,EACD;MACEN,YAAY,EAAG,2BAA0B;MACzCC,OAAO,EAAE,IAAAM,yCAA4B,EAAC;IACxC,CAAC,EACD;MACEP,YAAY,EAAG,uBAAsB;MACrCC,OAAO,EAAE,IAAAO,qCAAwB,EAAC;IACpC,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,0BAAA,GAAAA,0BAAA"}
@@ -1,2 +1,2 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../..';
2
2
  export declare function aspectFile({ namePascalCase, componentId }: ComponentContext): string;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["aspectFile","namePascalCase","componentId"],"sources":["aspect-file.ts"],"sourcesContent":["import { ComponentContext } from '../../..';\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"}
@@ -0,0 +1,2 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function indexFile({ namePascalCase, name }: ComponentContext): string;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.indexFile = indexFile;
7
+ function indexFile({
8
+ namePascalCase,
9
+ name
10
+ }) {
11
+ return `import { ${namePascalCase}Aspect } from './${name}.aspect';
12
+
13
+ export type { ${namePascalCase}Main } from './${name}.main.runtime';
14
+ export default ${namePascalCase}Aspect;
15
+ export { ${namePascalCase}Aspect };
16
+ `;
17
+ }
18
+
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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,2 +1,2 @@
1
- import { ComponentContext } from '@teambit/generator';
1
+ import { ComponentContext } from '../../..';
2
2
  export declare function mainRuntime({ name, namePascalCase }: ComponentContext): string;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["mainRuntime","name","namePascalCase"],"sources":["main-runtime.ts"],"sourcesContent":["import { ComponentContext } from '../../..';\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"}
@@ -0,0 +1,2 @@
1
+ import { ComponentTemplate } from '@teambit/generator';
2
+ export declare const componentGeneratorTemplate: ComponentTemplate;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.componentGeneratorTemplate = void 0;
7
+ function _index() {
8
+ const data = require("./files/index");
9
+ _index = function () {
10
+ return data;
11
+ };
12
+ return data;
13
+ }
14
+ function _aspectFile() {
15
+ const data = require("./files/aspect-file");
16
+ _aspectFile = function () {
17
+ return data;
18
+ };
19
+ return data;
20
+ }
21
+ function _docsFile() {
22
+ const data = require("./files/docs-file");
23
+ _docsFile = function () {
24
+ return data;
25
+ };
26
+ return data;
27
+ }
28
+ function _mainRuntime() {
29
+ const data = require("./files/main-runtime");
30
+ _mainRuntime = function () {
31
+ return data;
32
+ };
33
+ return data;
34
+ }
35
+ const componentGeneratorTemplate = {
36
+ name: 'component-generator',
37
+ description: 'create your own component generator \nDocs: https://bit.dev/docs/dev-services/generator/generate-component',
38
+ hidden: true,
39
+ generateFiles: context => {
40
+ return [{
41
+ relativePath: 'index.ts',
42
+ content: (0, _index().indexFile)(context),
43
+ isMain: true
44
+ }, {
45
+ relativePath: `${context.name}.aspect.ts`,
46
+ content: (0, _aspectFile().aspectFile)(context)
47
+ }, {
48
+ relativePath: `${context.name}.docs.mdx`,
49
+ content: (0, _docsFile().docsFile)()
50
+ }, {
51
+ relativePath: `${context.name}.main.runtime.ts`,
52
+ content: (0, _mainRuntime().mainRuntime)(context)
53
+ }];
54
+ },
55
+ config: {
56
+ 'teambit.harmony/aspect': {},
57
+ 'teambit.envs/envs': {
58
+ env: 'teambit.harmony/aspect'
59
+ }
60
+ }
61
+ };
62
+ exports.componentGeneratorTemplate = componentGeneratorTemplate;
63
+
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_index","data","require","_aspectFile","_docsFile","_mainRuntime","componentGeneratorTemplate","name","description","hidden","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 hidden: true,\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,MAAM,EAAE,IAAI;EACZC,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,CAACJ,IAAK,YAAW;MACzCM,OAAO,EAAE,IAAAG,wBAAU,EAACL,OAAO;IAC7B,CAAC,EACD;MACEC,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,WAAU;MACxCM,OAAO,EAAE,IAAAI,oBAAQ,EAAC;IACpB,CAAC,EACD;MACEL,YAAY,EAAG,GAAED,OAAO,CAACJ,IAAK,kBAAiB;MAC/CM,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,CAAAf,0BAAA,GAAAA,0BAAA"}
@@ -0,0 +1,4 @@
1
+ export { starterTemplate as starterTemplateStandalone } from './starter-standalone';
2
+ export { starterTemplate } from './starter';
3
+ export { componentGeneratorTemplate as componentGeneratorTemplateStandalone } from './component-generator-standalone';
4
+ export { componentGeneratorTemplate } from './component-generator';
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "componentGeneratorTemplate", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _componentGenerator().componentGeneratorTemplate;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "componentGeneratorTemplateStandalone", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _componentGeneratorStandalone().componentGeneratorTemplate;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "starterTemplate", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _starter().starterTemplate;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "starterTemplateStandalone", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _starterStandalone().starterTemplate;
28
+ }
29
+ });
30
+ function _starterStandalone() {
31
+ const data = require("./starter-standalone");
32
+ _starterStandalone = function () {
33
+ return data;
34
+ };
35
+ return data;
36
+ }
37
+ function _starter() {
38
+ const data = require("./starter");
39
+ _starter = function () {
40
+ return data;
41
+ };
42
+ return data;
43
+ }
44
+ function _componentGeneratorStandalone() {
45
+ const data = require("./component-generator-standalone");
46
+ _componentGeneratorStandalone = function () {
47
+ return data;
48
+ };
49
+ return data;
50
+ }
51
+ function _componentGenerator() {
52
+ const data = require("./component-generator");
53
+ _componentGenerator = function () {
54
+ return data;
55
+ };
56
+ return data;
57
+ }
58
+
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_starterStandalone","data","require","_starter","_componentGeneratorStandalone","_componentGenerator"],"sources":["index.ts"],"sourcesContent":["export { starterTemplate as starterTemplateStandalone } from './starter-standalone';\nexport { starterTemplate } from './starter';\nexport { componentGeneratorTemplate as componentGeneratorTemplateStandalone } from './component-generator-standalone';\nexport { componentGeneratorTemplate } from './component-generator';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAAA,mBAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,kBAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,SAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,QAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,8BAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,6BAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,oBAAA;EAAA,MAAAJ,IAAA,GAAAC,OAAA;EAAAG,mBAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA"}
@@ -0,0 +1,2 @@
1
+ import { ComponentContext } from '@teambit/generator';
2
+ export declare function docFile(context: ComponentContext): string;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.docFile = docFile;
7
+ function docFile(context) {
8
+ const {
9
+ name,
10
+ componentId
11
+ } = context;
12
+ return `---
13
+ description: Starter for generating a ${name} workspace
14
+ labels: ['generator', 'templates', '${name}-workspace']
15
+ ---
16
+
17
+ ## Using the ${name} Workspace Starter
18
+
19
+ How to use this generator locally, essentially for development purposes:
20
+
21
+ \`\`\`js
22
+ bit new ${name} my-${name}-workspace --load-from /Users/me/path/to/this/dir --aspect ${componentId.toString()}
23
+ \`\`\`
24
+
25
+ How to use this generator after exporting to a remote scope:
26
+
27
+ \`\`\`js
28
+ bit new ${name} my-${name}-workspace --aspect ${componentId.toString()}
29
+ \`\`\`
30
+ `;
31
+ }
32
+
33
+ //# sourceMappingURL=doc-file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["docFile","context","name","componentId","toString"],"sources":["doc-file.ts"],"sourcesContent":["import { ComponentContext } from '@teambit/generator';\n\nexport function docFile(context: ComponentContext) {\n const { name, componentId } = context;\n return `---\ndescription: Starter for generating a ${name} workspace\nlabels: ['generator', 'templates', '${name}-workspace']\n---\n\n## Using the ${name} Workspace Starter\n\nHow to use this generator locally, essentially for development purposes:\n\n\\`\\`\\`js\nbit new ${name} my-${name}-workspace --load-from /Users/me/path/to/this/dir --aspect ${componentId.toString()}\n\\`\\`\\`\n\nHow to use this generator after exporting to a remote scope:\n\n\\`\\`\\`js\nbit new ${name} my-${name}-workspace --aspect ${componentId.toString()}\n\\`\\`\\`\n`;\n}\n"],"mappings":";;;;;;AAEO,SAASA,OAAOA,CAACC,OAAyB,EAAE;EACjD,MAAM;IAAEC,IAAI;IAAEC;EAAY,CAAC,GAAGF,OAAO;EACrC,OAAQ;AACV,wCAAwCC,IAAK;AAC7C,sCAAsCA,IAAK;AAC3C;AACA;AACA,eAAeA,IAAK;AACpB;AACA;AACA;AACA;AACA,UAAUA,IAAK,OAAMA,IAAK,8DAA6DC,WAAW,CAACC,QAAQ,CAAC,CAAE;AAC9G;AACA;AACA;AACA;AACA;AACA,UAAUF,IAAK,OAAMA,IAAK,uBAAsBC,WAAW,CAACC,QAAQ,CAAC,CAAE;AACvE;AACA,CAAC;AACD"}
@@ -0,0 +1 @@
1
+ export declare function generateFiles(): string;