@arkstack/console 0.1.29 → 0.1.30
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/{app-CQsshUJ7.js → app-DtecNuLP.js} +35 -19
- package/dist/app.d.ts +15 -2
- package/dist/app.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +3 -3
|
@@ -3,17 +3,19 @@ import { CliApp } from "resora";
|
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
|
|
5
5
|
//#region dist/config.js
|
|
6
|
-
const defaultConfig = {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
const defaultConfig = (app) => {
|
|
7
|
+
return {
|
|
8
|
+
resourcesDir: "dist/app/http/resources",
|
|
9
|
+
localStubsDir: `node_modules/@arkstack/driver-${app.getDriver().name ?? "h3"}/stubs`,
|
|
10
|
+
stubs: {
|
|
11
|
+
resource: "resource.stub",
|
|
12
|
+
collection: "resource.collection.stub",
|
|
13
|
+
controller: "controller.stub",
|
|
14
|
+
api: "controller.api.stub",
|
|
15
|
+
model: "controller.model.stub",
|
|
16
|
+
apiResource: "controller.api.resource.stub"
|
|
17
|
+
}
|
|
18
|
+
};
|
|
17
19
|
};
|
|
18
20
|
|
|
19
21
|
//#endregion
|
|
@@ -36,16 +38,10 @@ var ArkstackConsoleApp = class extends CliApp {
|
|
|
36
38
|
super();
|
|
37
39
|
this.core = core;
|
|
38
40
|
this.options = options;
|
|
39
|
-
this.
|
|
40
|
-
...defaultConfig,
|
|
41
|
-
...this.config,
|
|
42
|
-
stubs: {
|
|
43
|
-
...defaultConfig.stubs,
|
|
44
|
-
...this.config?.stubs
|
|
45
|
-
}
|
|
46
|
-
};
|
|
41
|
+
this.mergeConfig();
|
|
47
42
|
}
|
|
48
43
|
makeController = (name, opts) => {
|
|
44
|
+
this.mergeConfig();
|
|
49
45
|
const normalized = name.endsWith("Controller") ? name.replace(/controller/i, "") : name;
|
|
50
46
|
let controllerName = normalized.endsWith("Controller") ? normalized : `${normalized}Controller`;
|
|
51
47
|
const outputPath = join(path.resolve(process.cwd(), "src", "app/http/controllers"), `${controllerName}.${opts?.ext ?? "ts"}`);
|
|
@@ -68,9 +64,29 @@ var ArkstackConsoleApp = class extends CliApp {
|
|
|
68
64
|
}, opts);
|
|
69
65
|
return outputPath;
|
|
70
66
|
};
|
|
67
|
+
/**
|
|
68
|
+
* Normalize a file path by removing the current working directory from it.
|
|
69
|
+
*
|
|
70
|
+
* @param p
|
|
71
|
+
* @returns
|
|
72
|
+
*/
|
|
71
73
|
normalizePath = (p) => {
|
|
72
74
|
return p.replace(process.cwd(), "");
|
|
73
75
|
};
|
|
76
|
+
/**
|
|
77
|
+
* Recursively merge defaultConfig with config from resora.config.js, giving
|
|
78
|
+
* precedence to resora.
|
|
79
|
+
*/
|
|
80
|
+
mergeConfig = () => {
|
|
81
|
+
this.config = {
|
|
82
|
+
...defaultConfig(this.core),
|
|
83
|
+
...this.config,
|
|
84
|
+
stubs: {
|
|
85
|
+
...defaultConfig(this.core).stubs,
|
|
86
|
+
...this.config?.stubs
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
};
|
|
74
90
|
};
|
|
75
91
|
|
|
76
92
|
//#endregion
|
package/dist/app.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CliApp } from "resora";
|
|
2
2
|
|
|
3
|
-
//#region src/
|
|
3
|
+
//#region src/types.d.ts
|
|
4
4
|
interface Core {
|
|
5
5
|
[k: string]: any;
|
|
6
6
|
getDriver: () => {
|
|
@@ -11,6 +11,8 @@ interface Core {
|
|
|
11
11
|
interface ConsoleAppOptions {
|
|
12
12
|
stubsDir?: string;
|
|
13
13
|
}
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/app.d.ts
|
|
14
16
|
declare const resolveStubsDir: (config: {
|
|
15
17
|
localStubsDir?: string;
|
|
16
18
|
} | undefined, options?: ConsoleAppOptions, core?: Core) => string;
|
|
@@ -19,7 +21,18 @@ declare class ArkstackConsoleApp<TCore extends Core> extends CliApp {
|
|
|
19
21
|
private readonly options;
|
|
20
22
|
constructor(core: TCore, options: ConsoleAppOptions);
|
|
21
23
|
makeController: (name: string, opts: any) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Normalize a file path by removing the current working directory from it.
|
|
26
|
+
*
|
|
27
|
+
* @param p
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
22
30
|
normalizePath: (p: string) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Recursively merge defaultConfig with config from resora.config.js, giving
|
|
33
|
+
* precedence to resora.
|
|
34
|
+
*/
|
|
35
|
+
mergeConfig: () => void;
|
|
23
36
|
}
|
|
24
37
|
//#endregion
|
|
25
|
-
export { ArkstackConsoleApp,
|
|
38
|
+
export { ArkstackConsoleApp, resolveStubsDir };
|
package/dist/app.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { t as ArkstackConsoleApp } from "./app-
|
|
2
|
+
import { t as ArkstackConsoleApp } from "./app-DtecNuLP.js";
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { MakeResource } from "resora";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arkstack/console",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.30",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Console package for Arkstack providing console-specific implementations of core Arkstack features such as routing, middleware, and database integration.",
|
|
6
6
|
"homepage": "https://arkstack.toneflix.net",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"@h3ravel/musket": "^0.10.1",
|
|
50
50
|
"chalk": "^5.6.2",
|
|
51
51
|
"resora": "^0.2.14",
|
|
52
|
-
"@arkstack/common": "^0.1.
|
|
53
|
-
"@arkstack/contract": "^0.1.
|
|
52
|
+
"@arkstack/common": "^0.1.30",
|
|
53
|
+
"@arkstack/contract": "^0.1.30"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"build": "tsdown",
|