@mxpicture/gcp-functions-generator 0.2.3 → 0.2.5
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/common/Extractor.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import ts from "typescript";
|
|
2
2
|
import { Evaluate } from "./Evaluate.js";
|
|
3
3
|
import { metaRename } from "../meta/meta.names.js";
|
|
4
|
-
import { relative } from "node:path";
|
|
5
|
-
import { VSCodeWorkspace } from "@mxpicture/gcp-functions-code/vscode";
|
|
4
|
+
import { dirname, relative } from "node:path";
|
|
6
5
|
import { createSourceFiles } from "@mxpicture/gcp-functions-code/common";
|
|
7
6
|
import { MetaFileType, MetaHeadType, metaMainOptionsMap, metaPropertyOptionsMap, } from "@mxpicture/gcp-functions-common/meta";
|
|
7
|
+
import { findWorkspaceRoot } from "@mxpicture/build-api/workspace";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
10
|
export const createExtractors = async (filePaths) => {
|
|
9
|
-
const rootDir = (await
|
|
11
|
+
const rootDir = (await findWorkspaceRoot(__dirname)).dirPath;
|
|
10
12
|
return createSourceFiles(filePaths).map((f) => new Extractor(f.filePath, f.checker, f.sourceFile, rootDir));
|
|
11
13
|
};
|
|
12
14
|
export const extractFiles = (extractors) => extractors.map((extractor) => extractor.run());
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MetaFileType } from "@mxpicture/gcp-functions-common/meta";
|
|
2
2
|
import { ChangeDetector, ChangeEventHandler, Changelog } from "@mxpicture/gcp-functions-code/changelog";
|
|
3
3
|
import { GitChangesCommit } from "@mxpicture/gcp-functions-code/git";
|
|
4
|
-
import { PackageVersion } from "@mxpicture/
|
|
4
|
+
import { PackageVersion } from "@mxpicture/build-api/types";
|
|
5
5
|
export interface GenChangeParams {
|
|
6
6
|
gitSinceCommit: {
|
|
7
7
|
rootDir: string;
|
|
@@ -57,7 +57,7 @@ export class GeneratorFrontend extends Generator {
|
|
|
57
57
|
const superClassName = hasCrudRoute(Object.keys(routes))
|
|
58
58
|
? `FrontendApi<${names.doc}, ${names.func}>`
|
|
59
59
|
: `IFrontendApi<${names.func}>`;
|
|
60
|
-
code.push(`export class ${names.api} extends ${superClassName}`, `implements ApiFromRoutes<${names.routes}>`, "{", `public constructor(func?: ${names.func}) { super("${names.
|
|
60
|
+
code.push(`export class ${names.api} extends ${superClassName}`, `implements ApiFromRoutes<${names.routes}>`, "{", `public constructor(func?: ${names.func}) { super("${lowerFirstLetter(names.basename)}"); if (func) this.useFunc(func); }`, "");
|
|
61
61
|
for (const [routeName, params] of Object.entries(routes)) {
|
|
62
62
|
if (isCrudRoute(routeName))
|
|
63
63
|
continue; // ignore crud --> provided by super class
|
|
@@ -75,7 +75,7 @@ export class GeneratorFrontend extends Generator {
|
|
|
75
75
|
buildFunction(names) {
|
|
76
76
|
return [
|
|
77
77
|
`export class ${names.func} extends IFrontendFunction {`,
|
|
78
|
-
` public constructor() { super("${
|
|
78
|
+
` public constructor() { super("${names.functionName}"); this.useRoutes(${names.routes}Name); }`,
|
|
79
79
|
"}",
|
|
80
80
|
];
|
|
81
81
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mxpicture/gcp-functions-generator",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "Tools for google cloud functions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": "MXPicture",
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"node": ">=22"
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
|
-
"clean": "rm -rf dist .tsbuildinfo tsconfig.tsbuildinfo node_modules",
|
|
26
25
|
"lint": "eslint \"src/**/*.{ts,tsx}\" --ext .ts,.tsx",
|
|
27
26
|
"build": "tsc -b .",
|
|
28
27
|
"test": "vitest run",
|
|
@@ -32,16 +31,20 @@
|
|
|
32
31
|
"access": "public"
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
|
-
"@mxpicture/
|
|
36
|
-
"@mxpicture/gcp-functions-
|
|
37
|
-
"@mxpicture/gcp-functions-
|
|
38
|
-
"@mxpicture/gcp-functions-
|
|
34
|
+
"@mxpicture/build-api": "^0.2.7",
|
|
35
|
+
"@mxpicture/gcp-functions-backend": "^0.2.5",
|
|
36
|
+
"@mxpicture/gcp-functions-code": "^0.2.5",
|
|
37
|
+
"@mxpicture/gcp-functions-common": "^0.2.5",
|
|
38
|
+
"@mxpicture/gcp-functions-frontend": "^0.2.5"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^25.2.3",
|
|
42
|
-
"eslint": "^
|
|
42
|
+
"eslint": "^9.39.3",
|
|
43
43
|
"execa": "^9.6.1",
|
|
44
|
+
"firebase-admin": "^13.7.0",
|
|
45
|
+
"firebase-functions": "^7.0.6",
|
|
44
46
|
"typescript": "^5.9.3",
|
|
45
|
-
"vitest": "^4.0.18"
|
|
47
|
+
"vitest": "^4.0.18",
|
|
48
|
+
"zod": "^4.3.6"
|
|
46
49
|
}
|
|
47
50
|
}
|