@skalfa/skalfa-api-core 1.0.7 → 1.0.9

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.
Files changed (39) hide show
  1. package/dist/commands/cli.js +16 -27
  2. package/dist/commands/cli.js.map +1 -1
  3. package/dist/commands/make/resource.js +4 -4
  4. package/dist/commands/make/resource.js.map +1 -1
  5. package/dist/commands/make/skalfa-controller.d.ts +2 -2
  6. package/dist/commands/make/skalfa-controller.js +7 -7
  7. package/dist/commands/make/skalfa-controller.js.map +1 -1
  8. package/dist/commands/make/skalfa-model.d.ts +2 -2
  9. package/dist/commands/make/skalfa-model.js +9 -9
  10. package/dist/commands/make/skalfa-model.js.map +1 -1
  11. package/dist/commands/runner/blueprint/controller-generation.js +2 -2
  12. package/dist/commands/runner/blueprint/controller-generation.js.map +1 -1
  13. package/dist/commands/runner/blueprint/migration-generation.js +2 -2
  14. package/dist/commands/runner/blueprint/migration-generation.js.map +1 -1
  15. package/dist/commands/runner/blueprint/model-generation.js +2 -2
  16. package/dist/commands/runner/blueprint/model-generation.js.map +1 -1
  17. package/dist/commands/runner/blueprint/runner.js +5 -6
  18. package/dist/commands/runner/blueprint/runner.js.map +1 -1
  19. package/dist/commands/runner/blueprint/seeder-generation.js +2 -2
  20. package/dist/commands/runner/blueprint/seeder-generation.js.map +1 -1
  21. package/dist/commands/runner/generate-docs.d.ts +2 -0
  22. package/dist/commands/runner/generate-docs.js +400 -0
  23. package/dist/commands/runner/generate-docs.js.map +1 -0
  24. package/dist/commands/stubs/index.d.ts +4 -4
  25. package/dist/commands/stubs/index.js +4 -4
  26. package/dist/commands/stubs/index.js.map +1 -1
  27. package/package.json +2 -2
  28. package/src/commands/cli.ts +17 -29
  29. package/src/commands/make/basic-controller.ts +1 -1
  30. package/src/commands/make/resource.ts +4 -4
  31. package/src/commands/make/skalfa-controller.ts +7 -7
  32. package/src/commands/make/skalfa-model.ts +9 -9
  33. package/src/commands/runner/blueprint/controller-generation.ts +2 -2
  34. package/src/commands/runner/blueprint/migration-generation.ts +2 -2
  35. package/src/commands/runner/blueprint/model-generation.ts +2 -2
  36. package/src/commands/runner/blueprint/runner.ts +5 -6
  37. package/src/commands/runner/blueprint/seeder-generation.ts +2 -2
  38. package/src/commands/runner/generate-docs.ts +495 -0
  39. package/src/commands/stubs/index.ts +4 -4
@@ -1,6 +1,6 @@
1
1
  import { Command } from "commander";
2
- import { makeLightModel } from "./skalfa-model";
3
- import { makeLightController } from "./skalfa-controller";
2
+ import { makeSkalfaModel } from "./skalfa-model";
3
+ import { makeSkalfaController } from "./skalfa-controller";
4
4
  import { makeMigration } from "./basic-migration";
5
5
  import { makeSeeder } from "./basic-seeder";
6
6
 
@@ -13,8 +13,8 @@ export const makeResourceCommand = new Command("make:resource")
13
13
  .argument("<name>", "Name of resource")
14
14
  .description("Create a new model, migration, seeder, and controller for a resource")
