@msishamim/create-next-monorepo 1.0.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/LICENSE +21 -0
- package/README.md +297 -0
- package/bin/cli.js +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +5575 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +221 -0
- package/dist/index.js +5557 -0
- package/dist/index.js.map +1 -0
- package/package.json +60 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ProjectConfig — Immutable configuration model holding all user choices.
|
|
3
|
+
* Auto-derives package names, case variants, and computed properties.
|
|
4
|
+
* Mirrors flutter_monorepo's ProjectConfig pattern.
|
|
5
|
+
*/
|
|
6
|
+
declare const Backend: {
|
|
7
|
+
readonly nestjs: "nestjs";
|
|
8
|
+
readonly express: "express";
|
|
9
|
+
};
|
|
10
|
+
type Backend = (typeof Backend)[keyof typeof Backend];
|
|
11
|
+
declare const Styling: {
|
|
12
|
+
readonly tailwind: "tailwind";
|
|
13
|
+
readonly cssModules: "css-modules";
|
|
14
|
+
readonly styledComponents: "styled-components";
|
|
15
|
+
};
|
|
16
|
+
type Styling = (typeof Styling)[keyof typeof Styling];
|
|
17
|
+
declare const ORM: {
|
|
18
|
+
readonly prisma: "prisma";
|
|
19
|
+
readonly drizzle: "drizzle";
|
|
20
|
+
readonly none: "none";
|
|
21
|
+
};
|
|
22
|
+
type ORM = (typeof ORM)[keyof typeof ORM];
|
|
23
|
+
declare const Database: {
|
|
24
|
+
readonly postgres: "postgres";
|
|
25
|
+
readonly mysql: "mysql";
|
|
26
|
+
readonly sqlite: "sqlite";
|
|
27
|
+
readonly mongodb: "mongodb";
|
|
28
|
+
};
|
|
29
|
+
type Database = (typeof Database)[keyof typeof Database];
|
|
30
|
+
declare const Auth: {
|
|
31
|
+
readonly nextAuth: "next-auth";
|
|
32
|
+
readonly custom: "custom";
|
|
33
|
+
readonly none: "none";
|
|
34
|
+
};
|
|
35
|
+
type Auth = (typeof Auth)[keyof typeof Auth];
|
|
36
|
+
declare const StateManagement: {
|
|
37
|
+
readonly zustand: "zustand";
|
|
38
|
+
readonly jotai: "jotai";
|
|
39
|
+
readonly redux: "redux";
|
|
40
|
+
readonly tanstackQuery: "tanstack-query";
|
|
41
|
+
readonly none: "none";
|
|
42
|
+
};
|
|
43
|
+
type StateManagement = (typeof StateManagement)[keyof typeof StateManagement];
|
|
44
|
+
declare const TestFramework: {
|
|
45
|
+
readonly vitest: "vitest";
|
|
46
|
+
readonly jest: "jest";
|
|
47
|
+
};
|
|
48
|
+
type TestFramework = (typeof TestFramework)[keyof typeof TestFramework];
|
|
49
|
+
declare const PackageManager: {
|
|
50
|
+
readonly pnpm: "pnpm";
|
|
51
|
+
readonly npm: "npm";
|
|
52
|
+
readonly yarn: "yarn";
|
|
53
|
+
readonly bun: "bun";
|
|
54
|
+
};
|
|
55
|
+
type PackageManager = (typeof PackageManager)[keyof typeof PackageManager];
|
|
56
|
+
declare const LicenseType: {
|
|
57
|
+
readonly MIT: "MIT";
|
|
58
|
+
readonly Apache2: "Apache-2.0";
|
|
59
|
+
readonly BSD2: "BSD-2-Clause";
|
|
60
|
+
readonly BSD3: "BSD-3-Clause";
|
|
61
|
+
readonly GPL2: "GPL-2.0";
|
|
62
|
+
readonly GPL3: "GPL-3.0";
|
|
63
|
+
readonly LGPL21: "LGPL-2.1";
|
|
64
|
+
readonly MPL2: "MPL-2.0";
|
|
65
|
+
readonly ISC: "ISC";
|
|
66
|
+
readonly Unlicense: "Unlicense";
|
|
67
|
+
readonly Proprietary: "proprietary";
|
|
68
|
+
};
|
|
69
|
+
type LicenseType = (typeof LicenseType)[keyof typeof LicenseType];
|
|
70
|
+
interface ProjectConfigOptions {
|
|
71
|
+
name: string;
|
|
72
|
+
backend?: Backend;
|
|
73
|
+
styling?: Styling;
|
|
74
|
+
orm?: ORM;
|
|
75
|
+
db?: Database;
|
|
76
|
+
auth?: Auth;
|
|
77
|
+
state?: StateManagement;
|
|
78
|
+
testing?: TestFramework;
|
|
79
|
+
license?: LicenseType;
|
|
80
|
+
packageManager?: PackageManager;
|
|
81
|
+
gitInit?: boolean;
|
|
82
|
+
githubFiles?: boolean;
|
|
83
|
+
}
|
|
84
|
+
declare class ProjectConfig {
|
|
85
|
+
/** Project name in kebab-case (e.g. "my-app") */
|
|
86
|
+
readonly name: string;
|
|
87
|
+
readonly backend: Backend;
|
|
88
|
+
readonly styling: Styling;
|
|
89
|
+
readonly orm: ORM;
|
|
90
|
+
readonly db: Database;
|
|
91
|
+
readonly auth: Auth;
|
|
92
|
+
readonly state: StateManagement;
|
|
93
|
+
readonly testing: TestFramework;
|
|
94
|
+
readonly license: LicenseType;
|
|
95
|
+
readonly packageManager: PackageManager;
|
|
96
|
+
readonly gitInit: boolean;
|
|
97
|
+
readonly githubFiles: boolean;
|
|
98
|
+
/** Resolved npm package versions — set by Generator before template rendering */
|
|
99
|
+
versions: Record<string, string>;
|
|
100
|
+
constructor(options: ProjectConfigOptions);
|
|
101
|
+
/** PascalCase (e.g. "my-app" → "MyApp") */
|
|
102
|
+
get pascalCase(): string;
|
|
103
|
+
/** camelCase (e.g. "my-app" → "myApp") */
|
|
104
|
+
get camelCase(): string;
|
|
105
|
+
/** SCREAMING_SNAKE_CASE (e.g. "my-app" → "MY_APP") */
|
|
106
|
+
get screamingSnakeCase(): string;
|
|
107
|
+
get hasDatabase(): boolean;
|
|
108
|
+
get hasAuth(): boolean;
|
|
109
|
+
get hasState(): boolean;
|
|
110
|
+
get usesTailwind(): boolean;
|
|
111
|
+
/** Install command for the selected package manager */
|
|
112
|
+
get installCommand(): string;
|
|
113
|
+
/** Run command prefix for the selected package manager */
|
|
114
|
+
get runCommand(): string;
|
|
115
|
+
/** Workspace config file name */
|
|
116
|
+
get workspaceConfigFile(): string;
|
|
117
|
+
/** List of npm packages required based on current config */
|
|
118
|
+
get requiredPackages(): string[];
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Generator — 16-step pipeline that creates a complete monorepo.
|
|
123
|
+
* Mirrors flutter_monorepo's Generator class architecture.
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
declare class Generator {
|
|
127
|
+
private rootPath;
|
|
128
|
+
private config;
|
|
129
|
+
constructor(config: ProjectConfig, rootPath: string);
|
|
130
|
+
/** Run the full 16-step generation pipeline */
|
|
131
|
+
run(): Promise<void>;
|
|
132
|
+
private resolveVersions;
|
|
133
|
+
private createRootWorkspace;
|
|
134
|
+
private createDirectories;
|
|
135
|
+
private writeRootFiles;
|
|
136
|
+
private writeGithubFiles;
|
|
137
|
+
private writeConfigPackage;
|
|
138
|
+
private writeLibPackage;
|
|
139
|
+
private writeUiPackage;
|
|
140
|
+
private writeDatabasePackage;
|
|
141
|
+
private writeNextjsApp;
|
|
142
|
+
private writeBackendApp;
|
|
143
|
+
private writeAuthLayer;
|
|
144
|
+
private writeSkills;
|
|
145
|
+
private installDependencies;
|
|
146
|
+
private initializeGit;
|
|
147
|
+
private printSummary;
|
|
148
|
+
private write;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* VersionResolver — Fetches latest compatible versions from npm registry.
|
|
153
|
+
* Falls back to hardcoded tested versions when offline.
|
|
154
|
+
*/
|
|
155
|
+
declare class VersionResolver {
|
|
156
|
+
private resolved;
|
|
157
|
+
/**
|
|
158
|
+
* Resolve versions for the given package names.
|
|
159
|
+
* Attempts to fetch latest from npm registry; falls back to hardcoded versions.
|
|
160
|
+
*/
|
|
161
|
+
resolve(packageNames: string[]): Promise<Record<string, string>>;
|
|
162
|
+
/** Get the fallback version for a package */
|
|
163
|
+
getFallback(packageName: string): string;
|
|
164
|
+
/** Fetch the latest version of a package from the npm registry */
|
|
165
|
+
private fetchLatestVersion;
|
|
166
|
+
/** Get all resolved versions */
|
|
167
|
+
getVersions(): Record<string, string>;
|
|
168
|
+
/** Get all fallback versions (for testing/reference) */
|
|
169
|
+
static getFallbacks(): Record<string, string>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Doctor — Validates monorepo structure integrity and auto-fixes missing items.
|
|
174
|
+
* Mirrors flutter_monorepo's Doctor class.
|
|
175
|
+
*/
|
|
176
|
+
declare class Doctor {
|
|
177
|
+
private rootPath;
|
|
178
|
+
constructor(rootPath: string);
|
|
179
|
+
/** Run the doctor validation */
|
|
180
|
+
run(fix: boolean): Promise<void>;
|
|
181
|
+
/** Build the restorable files map using templates */
|
|
182
|
+
private buildRestorableFiles;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Workflow — Step-by-step development guides for building features.
|
|
187
|
+
* Three flows: A (Component), B (Page/Route), C (API Feature).
|
|
188
|
+
* Adapts output based on detected project configuration.
|
|
189
|
+
* Mirrors flutter_monorepo's Workflow class.
|
|
190
|
+
*/
|
|
191
|
+
declare class Workflow {
|
|
192
|
+
private rootPath;
|
|
193
|
+
constructor(rootPath: string);
|
|
194
|
+
/** Run the specified workflow (or show overview) */
|
|
195
|
+
run(flow?: string): void;
|
|
196
|
+
private printOverview;
|
|
197
|
+
private printComponentFlow;
|
|
198
|
+
private printPageFlow;
|
|
199
|
+
private printApiFlow;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* ConfigDetector — Reverse-engineers a ProjectConfig from an existing
|
|
204
|
+
* generated monorepo by reading files on disk.
|
|
205
|
+
* Mirrors flutter_monorepo's config_detector.dart.
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
/** Attempt to detect project configuration from existing files */
|
|
209
|
+
declare function detectProjectConfig(rootPath: string): ProjectConfig | null;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Expected directories and files for a generated monorepo.
|
|
213
|
+
* Shared by Generator (creation) and Doctor (validation).
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
/** All directories that should exist in a generated monorepo */
|
|
217
|
+
declare function getExpectedDirectories(config: ProjectConfig): string[];
|
|
218
|
+
/** All files that should exist in a generated monorepo */
|
|
219
|
+
declare function getExpectedFiles(config: ProjectConfig): string[];
|
|
220
|
+
|
|
221
|
+
export { Auth, Backend, Database, Doctor, Generator, LicenseType, ORM, PackageManager, ProjectConfig, type ProjectConfigOptions, StateManagement, Styling, TestFramework, VersionResolver, Workflow, detectProjectConfig, getExpectedDirectories, getExpectedFiles };
|