wlmaker 1.7.0 → 1.8.1
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/README.md +749 -1
- package/dist/chunk-4AOS33ZX.mjs +390 -0
- package/dist/{chunk-LHUDYCA5.mjs → chunk-554WKK3Z.mjs} +1 -1
- package/dist/chunk-6JXSEAVX.mjs +49 -0
- package/dist/{chunk-OTFDN3HG.mjs → chunk-ELYQ3PL5.mjs} +40 -1
- package/dist/{chunk-BVPCRMD4.mjs → chunk-P7W5YVTZ.mjs} +1 -1
- package/dist/{chunk-KBIXWYFD.mjs → chunk-V4S7DQDN.mjs} +15 -1
- package/dist/chunk-ZYOPXWRK.mjs +221 -0
- package/dist/cli.mjs +2520 -1478
- package/dist/compose-flow-JPC2CZ72.mjs +202 -0
- package/dist/{generator-PWZL3JNY.mjs → generator-CACGWIBO.mjs} +2 -2
- package/dist/{generator-PEYFNXBT.mjs → generator-NQ6GX2L6.mjs} +3 -3
- package/dist/{generator-DDKHXUAT.mjs → generator-OYLKPDQC.mjs} +2 -2
- package/dist/{project-RTR7EV3X.mjs → project-433ZRUBC.mjs} +3 -1
- package/dist/validate-regions-UIGBXPHU.mjs +49 -0
- package/package.json +3 -2
- package/dist/chunk-FXU2ADDY.mjs +0 -146
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
dartFormat,
|
|
4
|
+
detectDesignSystem,
|
|
5
|
+
tierPlural,
|
|
6
|
+
updateSortedBarrelFile
|
|
7
|
+
} from "./chunk-ZYOPXWRK.mjs";
|
|
8
|
+
import "./chunk-V4S7DQDN.mjs";
|
|
9
|
+
import {
|
|
10
|
+
parseRegions
|
|
11
|
+
} from "./chunk-6JXSEAVX.mjs";
|
|
12
|
+
|
|
13
|
+
// src/flows/compose-flow.ts
|
|
14
|
+
import * as fs2 from "fs";
|
|
15
|
+
import * as path2 from "path";
|
|
16
|
+
import * as clack from "@clack/prompts";
|
|
17
|
+
import chalk from "chalk";
|
|
18
|
+
import { pascalCase } from "change-case";
|
|
19
|
+
|
|
20
|
+
// src/analyzer/component-regions.ts
|
|
21
|
+
import * as fs from "fs";
|
|
22
|
+
import * as path from "path";
|
|
23
|
+
function analyzeComponent(filePath) {
|
|
24
|
+
if (!fs.existsSync(filePath)) return null;
|
|
25
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
26
|
+
const { regions, errors } = parseRegions(content);
|
|
27
|
+
if (errors.length > 0) {
|
|
28
|
+
console.warn(`\u26A0 Regions warning in ${filePath}:`);
|
|
29
|
+
for (const err of errors) console.warn(` ${err}`);
|
|
30
|
+
}
|
|
31
|
+
const componentName = path.basename(path.dirname(filePath)) === path.basename(filePath, ".dart") ? path.basename(path.dirname(filePath)) : path.basename(filePath, ".dart");
|
|
32
|
+
return {
|
|
33
|
+
componentName,
|
|
34
|
+
filePath,
|
|
35
|
+
props: regions["Props"] ?? null,
|
|
36
|
+
constructor: regions["Constructor"] ?? null,
|
|
37
|
+
fields: regions["Fields"] ?? regions["Props"] ?? null,
|
|
38
|
+
allRegions: regions
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function listComponents(projectRoot) {
|
|
42
|
+
const ds = detectDesignSystem(projectRoot);
|
|
43
|
+
if (!ds) return [];
|
|
44
|
+
const results = [];
|
|
45
|
+
for (const tierDir of ds.availableTiers) {
|
|
46
|
+
const dir = path.join(ds.componentsDir, tierDir);
|
|
47
|
+
if (!fs.existsSync(dir)) continue;
|
|
48
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
49
|
+
for (const entry of entries) {
|
|
50
|
+
if (entry.isDirectory() && entry.name.startsWith("wl_")) {
|
|
51
|
+
results.push(entry.name);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return results.sort();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/flows/compose-flow.ts
|
|
59
|
+
async function composeFlow() {
|
|
60
|
+
const projectRoot = process.cwd();
|
|
61
|
+
const ds = detectDesignSystem(projectRoot);
|
|
62
|
+
if (!ds) {
|
|
63
|
+
clack.outro(chalk.red("No design system detected."));
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
const rawName = await clack.text({
|
|
67
|
+
message: "Parent component name (snake_case, without wl_ prefix)",
|
|
68
|
+
placeholder: "e.g. confirmation_card",
|
|
69
|
+
validate: (v) => {
|
|
70
|
+
if (!v?.trim()) return "Name is required";
|
|
71
|
+
if (!/^[a-z][a-z0-9_]*$/.test(v)) return "Must be snake_case";
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
if (clack.isCancel(rawName)) {
|
|
75
|
+
clack.cancel("Cancelled");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
const name = rawName;
|
|
79
|
+
const pascal = pascalCase(name);
|
|
80
|
+
const fileName = `wl_${name}`;
|
|
81
|
+
const allTiers = ["atom", "molecule", "organism", "template"];
|
|
82
|
+
const tierChoice = await clack.select({
|
|
83
|
+
message: "Select tier",
|
|
84
|
+
options: allTiers.map((t) => ({ value: t, label: t })),
|
|
85
|
+
initialValue: "molecule"
|
|
86
|
+
});
|
|
87
|
+
if (clack.isCancel(tierChoice)) {
|
|
88
|
+
clack.cancel("Cancelled");
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
const tier = tierChoice;
|
|
92
|
+
const availableComponents = listComponents(projectRoot).filter((c) => c !== fileName);
|
|
93
|
+
if (availableComponents.length === 0) {
|
|
94
|
+
clack.outro(chalk.yellow("No components found in the design system."));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const selected = await clack.multiselect({
|
|
98
|
+
message: "Select child components to compose from:",
|
|
99
|
+
options: availableComponents.map((c) => ({ value: c, label: c })),
|
|
100
|
+
required: true
|
|
101
|
+
});
|
|
102
|
+
if (clack.isCancel(selected)) {
|
|
103
|
+
clack.cancel("Cancelled");
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const childNames = selected;
|
|
107
|
+
const allProps = [];
|
|
108
|
+
const allConstructorParams = [];
|
|
109
|
+
const fieldNames = /* @__PURE__ */ new Set();
|
|
110
|
+
function findAnyComponent(name2) {
|
|
111
|
+
for (const t of ["atoms", "molecules", "organisms", "templates"]) {
|
|
112
|
+
const p = path2.join(ds.componentsDir, t, name2, `${name2}.dart`);
|
|
113
|
+
if (fs2.existsSync(p)) return p;
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
for (const child of childNames) {
|
|
118
|
+
const childFile = findAnyComponent(child);
|
|
119
|
+
if (!childFile) {
|
|
120
|
+
clack.log.warn(`Component "${child}" not found in any tier, skipping.`);
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
const analysis = analyzeComponent(childFile);
|
|
124
|
+
if (!analysis) continue;
|
|
125
|
+
if (analysis.props || analysis.fields) {
|
|
126
|
+
const region = analysis.props ?? analysis.fields;
|
|
127
|
+
const lines = region.content.split("\n");
|
|
128
|
+
for (const line of lines) {
|
|
129
|
+
const trimmed = line.trim();
|
|
130
|
+
if (!trimmed || trimmed.startsWith("//")) continue;
|
|
131
|
+
const fieldMatch = trimmed.match(/final\s+\S+\s+(\w+)/);
|
|
132
|
+
if (fieldMatch && !fieldNames.has(fieldMatch[1])) {
|
|
133
|
+
fieldNames.add(fieldMatch[1]);
|
|
134
|
+
allProps.push(` ${trimmed}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
if (analysis.constructor) {
|
|
139
|
+
const lines = analysis.constructor.content.split("\n");
|
|
140
|
+
for (const line of lines) {
|
|
141
|
+
const trimmed = line.trim();
|
|
142
|
+
if (!trimmed || trimmed === "const WlXxx({" || trimmed === "});" || trimmed.startsWith("//")) continue;
|
|
143
|
+
const paramMatch = trimmed.match(/this\.(\w+)/);
|
|
144
|
+
if (paramMatch && fieldNames.has(paramMatch[1])) {
|
|
145
|
+
allConstructorParams.push(` ${trimmed.replace(/,\s*$/, "")},`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (allProps.length === 0) {
|
|
151
|
+
clack.outro(chalk.yellow("No props found in selected components. Make sure they have //#region Props markers."));
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const plural = tierPlural(tier);
|
|
155
|
+
const tierDir = path2.join(ds.componentsDir, plural);
|
|
156
|
+
const outDir = path2.join(tierDir, fileName);
|
|
157
|
+
if (!fs2.existsSync(outDir)) fs2.mkdirSync(outDir, { recursive: true });
|
|
158
|
+
const targetFile = path2.join(outDir, `${fileName}.dart`);
|
|
159
|
+
if (fs2.existsSync(targetFile)) {
|
|
160
|
+
const overwrite = await clack.confirm({
|
|
161
|
+
message: `${fileName} already exists. Overwrite?`,
|
|
162
|
+
initialValue: false
|
|
163
|
+
});
|
|
164
|
+
if (!overwrite || clack.isCancel(overwrite)) {
|
|
165
|
+
clack.cancel("Cancelled");
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const componentName = `Wl${pascal}`;
|
|
170
|
+
const code = `import 'package:design_system/design_system.dart';
|
|
171
|
+
import 'package:flutter/material.dart';
|
|
172
|
+
|
|
173
|
+
class ${componentName} extends StatelessWidget {
|
|
174
|
+
//#region Constructor
|
|
175
|
+
const ${componentName}({
|
|
176
|
+
super.key,
|
|
177
|
+
${allConstructorParams.join("\n")}
|
|
178
|
+
});
|
|
179
|
+
//#endregion
|
|
180
|
+
|
|
181
|
+
//#region Props
|
|
182
|
+
${allProps.join("\n")}
|
|
183
|
+
//#endregion
|
|
184
|
+
|
|
185
|
+
@override
|
|
186
|
+
Widget build(BuildContext context) {
|
|
187
|
+
final theme = context.theme;
|
|
188
|
+
// TODO: compose children from ${childNames.join(", ")}
|
|
189
|
+
return const SizedBox.shrink();
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
`;
|
|
193
|
+
fs2.writeFileSync(targetFile, code);
|
|
194
|
+
dartFormat(targetFile);
|
|
195
|
+
const barrelFileName = `${plural}.dart`;
|
|
196
|
+
const exportLine = `export '${fileName}/${fileName}.dart';`;
|
|
197
|
+
updateSortedBarrelFile(tierDir, barrelFileName, exportLine);
|
|
198
|
+
clack.outro(chalk.green(`${componentName} created in ${plural}/${fileName}/ with ${allProps.length} combined props from ${childNames.length} children.`));
|
|
199
|
+
}
|
|
200
|
+
export {
|
|
201
|
+
composeFlow
|
|
202
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createCollaborativeBloc
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-554WKK3Z.mjs";
|
|
5
5
|
import "./chunk-7KUDXB2F.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-ELYQ3PL5.mjs";
|
|
7
7
|
export {
|
|
8
8
|
createCollaborativeBloc
|
|
9
9
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createCollaborativeFeature
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-4AOS33ZX.mjs";
|
|
5
|
+
import "./chunk-ELYQ3PL5.mjs";
|
|
6
|
+
import "./chunk-V4S7DQDN.mjs";
|
|
7
7
|
export {
|
|
8
8
|
createCollaborativeFeature
|
|
9
9
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
createCollaborativePage
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-P7W5YVTZ.mjs";
|
|
5
5
|
import "./chunk-7KUDXB2F.mjs";
|
|
6
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-ELYQ3PL5.mjs";
|
|
7
7
|
export {
|
|
8
8
|
createCollaborativePage
|
|
9
9
|
};
|
|
@@ -5,13 +5,15 @@ import {
|
|
|
5
5
|
discoverPackages,
|
|
6
6
|
discoverProjects,
|
|
7
7
|
findMonorepoRoot,
|
|
8
|
+
isMonorepoRoot,
|
|
8
9
|
resolveWorkspaceVersions
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-V4S7DQDN.mjs";
|
|
10
11
|
export {
|
|
11
12
|
analyzeProject,
|
|
12
13
|
discoverCollaborativeFeatures,
|
|
13
14
|
discoverPackages,
|
|
14
15
|
discoverProjects,
|
|
15
16
|
findMonorepoRoot,
|
|
17
|
+
isMonorepoRoot,
|
|
16
18
|
resolveWorkspaceVersions
|
|
17
19
|
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
parseRegions
|
|
4
|
+
} from "./chunk-6JXSEAVX.mjs";
|
|
5
|
+
|
|
6
|
+
// src/commands/validate-regions.ts
|
|
7
|
+
import * as fs from "fs";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
function validateAllRegions(dir) {
|
|
11
|
+
const results = [];
|
|
12
|
+
function walk(currentDir) {
|
|
13
|
+
if (!fs.existsSync(currentDir)) return;
|
|
14
|
+
const entries = fs.readdirSync(currentDir, { withFileTypes: true });
|
|
15
|
+
for (const entry of entries) {
|
|
16
|
+
const fullPath = path.join(currentDir, entry.name);
|
|
17
|
+
if (entry.isDirectory()) {
|
|
18
|
+
walk(fullPath);
|
|
19
|
+
} else if (entry.name.endsWith(".dart") && !entry.name.endsWith(".g.dart")) {
|
|
20
|
+
const content = fs.readFileSync(fullPath, "utf-8");
|
|
21
|
+
const { errors } = parseRegions(content);
|
|
22
|
+
if (errors.length > 0) {
|
|
23
|
+
results.push({ file: fullPath, errors });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
walk(dir);
|
|
29
|
+
return results;
|
|
30
|
+
}
|
|
31
|
+
function displayRegionValidation(results) {
|
|
32
|
+
if (results.length === 0) {
|
|
33
|
+
console.log(chalk.green("\u2713 Todas las regions est\xE1n balanceadas."));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
console.log(chalk.red(`\u2717 ${results.length} archivo(s) con errores:
|
|
37
|
+
`));
|
|
38
|
+
for (const { file, errors } of results) {
|
|
39
|
+
console.log(chalk.cyan(file));
|
|
40
|
+
for (const error of errors) {
|
|
41
|
+
console.log(chalk.yellow(` ${error}`));
|
|
42
|
+
}
|
|
43
|
+
console.log();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
displayRegionValidation,
|
|
48
|
+
validateAllRegions
|
|
49
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wlmaker",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.1",
|
|
4
4
|
"description": "Create Flutter BLoCs with Freezed sealed classes from the terminal",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"flutter",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"chalk": "^5.3.0",
|
|
32
32
|
"change-case": "^5.4.0",
|
|
33
33
|
"commander": "^12.0.0",
|
|
34
|
-
"yaml": "^2.8.3"
|
|
34
|
+
"yaml": "^2.8.3",
|
|
35
|
+
"zod": "^4.4.3"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
38
|
"@types/node": "^22.0.0",
|
package/dist/chunk-FXU2ADDY.mjs
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
resolveWorkspaceVersions
|
|
4
|
-
} from "./chunk-KBIXWYFD.mjs";
|
|
5
|
-
import {
|
|
6
|
-
blocsModuleTemplate,
|
|
7
|
-
collaborativeGitignore,
|
|
8
|
-
collaborativePubspec,
|
|
9
|
-
datasourcesModuleTemplate,
|
|
10
|
-
emptyBarrelTemplate,
|
|
11
|
-
featureDiTemplate,
|
|
12
|
-
mainBarrelTemplate,
|
|
13
|
-
repositoriesModuleTemplate,
|
|
14
|
-
usecasesModuleTemplate
|
|
15
|
-
} from "./chunk-OTFDN3HG.mjs";
|
|
16
|
-
|
|
17
|
-
// src/generators/collaborative/feature/generator.ts
|
|
18
|
-
import * as fs from "fs";
|
|
19
|
-
import * as path from "path";
|
|
20
|
-
import { execSync } from "child_process";
|
|
21
|
-
import chalk from "chalk";
|
|
22
|
-
import { pascalCase } from "change-case";
|
|
23
|
-
var SNAKE_CASE_REGEX = /^[a-z][a-z0-9_]*$/;
|
|
24
|
-
async function createCollaborativeFeature(options) {
|
|
25
|
-
const { monorepoRoot, featureName } = options;
|
|
26
|
-
const pascal = pascalCase(featureName);
|
|
27
|
-
const description = options.description ?? `${pascal} collaborative feature`;
|
|
28
|
-
if (!SNAKE_CASE_REGEX.test(featureName)) {
|
|
29
|
-
throw new Error(
|
|
30
|
-
"Feature name must be snake_case (lowercase letters, digits, underscores)."
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
const collaborativeDir = path.join(monorepoRoot, "packages", "collaborative");
|
|
34
|
-
if (!fs.existsSync(collaborativeDir)) {
|
|
35
|
-
fs.mkdirSync(collaborativeDir, { recursive: true });
|
|
36
|
-
}
|
|
37
|
-
const pkgDir = path.join(collaborativeDir, featureName);
|
|
38
|
-
if (fs.existsSync(pkgDir)) {
|
|
39
|
-
throw new Error(`packages/collaborative/${featureName} already exists`);
|
|
40
|
-
}
|
|
41
|
-
console.log(
|
|
42
|
-
chalk.bold(`
|
|
43
|
-
Creating collaborative feature: ${chalk.cyan(featureName)}
|
|
44
|
-
`)
|
|
45
|
-
);
|
|
46
|
-
console.log(chalk.cyan(" -> Running flutter create..."));
|
|
47
|
-
execSync(
|
|
48
|
-
`flutter create --template=package packages/collaborative/${featureName}`,
|
|
49
|
-
{ cwd: monorepoRoot, stdio: "pipe" }
|
|
50
|
-
);
|
|
51
|
-
const autoTestFile = path.join(pkgDir, "test", `${featureName}_test.dart`);
|
|
52
|
-
if (fs.existsSync(autoTestFile)) {
|
|
53
|
-
fs.unlinkSync(autoTestFile);
|
|
54
|
-
}
|
|
55
|
-
console.log(chalk.cyan(" -> Generating feature structure..."));
|
|
56
|
-
const lib = path.join(pkgDir, "lib");
|
|
57
|
-
const dirs = [
|
|
58
|
-
path.join(lib, "data", "api", "bff"),
|
|
59
|
-
path.join(lib, "data", "datasources"),
|
|
60
|
-
path.join(lib, "data", "models"),
|
|
61
|
-
path.join(lib, "data", "repositories"),
|
|
62
|
-
path.join(lib, "domain", "entities"),
|
|
63
|
-
path.join(lib, "domain", "repositories"),
|
|
64
|
-
path.join(lib, "domain", "usecases"),
|
|
65
|
-
path.join(lib, "presentation", "bloc"),
|
|
66
|
-
path.join(lib, "presentation", "pages", "views"),
|
|
67
|
-
path.join(lib, "di")
|
|
68
|
-
];
|
|
69
|
-
for (const dir of dirs) {
|
|
70
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
71
|
-
}
|
|
72
|
-
const workspaceVersions = resolveWorkspaceVersions(monorepoRoot);
|
|
73
|
-
fs.writeFileSync(
|
|
74
|
-
path.join(pkgDir, "pubspec.yaml"),
|
|
75
|
-
collaborativePubspec(featureName, description, workspaceVersions)
|
|
76
|
-
);
|
|
77
|
-
fs.writeFileSync(
|
|
78
|
-
path.join(pkgDir, ".gitignore"),
|
|
79
|
-
collaborativeGitignore()
|
|
80
|
-
);
|
|
81
|
-
const diDir = path.join(lib, "di");
|
|
82
|
-
fs.writeFileSync(
|
|
83
|
-
path.join(diDir, `${featureName}_di.dart`),
|
|
84
|
-
featureDiTemplate(featureName)
|
|
85
|
-
);
|
|
86
|
-
fs.writeFileSync(
|
|
87
|
-
path.join(diDir, "blocs_module.dart"),
|
|
88
|
-
blocsModuleTemplate(featureName)
|
|
89
|
-
);
|
|
90
|
-
fs.writeFileSync(
|
|
91
|
-
path.join(diDir, "datasources_module.dart"),
|
|
92
|
-
datasourcesModuleTemplate(featureName)
|
|
93
|
-
);
|
|
94
|
-
fs.writeFileSync(
|
|
95
|
-
path.join(diDir, "repositories_module.dart"),
|
|
96
|
-
repositoriesModuleTemplate(featureName)
|
|
97
|
-
);
|
|
98
|
-
fs.writeFileSync(
|
|
99
|
-
path.join(diDir, "usecases_module.dart"),
|
|
100
|
-
usecasesModuleTemplate(featureName)
|
|
101
|
-
);
|
|
102
|
-
const barrelPaths = [
|
|
103
|
-
path.join(lib, "data", "api", "bff", "bff.dart"),
|
|
104
|
-
path.join(lib, "data", "datasources", "datasources.dart"),
|
|
105
|
-
path.join(lib, "data", "models", "models.dart"),
|
|
106
|
-
path.join(lib, "data", "repositories", "repositories.dart"),
|
|
107
|
-
path.join(lib, "domain", "entities", "entities.dart"),
|
|
108
|
-
path.join(lib, "domain", "repositories", "repositories.dart"),
|
|
109
|
-
path.join(lib, "domain", "usecases", "usecases.dart"),
|
|
110
|
-
path.join(lib, "presentation", "bloc", "bloc.dart"),
|
|
111
|
-
path.join(lib, "presentation", "pages", "views", "views.dart"),
|
|
112
|
-
path.join(lib, "presentation", "pages", "pages.dart")
|
|
113
|
-
];
|
|
114
|
-
for (const barrelPath of barrelPaths) {
|
|
115
|
-
fs.writeFileSync(barrelPath, emptyBarrelTemplate());
|
|
116
|
-
}
|
|
117
|
-
fs.writeFileSync(
|
|
118
|
-
path.join(lib, `${featureName}.dart`),
|
|
119
|
-
mainBarrelTemplate(featureName)
|
|
120
|
-
);
|
|
121
|
-
if (options.runBootstrap !== false) {
|
|
122
|
-
console.log(chalk.cyan(" -> Running melos bootstrap..."));
|
|
123
|
-
try {
|
|
124
|
-
execSync("melos bootstrap", { cwd: monorepoRoot, stdio: "pipe" });
|
|
125
|
-
console.log(chalk.green(" melos bootstrap completed"));
|
|
126
|
-
} catch {
|
|
127
|
-
console.log(
|
|
128
|
-
chalk.yellow(" melos bootstrap failed (you may need to run it manually)")
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
console.log(
|
|
133
|
-
chalk.green(`
|
|
134
|
-
Feature "${featureName}" created successfully!`)
|
|
135
|
-
);
|
|
136
|
-
console.log(chalk.gray(` ${pkgDir}`));
|
|
137
|
-
console.log(chalk.gray(`
|
|
138
|
-
Next steps:`));
|
|
139
|
-
console.log(chalk.gray(` wlmaker collaborative endpoint ...`));
|
|
140
|
-
console.log(chalk.gray(` wlmaker collaborative bloc ...`));
|
|
141
|
-
console.log(chalk.gray(` wlmaker collaborative page ...`));
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export {
|
|
145
|
-
createCollaborativeFeature
|
|
146
|
-
};
|