@teambit/generator 1.0.1267 → 1.0.1268

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.
@@ -1,169 +1 @@
1
- import type { ComponentID } from '@teambit/component';
2
- /**
3
- * BaseComponentTemplateOptions describes the foundational properties for components.
4
- */
5
- export interface BaseComponentTemplateOptions {
6
- /**
7
- * component-name as entered by the user, e.g. `use-date`.
8
- * without the scope and the namespace.
9
- */
10
- name: string;
11
- /**
12
- * component-name as upper camel case, e.g. `use-date` becomes `UseDate`.
13
- * useful when generating the file content, for example for a class name.
14
- */
15
- namePascalCase: string;
16
- /**
17
- * component-name as lower camel case, e.g. `use-date` becomes `useDate`.
18
- * useful when generating the file content, for example for a function/variable name.
19
- */
20
- nameCamelCase: string;
21
- /**
22
- * component id.
23
- * the name is the name+namespace. the scope is the scope entered by --scope flag or the defaultScope
24
- */
25
- componentId: ComponentID;
26
- /**
27
- * aspect id of the aspect that register the template itself
28
- */
29
- aspectId: ComponentID | string;
30
- /**
31
- * env id of the env that register the template itself.
32
- * This will be usually identical to the aspectId but aspectId will always exist,
33
- * while envId will be undefined if the template is not registered by an env.
34
- */
35
- envId?: ComponentID;
36
- /**
37
- * path of the component.
38
- */
39
- path?: string;
40
- /**
41
- * scope of the component.
42
- */
43
- scope?: string;
44
- /**
45
- * namespace of the component.
46
- */
47
- namespace?: string;
48
- /**
49
- * when a template implements the promptOptions function, this object will be populated with the user responses.
50
- */
51
- promptResults?: PromptResults;
52
- }
53
- /**
54
- * ComponentContext represents foundational properties for a component context.
55
- */
56
- export type ComponentContext = BaseComponentTemplateOptions;
57
- export interface ComponentFile {
58
- /**
59
- * relative path of the file within the component.
60
- */
61
- relativePath: string;
62
- /**
63
- * file content
64
- */
65
- content: string;
66
- /**
67
- * whether this file will be tracked as the main file
68
- */
69
- isMain?: boolean;
70
- }
71
- export interface ConfigContext {
72
- /**
73
- * Aspect id of the aspect that register the template itself
74
- */
75
- aspectId: string;
76
- }
77
- export type ComponentConfig = {
78
- [aspectName: string]: any;
79
- };
80
- export interface ComponentTemplateOptions {
81
- /**
82
- * name of the component template. for example: `hook`, `react-component` or `module`.
83
- */
84
- name?: string;
85
- /**
86
- * display name of the template.
87
- */
88
- displayName?: string;
89
- /**
90
- * example name for the component template.
91
- */
92
- exampleComponentName?: string;
93
- /**
94
- * short description of the template. shown in the `bit templates` command.
95
- */
96
- description?: string;
97
- /**
98
- * hide this template so that it is not listed with `bit templates`
99
- */
100
- hidden?: boolean;
101
- /**
102
- * env to use for the generated component.
103
- */
104
- env?: string;
105
- /**
106
- * adds a metadata that the component that this template creates is of type env.
107
- * This will be used later to do further configuration for example:
108
- * - ensure to create the .bit_root for it
109
- */
110
- isEnv?: boolean;
111
- /**
112
- * adds a metadata that the component that this template creates is of type app.
113
- * This will be used later to do further configuration for example:
114
- * - add it to the workspace.jsonc as app
115
- * - ensure to create the .bit_root for it
116
- */
117
- isApp?: boolean;
118
- /**
119
- * list of dependencies to install when the component is created.
120
- */
121
- dependencies?: string[];
122
- /**
123
- * Perform installation of missing dependencies after component generation.
124
- * This is the same as of running `bit install --add-missing-deps` after component generation.
125
- */
126
- installMissingDependencies?: boolean;
127
- }
128
- /**
129
- * PromptOption is shown to the user before calling the generateFiles function.
130
- * The prompt is using enquirer under the hood. see https://www.npmjs.com/package/enquirer.
131
- * Examples:
132
- * - input: {name: 'name', message: 'enter your name', type: 'input'}
133
- * - confirm: {name: 'isHappy', message: 'are you happy?', type: 'confirm'}
134
- * - select: {name: 'color', message: 'pick a color', type: 'select', choices: ['red', 'blue', 'green']}
135
- */
136
- export type PromptOption = {
137
- name: string;
138
- message: string;
139
- type: 'input' | 'confirm' | 'select';
140
- choices?: string[];
141
- skip?: (previousResults: PromptResults) => boolean;
142
- };
143
- /**
144
- * PromptResults is the result of the user input received from the promptOptions.
145
- * The key is the name of the prompt option and the value is the user input.
146
- * in case the prompt-option is of type 'confirm', the value will be a boolean.
147
- */
148
- export type PromptResults = Record<string, string | boolean>;
149
- export interface ComponentTemplate extends ComponentTemplateOptions {
150
- name: string;
151
- /**
152
- * in case the template requires user input, this function will be called to prompt the user.
153
- * the results will be passed to the generateFiles function.
154
- */
155
- promptOptions?: () => PromptOption[];
156
- /**
157
- * template function for generating the file of a certain component.,
158
- */
159
- generateFiles(context: ComponentContext): Promise<ComponentFile[]> | ComponentFile[];
160
- /**
161
- * component config. gets saved in the .bitmap file and it overrides the workspace.jsonc config.
162
- * for example, you can set the env that will be used for this component as follows:
163
- * "teambit.envs/envs": {
164
- * "env": "teambit.harmony/aspect"
165
- * },
166
- */
167
- config?: ComponentConfig | ((context: ConfigContext) => ComponentConfig);
168
- }
169
- export type GetComponentTemplates = () => ComponentTemplate[];
1
+ export type { BaseComponentTemplateOptions, ComponentContext, ComponentFile, ConfigContext, ComponentConfig, ComponentTemplateOptions, PromptOption, PromptResults, ComponentTemplate, GetComponentTemplates, } from '@teambit/envs.contracts';
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["component-template.ts"],"sourcesContent":["import type { ComponentID } from '@teambit/component';\n\n/**\n * BaseComponentTemplateOptions describes the foundational properties for components.\n */\nexport interface BaseComponentTemplateOptions {\n /**\n * component-name as entered by the user, e.g. `use-date`.\n * without the scope and the namespace.\n */\n name: string;\n\n /**\n * component-name as upper camel case, e.g. `use-date` becomes `UseDate`.\n * useful when generating the file content, for example for a class name.\n */\n namePascalCase: string;\n\n /**\n * component-name as lower camel case, e.g. `use-date` becomes `useDate`.\n * useful when generating the file content, for example for a function/variable name.\n */\n nameCamelCase: string;\n\n /**\n * component id.\n * the name is the name+namespace. the scope is the scope entered by --scope flag or the defaultScope\n */\n componentId: ComponentID;\n\n /**\n * aspect id of the aspect that register the template itself\n */\n aspectId: ComponentID | string;\n\n /**\n * env id of the env that register the template itself.\n * This will be usually identical to the aspectId but aspectId will always exist,\n * while envId will be undefined if the template is not registered by an env.\n */\n envId?: ComponentID;\n\n /**\n * path of the component.\n */\n path?: string;\n /**\n * scope of the component.\n */\n scope?: string;\n /**\n * namespace of the component.\n */\n namespace?: string;\n /**\n * when a template implements the promptOptions function, this object will be populated with the user responses.\n */\n promptResults?: PromptResults;\n}\n\n/**\n * ComponentContext represents foundational properties for a component context.\n */\nexport type ComponentContext = BaseComponentTemplateOptions;\n\nexport interface ComponentFile {\n /**\n * relative path of the file within the component.\n */\n relativePath: string;\n\n /**\n * file content\n */\n content: string;\n\n /**\n * whether this file will be tracked as the main file\n */\n isMain?: boolean;\n}\n\nexport interface ConfigContext {\n /**\n * Aspect id of the aspect that register the template itself\n */\n aspectId: string;\n}\n\nexport type ComponentConfig = { [aspectName: string]: any };\n\nexport interface ComponentTemplateOptions {\n /**\n * name of the component template. for example: `hook`, `react-component` or `module`.\n */\n name?: string;\n\n /**\n * display name of the template.\n */\n displayName?: string;\n\n /**\n * example name for the component template.\n */\n exampleComponentName?: string;\n\n /**\n * short description of the template. shown in the `bit templates` command.\n */\n description?: string;\n\n /**\n * hide this template so that it is not listed with `bit templates`\n */\n hidden?: boolean;\n\n /**\n * env to use for the generated component.\n */\n env?: string;\n\n /**\n * adds a metadata that the component that this template creates is of type env.\n * This will be used later to do further configuration for example:\n * - ensure to create the .bit_root for it\n */\n isEnv?: boolean;\n\n /**\n * adds a metadata that the component that this template creates is of type app.\n * This will be used later to do further configuration for example:\n * - add it to the workspace.jsonc as app\n * - ensure to create the .bit_root for it\n */\n isApp?: boolean;\n\n /**\n * list of dependencies to install when the component is created.\n */\n dependencies?: string[];\n\n /**\n * Perform installation of missing dependencies after component generation.\n * This is the same as of running `bit install --add-missing-deps` after component generation.\n */\n installMissingDependencies?: boolean;\n}\n\n/**\n * PromptOption is shown to the user before calling the generateFiles function.\n * The prompt is using enquirer under the hood. see https://www.npmjs.com/package/enquirer.\n * Examples:\n * - input: {name: 'name', message: 'enter your name', type: 'input'}\n * - confirm: {name: 'isHappy', message: 'are you happy?', type: 'confirm'}\n * - select: {name: 'color', message: 'pick a color', type: 'select', choices: ['red', 'blue', 'green']}\n */\nexport type PromptOption = {\n name: string;\n message: string;\n type: 'input' | 'confirm' | 'select';\n choices?: string[]; // for select type\n skip?: (previousResults: PromptResults) => boolean; // skip this prompt if this function returns true\n};\n\n/**\n * PromptResults is the result of the user input received from the promptOptions.\n * The key is the name of the prompt option and the value is the user input.\n * in case the prompt-option is of type 'confirm', the value will be a boolean.\n */\nexport type PromptResults = Record<string, string | boolean>;\n\nexport interface ComponentTemplate extends ComponentTemplateOptions {\n name: string;\n\n /**\n * in case the template requires user input, this function will be called to prompt the user.\n * the results will be passed to the generateFiles function.\n */\n promptOptions?: () => PromptOption[];\n\n /**\n * template function for generating the file of a certain component.,\n */\n generateFiles(context: ComponentContext): Promise<ComponentFile[]> | ComponentFile[];\n\n /**\n * component config. gets saved in the .bitmap file and it overrides the workspace.jsonc config.\n * for example, you can set the env that will be used for this component as follows:\n * \"teambit.envs/envs\": {\n * \"env\": \"teambit.harmony/aspect\"\n * },\n */\n config?: ComponentConfig | ((context: ConfigContext) => ComponentConfig);\n}\n\nexport type GetComponentTemplates = () => ComponentTemplate[];\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["component-template.ts"],"sourcesContent":["export type {\n BaseComponentTemplateOptions,\n ComponentContext,\n ComponentFile,\n ConfigContext,\n ComponentConfig,\n ComponentTemplateOptions,\n PromptOption,\n PromptResults,\n ComponentTemplate,\n GetComponentTemplates,\n} from '@teambit/envs.contracts';\n"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.1267/dist/generator.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.1267/dist/generator.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.1268/dist/generator.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.generator_generator@1.0.1268/dist/generator.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
@@ -1,13 +1,2 @@
1
- import type { EnvContext, EnvHandler } from '@teambit/envs';
2
- import type { WorkspaceTemplate } from './workspace-template';
3
- export type StarterListOptions = {
4
- name?: string;
5
- };
6
- export declare class StarterList {
7
- readonly name: string;
8
- private starters;
9
- private context;
10
- constructor(name: string, starters: EnvHandler<WorkspaceTemplate>[], context: EnvContext);
11
- compute(): WorkspaceTemplate[];
12
- static from(starters: EnvHandler<WorkspaceTemplate>[], options?: StarterListOptions): (context: EnvContext) => StarterList;
13
- }
1
+ export { StarterList } from '@teambit/envs.contracts';
2
+ export type { StarterListOptions } from '@teambit/envs.contracts';
@@ -3,23 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StarterList = void 0;
7
- class StarterList {
8
- constructor(name, starters, context) {
9
- this.name = name;
10
- this.starters = starters;
11
- this.context = context;
12
- }
13
- compute() {
14
- return this.starters.map(starter => starter(this.context));
15
- }
16
- static from(starters, options = {}) {
17
- return context => {
18
- const name = options.name || 'starter-list';
19
- return new StarterList(name, starters, context);
20
- };
6
+ Object.defineProperty(exports, "StarterList", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _envs().StarterList;
21
10
  }
11
+ });
12
+ function _envs() {
13
+ const data = require("@teambit/envs.contracts");
14
+ _envs = function () {
15
+ return data;
16
+ };
17
+ return data;
22
18
  }
23
- exports.StarterList = StarterList;
24
19
 
25
20
  //# sourceMappingURL=starter-list.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["StarterList","constructor","name","starters","context","compute","map","starter","from","options","exports"],"sources":["starter-list.ts"],"sourcesContent":["import type { EnvContext, EnvHandler } from '@teambit/envs';\nimport type { WorkspaceTemplate } from './workspace-template';\n\nexport type StarterListOptions = {\n name?: string;\n};\n\nexport class StarterList {\n constructor(\n readonly name: string,\n private starters: EnvHandler<WorkspaceTemplate>[],\n private context: EnvContext\n ) {}\n\n compute(): WorkspaceTemplate[] {\n return this.starters.map((starter) => starter(this.context));\n }\n\n static from(starters: EnvHandler<WorkspaceTemplate>[], options: StarterListOptions = {}) {\n return (context: EnvContext) => {\n const name = options.name || 'starter-list';\n return new StarterList(name, starters, context);\n };\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,WAAW,CAAC;EACvBC,WAAWA,CACAC,IAAY,EACbC,QAAyC,EACzCC,OAAmB,EAC3B;IAAA,KAHSF,IAAY,GAAZA,IAAY;IAAA,KACbC,QAAyC,GAAzCA,QAAyC;IAAA,KACzCC,OAAmB,GAAnBA,OAAmB;EAC1B;EAEHC,OAAOA,CAAA,EAAwB;IAC7B,OAAO,IAAI,CAACF,QAAQ,CAACG,GAAG,CAAEC,OAAO,IAAKA,OAAO,CAAC,IAAI,CAACH,OAAO,CAAC,CAAC;EAC9D;EAEA,OAAOI,IAAIA,CAACL,QAAyC,EAAEM,OAA2B,GAAG,CAAC,CAAC,EAAE;IACvF,OAAQL,OAAmB,IAAK;MAC9B,MAAMF,IAAI,GAAGO,OAAO,CAACP,IAAI,IAAI,cAAc;MAC3C,OAAO,IAAIF,WAAW,CAACE,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAAC;IACjD,CAAC;EACH;AACF;AAACM,OAAA,CAAAV,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"names":["_envs","data","require"],"sources":["starter-list.ts"],"sourcesContent":["export { StarterList } from '@teambit/envs.contracts';\nexport type { StarterListOptions } from '@teambit/envs.contracts';\n"],"mappings":";;;;;;;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
@@ -1,13 +1,2 @@
1
- import type { EnvContext, EnvHandler } from '@teambit/envs';
2
- import type { ComponentTemplate } from './component-template';
3
- export type TemplateListOptions = {
4
- name?: string;
5
- };
6
- export declare class TemplateList {
7
- readonly name: string;
8
- private templates;
9
- private context;
10
- constructor(name: string, templates: EnvHandler<ComponentTemplate>[], context: EnvContext);
11
- compute(): ComponentTemplate[];
12
- static from(templates: EnvHandler<ComponentTemplate>[], options?: TemplateListOptions): (context: EnvContext) => TemplateList;
13
- }
1
+ export { TemplateList } from '@teambit/envs.contracts';
2
+ export type { TemplateListOptions } from '@teambit/envs.contracts';
@@ -3,23 +3,18 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.TemplateList = void 0;
7
- class TemplateList {
8
- constructor(name, templates, context) {
9
- this.name = name;
10
- this.templates = templates;
11
- this.context = context;
12
- }
13
- compute() {
14
- return this.templates.map(template => template(this.context));
15
- }
16
- static from(templates, options = {}) {
17
- return context => {
18
- const name = options.name || 'template-list';
19
- return new TemplateList(name, templates, context);
20
- };
6
+ Object.defineProperty(exports, "TemplateList", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _envs().TemplateList;
21
10
  }
11
+ });
12
+ function _envs() {
13
+ const data = require("@teambit/envs.contracts");
14
+ _envs = function () {
15
+ return data;
16
+ };
17
+ return data;
22
18
  }
23
- exports.TemplateList = TemplateList;
24
19
 
25
20
  //# sourceMappingURL=template-list.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["TemplateList","constructor","name","templates","context","compute","map","template","from","options","exports"],"sources":["template-list.ts"],"sourcesContent":["import type { EnvContext, EnvHandler } from '@teambit/envs';\nimport type { ComponentTemplate } from './component-template';\n\nexport type TemplateListOptions = {\n name?: string;\n};\n\nexport class TemplateList {\n constructor(\n readonly name: string,\n private templates: EnvHandler<ComponentTemplate>[],\n private context: EnvContext\n ) {}\n\n compute(): ComponentTemplate[] {\n return this.templates.map((template) => template(this.context));\n }\n\n static from(templates: EnvHandler<ComponentTemplate>[], options: TemplateListOptions = {}) {\n return (context: EnvContext) => {\n const name = options.name || 'template-list';\n return new TemplateList(name, templates, context);\n };\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,YAAY,CAAC;EACxBC,WAAWA,CACAC,IAAY,EACbC,SAA0C,EAC1CC,OAAmB,EAC3B;IAAA,KAHSF,IAAY,GAAZA,IAAY;IAAA,KACbC,SAA0C,GAA1CA,SAA0C;IAAA,KAC1CC,OAAmB,GAAnBA,OAAmB;EAC1B;EAEHC,OAAOA,CAAA,EAAwB;IAC7B,OAAO,IAAI,CAACF,SAAS,CAACG,GAAG,CAAEC,QAAQ,IAAKA,QAAQ,CAAC,IAAI,CAACH,OAAO,CAAC,CAAC;EACjE;EAEA,OAAOI,IAAIA,CAACL,SAA0C,EAAEM,OAA4B,GAAG,CAAC,CAAC,EAAE;IACzF,OAAQL,OAAmB,IAAK;MAC9B,MAAMF,IAAI,GAAGO,OAAO,CAACP,IAAI,IAAI,eAAe;MAC5C,OAAO,IAAIF,YAAY,CAACE,IAAI,EAAEC,SAAS,EAAEC,OAAO,CAAC;IACnD,CAAC;EACH;AACF;AAACM,OAAA,CAAAV,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["_envs","data","require"],"sources":["template-list.ts"],"sourcesContent":["export { TemplateList } from '@teambit/envs.contracts';\nexport type { TemplateListOptions } from '@teambit/envs.contracts';\n"],"mappings":";;;;;;;;;;;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA","ignoreList":[]}
@@ -1,164 +1 @@
1
- import type { Component } from '@teambit/component';
2
- import type { ComponentConfig } from './component-template';
3
- /**
4
- * BaseWorkspaceOptions describes the foundational properties for workspaces.
5
- */
6
- export interface BaseWorkspaceOptions {
7
- /**
8
- * The name of the workspace as provided by the user (e.g., `react-app`).
9
- * This is also used as the directory name for the workspace.
10
- */
11
- name: string;
12
- /**
13
- * The default scope provided by the user.
14
- * This is set in the workspace.jsonc and is utilized for components within the workspace.
15
- */
16
- defaultScope?: string;
17
- /**
18
- * Indicates whether the user has opted to avoid creating components (typically with a `--empty` flag).
19
- */
20
- empty?: boolean;
21
- /**
22
- * Represents the aspect in the context where a remote aspect is imported (often via the `--aspect` flag).
23
- * This is useful for obtaining the aspect-id and other related information.
24
- */
25
- aspectComponent?: Component;
26
- /**
27
- * Represents the selected template to initialize or create the workspace.
28
- */
29
- template: WorkspaceTemplate;
30
- /**
31
- * Flag to check if Git repository generation should be skipped.
32
- */
33
- skipGit?: boolean;
34
- /**
35
- * Local path to the workspace template.
36
- * Useful during the development of a workspace-template.
37
- */
38
- loadFrom?: string;
39
- /**
40
- * AI agent target. When set, writes agent instructions to the tool-specific file
41
- * (e.g. "claude" → CLAUDE.md). When omitted, writes the universal AGENTS.md.
42
- */
43
- agent?: string;
44
- }
45
- /**
46
- * WorkspaceContext represents foundational properties for a workspace context.
47
- */
48
- export type WorkspaceContext = BaseWorkspaceOptions;
49
- export interface WorkspaceFile {
50
- /**
51
- * relative path of the file within the workspace.
52
- */
53
- relativePath: string;
54
- /**
55
- * file content
56
- */
57
- content: string;
58
- }
59
- export interface CreateComponentInfo {
60
- /**
61
- * the template for generating the component
62
- */
63
- templateName: string;
64
- /**
65
- * component name to generate
66
- */
67
- componentName: string;
68
- /**
69
- * sets the component's scope-name. if not entered, the default-scope will be used
70
- */
71
- scope?: string;
72
- /**
73
- * relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`
74
- */
75
- path?: string;
76
- /**
77
- * set the component's environment. (overrides the env from variants and the template)
78
- */
79
- env?: string;
80
- /**
81
- * aspect-id of the template.
82
- */
83
- aspect?: string;
84
- }
85
- export interface ForkComponentInfo extends ImportComponentInfo {
86
- /**
87
- * a new component name. if not specified, use the original id (without the scope)
88
- */
89
- targetName?: string;
90
- /**
91
- * a new scope for the component. if not specified, use the original scope
92
- */
93
- targetScope?: string;
94
- /**
95
- * env to use for the component.
96
- */
97
- env?: string;
98
- /**
99
- * component config. gets saved in the .bitmap file and overrides the workspace.jsonc config.
100
- * for example, you can set the env that will be used for this component as follows:
101
- * "teambit.envs/envs": {
102
- * "env": "teambit.harmony/aspect"
103
- * },
104
- */
105
- config?: ComponentConfig;
106
- }
107
- /**
108
- * @deprecated use ForkComponentInfo instead.
109
- */
110
- export type ComponentToImport = ForkComponentInfo;
111
- export interface ImportComponentInfo {
112
- /**
113
- * full component id
114
- */
115
- id: string;
116
- /**
117
- * path where to write the component
118
- */
119
- path?: string;
120
- }
121
- export interface WorkspaceTemplateOptions {
122
- /**
123
- * name of the workspace starter. for example: `react-workspace`.
124
- */
125
- name: string;
126
- /**
127
- * name of an app created in the workspace. for example: `my-app`.
128
- * This will be used to instruct the user to run `bit run <appName>` in the new workspace.
129
- */
130
- appName?: string;
131
- /**
132
- * short description of the starter. shown in the `bit starter` command when outside of bit-workspace.
133
- */
134
- description?: string;
135
- /**
136
- * hide this starter so that it is not listed with `bit starter`
137
- */
138
- hidden?: boolean;
139
- }
140
- export interface WorkspaceTemplate extends WorkspaceTemplateOptions {
141
- /**
142
- * starter function for generating the template files,
143
- */
144
- generateFiles(context: WorkspaceContext): Promise<WorkspaceFile[]>;
145
- /**
146
- * @deprecated use `fork()` or `import()` instead
147
- * this is working similarly to `fork()`
148
- */
149
- importComponents?: (context: WorkspaceContext) => ForkComponentInfo[];
150
- /**
151
- * import components into the new workspace, don't change their source code.
152
- */
153
- import?: (context: WorkspaceContext) => ImportComponentInfo[];
154
- /**
155
- * populate existing components into the new workspace and add them as new components.
156
- * change their source code and update the dependency names according to the new component names.
157
- */
158
- fork?: (context: WorkspaceContext) => ForkComponentInfo[];
159
- /**
160
- * populate new components into the new workspace and add them as new components.
161
- */
162
- create?: (context: WorkspaceContext) => CreateComponentInfo[];
163
- }
164
- export type GetWorkspaceTemplates = () => WorkspaceTemplate[];
1
+ export type { BaseWorkspaceOptions, WorkspaceContext, WorkspaceFile, CreateComponentInfo, ForkComponentInfo, ComponentToImport, ImportComponentInfo, WorkspaceTemplateOptions, WorkspaceTemplate, GetWorkspaceTemplates, } from '@teambit/envs.contracts';
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["workspace-template.ts"],"sourcesContent":["import type { Component } from '@teambit/component';\nimport type { ComponentConfig } from './component-template';\n\n/**\n * BaseWorkspaceOptions describes the foundational properties for workspaces.\n */\nexport interface BaseWorkspaceOptions {\n /**\n * The name of the workspace as provided by the user (e.g., `react-app`).\n * This is also used as the directory name for the workspace.\n */\n name: string;\n\n /**\n * The default scope provided by the user.\n * This is set in the workspace.jsonc and is utilized for components within the workspace.\n */\n defaultScope?: string;\n\n /**\n * Indicates whether the user has opted to avoid creating components (typically with a `--empty` flag).\n */\n empty?: boolean;\n\n /**\n * Represents the aspect in the context where a remote aspect is imported (often via the `--aspect` flag).\n * This is useful for obtaining the aspect-id and other related information.\n */\n aspectComponent?: Component;\n\n /**\n * Represents the selected template to initialize or create the workspace.\n */\n template: WorkspaceTemplate;\n\n /**\n * Flag to check if Git repository generation should be skipped.\n */\n skipGit?: boolean;\n\n /**\n * Local path to the workspace template.\n * Useful during the development of a workspace-template.\n */\n loadFrom?: string;\n\n /**\n * AI agent target. When set, writes agent instructions to the tool-specific file\n * (e.g. \"claude\" → CLAUDE.md). When omitted, writes the universal AGENTS.md.\n */\n agent?: string;\n}\n\n/**\n * WorkspaceContext represents foundational properties for a workspace context.\n */\nexport type WorkspaceContext = BaseWorkspaceOptions;\n\nexport interface WorkspaceFile {\n /**\n * relative path of the file within the workspace.\n */\n relativePath: string;\n\n /**\n * file content\n */\n content: string;\n}\n\nexport interface CreateComponentInfo {\n /**\n * the template for generating the component\n */\n templateName: string;\n /**\n * component name to generate\n */\n componentName: string;\n /**\n * sets the component's scope-name. if not entered, the default-scope will be used\n */\n scope?: string;\n /**\n * relative path in the workspace. by default the path is `<scope>/<namespace>/<name>`\n */\n path?: string;\n /**\n * set the component's environment. (overrides the env from variants and the template)\n */\n env?: string;\n /**\n * aspect-id of the template.\n */\n aspect?: string;\n}\n\nexport interface ForkComponentInfo extends ImportComponentInfo {\n /**\n * a new component name. if not specified, use the original id (without the scope)\n */\n targetName?: string;\n\n /**\n * a new scope for the component. if not specified, use the original scope\n */\n targetScope?: string;\n\n /**\n * env to use for the component.\n */\n env?: string;\n\n /**\n * component config. gets saved in the .bitmap file and overrides the workspace.jsonc config.\n * for example, you can set the env that will be used for this component as follows:\n * \"teambit.envs/envs\": {\n * \"env\": \"teambit.harmony/aspect\"\n * },\n */\n config?: ComponentConfig;\n}\n\n/**\n * @deprecated use ForkComponentInfo instead.\n */\nexport type ComponentToImport = ForkComponentInfo;\n\nexport interface ImportComponentInfo {\n /**\n * full component id\n */\n id: string;\n\n /**\n * path where to write the component\n */\n path?: string;\n}\n\nexport interface WorkspaceTemplateOptions {\n /**\n * name of the workspace starter. for example: `react-workspace`.\n */\n name: string;\n\n /**\n * name of an app created in the workspace. for example: `my-app`.\n * This will be used to instruct the user to run `bit run <appName>` in the new workspace.\n */\n appName?: string;\n\n /**\n * short description of the starter. shown in the `bit starter` command when outside of bit-workspace.\n */\n description?: string;\n\n /**\n * hide this starter so that it is not listed with `bit starter`\n */\n hidden?: boolean;\n}\n\nexport interface WorkspaceTemplate extends WorkspaceTemplateOptions {\n /**\n * starter function for generating the template files,\n */\n generateFiles(context: WorkspaceContext): Promise<WorkspaceFile[]>;\n\n /**\n * @deprecated use `fork()` or `import()` instead\n * this is working similarly to `fork()`\n */\n importComponents?: (context: WorkspaceContext) => ForkComponentInfo[];\n\n /**\n * import components into the new workspace, don't change their source code.\n */\n import?: (context: WorkspaceContext) => ImportComponentInfo[];\n\n /**\n * populate existing components into the new workspace and add them as new components.\n * change their source code and update the dependency names according to the new component names.\n */\n fork?: (context: WorkspaceContext) => ForkComponentInfo[];\n\n /**\n * populate new components into the new workspace and add them as new components.\n */\n create?: (context: WorkspaceContext) => CreateComponentInfo[];\n}\n\nexport type GetWorkspaceTemplates = () => WorkspaceTemplate[];\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"names":[],"sources":["workspace-template.ts"],"sourcesContent":["export type {\n BaseWorkspaceOptions,\n WorkspaceContext,\n WorkspaceFile,\n CreateComponentInfo,\n ForkComponentInfo,\n ComponentToImport,\n ImportComponentInfo,\n WorkspaceTemplateOptions,\n WorkspaceTemplate,\n GetWorkspaceTemplates,\n} from '@teambit/envs.contracts';\n"],"mappings":"","ignoreList":[]}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/generator",
3
- "version": "1.0.1267",
3
+ "version": "1.0.1268",
4
4
  "homepage": "https://bit.cloud/teambit/generator/generator",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.generator",
8
8
  "name": "generator",
9
- "version": "1.0.1267"
9
+ "version": "1.0.1268"
10
10
  },
11
11
  "dependencies": {
12
12
  "camelcase": "6.2.0",
@@ -22,7 +22,9 @@
22
22
  "@teambit/pkg.modules.component-package-name": "0.0.198",
23
23
  "@teambit/workspace.modules.node-modules-linker": "0.0.434",
24
24
  "@teambit/cli": "0.0.1432",
25
+ "@teambit/component": "1.0.1246",
25
26
  "@teambit/harmony": "0.4.12",
27
+ "@teambit/graphql": "1.0.1211",
26
28
  "@teambit/harmony.modules.runtimes": "0.0.4",
27
29
  "@teambit/legacy-bit-id": "1.1.4",
28
30
  "@teambit/legacy.constants": "0.0.50",
@@ -30,16 +32,15 @@
30
32
  "@teambit/legacy.scope": "0.0.201",
31
33
  "@teambit/git.modules.git-ignore": "1.0.2",
32
34
  "@teambit/config": "0.0.1607",
33
- "@teambit/envs": "1.0.1246",
34
- "@teambit/new-component-helper": "1.0.1266",
35
- "@teambit/tracker": "1.0.1266",
36
- "@teambit/workspace-config-files": "1.0.1266",
37
- "@teambit/workspace": "1.0.1266",
38
- "@teambit/component": "1.0.1246",
39
- "@teambit/graphql": "1.0.1211",
40
- "@teambit/aspect-loader": "1.0.1246",
41
- "@teambit/git": "1.0.1266",
42
- "@teambit/scope": "1.0.1265"
35
+ "@teambit/envs": "1.0.1247",
36
+ "@teambit/new-component-helper": "1.0.1267",
37
+ "@teambit/tracker": "1.0.1267",
38
+ "@teambit/workspace-config-files": "1.0.1267",
39
+ "@teambit/workspace": "1.0.1267",
40
+ "@teambit/envs.contracts": "0.0.1",
41
+ "@teambit/aspect-loader": "1.0.1247",
42
+ "@teambit/git": "1.0.1267",
43
+ "@teambit/scope": "1.0.1266"
43
44
  },
44
45
  "devDependencies": {
45
46
  "@types/fs-extra": "9.0.7",