@voxgig/create-sdkgen 0.18.0 → 0.18.1
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.
|
@@ -61,6 +61,52 @@ log/
|
|
|
61
61
|
// repeated.
|
|
62
62
|
//
|
|
63
63
|
// It is excluded from the bulk Copy and merged instead (see mergeGuide).
|
|
64
|
+
// The PROJECT overlay: the second model file the user owns.
|
|
65
|
+
//
|
|
66
|
+
// `guide.aontu` owns what the API looks like. This owns what the PROJECT is —
|
|
67
|
+
// publication values above all. The sdkgen schema tells you to declare those
|
|
68
|
+
// in `model/sdk.aontu` "where they survive a resync", and that was simply not
|
|
69
|
+
// true: ModelSdk rewrites sdk.aontu from its template on every scaffold, so a
|
|
70
|
+
// version or package name declared there vanished before the model was built,
|
|
71
|
+
// with no error. The cedar fleet ran for months with every manifest pinned at
|
|
72
|
+
// the schema default 0.0.1 while its git tags climbed past 0.1.1, and this is
|
|
73
|
+
// why.
|
|
74
|
+
//
|
|
75
|
+
// sdk.aontu cannot simply be merged the way guide.aontu is. Its template owns
|
|
76
|
+
// `name`, `origin` and especially `def` — the OpenAPI filename, which really
|
|
77
|
+
// does change (three cedar specs were renamed in one week). A "keep the user's
|
|
78
|
+
// file" merge would freeze `def` at a spec that no longer exists and break
|
|
79
|
+
// regeneration. So the template keeps sole ownership of sdk.aontu, and the
|
|
80
|
+
// user gets a file of their own that sdk.aontu includes.
|
|
81
|
+
//
|
|
82
|
+
// Written ONCE. If it exists, it is re-emitted byte-for-byte, so a
|
|
83
|
+
// re-scaffold is a no-op on it.
|
|
84
|
+
const PROJECT_FILE = 'project.aontu';
|
|
85
|
+
const PROJECT_STUB = `# Project overlay — YOURS. The scaffold creates this file once and never
|
|
86
|
+
# overwrites it, unlike every other file it writes.
|
|
87
|
+
#
|
|
88
|
+
# Everything else under model/ is toolchain-derived and is deliberately
|
|
89
|
+
# regenerated so that toolchain fixes propagate. Put anything here that is a
|
|
90
|
+
# decision about THIS project rather than a fact about the API.
|
|
91
|
+
#
|
|
92
|
+
# Included LAST by sdk.aontu, after target/target-index.aontu, because a key
|
|
93
|
+
# under main.kit.target.<t> can only refine a target that has already been
|
|
94
|
+
# defined. Declared earlier, the model build fails with "Cannot unify value:
|
|
95
|
+
# nil with value: string / key ext value was: nil", which names nothing that
|
|
96
|
+
# would lead you here.
|
|
97
|
+
#
|
|
98
|
+
# The release version each generated manifest declares (package.json,
|
|
99
|
+
# pyproject.toml, the gemspec, the rockspec) and that the port Makefiles tag:
|
|
100
|
+
#
|
|
101
|
+
# main: kit: target: ts: publish: version: '1.2.3'
|
|
102
|
+
#
|
|
103
|
+
# Per target, because ports publish to different registries on different
|
|
104
|
+
# clocks. Set every target to the same value for a lockstep repo.
|
|
105
|
+
#
|
|
106
|
+
# A published package name that does not follow the derivation:
|
|
107
|
+
#
|
|
108
|
+
# main: kit: target: ts: publish: registry: package: '@scope/name'
|
|
109
|
+
`;
|
|
64
110
|
const GUIDE_FILE = 'guide.aontu';
|
|
65
111
|
const GUIDE_REL = ['model', 'guide', GUIDE_FILE];
|
|
66
112
|
// Merge the guide template into an existing guide overlay.
|
|
@@ -165,6 +211,14 @@ const CreateRoot = (0, jostraca_1.cmp)(function CreateRoot(props) {
|
|
|
165
211
|
});
|
|
166
212
|
(0, jostraca_1.Folder)({ name: 'model' }, () => {
|
|
167
213
|
(0, ModelSdk_1.ModelSdk)({ spec });
|
|
214
|
+
// The project overlay, created once. An existing one is re-emitted
|
|
215
|
+
// unchanged rather than skipped, so the write is a no-op instead of a
|
|
216
|
+
// special case in the component tree.
|
|
217
|
+
const projectPath = node_path_1.default.join(folder, spec.sdk_folder, 'model', PROJECT_FILE);
|
|
218
|
+
const existingProject = fs.existsSync(projectPath) ? fs.readFileSync(projectPath, 'utf8') : null;
|
|
219
|
+
(0, jostraca_1.File)({ name: PROJECT_FILE }, () => {
|
|
220
|
+
(0, jostraca_1.Content)(null == existingProject ? PROJECT_STUB : existingProject);
|
|
221
|
+
});
|
|
168
222
|
// Re-emit the guide the Copy skipped, merged over whatever is already
|
|
169
223
|
// there. On a fresh scaffold there is no existing file and this writes
|
|
170
224
|
// the template unchanged; on a re-scaffold the user's overlay survives.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateRoot.js","sourceRoot":"","sources":["../../../src/project/standard/CreateRoot.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"CreateRoot.js","sourceRoot":"","sources":["../../../src/project/standard/CreateRoot.ts"],"names":[],"mappings":";;;;;;QA+RE,eAAe;AA7RjB,0DAA4B;AAC5B,gCAAgC;AAEhC,uCAUiB;AAGjB,yCAAqC;AAGrC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;CAkBrB,CAAA;AAGD,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;CAmBrB,CAAA;AAGD,yDAAyD;AACzD,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,sEAAsE;AACtE,wEAAwE;AACxE,4EAA4E;AAC5E,yEAAyE;AACzE,yEAAyE;AACzE,YAAY;AACZ,EAAE;AACF,yEAAyE;AACzE,4DAA4D;AAC5D,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,OAAO;AACP,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,+EAA+E;AAC/E,2EAA2E;AAC3E,2EAA2E;AAC3E,yDAAyD;AACzD,EAAE;AACF,mEAAmE;AACnE,gCAAgC;AAChC,MAAM,YAAY,GAAG,eAAe,CAAA;AACpC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwBpB,CAAA;AAGD,MAAM,UAAU,GAAG,aAAa,CAAA;AAChC,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAAA;AAGhD,2DA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AI,CAAC,UAAU,EAAE,GAAG,SAAS,CAAC,CAAA;oBAClE,MAAM,aAAa,GACjB,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;oBAEtE,IAAA,eAAI,EAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,GAAG,EAAE;wBAC9B,IAAA,kBAAO,EAAC,UAAU,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC,CAAA;oBACnD,CAAC,CAAC,CAAA;gBACJ,CAAC,CAAC,CAAA;YACJ,CAAC,CAAC,CAAA;QACJ,CAAC,CAAC,CAAA;IAEJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;QAIA,UAAU"}
|
package/package.json
CHANGED
|
@@ -33,3 +33,9 @@ def: 'DEF'
|
|
|
33
33
|
# Operation workflows.
|
|
34
34
|
@"flow/flow-index.aontu"
|
|
35
35
|
|
|
36
|
+
|
|
37
|
+
# Project overlay — user-owned, created once and never overwritten.
|
|
38
|
+
#
|
|
39
|
+
# LAST, deliberately: it may refine main.kit.target.<t>, and a target can only
|
|
40
|
+
# be refined after target-index.aontu has defined it.
|
|
41
|
+
@"project.aontu"
|
|
@@ -75,6 +75,54 @@ log/
|
|
|
75
75
|
// repeated.
|
|
76
76
|
//
|
|
77
77
|
// It is excluded from the bulk Copy and merged instead (see mergeGuide).
|
|
78
|
+
// The PROJECT overlay: the second model file the user owns.
|
|
79
|
+
//
|
|
80
|
+
// `guide.aontu` owns what the API looks like. This owns what the PROJECT is —
|
|
81
|
+
// publication values above all. The sdkgen schema tells you to declare those
|
|
82
|
+
// in `model/sdk.aontu` "where they survive a resync", and that was simply not
|
|
83
|
+
// true: ModelSdk rewrites sdk.aontu from its template on every scaffold, so a
|
|
84
|
+
// version or package name declared there vanished before the model was built,
|
|
85
|
+
// with no error. The cedar fleet ran for months with every manifest pinned at
|
|
86
|
+
// the schema default 0.0.1 while its git tags climbed past 0.1.1, and this is
|
|
87
|
+
// why.
|
|
88
|
+
//
|
|
89
|
+
// sdk.aontu cannot simply be merged the way guide.aontu is. Its template owns
|
|
90
|
+
// `name`, `origin` and especially `def` — the OpenAPI filename, which really
|
|
91
|
+
// does change (three cedar specs were renamed in one week). A "keep the user's
|
|
92
|
+
// file" merge would freeze `def` at a spec that no longer exists and break
|
|
93
|
+
// regeneration. So the template keeps sole ownership of sdk.aontu, and the
|
|
94
|
+
// user gets a file of their own that sdk.aontu includes.
|
|
95
|
+
//
|
|
96
|
+
// Written ONCE. If it exists, it is re-emitted byte-for-byte, so a
|
|
97
|
+
// re-scaffold is a no-op on it.
|
|
98
|
+
const PROJECT_FILE = 'project.aontu'
|
|
99
|
+
const PROJECT_STUB = `# Project overlay — YOURS. The scaffold creates this file once and never
|
|
100
|
+
# overwrites it, unlike every other file it writes.
|
|
101
|
+
#
|
|
102
|
+
# Everything else under model/ is toolchain-derived and is deliberately
|
|
103
|
+
# regenerated so that toolchain fixes propagate. Put anything here that is a
|
|
104
|
+
# decision about THIS project rather than a fact about the API.
|
|
105
|
+
#
|
|
106
|
+
# Included LAST by sdk.aontu, after target/target-index.aontu, because a key
|
|
107
|
+
# under main.kit.target.<t> can only refine a target that has already been
|
|
108
|
+
# defined. Declared earlier, the model build fails with "Cannot unify value:
|
|
109
|
+
# nil with value: string / key ext value was: nil", which names nothing that
|
|
110
|
+
# would lead you here.
|
|
111
|
+
#
|
|
112
|
+
# The release version each generated manifest declares (package.json,
|
|
113
|
+
# pyproject.toml, the gemspec, the rockspec) and that the port Makefiles tag:
|
|
114
|
+
#
|
|
115
|
+
# main: kit: target: ts: publish: version: '1.2.3'
|
|
116
|
+
#
|
|
117
|
+
# Per target, because ports publish to different registries on different
|
|
118
|
+
# clocks. Set every target to the same value for a lockstep repo.
|
|
119
|
+
#
|
|
120
|
+
# A published package name that does not follow the derivation:
|
|
121
|
+
#
|
|
122
|
+
# main: kit: target: ts: publish: registry: package: '@scope/name'
|
|
123
|
+
`
|
|
124
|
+
|
|
125
|
+
|
|
78
126
|
const GUIDE_FILE = 'guide.aontu'
|
|
79
127
|
const GUIDE_REL = ['model', 'guide', GUIDE_FILE]
|
|
80
128
|
|
|
@@ -202,6 +250,18 @@ const CreateRoot = cmp(function CreateRoot(props: any) {
|
|
|
202
250
|
Folder({ name: 'model' }, () => {
|
|
203
251
|
ModelSdk({ spec })
|
|
204
252
|
|
|
253
|
+
// The project overlay, created once. An existing one is re-emitted
|
|
254
|
+
// unchanged rather than skipped, so the write is a no-op instead of a
|
|
255
|
+
// special case in the component tree.
|
|
256
|
+
const projectPath =
|
|
257
|
+
Path.join(folder, spec.sdk_folder, 'model', PROJECT_FILE)
|
|
258
|
+
const existingProject =
|
|
259
|
+
fs.existsSync(projectPath) ? fs.readFileSync(projectPath, 'utf8') : null
|
|
260
|
+
|
|
261
|
+
File({ name: PROJECT_FILE }, () => {
|
|
262
|
+
Content(null == existingProject ? PROJECT_STUB : existingProject)
|
|
263
|
+
})
|
|
264
|
+
|
|
205
265
|
// Re-emit the guide the Copy skipped, merged over whatever is already
|
|
206
266
|
// there. On a fresh scaffold there is no existing file and this writes
|
|
207
267
|
// the template unchanged; on a re-scaffold the user's overlay survives.
|