@teambit/generator 1.0.229 → 1.0.231
Sign up to get free protection for your applications and to get access to all the features.
- package/artifacts/__bit_junit.xml +1 -1
- package/artifacts/preview/teambit_generator_generator-preview.js +1 -1
- package/artifacts/schema.json +501 -118
- package/dist/component-generator.d.ts +56 -0
- package/dist/component-template.d.ts +130 -0
- package/dist/create.cmd.d.ts +35 -0
- package/dist/exceptions/workspace-path-exists.d.ts +5 -0
- package/dist/generator-env-type.d.ts +13 -0
- package/dist/generator.aspect.d.ts +2 -0
- package/dist/generator.composition.d.ts +1 -0
- package/dist/generator.graphql.d.ts +7 -0
- package/dist/generator.main.runtime.d.ts +173 -0
- package/dist/generator.service.d.ts +12 -0
- package/dist/index.d.ts +8 -0
- package/dist/new.cmd.d.ts +28 -0
- package/dist/{preview-1712805335812.js → preview-1712891953391.js} +2 -2
- package/dist/starter-list.d.ts +13 -0
- package/dist/starter.plugin.d.ts +9 -0
- package/dist/template-list.d.ts +13 -0
- package/dist/templates/basic/basic.starter.d.ts +3 -0
- package/dist/templates/basic/index.d.ts +1 -0
- package/dist/templates/basic/template/files/package-json.d.ts +1 -0
- package/dist/templates/basic/template/files/workspace-config.d.ts +2 -0
- package/dist/templates/component-generator/files/component-template-files/component.d.ts +1 -0
- package/dist/templates/component-generator/files/component-template-files/composition.d.ts +1 -0
- package/dist/templates/component-generator/files/component-template-files/index-file.d.ts +1 -0
- package/dist/templates/component-generator/files/component-template-files/test.d.ts +1 -0
- package/dist/templates/component-generator/files/component-template.d.ts +2 -0
- package/dist/templates/component-generator/files/index.d.ts +2 -0
- package/dist/templates/component-generator/index.d.ts +2 -0
- package/dist/templates/component-generator-standalone/files/aspect-file.d.ts +2 -0
- package/dist/templates/component-generator-standalone/files/docs-file.d.ts +1 -0
- package/dist/templates/component-generator-standalone/files/index.d.ts +2 -0
- package/dist/templates/component-generator-standalone/files/main-runtime.d.ts +2 -0
- package/dist/templates/component-generator-standalone/index.d.ts +2 -0
- package/dist/templates/index.d.ts +4 -0
- package/dist/templates/starter/files/doc-file.d.ts +2 -0
- package/dist/templates/starter/files/generate-files.d.ts +1 -0
- package/dist/templates/starter/files/git-ignore-tpl.d.ts +1 -0
- package/dist/templates/starter/files/index.d.ts +2 -0
- package/dist/templates/starter/files/starter.d.ts +2 -0
- package/dist/templates/starter/files/workspace-config-tpl.d.ts +1 -0
- package/dist/templates/starter/index.d.ts +2 -0
- package/dist/templates/starter-standalone/files/doc-file.d.ts +2 -0
- package/dist/templates/starter-standalone/files/git-ignore-tpl.d.ts +1 -0
- package/dist/templates/starter-standalone/files/index.d.ts +2 -0
- package/dist/templates/starter-standalone/files/starter.d.ts +2 -0
- package/dist/templates/starter-standalone/files/workspace-config-tpl.d.ts +1 -0
- package/dist/templates/starter-standalone/index.d.ts +2 -0
- package/dist/templates.cmd.d.ts +18 -0
- package/dist/types.d.ts +3 -0
- package/dist/workspace-generator.d.ts +43 -0
- package/dist/workspace-template.d.ts +156 -0
- package/package.json +22 -22
- package/tsconfig.json +1 -58
@@ -0,0 +1,56 @@
|
|
1
|
+
import { Workspace } from '@teambit/workspace';
|
2
|
+
import { EnvsMain } from '@teambit/envs';
|
3
|
+
import { Logger } from '@teambit/logger';
|
4
|
+
import { TrackerMain } from '@teambit/tracker';
|
5
|
+
import { NewComponentHelperMain } from '@teambit/new-component-helper';
|
6
|
+
import { ComponentID } from '@teambit/component-id';
|
7
|
+
import { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';
|
8
|
+
import { ComponentTemplate } from './component-template';
|
9
|
+
import { CreateOptions } from './create.cmd';
|
10
|
+
import { OnComponentCreateSlot } from './generator.main.runtime';
|
11
|
+
export type GenerateResult = {
|
12
|
+
id: ComponentID;
|
13
|
+
dir: string;
|
14
|
+
files: string[];
|
15
|
+
envId: string;
|
16
|
+
envSetBy: string;
|
17
|
+
packageName: string;
|
18
|
+
isApp?: boolean;
|
19
|
+
isEnv?: boolean;
|
20
|
+
dependencies?: string[];
|
21
|
+
installMissingDependencies?: boolean;
|
22
|
+
};
|
23
|
+
export type OnComponentCreateFn = (generateResults: GenerateResult[]) => Promise<void>;
|
24
|
+
export declare class ComponentGenerator {
|
25
|
+
private workspace;
|
26
|
+
private componentIds;
|
27
|
+
private options;
|
28
|
+
private template;
|
29
|
+
private envs;
|
30
|
+
private newComponentHelper;
|
31
|
+
private tracker;
|
32
|
+
private wsConfigFiles;
|
33
|
+
private logger;
|
34
|
+
private onComponentCreateSlot;
|
35
|
+
private aspectId;
|
36
|
+
private envId?;
|
37
|
+
constructor(workspace: Workspace, componentIds: ComponentID[], options: Partial<CreateOptions>, template: ComponentTemplate, envs: EnvsMain, newComponentHelper: NewComponentHelperMain, tracker: TrackerMain, wsConfigFiles: WorkspaceConfigFilesMain, logger: Logger, onComponentCreateSlot: OnComponentCreateSlot, aspectId: string, envId?: ComponentID | undefined);
|
38
|
+
generate(force?: boolean): Promise<GenerateResult[]>;
|
39
|
+
private tryLinkToNodeModules;
|
40
|
+
private runOnComponentCreateHook;
|
41
|
+
/**
|
42
|
+
* The function `tryWriteConfigFiles` attempts to write workspace config files, and if it fails, it logs an error
|
43
|
+
* message.
|
44
|
+
* @returns If the condition `!shouldWrite` is true, then nothing is being returned. Otherwise, if the `writeConfigFiles`
|
45
|
+
* function is successfully executed, nothing is being returned. If an error occurs during the execution of
|
46
|
+
* `writeConfigFiles`, an error message is being returned.
|
47
|
+
*/
|
48
|
+
private tryWriteConfigFiles;
|
49
|
+
private deleteGeneratedComponents;
|
50
|
+
private generateOneComponent;
|
51
|
+
private addEnvIfProvidedByFlag;
|
52
|
+
/**
|
53
|
+
* writes the generated template files to the default directory set in the workspace config
|
54
|
+
*/
|
55
|
+
private writeComponentFiles;
|
56
|
+
}
|
@@ -0,0 +1,130 @@
|
|
1
|
+
import { 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
|
+
/**
|
50
|
+
* ComponentContext represents foundational properties for a component context.
|
51
|
+
*/
|
52
|
+
export type ComponentContext = BaseComponentTemplateOptions;
|
53
|
+
export interface ComponentFile {
|
54
|
+
/**
|
55
|
+
* relative path of the file within the component.
|
56
|
+
*/
|
57
|
+
relativePath: string;
|
58
|
+
/**
|
59
|
+
* file content
|
60
|
+
*/
|
61
|
+
content: string;
|
62
|
+
/**
|
63
|
+
* whether this file will be tracked as the main file
|
64
|
+
*/
|
65
|
+
isMain?: boolean;
|
66
|
+
}
|
67
|
+
export interface ConfigContext {
|
68
|
+
/**
|
69
|
+
* Aspect id of the aspect that register the template itself
|
70
|
+
*/
|
71
|
+
aspectId: string;
|
72
|
+
}
|
73
|
+
export type ComponentConfig = {
|
74
|
+
[aspectName: string]: any;
|
75
|
+
};
|
76
|
+
export interface ComponentTemplateOptions {
|
77
|
+
/**
|
78
|
+
* name of the component template. for example: `hook`, `react-component` or `module`.
|
79
|
+
*/
|
80
|
+
name?: string;
|
81
|
+
/**
|
82
|
+
* short description of the template. shown in the `bit templates` command.
|
83
|
+
*/
|
84
|
+
description?: string;
|
85
|
+
/**
|
86
|
+
* hide this template so that it is not listed with `bit templates`
|
87
|
+
*/
|
88
|
+
hidden?: boolean;
|
89
|
+
/**
|
90
|
+
* env to use for the generated component.
|
91
|
+
*/
|
92
|
+
env?: string;
|
93
|
+
/**
|
94
|
+
* adds a metadata that the component that this template creates is of type env.
|
95
|
+
* This will be used later to do further configuration for example:
|
96
|
+
* - ensure to create the .bit_root for it
|
97
|
+
*/
|
98
|
+
isEnv?: boolean;
|
99
|
+
/**
|
100
|
+
* adds a metadata that the component that this template creates is of type app.
|
101
|
+
* This will be used later to do further configuration for example:
|
102
|
+
* - add it to the workspace.jsonc as app
|
103
|
+
* - ensure to create the .bit_root for it
|
104
|
+
*/
|
105
|
+
isApp?: boolean;
|
106
|
+
/**
|
107
|
+
* list of dependencies to install when the component is created.
|
108
|
+
*/
|
109
|
+
dependencies?: string[];
|
110
|
+
/**
|
111
|
+
* Perform installation of missing dependencies after component generation.
|
112
|
+
* This is the same as of running `bit install --add-missing-deps` after component generation.
|
113
|
+
*/
|
114
|
+
installMissingDependencies?: boolean;
|
115
|
+
}
|
116
|
+
export interface ComponentTemplate extends ComponentTemplateOptions {
|
117
|
+
name: string;
|
118
|
+
/**
|
119
|
+
* template function for generating the file of a certain component.,
|
120
|
+
*/
|
121
|
+
generateFiles(context: ComponentContext): Promise<ComponentFile[]> | ComponentFile[];
|
122
|
+
/**
|
123
|
+
* component config. gets saved in the .bitmap file and it overrides the workspace.jsonc config.
|
124
|
+
* for example, you can set the env that will be used for this component as follows:
|
125
|
+
* "teambit.envs/envs": {
|
126
|
+
* "env": "teambit.harmony/aspect"
|
127
|
+
* },
|
128
|
+
*/
|
129
|
+
config?: ComponentConfig | ((context: ConfigContext) => ComponentConfig);
|
130
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
2
|
+
import { ComponentID } from '@teambit/component';
|
3
|
+
import { 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
|
+
alias: string;
|
18
|
+
loader: boolean;
|
19
|
+
helpUrl: string;
|
20
|
+
arguments: {
|
21
|
+
name: string;
|
22
|
+
description: string;
|
23
|
+
}[];
|
24
|
+
examples: {
|
25
|
+
cmd: string;
|
26
|
+
description: string;
|
27
|
+
}[];
|
28
|
+
group: string;
|
29
|
+
options: CommandOptions;
|
30
|
+
constructor(generator: GeneratorMain);
|
31
|
+
report([templateName, componentNames]: [string, string[]], options: Partial<CreateOptions> & {
|
32
|
+
template?: string | ComponentID;
|
33
|
+
force?: boolean;
|
34
|
+
}): Promise<string>;
|
35
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { EnvHandler } from '@teambit/envs';
|
2
|
+
import { TemplateList } from './template-list';
|
3
|
+
import { 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 @@
|
|
1
|
+
export declare const Logo: () => import("react/jsx-runtime").JSX.Element;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Schema } from '@teambit/graphql';
|
2
|
+
import { GeneratorMain } from './generator.main.runtime';
|
3
|
+
import { CreateOptions } from './create.cmd';
|
4
|
+
export type CreateQueryOptions = CreateOptions & {
|
5
|
+
templateName: string;
|
6
|
+
};
|
7
|
+
export declare function generatorSchema(generator: GeneratorMain): Schema;
|
@@ -0,0 +1,173 @@
|
|
1
|
+
import { GraphqlMain } from '@teambit/graphql';
|
2
|
+
import { CLIMain } from '@teambit/cli';
|
3
|
+
import { Workspace } from '@teambit/workspace';
|
4
|
+
import { EnvDefinition, EnvsMain } from '@teambit/envs';
|
5
|
+
import { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';
|
6
|
+
import type { ComponentMain, Component } from '@teambit/component';
|
7
|
+
import { SlotRegistry } from '@teambit/harmony';
|
8
|
+
import { GitMain } from '@teambit/git';
|
9
|
+
import { AspectLoaderMain } from '@teambit/aspect-loader';
|
10
|
+
import { TrackerMain } from '@teambit/tracker';
|
11
|
+
import { NewComponentHelperMain } from '@teambit/new-component-helper';
|
12
|
+
import { Logger, LoggerMain } from '@teambit/logger';
|
13
|
+
import { ComponentTemplate } from './component-template';
|
14
|
+
import { CreateOptions } from './create.cmd';
|
15
|
+
import { GenerateResult, OnComponentCreateFn } from './component-generator';
|
16
|
+
import { WorkspaceTemplate } from './workspace-template';
|
17
|
+
import { NewOptions } from './new.cmd';
|
18
|
+
export type ComponentTemplateSlot = SlotRegistry<ComponentTemplate[]>;
|
19
|
+
export type WorkspaceTemplateSlot = SlotRegistry<WorkspaceTemplate[]>;
|
20
|
+
export type OnComponentCreateSlot = SlotRegistry<OnComponentCreateFn>;
|
21
|
+
export type TemplateDescriptor = {
|
22
|
+
aspectId: string;
|
23
|
+
titlePrefix?: string;
|
24
|
+
name: string;
|
25
|
+
description?: string;
|
26
|
+
hidden?: boolean;
|
27
|
+
};
|
28
|
+
type TemplateWithId = {
|
29
|
+
id: string;
|
30
|
+
envName?: string;
|
31
|
+
};
|
32
|
+
type WorkspaceTemplateWithId = TemplateWithId & {
|
33
|
+
template: WorkspaceTemplate;
|
34
|
+
};
|
35
|
+
type ComponentTemplateWithId = TemplateWithId & {
|
36
|
+
template: ComponentTemplate;
|
37
|
+
};
|
38
|
+
export type GenerateWorkspaceTemplateResult = {
|
39
|
+
workspacePath: string;
|
40
|
+
appName?: string;
|
41
|
+
};
|
42
|
+
export type GeneratorConfig = {
|
43
|
+
/**
|
44
|
+
* array of aspects to include in the list of templates.
|
45
|
+
*/
|
46
|
+
aspects: string[];
|
47
|
+
/**
|
48
|
+
* by default core templates are shown.
|
49
|
+
* use this to hide them unless `--show-all` flag of `bit templates` was used
|
50
|
+
*/
|
51
|
+
hideCoreTemplates: boolean;
|
52
|
+
/**
|
53
|
+
* default envs.
|
54
|
+
*/
|
55
|
+
envs?: string[];
|
56
|
+
};
|
57
|
+
export declare class GeneratorMain {
|
58
|
+
private componentTemplateSlot;
|
59
|
+
private workspaceTemplateSlot;
|
60
|
+
private onComponentCreateSlot;
|
61
|
+
private config;
|
62
|
+
private workspace;
|
63
|
+
private envs;
|
64
|
+
private aspectLoader;
|
65
|
+
private newComponentHelper;
|
66
|
+
private componentAspect;
|
67
|
+
private tracker;
|
68
|
+
private logger;
|
69
|
+
private git;
|
70
|
+
private wsConfigFiles;
|
71
|
+
private aspectLoaded;
|
72
|
+
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);
|
73
|
+
/**
|
74
|
+
* register a new component template.
|
75
|
+
*/
|
76
|
+
registerComponentTemplate(templates: ComponentTemplate[]): this;
|
77
|
+
/**
|
78
|
+
* register a new workspace starter.
|
79
|
+
*/
|
80
|
+
registerWorkspaceTemplate(templates: WorkspaceTemplate[]): this;
|
81
|
+
registerOnComponentCreate(fn: OnComponentCreateFn): this;
|
82
|
+
/**
|
83
|
+
* list all component templates registered in the workspace or workspace templates in case the
|
84
|
+
* workspace is not available
|
85
|
+
*/
|
86
|
+
listTemplates({ aspect }?: {
|
87
|
+
aspect?: string;
|
88
|
+
}): Promise<TemplateDescriptor[]>;
|
89
|
+
private getTemplateDescriptor;
|
90
|
+
/**
|
91
|
+
* @deprecated use this.listTemplates()
|
92
|
+
*/
|
93
|
+
listComponentTemplates(opts: {
|
94
|
+
aspect?: string;
|
95
|
+
}): Promise<TemplateDescriptor[]>;
|
96
|
+
isRunningInsideWorkspace(): boolean;
|
97
|
+
/**
|
98
|
+
* get all component templates registered by a specific aspect ID.
|
99
|
+
*/
|
100
|
+
getComponentTemplateByAspect(aspectId: string): ComponentTemplate[];
|
101
|
+
/**
|
102
|
+
* returns a specific component template.
|
103
|
+
*/
|
104
|
+
getComponentTemplate(name: string, aspectId?: string): Promise<ComponentTemplateWithId | undefined>;
|
105
|
+
private findTemplateByAspectIdAndName;
|
106
|
+
/**
|
107
|
+
* Get the generator aspect and the envs aspect from an harmony instance of the global scope
|
108
|
+
*/
|
109
|
+
private getGlobalGeneratorEnvs;
|
110
|
+
/**
|
111
|
+
* in the case the aspect-id is given and this aspect doesn't exist locally, import it to the
|
112
|
+
* global scope and load it from the capsule
|
113
|
+
*/
|
114
|
+
findWorkspaceTemplateInGlobalScope(aspectId: string, name?: string): Promise<{
|
115
|
+
workspaceTemplate?: WorkspaceTemplate;
|
116
|
+
aspect?: Component;
|
117
|
+
}>;
|
118
|
+
findTemplateInOtherWorkspace(workspacePath: string, name: string, aspectId?: string): Promise<{
|
119
|
+
workspaceTemplate: WorkspaceTemplate | undefined;
|
120
|
+
aspect: Component;
|
121
|
+
}>;
|
122
|
+
/**
|
123
|
+
* returns a specific workspace template.
|
124
|
+
*/
|
125
|
+
getWorkspaceTemplate(name: string, aspectId?: string): Promise<{
|
126
|
+
workspaceTemplate: WorkspaceTemplate;
|
127
|
+
aspect?: Component;
|
128
|
+
}>;
|
129
|
+
searchRegisteredWorkspaceTemplate(name?: string, aspectId?: string, remoteEnvsAspect?: EnvsMain): Promise<WorkspaceTemplate | undefined>;
|
130
|
+
generateComponentTemplate(componentNames: string[], templateName: string, options: Partial<CreateOptions>): Promise<GenerateResult[]>;
|
131
|
+
private getEnvIdFromTemplateWithId;
|
132
|
+
generateWorkspaceTemplate(workspaceName: string, templateName: string, options: NewOptions & {
|
133
|
+
aspect?: string;
|
134
|
+
currentDir?: boolean;
|
135
|
+
}): Promise<GenerateWorkspaceTemplateResult>;
|
136
|
+
private getAllComponentTemplatesDescriptorsFlattened;
|
137
|
+
private getAllComponentTemplatesFlattened;
|
138
|
+
private getAllWorkspaceTemplatesDescriptorFlattened;
|
139
|
+
private getAllWorkspaceTemplatesFlattened;
|
140
|
+
/**
|
141
|
+
* list all starter templates registered by an env.
|
142
|
+
*/
|
143
|
+
listEnvWorkspaceTemplates(envId: string, remoteEnvsAspect?: EnvsMain): Promise<Array<WorkspaceTemplateWithId>>;
|
144
|
+
/**
|
145
|
+
* list all component templates registered by an env.
|
146
|
+
*/
|
147
|
+
listEnvComponentTemplateDescriptors(ids?: string[], aspectId?: string): Promise<TemplateDescriptor[]>;
|
148
|
+
getConfiguredEnvs(): string[];
|
149
|
+
listEnvComponentTemplates(ids?: string[], aspectId?: string): Promise<Array<ComponentTemplateWithId>>;
|
150
|
+
loadEnvs(ids?: string[], remoteEnvsAspect?: EnvsMain): Promise<EnvDefinition[]>;
|
151
|
+
loadAspects(): Promise<void>;
|
152
|
+
static slots: (((registerFn: () => string) => SlotRegistry<ComponentTemplate[]>) | ((registerFn: () => string) => SlotRegistry<WorkspaceTemplate[]>) | ((registerFn: () => string) => SlotRegistry<OnComponentCreateFn>))[];
|
153
|
+
static dependencies: import("@teambit/bit").Aspect[];
|
154
|
+
static runtime: import("@teambit/bit").RuntimeDefinition;
|
155
|
+
static provider([workspace, cli, graphql, envs, aspectLoader, newComponentHelper, componentAspect, tracker, loggerMain, git, wsConfigFiles,]: [
|
156
|
+
Workspace,
|
157
|
+
CLIMain,
|
158
|
+
GraphqlMain,
|
159
|
+
EnvsMain,
|
160
|
+
AspectLoaderMain,
|
161
|
+
NewComponentHelperMain,
|
162
|
+
ComponentMain,
|
163
|
+
TrackerMain,
|
164
|
+
LoggerMain,
|
165
|
+
GitMain,
|
166
|
+
WorkspaceConfigFilesMain
|
167
|
+
], config: GeneratorConfig, [componentTemplateSlot, workspaceTemplateSlot, onComponentCreateSlot]: [
|
168
|
+
ComponentTemplateSlot,
|
169
|
+
WorkspaceTemplateSlot,
|
170
|
+
OnComponentCreateSlot
|
171
|
+
]): Promise<GeneratorMain>;
|
172
|
+
}
|
173
|
+
export {};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { EnvService, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';
|
2
|
+
import { ComponentTemplate } from './component-template';
|
3
|
+
import { WorkspaceTemplate } from './workspace-template';
|
4
|
+
type GeneratorTransformationMap = ServiceTransformationMap & {
|
5
|
+
getGeneratorTemplates: () => ComponentTemplate;
|
6
|
+
getGeneratorStarters: () => WorkspaceTemplate;
|
7
|
+
};
|
8
|
+
export declare class GeneratorService implements EnvService<any> {
|
9
|
+
name: string;
|
10
|
+
transform(env: Env, context: EnvContext): GeneratorTransformationMap | undefined;
|
11
|
+
}
|
12
|
+
export {};
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
export type { GeneratorMain } from './generator.main.runtime';
|
2
|
+
export type { ComponentContext, ComponentTemplate, ComponentTemplateOptions, ComponentFile, ComponentConfig, ConfigContext, } from './component-template';
|
3
|
+
export type { WorkspaceContext, WorkspaceTemplate, WorkspaceTemplate as Starter, WorkspaceFile, ForkComponentInfo, ImportComponentInfo, CreateComponentInfo, } from './workspace-template';
|
4
|
+
export type { GeneratorEnv } from './generator-env-type';
|
5
|
+
export { GeneratorAspect } from './generator.aspect';
|
6
|
+
export { TemplateList } from './template-list';
|
7
|
+
export { StarterList } from './starter-list';
|
8
|
+
export type { GenerateResult } from './component-generator';
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { Command, CommandOptions } from '@teambit/cli';
|
2
|
+
import { GeneratorMain } from './generator.main.runtime';
|
3
|
+
import { BaseWorkspaceOptions } from './workspace-template';
|
4
|
+
/**
|
5
|
+
* NewOptions combines foundational properties with additional options for creating a workspace.
|
6
|
+
*/
|
7
|
+
export type NewOptions = BaseWorkspaceOptions;
|
8
|
+
export declare class NewCmd implements Command {
|
9
|
+
private generator;
|
10
|
+
name: string;
|
11
|
+
description: string;
|
12
|
+
arguments: {
|
13
|
+
name: string;
|
14
|
+
description: string;
|
15
|
+
}[];
|
16
|
+
alias: string;
|
17
|
+
loader: boolean;
|
18
|
+
group: string;
|
19
|
+
options: CommandOptions;
|
20
|
+
constructor(generator: GeneratorMain);
|
21
|
+
report([templateName, workspaceName]: [string, string], options: NewOptions & {
|
22
|
+
standalone: boolean;
|
23
|
+
env?: string;
|
24
|
+
template?: string;
|
25
|
+
aspect?: string;
|
26
|
+
currentDir?: boolean;
|
27
|
+
}): Promise<string>;
|
28
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@1.0.
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@1.0.
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@1.0.231/dist/generator.composition.js';
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.generator_generator@1.0.231/dist/generator.docs.mdx';
|
3
3
|
|
4
4
|
export const compositions = [compositions_0];
|
5
5
|
export const overview = [overview_0];
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { EnvContext, EnvHandler } from '@teambit/envs';
|
2
|
+
import { 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
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import { PluginDefinition } from '@teambit/aspect-loader';
|
2
|
+
import { GeneratorMain } from './generator.main.runtime';
|
3
|
+
export declare class StarterPlugin implements PluginDefinition {
|
4
|
+
private generator;
|
5
|
+
constructor(generator: GeneratorMain);
|
6
|
+
pattern: string;
|
7
|
+
runtimes: string[];
|
8
|
+
register(object: any): GeneratorMain;
|
9
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { EnvContext, EnvHandler } from '@teambit/envs';
|
2
|
+
import { 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
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export { BasicWorkspaceStarter } from './basic.starter';
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function packageJson(): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const generateComponentFileContent: () => string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const generateCompositionFileContent: () => string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const generateIndexFileContent: () => string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const generateTestFileContent: () => string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function docsFile(): string;
|
@@ -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 @@
|
|
1
|
+
export declare function generateFiles(): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function gitIgnoreTemplate(): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function workspaceConfigTemplate(): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function gitIgnoreTemplate(): string;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function workspaceConfigTemplate(): string;
|