@abhinav2-3/core 0.1.0
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.
- package/dist/index.d.mts +115 -0
- package/dist/index.d.ts +115 -0
- package/dist/index.js +2505 -0
- package/dist/index.mjs +2493 -0
- package/package.json +26 -0
- package/src/constants/paths.ts +55 -0
- package/src/environment/index.ts +16 -0
- package/src/features/apply-features.ts +171 -0
- package/src/features/index.ts +3 -0
- package/src/features/registry.ts +222 -0
- package/src/features/resolver.ts +19 -0
- package/src/filesystem/index.ts +45 -0
- package/src/generator/generateProject.ts +91 -0
- package/src/git/index.ts +22 -0
- package/src/index.ts +3 -0
- package/src/installers/base.ts +31 -0
- package/src/installers/implementations.ts +28 -0
- package/src/installers/index.ts +16 -0
- package/src/resolvers/templateResolver.ts +26 -0
- package/src/template-engine/index.ts +21 -0
- package/src/types.ts +38 -0
- package/tsconfig.json +13 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
type Framework = 'express';
|
|
2
|
+
type Architecture = 'traditional' | 'modular';
|
|
3
|
+
type Database = 'mongodb' | 'postgres';
|
|
4
|
+
type ORM = 'mongoose' | 'prisma';
|
|
5
|
+
type PackageManager = 'npm' | 'pnpm' | 'yarn';
|
|
6
|
+
interface GeneratorConfig {
|
|
7
|
+
projectName: string;
|
|
8
|
+
framework: Framework;
|
|
9
|
+
architecture: Architecture;
|
|
10
|
+
database: Database;
|
|
11
|
+
orm: ORM;
|
|
12
|
+
packageManager: PackageManager;
|
|
13
|
+
features: string[];
|
|
14
|
+
}
|
|
15
|
+
interface FeatureMetadata {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
frameworks?: Framework[];
|
|
19
|
+
architectures?: Architecture[];
|
|
20
|
+
databases?: Database[];
|
|
21
|
+
}
|
|
22
|
+
interface FeatureDependencies {
|
|
23
|
+
dependencies?: Record<string, string>;
|
|
24
|
+
devDependencies?: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
interface Feature {
|
|
27
|
+
metadata: FeatureMetadata;
|
|
28
|
+
dependencies: FeatureDependencies;
|
|
29
|
+
apply?: (projectPath: string, config: GeneratorConfig) => Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface GeneratorOptions {
|
|
33
|
+
assetsRoot?: string;
|
|
34
|
+
}
|
|
35
|
+
declare const generateProject: (config: GeneratorConfig, options?: GeneratorOptions) => Promise<void>;
|
|
36
|
+
|
|
37
|
+
interface RegisteredFeature {
|
|
38
|
+
name: string;
|
|
39
|
+
metadata: FeatureMetadata;
|
|
40
|
+
path: string;
|
|
41
|
+
}
|
|
42
|
+
declare class FeatureRegistry {
|
|
43
|
+
private features;
|
|
44
|
+
private readonly featuresBaseDir;
|
|
45
|
+
constructor();
|
|
46
|
+
/**
|
|
47
|
+
* Load and register all available features from the features directory
|
|
48
|
+
*/
|
|
49
|
+
discoverFeatures(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Register a single feature by loading its metadata
|
|
52
|
+
*/
|
|
53
|
+
private registerFeature;
|
|
54
|
+
/**
|
|
55
|
+
* Get a registered feature by name
|
|
56
|
+
*/
|
|
57
|
+
getFeature(name: string): RegisteredFeature | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Get metadata for a feature
|
|
60
|
+
*/
|
|
61
|
+
getFeatureMetadata(name: string): FeatureMetadata | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Get path to a feature directory
|
|
64
|
+
*/
|
|
65
|
+
getFeaturePath(name: string): string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Get all registered features
|
|
68
|
+
*/
|
|
69
|
+
getAllFeatures(): RegisteredFeature[];
|
|
70
|
+
/**
|
|
71
|
+
* Check if a feature is registered
|
|
72
|
+
*/
|
|
73
|
+
hasFeature(name: string): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Get features that support a specific framework
|
|
76
|
+
*/
|
|
77
|
+
getFeaturesByFramework(framework: string): RegisteredFeature[];
|
|
78
|
+
/**
|
|
79
|
+
* Get features that support a specific architecture
|
|
80
|
+
*/
|
|
81
|
+
getFeaturesByArchitecture(architecture: string): RegisteredFeature[];
|
|
82
|
+
/**
|
|
83
|
+
* Get features that support a specific database
|
|
84
|
+
*/
|
|
85
|
+
getFeaturesByDatabase(database: string): RegisteredFeature[];
|
|
86
|
+
/**
|
|
87
|
+
* Get all features compatible with given config
|
|
88
|
+
*/
|
|
89
|
+
getCompatibleFeatures(framework: string, architecture: string, database: string): RegisteredFeature[];
|
|
90
|
+
/**
|
|
91
|
+
* Validate that requested features are available and compatible
|
|
92
|
+
*/
|
|
93
|
+
validateFeatures(featureNames: string[], framework: string, architecture: string, database: string): {
|
|
94
|
+
valid: boolean;
|
|
95
|
+
errors: string[];
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
declare function getFeatureRegistry(): Promise<FeatureRegistry>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Resolves selected feature names from the generator configuration.
|
|
102
|
+
* Currently, it simply returns the features selected by the user.
|
|
103
|
+
* In the future, this can handle dependencies between features.
|
|
104
|
+
*/
|
|
105
|
+
declare const resolveFeatures: (config: GeneratorConfig) => string[];
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Applies all selected features to the generated project.
|
|
109
|
+
*/
|
|
110
|
+
declare const applyFeatures: (projectPath: string, config: GeneratorConfig, options?: {
|
|
111
|
+
renderData?: Record<string, any>;
|
|
112
|
+
assetsRoot?: string;
|
|
113
|
+
}) => Promise<void>;
|
|
114
|
+
|
|
115
|
+
export { type Architecture, type Database, type Feature, type FeatureDependencies, type FeatureMetadata, FeatureRegistry, type Framework, type GeneratorConfig, type GeneratorOptions, type ORM, type PackageManager, type RegisteredFeature, applyFeatures, generateProject, getFeatureRegistry, resolveFeatures };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
type Framework = 'express';
|
|
2
|
+
type Architecture = 'traditional' | 'modular';
|
|
3
|
+
type Database = 'mongodb' | 'postgres';
|
|
4
|
+
type ORM = 'mongoose' | 'prisma';
|
|
5
|
+
type PackageManager = 'npm' | 'pnpm' | 'yarn';
|
|
6
|
+
interface GeneratorConfig {
|
|
7
|
+
projectName: string;
|
|
8
|
+
framework: Framework;
|
|
9
|
+
architecture: Architecture;
|
|
10
|
+
database: Database;
|
|
11
|
+
orm: ORM;
|
|
12
|
+
packageManager: PackageManager;
|
|
13
|
+
features: string[];
|
|
14
|
+
}
|
|
15
|
+
interface FeatureMetadata {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
frameworks?: Framework[];
|
|
19
|
+
architectures?: Architecture[];
|
|
20
|
+
databases?: Database[];
|
|
21
|
+
}
|
|
22
|
+
interface FeatureDependencies {
|
|
23
|
+
dependencies?: Record<string, string>;
|
|
24
|
+
devDependencies?: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
interface Feature {
|
|
27
|
+
metadata: FeatureMetadata;
|
|
28
|
+
dependencies: FeatureDependencies;
|
|
29
|
+
apply?: (projectPath: string, config: GeneratorConfig) => Promise<void>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
interface GeneratorOptions {
|
|
33
|
+
assetsRoot?: string;
|
|
34
|
+
}
|
|
35
|
+
declare const generateProject: (config: GeneratorConfig, options?: GeneratorOptions) => Promise<void>;
|
|
36
|
+
|
|
37
|
+
interface RegisteredFeature {
|
|
38
|
+
name: string;
|
|
39
|
+
metadata: FeatureMetadata;
|
|
40
|
+
path: string;
|
|
41
|
+
}
|
|
42
|
+
declare class FeatureRegistry {
|
|
43
|
+
private features;
|
|
44
|
+
private readonly featuresBaseDir;
|
|
45
|
+
constructor();
|
|
46
|
+
/**
|
|
47
|
+
* Load and register all available features from the features directory
|
|
48
|
+
*/
|
|
49
|
+
discoverFeatures(): Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Register a single feature by loading its metadata
|
|
52
|
+
*/
|
|
53
|
+
private registerFeature;
|
|
54
|
+
/**
|
|
55
|
+
* Get a registered feature by name
|
|
56
|
+
*/
|
|
57
|
+
getFeature(name: string): RegisteredFeature | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Get metadata for a feature
|
|
60
|
+
*/
|
|
61
|
+
getFeatureMetadata(name: string): FeatureMetadata | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Get path to a feature directory
|
|
64
|
+
*/
|
|
65
|
+
getFeaturePath(name: string): string | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Get all registered features
|
|
68
|
+
*/
|
|
69
|
+
getAllFeatures(): RegisteredFeature[];
|
|
70
|
+
/**
|
|
71
|
+
* Check if a feature is registered
|
|
72
|
+
*/
|
|
73
|
+
hasFeature(name: string): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Get features that support a specific framework
|
|
76
|
+
*/
|
|
77
|
+
getFeaturesByFramework(framework: string): RegisteredFeature[];
|
|
78
|
+
/**
|
|
79
|
+
* Get features that support a specific architecture
|
|
80
|
+
*/
|
|
81
|
+
getFeaturesByArchitecture(architecture: string): RegisteredFeature[];
|
|
82
|
+
/**
|
|
83
|
+
* Get features that support a specific database
|
|
84
|
+
*/
|
|
85
|
+
getFeaturesByDatabase(database: string): RegisteredFeature[];
|
|
86
|
+
/**
|
|
87
|
+
* Get all features compatible with given config
|
|
88
|
+
*/
|
|
89
|
+
getCompatibleFeatures(framework: string, architecture: string, database: string): RegisteredFeature[];
|
|
90
|
+
/**
|
|
91
|
+
* Validate that requested features are available and compatible
|
|
92
|
+
*/
|
|
93
|
+
validateFeatures(featureNames: string[], framework: string, architecture: string, database: string): {
|
|
94
|
+
valid: boolean;
|
|
95
|
+
errors: string[];
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
declare function getFeatureRegistry(): Promise<FeatureRegistry>;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Resolves selected feature names from the generator configuration.
|
|
102
|
+
* Currently, it simply returns the features selected by the user.
|
|
103
|
+
* In the future, this can handle dependencies between features.
|
|
104
|
+
*/
|
|
105
|
+
declare const resolveFeatures: (config: GeneratorConfig) => string[];
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Applies all selected features to the generated project.
|
|
109
|
+
*/
|
|
110
|
+
declare const applyFeatures: (projectPath: string, config: GeneratorConfig, options?: {
|
|
111
|
+
renderData?: Record<string, any>;
|
|
112
|
+
assetsRoot?: string;
|
|
113
|
+
}) => Promise<void>;
|
|
114
|
+
|
|
115
|
+
export { type Architecture, type Database, type Feature, type FeatureDependencies, type FeatureMetadata, FeatureRegistry, type Framework, type GeneratorConfig, type GeneratorOptions, type ORM, type PackageManager, type RegisteredFeature, applyFeatures, generateProject, getFeatureRegistry, resolveFeatures };
|