@voxgig/create-sdkgen 0.13.0 → 0.14.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.
|
@@ -8,6 +8,43 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
8
8
|
// import * as Fs from 'node:fs'
|
|
9
9
|
const jostraca_1 = require("jostraca");
|
|
10
10
|
const ModelSdk_1 = require("./ModelSdk");
|
|
11
|
+
const GITIGNORE_TOP = `# Local config / secrets
|
|
12
|
+
*.local.*
|
|
13
|
+
*.local
|
|
14
|
+
|
|
15
|
+
# Dependencies
|
|
16
|
+
node_modules/
|
|
17
|
+
|
|
18
|
+
# Logs
|
|
19
|
+
*.log
|
|
20
|
+
logs/
|
|
21
|
+
|
|
22
|
+
# OS
|
|
23
|
+
.DS_Store
|
|
24
|
+
|
|
25
|
+
# Editor
|
|
26
|
+
*~
|
|
27
|
+
*.swp
|
|
28
|
+
`;
|
|
29
|
+
const GITIGNORE_SDK = `# Local config / secrets
|
|
30
|
+
*.local.*
|
|
31
|
+
*.local
|
|
32
|
+
|
|
33
|
+
# Dependencies
|
|
34
|
+
node_modules/
|
|
35
|
+
|
|
36
|
+
# Build output
|
|
37
|
+
dist/
|
|
38
|
+
dist-test/
|
|
39
|
+
*.tsbuildinfo
|
|
40
|
+
|
|
41
|
+
# Generated logs
|
|
42
|
+
log/
|
|
43
|
+
*.log
|
|
44
|
+
|
|
45
|
+
# OS
|
|
46
|
+
.DS_Store
|
|
47
|
+
`;
|
|
11
48
|
// TODO: rename to RootSdk
|
|
12
49
|
const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
|
|
13
50
|
const { ctx$, ctx$: { folder }, spec, model } = props;
|
|
@@ -24,10 +61,16 @@ const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
|
|
|
24
61
|
from,
|
|
25
62
|
exclude: [/\.fragment\./]
|
|
26
63
|
});
|
|
64
|
+
(0, jostraca_1.File)({ name: '.gitignore' }, () => {
|
|
65
|
+
(0, jostraca_1.Content)(GITIGNORE_TOP);
|
|
66
|
+
});
|
|
27
67
|
const origdef = spec.def;
|
|
28
68
|
const projdef = node_path_1.default.basename(origdef);
|
|
29
69
|
spec.def = projdef;
|
|
30
70
|
(0, jostraca_1.Folder)({ name: spec.sdk_folder }, () => {
|
|
71
|
+
(0, jostraca_1.File)({ name: '.gitignore' }, () => {
|
|
72
|
+
(0, jostraca_1.Content)(GITIGNORE_SDK);
|
|
73
|
+
});
|
|
31
74
|
(0, jostraca_1.Folder)({ name: 'def' }, () => {
|
|
32
75
|
// TODO: file existence check should be jostraca util
|
|
33
76
|
if (fs.existsSync(origdef)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRoot.js","sourceRoot":"","sources":["../../../src/project/standard/CreateRoot.ts"],"names":[],"mappings":";;;;;;AAEA,0DAA4B;AAC5B,gCAAgC;AAEhC,uCAUiB;AAGjB,yCAAqC;AAGrC,0BAA0B;AAC1B,MAAM,UAAU,GAAG,IAAA,cAAG,EAAC,SAAS,UAAU,CAAC,KAAU;IACnD,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,CAAA;IACrD,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,CAAA;IAEpB,2CAA2C;IAC3C,KAAK,CAAC,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAA;IAClC,IAAA,gBAAK,EAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;IAC9B,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IAE3C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IAElB,IAAA,kBAAO,EAAC,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE;QACvB,MAAM,IAAI,GACR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IA,gCAAU"}
|
package/package.json
CHANGED
|
@@ -76,6 +76,8 @@ function makeEntityTestData(_model: Model, entity: ModelEntity) {
|
|
|
76
76
|
// with values that match what the test code sends via setup.idmap.
|
|
77
77
|
const pathParams = collectEntityPathParams(entity)
|
|
78
78
|
|
|
79
|
+
const hasEntId = null != (entity as any).id
|
|
80
|
+
|
|
79
81
|
let i = 1
|
|
80
82
|
|
|
81
83
|
refs.map((ref) => {
|
|
@@ -89,7 +91,12 @@ function makeEntityTestData(_model: Model, entity: ModelEntity) {
|
|
|
89
91
|
ent[paramName] = paramValue
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
|
-
|
|
94
|
+
// Only inject a fixture id when the spec actually models one for this
|
|
95
|
+
// entity. Public APIs (e.g. read-only feeds) without ids leave fixtures
|
|
96
|
+
// bare so test generators don't synthesise bogus id assertions.
|
|
97
|
+
if (hasEntId) {
|
|
98
|
+
ent.id = id
|
|
99
|
+
}
|
|
93
100
|
})
|
|
94
101
|
|
|
95
102
|
let id = entity.name + '_ref01'
|
|
@@ -19,6 +19,47 @@ import {
|
|
|
19
19
|
import { ModelSdk } from './ModelSdk'
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
const GITIGNORE_TOP = `# Local config / secrets
|
|
23
|
+
*.local.*
|
|
24
|
+
*.local
|
|
25
|
+
|
|
26
|
+
# Dependencies
|
|
27
|
+
node_modules/
|
|
28
|
+
|
|
29
|
+
# Logs
|
|
30
|
+
*.log
|
|
31
|
+
logs/
|
|
32
|
+
|
|
33
|
+
# OS
|
|
34
|
+
.DS_Store
|
|
35
|
+
|
|
36
|
+
# Editor
|
|
37
|
+
*~
|
|
38
|
+
*.swp
|
|
39
|
+
`
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
const GITIGNORE_SDK = `# Local config / secrets
|
|
43
|
+
*.local.*
|
|
44
|
+
*.local
|
|
45
|
+
|
|
46
|
+
# Dependencies
|
|
47
|
+
node_modules/
|
|
48
|
+
|
|
49
|
+
# Build output
|
|
50
|
+
dist/
|
|
51
|
+
dist-test/
|
|
52
|
+
*.tsbuildinfo
|
|
53
|
+
|
|
54
|
+
# Generated logs
|
|
55
|
+
log/
|
|
56
|
+
*.log
|
|
57
|
+
|
|
58
|
+
# OS
|
|
59
|
+
.DS_Store
|
|
60
|
+
`
|
|
61
|
+
|
|
62
|
+
|
|
22
63
|
// TODO: rename to RootSdk
|
|
23
64
|
const CreateRoot = cmp(function CreateRoot(props: any) {
|
|
24
65
|
const { ctx$, ctx$: { folder }, spec, model } = props
|
|
@@ -42,11 +83,19 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
|
|
|
42
83
|
exclude: [/\.fragment\./]
|
|
43
84
|
})
|
|
44
85
|
|
|
86
|
+
File({ name: '.gitignore' }, () => {
|
|
87
|
+
Content(GITIGNORE_TOP)
|
|
88
|
+
})
|
|
89
|
+
|
|
45
90
|
const origdef = spec.def
|
|
46
91
|
const projdef = Path.basename(origdef)
|
|
47
92
|
spec.def = projdef
|
|
48
93
|
|
|
49
94
|
Folder({ name: spec.sdk_folder }, () => {
|
|
95
|
+
File({ name: '.gitignore' }, () => {
|
|
96
|
+
Content(GITIGNORE_SDK)
|
|
97
|
+
})
|
|
98
|
+
|
|
50
99
|
Folder({ name: 'def' }, () => {
|
|
51
100
|
// TODO: file existence check should be jostraca util
|
|
52
101
|
if (fs.existsSync(origdef)) {
|