@anu8151/adonisjs-blueprint 0.3.3 → 0.3.6
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/build/base_generator-ClKso0XJ.d.ts +3009 -0
- package/build/event_generator-B83LtJmu.d.ts +8 -0
- package/build/job_generator-GmmbUvVL.d.ts +8 -0
- package/build/mail_generator-B-TNNzl3.d.ts +8 -0
- package/build/notification_generator-C8kSV8HA.d.ts +8 -0
- package/build/service_generator-Slb920qs.d.ts +8 -0
- package/build/src/commands/init.js +64 -0
- package/build/src/commands/main.js +1 -63
- package/build/types-DTlzGpWR.d.ts +53 -0
- package/package.json +4 -3
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as BaseGenerator } from "./base_generator-ClKso0XJ.js";
|
|
2
|
+
|
|
3
|
+
//#region src/generators/event_generator.d.ts
|
|
4
|
+
declare class EventGenerator extends BaseGenerator {
|
|
5
|
+
generate(name: string, _definition?: any): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { EventGenerator as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as BaseGenerator } from "./base_generator-ClKso0XJ.js";
|
|
2
|
+
|
|
3
|
+
//#region src/generators/job_generator.d.ts
|
|
4
|
+
declare class JobGenerator extends BaseGenerator {
|
|
5
|
+
generate(name: string, _definition?: any): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { JobGenerator as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as BaseGenerator } from "./base_generator-ClKso0XJ.js";
|
|
2
|
+
|
|
3
|
+
//#region src/generators/mail_generator.d.ts
|
|
4
|
+
declare class MailGenerator extends BaseGenerator {
|
|
5
|
+
generate(name: string, _definition?: any): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { MailGenerator as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as BaseGenerator } from "./base_generator-ClKso0XJ.js";
|
|
2
|
+
|
|
3
|
+
//#region src/generators/notification_generator.d.ts
|
|
4
|
+
declare class NotificationGenerator extends BaseGenerator {
|
|
5
|
+
generate(name: string, _definition?: any): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { NotificationGenerator as t };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { t as BaseGenerator } from "./base_generator-ClKso0XJ.js";
|
|
2
|
+
|
|
3
|
+
//#region src/generators/service_generator.d.ts
|
|
4
|
+
declare class ServiceGenerator extends BaseGenerator {
|
|
5
|
+
generate(name: string): Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { ServiceGenerator as t };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { existsSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { BaseCommand } from "@adonisjs/core/ace";
|
|
3
|
+
//#region src/commands/init.ts
|
|
4
|
+
var InitBlueprint = class extends BaseCommand {
|
|
5
|
+
static commandName = "blueprint:init";
|
|
6
|
+
static description = "Initialize a draft.yaml file with a professional-grade example";
|
|
7
|
+
async run() {
|
|
8
|
+
const draftPath = this.app.makePath("draft.yaml");
|
|
9
|
+
if (existsSync(draftPath)) {
|
|
10
|
+
if (!await this.prompt.confirm("A draft.yaml already exists. Do you want to overwrite it?")) {
|
|
11
|
+
this.logger.info("Initialization cancelled.");
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
writeFileSync(draftPath, `# yaml-language-server: $schema=node_modules/@anu8151/adonisjs-blueprint/build/src/schema.json
|
|
16
|
+
|
|
17
|
+
settings:
|
|
18
|
+
api: true
|
|
19
|
+
inertia:
|
|
20
|
+
enabled: false
|
|
21
|
+
adapter: react
|
|
22
|
+
|
|
23
|
+
# Define your models here
|
|
24
|
+
models:
|
|
25
|
+
User:
|
|
26
|
+
attributes:
|
|
27
|
+
email: string:unique
|
|
28
|
+
password: string
|
|
29
|
+
full_name: string:optional
|
|
30
|
+
relationships:
|
|
31
|
+
posts: hasMany
|
|
32
|
+
|
|
33
|
+
Post:
|
|
34
|
+
attributes:
|
|
35
|
+
title: string:min:5
|
|
36
|
+
content: text
|
|
37
|
+
status: enum:draft,published,archived
|
|
38
|
+
softDeletes: true
|
|
39
|
+
relationships:
|
|
40
|
+
user: belongsTo
|
|
41
|
+
tags: belongsToMany
|
|
42
|
+
|
|
43
|
+
Tag:
|
|
44
|
+
attributes:
|
|
45
|
+
name: string:unique
|
|
46
|
+
|
|
47
|
+
# Define your controllers and business logic here
|
|
48
|
+
controllers:
|
|
49
|
+
Post:
|
|
50
|
+
resource: true
|
|
51
|
+
publish:
|
|
52
|
+
query: find
|
|
53
|
+
validate: title, content
|
|
54
|
+
save: true
|
|
55
|
+
fire: PostPublished
|
|
56
|
+
send: NewPostMail
|
|
57
|
+
render: 'json with: post'
|
|
58
|
+
`);
|
|
59
|
+
this.logger.success("draft.yaml initialized successfully.");
|
|
60
|
+
this.logger.info("You can now run: node ace blueprint:build");
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { InitBlueprint as default };
|
|
@@ -1,70 +1,8 @@
|
|
|
1
1
|
import { t as BuildBlueprint } from "../../build-CWtJ8mPG.js";
|
|
2
2
|
import EraseBlueprint from "./erase.js";
|
|
3
|
+
import InitBlueprint from "./init.js";
|
|
3
4
|
import TraceBlueprint from "./trace.js";
|
|
4
5
|
import EjectStubs from "./stubs.js";
|
|
5
|
-
import { existsSync, writeFileSync } from "node:fs";
|
|
6
|
-
import { BaseCommand } from "@adonisjs/core/ace";
|
|
7
|
-
//#region src/commands/init.ts
|
|
8
|
-
var InitBlueprint = class extends BaseCommand {
|
|
9
|
-
static commandName = "blueprint:init";
|
|
10
|
-
static description = "Initialize a draft.yaml file with a professional-grade example";
|
|
11
|
-
async run() {
|
|
12
|
-
const draftPath = this.app.makePath("draft.yaml");
|
|
13
|
-
if (existsSync(draftPath)) {
|
|
14
|
-
if (!await this.prompt.confirm("A draft.yaml already exists. Do you want to overwrite it?")) {
|
|
15
|
-
this.logger.info("Initialization cancelled.");
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
writeFileSync(draftPath, `# yaml-language-server: $schema=node_modules/@anu8151/adonisjs-blueprint/build/src/schema.json
|
|
20
|
-
|
|
21
|
-
settings:
|
|
22
|
-
api: true
|
|
23
|
-
inertia:
|
|
24
|
-
enabled: false
|
|
25
|
-
adapter: react
|
|
26
|
-
|
|
27
|
-
# Define your models here
|
|
28
|
-
models:
|
|
29
|
-
User:
|
|
30
|
-
attributes:
|
|
31
|
-
email: string:unique
|
|
32
|
-
password: string
|
|
33
|
-
full_name: string:optional
|
|
34
|
-
relationships:
|
|
35
|
-
posts: hasMany
|
|
36
|
-
|
|
37
|
-
Post:
|
|
38
|
-
attributes:
|
|
39
|
-
title: string:min:5
|
|
40
|
-
content: text
|
|
41
|
-
status: enum:draft,published,archived
|
|
42
|
-
softDeletes: true
|
|
43
|
-
relationships:
|
|
44
|
-
user: belongsTo
|
|
45
|
-
tags: belongsToMany
|
|
46
|
-
|
|
47
|
-
Tag:
|
|
48
|
-
attributes:
|
|
49
|
-
name: string:unique
|
|
50
|
-
|
|
51
|
-
# Define your controllers and business logic here
|
|
52
|
-
controllers:
|
|
53
|
-
Post:
|
|
54
|
-
resource: true
|
|
55
|
-
publish:
|
|
56
|
-
query: find
|
|
57
|
-
validate: title, content
|
|
58
|
-
save: true
|
|
59
|
-
fire: PostPublished
|
|
60
|
-
send: NewPostMail
|
|
61
|
-
render: 'json with: post'
|
|
62
|
-
`);
|
|
63
|
-
this.logger.success("draft.yaml initialized successfully.");
|
|
64
|
-
this.logger.info("You can now run: node ace blueprint:build");
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
//#endregion
|
|
68
6
|
//#region src/commands/main.ts
|
|
69
7
|
const commands = [
|
|
70
8
|
BuildBlueprint,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
interface Entity {
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
className: string;
|
|
6
|
+
tableName?: string;
|
|
7
|
+
}
|
|
8
|
+
interface ModelAttribute {
|
|
9
|
+
name: string;
|
|
10
|
+
type: string;
|
|
11
|
+
modifiers: string[];
|
|
12
|
+
}
|
|
13
|
+
interface ModelRelationship {
|
|
14
|
+
type: 'belongsTo' | 'hasMany' | 'belongsToMany' | 'hasOne';
|
|
15
|
+
model: string;
|
|
16
|
+
}
|
|
17
|
+
interface ModelDefinition {
|
|
18
|
+
name: string;
|
|
19
|
+
attributes: Record<string, string | {
|
|
20
|
+
type: string;
|
|
21
|
+
modifiers?: string[];
|
|
22
|
+
}>;
|
|
23
|
+
relationships?: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
interface ControllerAction {
|
|
26
|
+
query?: string;
|
|
27
|
+
render?: string;
|
|
28
|
+
validate?: string;
|
|
29
|
+
save?: string | boolean;
|
|
30
|
+
flash?: string;
|
|
31
|
+
redirect?: string;
|
|
32
|
+
delete?: string | boolean;
|
|
33
|
+
}
|
|
34
|
+
interface ControllerDefinition {
|
|
35
|
+
name: string;
|
|
36
|
+
middleware?: string[];
|
|
37
|
+
actions: Record<string, ControllerAction>;
|
|
38
|
+
}
|
|
39
|
+
interface BlueprintSchema {
|
|
40
|
+
settings?: {
|
|
41
|
+
api?: boolean;
|
|
42
|
+
inertia?: {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
adapter: 'react' | 'vue' | 'svelte';
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
auth?: Record<string, any> | boolean;
|
|
48
|
+
models?: Record<string, any>;
|
|
49
|
+
controllers?: Record<string, any>;
|
|
50
|
+
channels?: Record<string, any>;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { Entity as n, BlueprintSchema as t };
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anu8151/adonisjs-blueprint",
|
|
3
3
|
"description": "Blueprint for AdonisJS 7",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.6",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=24.0.0"
|
|
7
7
|
},
|
|
8
|
+
"main": "build/index.js",
|
|
8
9
|
"type": "module",
|
|
9
10
|
"files": [
|
|
10
11
|
"build",
|
|
@@ -12,7 +13,6 @@
|
|
|
12
13
|
"!build/bin",
|
|
13
14
|
"!build/tests"
|
|
14
15
|
],
|
|
15
|
-
"main": "build/index.js",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./build/index.js",
|
|
18
18
|
"./types": "./build/src/types.js",
|
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
"./src/commands/erase.ts",
|
|
101
101
|
"./src/commands/trace.ts",
|
|
102
102
|
"./src/commands/stubs.ts",
|
|
103
|
+
"./src/commands/init.ts",
|
|
103
104
|
"./src/generators/*.ts",
|
|
104
105
|
"./src/parser.ts"
|
|
105
106
|
],
|
|
@@ -108,7 +109,7 @@
|
|
|
108
109
|
"format": "esm",
|
|
109
110
|
"minify": "dce-only",
|
|
110
111
|
"fixedExtension": false,
|
|
111
|
-
"dts":
|
|
112
|
+
"dts": true,
|
|
112
113
|
"treeshake": false,
|
|
113
114
|
"sourcemaps": false,
|
|
114
115
|
"target": "esnext"
|