@evenicanpm/admin-graphql-codegen 1.0.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/README.md +9 -0
- package/codegen.ts +26 -0
- package/documents/search-engine/aliases.ts +17 -0
- package/documents/settings/settings.ts +48 -0
- package/package.json +22 -0
- package/test.js +15 -0
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## E4 GraphQL Codegen
|
|
2
|
+
|
|
3
|
+
- This repo is used to generate the graphql-request SDK
|
|
4
|
+
- Codegen must be run each time the @evenicanpm/e4-shared-client-graphql repo is modified
|
|
5
|
+
- run `NODE_TLS_REJECT_UNAUTHORIZED=0 npm run codegen` in this directory to generate complete types and methods
|
|
6
|
+
- the code gen requires a schema and list of documents (operations)
|
|
7
|
+
- the graphql shared repo acts as the e4 set of documents
|
|
8
|
+
- todo: add watching the graphql folder with codegen to npm commands and docker file to
|
|
9
|
+
keep the codegen running in the background
|
package/codegen.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { CodegenConfig } from "@graphql-codegen/cli";
|
|
2
|
+
|
|
3
|
+
const config: CodegenConfig = {
|
|
4
|
+
schema: "https://api.e4.local/graphql",
|
|
5
|
+
documents: [
|
|
6
|
+
"./documents/**/*.ts",
|
|
7
|
+
"!./documents/core/**",
|
|
8
|
+
"!./documents/base/**",
|
|
9
|
+
],
|
|
10
|
+
generates: {
|
|
11
|
+
"./index.ts": {
|
|
12
|
+
plugins: [
|
|
13
|
+
"typescript",
|
|
14
|
+
"typescript-operations",
|
|
15
|
+
"typescript-graphql-request",
|
|
16
|
+
],
|
|
17
|
+
config: {
|
|
18
|
+
preset: "client",
|
|
19
|
+
rawRequest: true,
|
|
20
|
+
documentMode: "documentNode",
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default config;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { gql } from "graphql-request";
|
|
2
|
+
|
|
3
|
+
const SELECTED_THEME = gql`
|
|
4
|
+
query Settings {
|
|
5
|
+
settings {
|
|
6
|
+
selectedTheme {
|
|
7
|
+
id
|
|
8
|
+
themeId
|
|
9
|
+
colorPrimary
|
|
10
|
+
colorSecondary
|
|
11
|
+
textPrimary
|
|
12
|
+
textSecondary
|
|
13
|
+
error
|
|
14
|
+
warning
|
|
15
|
+
success
|
|
16
|
+
info
|
|
17
|
+
background
|
|
18
|
+
panelBackground
|
|
19
|
+
defaultTheme
|
|
20
|
+
themeName
|
|
21
|
+
fontFamily
|
|
22
|
+
h1
|
|
23
|
+
h2
|
|
24
|
+
h3
|
|
25
|
+
h4
|
|
26
|
+
h5
|
|
27
|
+
h6
|
|
28
|
+
body1
|
|
29
|
+
body2
|
|
30
|
+
button
|
|
31
|
+
h1Font
|
|
32
|
+
h2Font
|
|
33
|
+
h3Font
|
|
34
|
+
h4Font
|
|
35
|
+
h5Font
|
|
36
|
+
h6Font
|
|
37
|
+
body1Font
|
|
38
|
+
body2Font
|
|
39
|
+
buttonFont
|
|
40
|
+
xsBreakpoint
|
|
41
|
+
smBreakpoint
|
|
42
|
+
mdBreakpoint
|
|
43
|
+
lgBreakpoint
|
|
44
|
+
xlBreakpoint
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`;
|
package/package.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@evenicanpm/admin-graphql-codegen",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"gitHead": "2a4307173bbfb888c935e45b3aca3c6227861368",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
11
|
+
"codegen:insecure": "NODE_TLS_REJECT_UNAUTHORIZED=0 npm run codegen",
|
|
12
|
+
"codegen": "graphql-codegen"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@graphql-codegen/cli": "^5.0.5",
|
|
16
|
+
"@graphql-codegen/typescript": "^4.1.6",
|
|
17
|
+
"@graphql-codegen/typescript-graphql-request": "^6.2.0",
|
|
18
|
+
"glob": "^11.0.1",
|
|
19
|
+
"graphql": "^16.10.0",
|
|
20
|
+
"graphql-request": "^7.1.2"
|
|
21
|
+
}
|
|
22
|
+
}
|
package/test.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { parse } from "graphql";
|
|
3
|
+
import { glob } from "glob";
|
|
4
|
+
|
|
5
|
+
const main = async () => {
|
|
6
|
+
const files = await glob("./documents/**/*.ts");
|
|
7
|
+
return files.map((f) => {
|
|
8
|
+
console.log(f);
|
|
9
|
+
const js = readFileSync(f, "utf8");
|
|
10
|
+
eval(js);
|
|
11
|
+
//const gql = parse(js);
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
main();
|