@gravito/pulse 3.2.1 → 3.3.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.js +86 -14
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -83872,7 +83872,7 @@ var init_SchemaSniffer = __esm(() => {
|
|
|
83872
83872
|
});
|
|
83873
83873
|
|
|
83874
83874
|
// ../atlas/src/orm/schema/SchemaRegistry.ts
|
|
83875
|
-
import { existsSync as existsSync3, readFileSync, writeFileSync } from "fs";
|
|
83875
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
83876
83876
|
|
|
83877
83877
|
class SchemaRegistry {
|
|
83878
83878
|
static instance = null;
|
|
@@ -84002,7 +84002,7 @@ class SchemaRegistry {
|
|
|
84002
84002
|
if (!existsSync3(lockPath)) {
|
|
84003
84003
|
throw new Error(`Schema lock file not found: ${lockPath}. Run 'bun db:schema:lock' to generate.`);
|
|
84004
84004
|
}
|
|
84005
|
-
const content =
|
|
84005
|
+
const content = readFileSync2(lockPath, "utf-8");
|
|
84006
84006
|
const lock = JSON.parse(content);
|
|
84007
84007
|
for (const [tableName, serialized] of Object.entries(lock.tables)) {
|
|
84008
84008
|
const schema = this.deserializeTableSchema(serialized);
|
|
@@ -92584,7 +92584,7 @@ function registerInitCommand(cli) {
|
|
|
92584
92584
|
}
|
|
92585
92585
|
|
|
92586
92586
|
// src/commands/MakeCommand.ts
|
|
92587
|
-
import { existsSync as existsSync2 } from "fs";
|
|
92587
|
+
import { existsSync as existsSync2, readFileSync } from "fs";
|
|
92588
92588
|
import fs10 from "fs/promises";
|
|
92589
92589
|
import path12 from "path";
|
|
92590
92590
|
import { cancel as cancel2, isCancel as isCancel2, text as text2 } from "@clack/prompts";
|
|
@@ -92593,6 +92593,7 @@ var __dirname = "/Users/carl/Dev/Carl/gravito-core-ci-fix/packages/cli/src/comma
|
|
|
92593
92593
|
|
|
92594
92594
|
class MakeCommand {
|
|
92595
92595
|
searchPaths = [];
|
|
92596
|
+
architecture = "mvc";
|
|
92596
92597
|
constructor(customStubsPath) {
|
|
92597
92598
|
const cwd = process.cwd();
|
|
92598
92599
|
const devPath = path12.resolve(__dirname, "../../stubs");
|
|
@@ -92602,6 +92603,17 @@ class MakeCommand {
|
|
|
92602
92603
|
}
|
|
92603
92604
|
this.searchPaths.push(path12.resolve(cwd, "stubs"), path12.resolve(cwd, ".gravito/stubs"), prodPath, devPath, path12.resolve(cwd, "packages/cli/stubs"), path12.resolve(cwd, "../packages/cli/stubs"));
|
|
92604
92605
|
this.searchPaths = this.searchPaths.filter((p) => existsSync2(p));
|
|
92606
|
+
this.detectArchitecture();
|
|
92607
|
+
}
|
|
92608
|
+
detectArchitecture() {
|
|
92609
|
+
try {
|
|
92610
|
+
const pkgPath = path12.join(process.cwd(), "package.json");
|
|
92611
|
+
const content = readFileSync(pkgPath, "utf-8");
|
|
92612
|
+
const pkg = JSON.parse(content);
|
|
92613
|
+
this.architecture = pkg.gravito?.architecture || "mvc";
|
|
92614
|
+
} catch {
|
|
92615
|
+
this.architecture = "mvc";
|
|
92616
|
+
}
|
|
92605
92617
|
}
|
|
92606
92618
|
async run(type, name, options = {}) {
|
|
92607
92619
|
let resolvedName = name;
|
|
@@ -92699,18 +92711,40 @@ class MakeCommand {
|
|
|
92699
92711
|
}
|
|
92700
92712
|
resolveTargetPath(type, name) {
|
|
92701
92713
|
const cwd = process.cwd();
|
|
92702
|
-
const
|
|
92703
|
-
|
|
92704
|
-
|
|
92705
|
-
|
|
92706
|
-
|
|
92707
|
-
|
|
92708
|
-
|
|
92714
|
+
const architecturePaths = {
|
|
92715
|
+
mvc: {
|
|
92716
|
+
controller: `src/Http/Controllers/${name.pascal}Controller.ts`,
|
|
92717
|
+
model: `src/Models/${name.pascal}.ts`,
|
|
92718
|
+
middleware: `src/Http/Middleware/${name.pascal}Middleware.ts`,
|
|
92719
|
+
seeder: `database/seeders/${name.pascal}Seeder.ts`,
|
|
92720
|
+
request: `src/Http/Requests/${name.pascal}Request.ts`,
|
|
92721
|
+
command: `src/Commands/${name.pascal}Command.ts`,
|
|
92722
|
+
service: `src/Services/${name.pascal}Service.ts`
|
|
92723
|
+
},
|
|
92724
|
+
ddd: {
|
|
92725
|
+
controller: `src/Presentation/Http/Controllers/${name.pascal}Controller.ts`,
|
|
92726
|
+
model: `src/Domain/${name.pascal}.ts`,
|
|
92727
|
+
middleware: `src/Presentation/Http/Middleware/${name.pascal}Middleware.ts`,
|
|
92728
|
+
seeder: `database/seeders/${name.pascal}Seeder.ts`,
|
|
92729
|
+
request: `src/Presentation/Http/Requests/${name.pascal}Request.ts`,
|
|
92730
|
+
command: `src/Application/Commands/${name.pascal}Command.ts`,
|
|
92731
|
+
service: `src/Application/Services/${name.pascal}Service.ts`
|
|
92732
|
+
},
|
|
92733
|
+
cqrs: {
|
|
92734
|
+
controller: `src/Presentation/Controllers/${name.pascal}Controller.ts`,
|
|
92735
|
+
model: `src/Infrastructure/Persistence/${name.pascal}.ts`,
|
|
92736
|
+
middleware: `src/Presentation/Middleware/${name.pascal}Middleware.ts`,
|
|
92737
|
+
seeder: `database/seeders/${name.pascal}Seeder.ts`,
|
|
92738
|
+
request: `src/Presentation/Requests/${name.pascal}Request.ts`,
|
|
92739
|
+
command: `src/Application/Commands/${name.pascal}Command.ts`,
|
|
92740
|
+
service: `src/Application/Services/${name.pascal}Service.ts`
|
|
92741
|
+
}
|
|
92709
92742
|
};
|
|
92710
|
-
|
|
92711
|
-
|
|
92743
|
+
const paths = architecturePaths[this.architecture];
|
|
92744
|
+
if (!paths || !paths[type]) {
|
|
92745
|
+
throw new Error(`Unknown type: ${type} for architecture: ${this.architecture}`);
|
|
92712
92746
|
}
|
|
92713
|
-
return path12.join(cwd,
|
|
92747
|
+
return path12.join(cwd, paths[type]);
|
|
92714
92748
|
}
|
|
92715
92749
|
normalizeName(type, rawName) {
|
|
92716
92750
|
const pascalRaw = this.toPascalCase(rawName);
|
|
@@ -94482,7 +94516,9 @@ cli.command("schedule:list", "List scheduled tasks").option("--entry <file>", "E
|
|
|
94482
94516
|
process.exit(1);
|
|
94483
94517
|
}
|
|
94484
94518
|
});
|
|
94485
|
-
cli.command("create [name]", "Create a new Gravito project").option("--
|
|
94519
|
+
cli.command("create [name]", "Create a new Gravito project").option("--architecture <arch>", "Architecture pattern (mvc, ddd, cqrs)", {
|
|
94520
|
+
default: "mvc"
|
|
94521
|
+
}).option("--template <template>", "Template to use (basic, inertia-react)").option("--profile <profile>", "Profile preset (core, scale, enterprise)", { default: "core" }).option("--with <features>", "Feature add-ons (comma-separated, e.g. redis,queue)", {
|
|
94486
94522
|
default: ""
|
|
94487
94523
|
}).option("--recommend", "Auto-detect profile based on environment").option("--framework <framework>", "Frontend framework (react, vue) for static-site template").action(async (name, options) => {
|
|
94488
94524
|
console.clear();
|
|
@@ -94526,6 +94562,17 @@ Confidence: ${detection.confidence}`, "Environment Detection");
|
|
|
94526
94562
|
console.log(pc14.gray(`Available features: redis, postgres, mysql, s3, queue, monitor...`));
|
|
94527
94563
|
process.exit(1);
|
|
94528
94564
|
}
|
|
94565
|
+
const validArchitectures = ["mvc", "ddd", "cqrs"];
|
|
94566
|
+
if (!validArchitectures.includes(options.architecture)) {
|
|
94567
|
+
console.error(pc14.red(`\u274C Invalid architecture: ${options.architecture}`));
|
|
94568
|
+
console.log(pc14.gray(`Available architectures: ${validArchitectures.join(", ")}`));
|
|
94569
|
+
process.exit(1);
|
|
94570
|
+
}
|
|
94571
|
+
const ARCHITECTURE_TEMPLATES = {
|
|
94572
|
+
mvc: "mvc-starter",
|
|
94573
|
+
ddd: "ddd-starter",
|
|
94574
|
+
cqrs: "cqrs-starter"
|
|
94575
|
+
};
|
|
94529
94576
|
const project = await group({
|
|
94530
94577
|
name: () => {
|
|
94531
94578
|
if (name) {
|
|
@@ -94550,9 +94597,30 @@ Confidence: ${detection.confidence}`, "Environment Detection");
|
|
|
94550
94597
|
if (options.template) {
|
|
94551
94598
|
return Promise.resolve(options.template);
|
|
94552
94599
|
}
|
|
94600
|
+
if (options.architecture && options.architecture !== "mvc") {
|
|
94601
|
+
const template = ARCHITECTURE_TEMPLATES[options.architecture];
|
|
94602
|
+
if (template) {
|
|
94603
|
+
return Promise.resolve(template);
|
|
94604
|
+
}
|
|
94605
|
+
}
|
|
94553
94606
|
return select2({
|
|
94554
94607
|
message: "Pick a starting point:",
|
|
94555
94608
|
options: [
|
|
94609
|
+
{
|
|
94610
|
+
value: "mvc-starter",
|
|
94611
|
+
label: "\uD83C\uDFD7\uFE0F MVC (Recommended)",
|
|
94612
|
+
hint: "Traditional MVC for CRUD apps"
|
|
94613
|
+
},
|
|
94614
|
+
{
|
|
94615
|
+
value: "ddd-starter",
|
|
94616
|
+
label: "\uD83E\uDDE9 DDD",
|
|
94617
|
+
hint: "Domain-Driven Design for complex business logic"
|
|
94618
|
+
},
|
|
94619
|
+
{
|
|
94620
|
+
value: "cqrs-starter",
|
|
94621
|
+
label: "\u26A1 CQRS",
|
|
94622
|
+
hint: "Command Query Responsibility Segregation for high-concurrency"
|
|
94623
|
+
},
|
|
94556
94624
|
{
|
|
94557
94625
|
value: "basic",
|
|
94558
94626
|
label: "\uD83D\uDE80 Singularity (Light)",
|
|
@@ -94857,6 +94925,10 @@ Confidence: ${detection.confidence}`, "Environment Detection");
|
|
|
94857
94925
|
const pkgPath = path22.join(process.cwd(), targetDir, "package.json");
|
|
94858
94926
|
const pkg = JSON.parse(await fs19.readFile(pkgPath, "utf-8"));
|
|
94859
94927
|
pkg.name = packageName.toLowerCase().replace(/[^a-z0-9-_]/g, "-");
|
|
94928
|
+
if (!pkg.gravito) {
|
|
94929
|
+
pkg.gravito = {};
|
|
94930
|
+
}
|
|
94931
|
+
pkg.gravito.architecture = options.architecture;
|
|
94860
94932
|
s.start("\u8F09\u5165 package \u7248\u672C\u8CC7\u8A0A...");
|
|
94861
94933
|
const versionRegistry = new VersionRegistry;
|
|
94862
94934
|
await versionRegistry.initialize();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravito/pulse",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "The official CLI for Gravito Galaxy Architecture. Scaffold projects and manage your universe.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"gravito": "bin/gravito.mjs"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@clack/prompts": "^0.7.0",
|
|
30
|
-
"@gravito/scaffold": "^3.
|
|
30
|
+
"@gravito/scaffold": "^3.2.0",
|
|
31
31
|
"cac": "^6.7.14",
|
|
32
32
|
"giget": "^1.2.5",
|
|
33
33
|
"node-fetch-native": "^1.6.7",
|