15
15
  .action((name) => {
16
- makeLightModel(name);
17
- makeLightController(name);
16
+ makeSkalfaModel(name);
17
+ makeSkalfaController(name);
18
18
  makeMigration("create_" + name, { init: true });
19
19
  makeSeeder(name);
20
20
  process.exit(0);
@@ -2,23 +2,23 @@ import path from "path";
2
2
  import { writeFileSync, mkdirSync, existsSync } from "fs";
3
3
  import { Command } from "commander";
4
4
  import { conversion, logger } from "@utils";
5
- import { lightControllerStub } from "../stubs";
5
+ import { skalfaControllerStub } from "../stubs";
6
6
 
7
7
 
8
8
 
9
9
  // =====================================>
10
- // ## Command: make:light-controller
10
+ // ## Command: make:skafa-controller
11
11
  // =====================================>
12
- export const makeLightControllerCommand = new Command("make:skalfa-controller")
12
+ export const makeSkalfaControllerCommand = new Command("make:skalfa-controller")
13
13
  .argument("<name>", "Name of controller")
14
14
  .option("-m, --model <model>", "Attach model to controller")
15
- .description("Make the Light Controller")
15
+ .description("Make the Skalfa Controller")
16
16
  .action((name, options) => {
17
- makeLightController(name, options.model);
17
+ makeSkalfaController(name, options.model);
18
18
  process.exit(0);
19
19
  });
20
20
 
21
- export const makeLightController = (controllerName: string, modelName?: string) => {
21
+ export const makeSkalfaController = (controllerName: string, modelName?: string) => {
22
22
  const basePath = path.join(process.cwd(), "app", "controllers");
23
23
 
24
24
  if (!controllerName || controllerName.trim() === "") {
@@ -48,7 +48,7 @@ export const makeLightController = (controllerName: string, modelName?: string)
48
48
  logger.info(`Create folder ${targetDir}...`);
49
49
  }
50
50
 
51
- let stub = lightControllerStub;
51
+ let stub = skalfaControllerStub;
52
52
 
53
53
  stub = stub.replace(
54
54
  /{{\s*name\s*}}|{{\s*model\s*}}|{{\s*validations\s*}}|{{\s*marker\s*}}/g,
@@ -2,25 +2,25 @@ import path from "path";
2
2
  import { writeFileSync, mkdirSync, existsSync } from "fs";
3
3
  import { Command } from "commander";
4
4
  import { conversion, logger } from "@utils";
5
- import { makeLightController } from "./skalfa-controller";
5
+ import { makeSkalfaController } from "./skalfa-controller";
6
6
  import { makeMigration } from "./basic-migration";
7
7
  import { makeSeeder } from "./basic-seeder";
8
- import { lightModelStub } from "../stubs";
8
+ import { skalfaModelStub } from "../stubs";
9
9
 
10
10
 
11
11
 
12
12
  // =====================================>
13
- // ## Command: make:light-model
13
+ // ## Command: make:skalfa-model
14
14
  // =====================================>
15
- export const makeLightModelCommand = new Command("make:skalfa-model")
15
+ export const makeSkalfaModelCommand = new Command("make:skalfa-model")
16
16
  .argument("<name>", "Name of model")
17
17
  .option("-r", "Generate all resource (controller, migration, seeder)")
18
- .description("Make the Light Model")
18
+ .description("Make the Skalfa Model")
19
19
  .action((name, options) => {
20
- makeLightModel(name);
20
+ makeSkalfaModel(name);
21
21
 
22
22
  if (options.r) {
23
- makeLightController(name);
23
+ makeSkalfaController(name);
24
24
  makeMigration("create_" + name, { init: true });
25
25
  makeSeeder(name);
26
26
  }
@@ -28,7 +28,7 @@ export const makeLightModelCommand = new Command("make:skalfa-model")
28
28
  process.exit(0);
29
29
  });
30
30
 
31
- export const makeLightModel = (modelName: string) => {
31
+ export const makeSkalfaModel = (modelName: string) => {
32
32
  const name = conversion.strPascal(modelName);
33
33
  const filename = conversion.strSlug(modelName) + ".model.ts";
34
34
 
@@ -45,7 +45,7 @@ export const makeLightModel = (modelName: string) => {
45
45
  return;
46
46
  }
47
47
 
48
- let stub = lightModelStub;
48
+ let stub = skalfaModelStub;
49
49
 
50
50
  stub = stub
51
51
  .replace(/{{\s*name\s*}}/g, name)
@@ -2,7 +2,7 @@ import fs from "fs";
2
2
  import path from "path";
3
3
  import { conversion } from "@utils";
4
4
  import { resolveBlueprintPath } from "./runner";
5
- import { lightControllerStub, routeStub } from "../../stubs";
5
+ import { skalfaControllerStub, routeStub } from "../../stubs";
6
6
 
7
7
 
8
8
 
@@ -33,7 +33,7 @@ export async function controllerGeneration(
33
33
  ...generateRelationValidations(relations)
34
34
  };
35
35
 
36
- let stub = lightControllerStub;
36
+ let stub = skalfaControllerStub;
37
37
 
38
38
  stub = stub
39
39
  .replace(/{{\s*marker\s*}}/g, marker)
@@ -1,7 +1,7 @@
1
1
  import { conversion, logger } from "@utils";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
- import { lightMigrationStub } from "../../stubs";
4
+ import { skalfaMigrationStub } from "../../stubs";
5
5
 
6
6
 
7
7
 
@@ -111,7 +111,7 @@ export async function migrationGeneration(
111
111
 
112
112
  const migrationSchema = migrationFields.map((f) => ` ${f}`).join("\n");
113
113
 
114
- let stub = lightMigrationStub;
114
+ let stub = skalfaMigrationStub;
115
115
 
116
116
  stub = stub
117
117
  .replace(/{{\s*marker\s*}}/g, marker)
@@ -2,7 +2,7 @@ import fs from "fs";
2
2
  import path from "path";
3
3
  import { conversion } from "@utils";
4
4
  import { resolveBlueprintPath } from "./runner";
5
- import { lightModelStub } from "../../stubs";
5
+ import { skalfaModelStub } from "../../stubs";
6
6
 
7
7
 
8
8
 
@@ -105,7 +105,7 @@ export async function modelGeneration(
105
105
  imports.push(`import { ${importRelations.join(", ")} } from '@models'`);
106
106
  }
107
107
 
108
- let stub = lightModelStub;
108
+ let stub = skalfaModelStub;
109
109
  const strImportUtils = importUtils?.length ? ", " + importUtils.join(", ") : "";
110
110
 
111
111
  stub = stub
@@ -6,7 +6,6 @@ import { modelGeneration } from "./model-generation";
6
6
  import { migrationGeneration } from "./migration-generation";
7
7
  import { controllerGeneration } from "./controller-generation";
8
8
  import { seederGeneration } from "./seeder-generation";
9
- import { generateDrawioEntityDocumentation, generateMermaidEntityDocumentation, generatePostmanAPIDocumentation } from "./documentation-generation";
10
9
  import { exec as execCb } from "child_process";
11
10
  import { promisify } from "util";
12
11
 
@@ -111,14 +110,14 @@ export async function runBlueprints(options?: { only?: string[] }) {
111
110
  await seederGeneration(struct.model, schema, seeders, marker);
112
111
  }
113
112
 
114
- if (struct.mermaid !== false) {
115
- await generateMermaidEntityDocumentation(file.file, file.blueprints);
116
- }
113
+ // if (struct.mermaid !== false) {
114
+ // await generateMermaidEntityDocumentation(file.file, file.blueprints);
115
+ // }
117
116
  }
118
117
  }
119
118
 
120
- await generateDrawioEntityDocumentation(loaded);
121
- await generatePostmanAPIDocumentation(postmanSchemas);
119
+ // await generateDrawioEntityDocumentation(loaded);
120
+ // await generatePostmanAPIDocumentation(postmanSchemas);
122
121
  }
123
122
 
124
123
 
@@ -1,7 +1,7 @@
1
1
  import { conversion, logger } from "@utils";
2
2
  import fs from "fs";
3
3
  import path from "path";
4
- import { lightSeederStub } from "../../stubs";
4
+ import { skalfaSeederStub } from "../../stubs";
5
5
 
6
6
 
7
7
 
@@ -39,7 +39,7 @@ export async function seederGeneration(
39
39
  })
40
40
  .join(", ")}}`).join(",\n ");
41
41
 
42
- let stub = lightSeederStub;
42
+ let stub = skalfaSeederStub;
43
43
 
44
44
  stub = stub
45
45
  .replace(/{{\s*marker\s*}}/g, marker)