@voxgig/sdkgen 4.45.0 → 4.47.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/bin/voxgig-sdkgen +1 -1
- package/dist/action/check.js +73 -4
- package/dist/action/check.js.map +1 -1
- package/dist/action/copies.js +1 -0
- package/dist/action/copies.js.map +1 -1
- package/dist/action/doctor.d.ts +26 -2
- package/dist/action/doctor.js +208 -11
- package/dist/action/doctor.js.map +1 -1
- package/dist/action/package.d.ts +1 -1
- package/dist/action/package.js +15 -16
- package/dist/action/package.js.map +1 -1
- package/dist/action/remove.js +16 -4
- package/dist/action/remove.js.map +1 -1
- package/dist/action/resolve.d.ts +1 -0
- package/dist/action/resolve.js +10 -4
- package/dist/action/resolve.js.map +1 -1
- package/dist/action/target.d.ts +2 -1
- package/dist/action/target.js +50 -11
- package/dist/action/target.js.map +1 -1
- package/dist/admin/status.d.ts +7 -1
- package/dist/admin/status.js +34 -5
- package/dist/admin/status.js.map +1 -1
- package/dist/cmp/AgentGuide.js +46 -23
- package/dist/cmp/AgentGuide.js.map +1 -1
- package/dist/cmp/AgentGuideContent.d.ts +9 -7
- package/dist/cmp/AgentGuideContent.js +73 -43
- package/dist/cmp/AgentGuideContent.js.map +1 -1
- package/dist/cmp/AgentGuideFeature.js +19 -9
- package/dist/cmp/AgentGuideFeature.js.map +1 -1
- package/dist/cmp/AgentGuideTop.js +95 -49
- package/dist/cmp/AgentGuideTop.js.map +1 -1
- package/dist/cmp/Changelog.js +45 -4
- package/dist/cmp/Changelog.js.map +1 -1
- package/dist/cmp/Deploy.js +73 -35
- package/dist/cmp/Deploy.js.map +1 -1
- package/dist/cmp/Entity.js +1 -1
- package/dist/cmp/Entity.js.map +1 -1
- package/dist/cmp/ExternalTarget.js +10 -5
- package/dist/cmp/ExternalTarget.js.map +1 -1
- package/dist/cmp/Feature.js +12 -5
- package/dist/cmp/Feature.js.map +1 -1
- package/dist/cmp/FeatureDocs.d.ts +6 -4
- package/dist/cmp/FeatureDocs.js +14 -39
- package/dist/cmp/FeatureDocs.js.map +1 -1
- package/dist/cmp/FeatureHook.d.ts +7 -1
- package/dist/cmp/FeatureHook.js +34 -1
- package/dist/cmp/FeatureHook.js.map +1 -1
- package/dist/cmp/Main.js +1 -1
- package/dist/cmp/Main.js.map +1 -1
- package/dist/cmp/PublishWorkflow.js +89 -55
- package/dist/cmp/PublishWorkflow.js.map +1 -1
- package/dist/cmp/ReadmeErrors.js +521 -18
- package/dist/cmp/ReadmeErrors.js.map +1 -1
- package/dist/cmp/ReadmeExplanation.js +280 -44
- package/dist/cmp/ReadmeExplanation.js.map +1 -1
- package/dist/cmp/ReadmeFeatures.js +16 -7
- package/dist/cmp/ReadmeFeatures.js.map +1 -1
- package/dist/cmp/ReadmeIntro.js +4 -3
- package/dist/cmp/ReadmeIntro.js.map +1 -1
- package/dist/cmp/ReadmeModel.js +2 -2
- package/dist/cmp/ReadmeModel.js.map +1 -1
- package/dist/cmp/ReadmeRefFeatures.js +34 -24
- package/dist/cmp/ReadmeRefFeatures.js.map +1 -1
- package/dist/cmp/ReadmeStation.js +12 -9
- package/dist/cmp/ReadmeStation.js.map +1 -1
- package/dist/cmp/ReadmeTop.js +479 -382
- package/dist/cmp/ReadmeTop.js.map +1 -1
- package/dist/cmp/ReadmeUnions.js +8 -2
- package/dist/cmp/ReadmeUnions.js.map +1 -1
- package/dist/cmp/Registered.js +1 -1
- package/dist/cmp/Registered.js.map +1 -1
- package/dist/cmp/Security.js +26 -5
- package/dist/cmp/Security.js.map +1 -1
- package/dist/cmp/Test.js +1 -1
- package/dist/cmp/Test.js.map +1 -1
- package/dist/helpers/alongside.d.ts +2 -3
- package/dist/helpers/alongside.js +16 -15
- package/dist/helpers/alongside.js.map +1 -1
- package/dist/helpers/applicability.d.ts +3 -1
- package/dist/helpers/applicability.js +40 -1
- package/dist/helpers/applicability.js.map +1 -1
- package/dist/helpers/component.js +9 -1
- package/dist/helpers/component.js.map +1 -1
- package/dist/helpers/copymerge.d.ts +3 -0
- package/dist/helpers/copymerge.js +43 -10
- package/dist/helpers/copymerge.js.map +1 -1
- package/dist/helpers/definitionPlan.js +0 -1
- package/dist/helpers/definitionPlan.js.map +1 -1
- package/dist/helpers/doccheck.d.ts +11 -0
- package/dist/helpers/doccheck.js +146 -0
- package/dist/helpers/doccheck.js.map +1 -0
- package/dist/helpers/doctext.d.ts +11 -0
- package/dist/helpers/doctext.js +85 -0
- package/dist/helpers/doctext.js.map +1 -0
- package/dist/helpers/exampleCall.d.ts +16 -0
- package/dist/helpers/exampleCall.js +334 -0
- package/dist/helpers/exampleCall.js.map +1 -0
- package/dist/helpers/exportnames.d.ts +4 -0
- package/dist/helpers/exportnames.js +35 -0
- package/dist/helpers/exportnames.js.map +1 -0
- package/dist/helpers/facts.d.ts +2 -1
- package/dist/helpers/facts.js +210 -5
- package/dist/helpers/facts.js.map +1 -1
- package/dist/helpers/flowGuard.d.ts +1 -1
- package/dist/helpers/flowGuard.js +20 -7
- package/dist/helpers/flowGuard.js.map +1 -1
- package/dist/helpers/generated.d.ts +1 -0
- package/dist/helpers/generated.js +1 -1
- package/dist/helpers/generated.js.map +1 -1
- package/dist/helpers/graphqlPoint.d.ts +2 -1
- package/dist/helpers/graphqlPoint.js +17 -0
- package/dist/helpers/graphqlPoint.js.map +1 -1
- package/dist/helpers/guardModel.d.ts +2 -0
- package/dist/helpers/guardModel.js +41 -0
- package/dist/helpers/guardModel.js.map +1 -0
- package/dist/helpers/manifest.d.ts +2 -1
- package/dist/helpers/manifest.js +16 -0
- package/dist/helpers/manifest.js.map +1 -1
- package/dist/helpers/mcpTools.d.ts +2 -1
- package/dist/helpers/mcpTools.js +8 -1
- package/dist/helpers/mcpTools.js.map +1 -1
- package/dist/helpers/modelcheck.d.ts +2 -1
- package/dist/helpers/modelcheck.js +13 -0
- package/dist/helpers/modelcheck.js.map +1 -1
- package/dist/helpers/opExample.d.ts +9 -2
- package/dist/helpers/opExample.js +22 -2
- package/dist/helpers/opExample.js.map +1 -1
- package/dist/helpers/opShape.d.ts +2 -1
- package/dist/helpers/opShape.js +29 -17
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/packageMeta.d.ts +6 -4
- package/dist/helpers/packageMeta.js +88 -53
- package/dist/helpers/packageMeta.js.map +1 -1
- package/dist/helpers/placement.d.ts +15 -0
- package/dist/helpers/placement.js +76 -0
- package/dist/helpers/placement.js.map +1 -0
- package/dist/helpers/semver.d.ts +3 -1
- package/dist/helpers/semver.js +28 -0
- package/dist/helpers/semver.js.map +1 -1
- package/dist/helpers/serverVars.js +3 -2
- package/dist/helpers/serverVars.js.map +1 -1
- package/dist/helpers/shipped.d.ts +2 -1
- package/dist/helpers/shipped.js +12 -0
- package/dist/helpers/shipped.js.map +1 -1
- package/dist/helpers/sourcestring.d.ts +3 -0
- package/dist/helpers/sourcestring.js +43 -0
- package/dist/helpers/sourcestring.js.map +1 -0
- package/dist/helpers/stdrep.d.ts +1 -1
- package/dist/helpers/stdrep.js +5 -1
- package/dist/helpers/stdrep.js.map +1 -1
- package/dist/helpers/surface.d.ts +7 -0
- package/dist/helpers/surface.js +69 -0
- package/dist/helpers/surface.js.map +1 -0
- package/dist/helpers/targetguard.d.ts +13 -0
- package/dist/helpers/targetguard.js +65 -0
- package/dist/helpers/targetguard.js.map +1 -0
- package/dist/helpers/text.d.ts +3 -1
- package/dist/helpers/text.js +16 -0
- package/dist/helpers/text.js.map +1 -1
- package/dist/helpers/textguard.d.ts +31 -0
- package/dist/helpers/textguard.js +157 -0
- package/dist/helpers/textguard.js.map +1 -0
- package/dist/helpers/title.d.ts +4 -0
- package/dist/helpers/title.js +52 -0
- package/dist/helpers/title.js.map +1 -0
- package/dist/sdkgen.d.ts +4 -6
- package/dist/sdkgen.js +72 -63
- package/dist/sdkgen.js.map +1 -1
- package/dist/testkit.d.ts +7 -2
- package/dist/testkit.js +27 -20
- package/dist/testkit.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utility.js +2 -1
- package/dist/utility.js.map +1 -1
- package/model/fact.aontu +150 -0
- package/model/sdkgen.aontu +15 -3
- package/package.json +3 -1
- package/project/.sdk/src/cmp/c/ReadmeQuick_c.ts +2 -2
- package/project/.sdk/src/cmp/c/ReadmeTopQuick_c.ts +1 -1
- package/project/.sdk/src/cmp/clojure/ReadmeEntity_clojure.ts +12 -3
- package/project/.sdk/src/cmp/clojure/ReadmeQuick_clojure.ts +1 -1
- package/project/.sdk/src/cmp/cpp/ReadmeQuick_cpp.ts +1 -1
- package/project/.sdk/src/cmp/csharp/ReadmeQuick_csharp.ts +1 -1
- package/project/.sdk/src/cmp/elixir/ReadmeQuick_elixir.ts +1 -1
- package/project/.sdk/src/cmp/go/ReadmeQuick_go.ts +1 -1
- package/project/.sdk/src/cmp/java/ReadmeQuick_java.ts +1 -1
- package/project/.sdk/src/cmp/js/ReadmeQuick_js.ts +1 -1
- package/project/.sdk/src/cmp/kotlin/ReadmeQuick_kotlin.ts +1 -1
- package/project/.sdk/src/cmp/lua/ReadmeQuick_lua.ts +1 -1
- package/project/.sdk/src/cmp/ocaml/ReadmeQuick_ocaml.ts +1 -1
- package/project/.sdk/src/cmp/perl/ReadmeQuick_perl.ts +1 -1
- package/project/.sdk/src/cmp/php/ReadmeQuick_php.ts +1 -1
- package/project/.sdk/src/cmp/py/ReadmeQuick_py.ts +1 -1
- package/project/.sdk/src/cmp/rb/ReadmeQuick_rb.ts +1 -1
- package/project/.sdk/src/cmp/rust/ReadmeQuick_rust.ts +1 -1
- package/project/.sdk/src/cmp/scala/ReadmeQuick_scala.ts +1 -1
- package/project/.sdk/src/cmp/scala/ReadmeRef_scala.ts +4 -1
- package/project/.sdk/src/cmp/swift/ReadmeQuick_swift.ts +2 -1
- package/project/.sdk/src/cmp/swift/ReadmeRef_swift.ts +3 -0
- package/project/.sdk/src/cmp/swift/ReadmeTopQuick_swift.ts +2 -1
- package/project/.sdk/src/cmp/ts/ReadmeQuick_ts.ts +1 -1
- package/project/.sdk/src/cmp/ts/TestDefinition_ts.ts +3 -1
- package/project/.sdk/src/cmp/zig/ReadmeOptions_zig.ts +1 -1
- package/project/.sdk/src/cmp/zig/ReadmeQuick_zig.ts +3 -3
- package/project/.sdk/src/cmp/zig/ReadmeTopQuick_zig.ts +2 -2
- package/project/.sdk/tm/ocaml/test/feature/secrets/t_secrets.ml +3 -1
- package/project/.sdk/tm/php/test/feature/secrets/SecretsTest.php +2 -1
- package/project/.sdk/tm/zig/test/feature/secrets/secrets_test.zig +11 -2
- package/project/sdkgen-package.json +1 -1
- package/src/action/check.ts +99 -4
- package/src/action/copies.ts +2 -0
- package/src/action/doctor.ts +304 -15
- package/src/action/package.ts +11 -13
- package/src/action/remove.ts +20 -5
- package/src/action/resolve.ts +11 -4
- package/src/action/target.ts +66 -15
- package/src/admin/status.ts +25 -5
- package/src/cmp/AgentGuide.ts +52 -25
- package/src/cmp/AgentGuideContent.ts +75 -43
- package/src/cmp/AgentGuideFeature.ts +21 -10
- package/src/cmp/AgentGuideTop.ts +119 -49
- package/src/cmp/Changelog.ts +56 -5
- package/src/cmp/Deploy.ts +81 -40
- package/src/cmp/Entity.ts +1 -1
- package/src/cmp/ExternalTarget.ts +12 -6
- package/src/cmp/Feature.ts +13 -6
- package/src/cmp/FeatureDocs.ts +21 -40
- package/src/cmp/FeatureHook.ts +38 -1
- package/src/cmp/Main.ts +1 -1
- package/src/cmp/PublishWorkflow.ts +94 -60
- package/src/cmp/ReadmeErrors.ts +555 -25
- package/src/cmp/ReadmeExplanation.ts +316 -52
- package/src/cmp/ReadmeFeatures.ts +18 -8
- package/src/cmp/ReadmeIntro.ts +4 -3
- package/src/cmp/ReadmeModel.ts +2 -2
- package/src/cmp/ReadmeRefFeatures.ts +39 -27
- package/src/cmp/ReadmeStation.ts +13 -16
- package/src/cmp/ReadmeTop.ts +538 -397
- package/src/cmp/ReadmeUnions.ts +10 -2
- package/src/cmp/Registered.ts +1 -1
- package/src/cmp/Security.ts +35 -7
- package/src/cmp/Test.ts +1 -1
- package/src/helpers/alongside.ts +16 -19
- package/src/helpers/applicability.ts +44 -1
- package/src/helpers/component.ts +11 -1
- package/src/helpers/copymerge.ts +58 -10
- package/src/helpers/definitionPlan.ts +0 -1
- package/src/helpers/doccheck.ts +174 -0
- package/src/helpers/doctext.ts +115 -0
- package/src/helpers/exampleCall.ts +415 -0
- package/src/helpers/exportnames.ts +47 -0
- package/src/helpers/facts.ts +259 -5
- package/src/helpers/flowGuard.ts +22 -7
- package/src/helpers/generated.ts +3 -1
- package/src/helpers/graphqlPoint.ts +20 -1
- package/src/helpers/guardModel.ts +50 -0
- package/src/helpers/manifest.ts +19 -0
- package/src/helpers/mcpTools.ts +11 -1
- package/src/helpers/modelcheck.ts +16 -0
- package/src/helpers/opExample.ts +34 -2
- package/src/helpers/opShape.ts +29 -16
- package/src/helpers/packageMeta.ts +89 -52
- package/src/helpers/placement.ts +114 -0
- package/src/helpers/semver.ts +35 -0
- package/src/helpers/serverVars.ts +4 -2
- package/src/helpers/shipped.ts +13 -0
- package/src/helpers/sourcestring.ts +47 -0
- package/src/helpers/stdrep.ts +6 -1
- package/src/helpers/surface.ts +82 -0
- package/src/helpers/targetguard.ts +91 -0
- package/src/helpers/text.ts +22 -0
- package/src/helpers/textguard.ts +208 -0
- package/src/helpers/title.ts +59 -0
- package/src/sdkgen.ts +82 -78
- package/src/testkit.ts +42 -20
- package/src/utility.ts +2 -1
package/src/action/doctor.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { kindCollection } from '../helpers/kindCollection'
|
|
2
2
|
|
|
3
|
+
import Fs from 'node:fs'
|
|
3
4
|
import Path from 'node:path'
|
|
4
5
|
|
|
5
6
|
import { template } from 'jostraca'
|
|
@@ -31,7 +32,13 @@ import type { TreeDef } from './kind'
|
|
|
31
32
|
import { resolveSource } from './resolve'
|
|
32
33
|
import type { Source } from './resolve'
|
|
33
34
|
|
|
34
|
-
import {
|
|
35
|
+
import {
|
|
36
|
+
definitionPath, definitionNames, migrateIncludes,
|
|
37
|
+
} from '../helpers/definition'
|
|
38
|
+
|
|
39
|
+
import { compileModel, slashComments } from '../helpers/modelcheck'
|
|
40
|
+
|
|
41
|
+
import { packageRoot } from '../helpers/shipped'
|
|
35
42
|
|
|
36
43
|
import { findFeatureSources, featureExcludes } from '../helpers/featureSource'
|
|
37
44
|
|
|
@@ -44,6 +51,13 @@ import type { CopyRecord } from './copies'
|
|
|
44
51
|
|
|
45
52
|
import { MERGE } from '../helpers/copymerge'
|
|
46
53
|
|
|
54
|
+
import { compareVersions } from '../helpers/semver'
|
|
55
|
+
|
|
56
|
+
import { isTypeScript, missingExports } from '../helpers/exportnames'
|
|
57
|
+
|
|
58
|
+
import { untestedTargets } from '../helpers/targetguard'
|
|
59
|
+
import type { BrokenTarget } from '../helpers/targetguard'
|
|
60
|
+
|
|
47
61
|
|
|
48
62
|
const IGNORED_RE = /(~|-jostraca-off)$/
|
|
49
63
|
|
|
@@ -104,10 +118,18 @@ type DoctorReport = {
|
|
|
104
118
|
// it is what an alias is FOR.
|
|
105
119
|
aliasedDiff: string[]
|
|
106
120
|
|
|
121
|
+
// Of those, a file lacking slots its origin's file declares. An add keeps
|
|
122
|
+
// the file, so a slot added since never reaches it. Informational.
|
|
123
|
+
aliasedBehind: { file: string, slots: string[] }[]
|
|
124
|
+
|
|
107
125
|
// Differs from its source, but the copy record shows it untouched since an
|
|
108
126
|
// add wrote it: the source moved on, so refreshing it discards nothing.
|
|
109
127
|
outdated: string[]
|
|
110
128
|
|
|
129
|
+
// As outdated, but copied from a newer release of the package than the one
|
|
130
|
+
// installed: a refresh would put older copies back.
|
|
131
|
+
ahead: string[]
|
|
132
|
+
|
|
111
133
|
// The forked and edited findings the copy record has no entry for, so
|
|
112
134
|
// nothing shows whether the project changed them.
|
|
113
135
|
unrecorded: string[]
|
|
@@ -117,6 +139,16 @@ type DoctorReport = {
|
|
|
117
139
|
// the project's own, not drift.
|
|
118
140
|
customized: string[]
|
|
119
141
|
|
|
142
|
+
// Customized TypeScript copies that lack a name their source exports, so a
|
|
143
|
+
// copy importing it does not compile.
|
|
144
|
+
unfolded: Unfolded[]
|
|
145
|
+
|
|
146
|
+
// Items whose copies this generator's record dates from before COPY_FLOOR.
|
|
147
|
+
belowFloor: string[]
|
|
148
|
+
|
|
149
|
+
// Item model files that do not compile, so the model leaves the item out.
|
|
150
|
+
unreadable: Unreadable[]
|
|
151
|
+
|
|
120
152
|
// Declared items whose source is not installed; their copies are kept.
|
|
121
153
|
unresolved: string[]
|
|
122
154
|
|
|
@@ -126,6 +158,10 @@ type DoctorReport = {
|
|
|
126
158
|
// `.sdk/.gitignore` hides the copy record from git. Informational.
|
|
127
159
|
ignoredLog: boolean
|
|
128
160
|
|
|
161
|
+
// Active SDK targets the model gives no active `test` feature, which
|
|
162
|
+
// generate refuses.
|
|
163
|
+
untested: string[]
|
|
164
|
+
|
|
129
165
|
ok: boolean
|
|
130
166
|
}
|
|
131
167
|
|
|
@@ -140,18 +176,46 @@ type ItemDrift = {
|
|
|
140
176
|
|
|
141
177
|
outdated: number
|
|
142
178
|
|
|
179
|
+
ahead: number
|
|
180
|
+
|
|
143
181
|
// Forked, edited, missing and stale files.
|
|
144
182
|
changed: number
|
|
145
183
|
|
|
146
184
|
customized: number
|
|
147
185
|
|
|
186
|
+
belowFloor?: boolean
|
|
187
|
+
|
|
148
188
|
unresolved?: string
|
|
149
189
|
}
|
|
150
190
|
|
|
151
191
|
|
|
192
|
+
type Unreadable = {
|
|
193
|
+
file: string
|
|
194
|
+
item: string
|
|
195
|
+
error: string
|
|
196
|
+
oldSyntax: boolean
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
// The oldest release of this generator whose component copies build with it.
|
|
201
|
+
const COPY_FLOOR = '4.23.0'
|
|
202
|
+
|
|
203
|
+
// The oldest release whose copied model files this generator reads.
|
|
204
|
+
const MODEL_FLOOR = '1.3.18'
|
|
205
|
+
|
|
206
|
+
const SHIPPED_PACKAGE: string =
|
|
207
|
+
JSON.parse(Fs.readFileSync(Path.join(packageRoot(), 'package.json'), 'utf8')).name
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
type Unfolded = {
|
|
211
|
+
file: string
|
|
212
|
+
item: string
|
|
213
|
+
names: string[]
|
|
214
|
+
}
|
|
215
|
+
|
|
152
216
|
type Category = 'forked' | 'edited' | 'missing' | 'stale'
|
|
153
217
|
|
|
154
|
-
type Found = (category: Category, label: string) => void
|
|
218
|
+
type Found = (category: Category, label: string, lacking?: () => string[]) => void
|
|
155
219
|
|
|
156
220
|
|
|
157
221
|
const CMD_MAP: any = {
|
|
@@ -296,12 +360,14 @@ async function doctor(
|
|
|
296
360
|
const report: DoctorReport = {
|
|
297
361
|
forked: [], edited: [], stale: [], missing: [], additive: [],
|
|
298
362
|
superseded: [], unwired: [], orphanModel: [],
|
|
299
|
-
resyncPending: [], aliasedDiff: [],
|
|
300
|
-
outdated: [],
|
|
301
|
-
|
|
363
|
+
resyncPending: [], aliasedDiff: [], aliasedBehind: [],
|
|
364
|
+
outdated: [], ahead: [], unrecorded: [], customized: [], unfolded: [],
|
|
365
|
+
belowFloor: [], unreadable: [], unresolved: [], byItem: {},
|
|
366
|
+
ignoredLog: false, untested: [], ok: true,
|
|
302
367
|
}
|
|
303
368
|
|
|
304
369
|
const copies = readCopies(fs, root)
|
|
370
|
+
const untested: BrokenTarget[] = []
|
|
305
371
|
|
|
306
372
|
report.ignoredLog = ignoredLog(fs, root)
|
|
307
373
|
if (report.ignoredLog) {
|
|
@@ -312,6 +378,8 @@ async function doctor(
|
|
|
312
378
|
|
|
313
379
|
report.orphanModel = orphanModelFiles(actx)
|
|
314
380
|
|
|
381
|
+
report.unreadable = unreadableModels(actx, report.orphanModel)
|
|
382
|
+
|
|
315
383
|
const kinds = Object.keys(KINDS).sort()
|
|
316
384
|
|
|
317
385
|
const counts: Record<string, number> = {}
|
|
@@ -380,6 +448,13 @@ async function doctor(
|
|
|
380
448
|
|
|
381
449
|
if (null == scope) {
|
|
382
450
|
checkWiring(actx, report)
|
|
451
|
+
|
|
452
|
+
// Only a prepared model has the facts to judge by; resolveModel prepares
|
|
453
|
+
// every action's.
|
|
454
|
+
if (null != (model as any)?.main?.[KIT]?.fact) {
|
|
455
|
+
untested.push(...untestedTargets(model))
|
|
456
|
+
report.untested = untested.map((b: BrokenTarget) => b.target)
|
|
457
|
+
}
|
|
383
458
|
}
|
|
384
459
|
|
|
385
460
|
// orphanModel counts, and `unwired` does not. Not skipping a root
|
|
@@ -389,8 +464,9 @@ async function doctor(
|
|
|
389
464
|
// authoritative either way.
|
|
390
465
|
report.ok = 0 === report.forked.length + report.edited.length -
|
|
391
466
|
report.customized.length + report.stale.length + report.missing.length + report.superseded.length +
|
|
392
|
-
report.orphanModel.length + report.outdated.length +
|
|
393
|
-
report.
|
|
467
|
+
report.orphanModel.length + report.outdated.length + report.ahead.length +
|
|
468
|
+
report.unfolded.length + report.belowFloor.length +
|
|
469
|
+
report.unreadable.length + report.unresolved.length + report.untested.length
|
|
394
470
|
|
|
395
471
|
const customized = new Set(report.customized)
|
|
396
472
|
const unmergeable = MERGE === projectCopyMode(actx) ? new Set(report.unrecorded) : new Set()
|
|
@@ -408,6 +484,7 @@ async function doctor(
|
|
|
408
484
|
['resyncPending', 'RESYNC PENDING (predates provenance; `target add` updates it)'],
|
|
409
485
|
['aliasedDiff', 'aliased model differs from its origin (project-owned, not drift)'],
|
|
410
486
|
['outdated', 'OUTDATED (unchanged since it was copied, but its source has moved on)'],
|
|
487
|
+
['ahead', 'AHEAD (unchanged since it was copied from a newer release than the one installed)'],
|
|
411
488
|
['unresolved', 'UNRESOLVED (declared, but its source is not installed; install it)'],
|
|
412
489
|
] as [keyof DoctorReport, string][]) {
|
|
413
490
|
for (const file of (report[kind] as string[])) {
|
|
@@ -421,8 +498,53 @@ async function doctor(
|
|
|
421
498
|
}
|
|
422
499
|
}
|
|
423
500
|
|
|
501
|
+
for (const b of untested) {
|
|
502
|
+
log.info({ point: 'doctor-finding', kind: 'untested', target: b.target, note: 'UNTESTED: ' + b.note })
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
for (const { file, item, error, oldSyntax } of report.unreadable) {
|
|
506
|
+
log.info({
|
|
507
|
+
point: 'doctor-finding', kind: 'unreadable', file, error,
|
|
508
|
+
note: 'UNREADABLE: ' + file + ' does not compile (' + error + '), so the ' +
|
|
509
|
+
'model leaves ' + item.replace('/', ' ') + ' out. ' + unreadableRemedy(item, oldSyntax)
|
|
510
|
+
})
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
for (const { file, slots } of report.aliasedBehind) {
|
|
514
|
+
log.info({
|
|
515
|
+
point: 'doctor-finding', kind: 'aliasedBehind', file, slots,
|
|
516
|
+
note: 'ALIASED BEHIND (lacks ' + slots.join(', ') + ', which its origin declares; ' +
|
|
517
|
+
'an add keeps this file, so copy them in by hand): ' + file
|
|
518
|
+
})
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
for (const { file, names } of report.unfolded) {
|
|
522
|
+
log.info({
|
|
523
|
+
point: 'doctor-finding', kind: 'unfolded', file, names,
|
|
524
|
+
note: 'UNFOLDED (customized, but lacks ' + names.join(', ') +
|
|
525
|
+
', which its source exports): ' + file
|
|
526
|
+
})
|
|
527
|
+
}
|
|
528
|
+
|
|
424
529
|
for (const item of Object.keys(report.byItem).sort()) {
|
|
425
530
|
const drift = report.byItem[item]
|
|
531
|
+
|
|
532
|
+
if (true === drift.belowFloor) {
|
|
533
|
+
log.info({ point: 'doctor-below-floor', item, ...drift, note: belowFloorNote(item, drift) })
|
|
534
|
+
continue
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
if (null == copies.items[item] && null == drift.unresolved && 0 < drift.changed) {
|
|
538
|
+
log.info({
|
|
539
|
+
point: 'doctor-unrecorded-item', item, ...drift,
|
|
540
|
+
note: item.replace('/', ' ') + ': nothing records which release wrote ' +
|
|
541
|
+
'its copies, and ' + drift.changed + ' differ from the installed ' +
|
|
542
|
+
'source. Copies from before ' + COPY_FLOOR + ' do not build with this ' +
|
|
543
|
+
'generator: if the .sdk build fails in them, commit, then run ' +
|
|
544
|
+
'`voxgig-sdkgen ' + refreshCommand(item) + ' --force`.'
|
|
545
|
+
})
|
|
546
|
+
}
|
|
547
|
+
|
|
426
548
|
if (0 < drift.outdated) {
|
|
427
549
|
log.info({
|
|
428
550
|
point: 'doctor-outdated', item, ...drift,
|
|
@@ -430,6 +552,13 @@ async function doctor(
|
|
|
430
552
|
refreshCommand(item, drift.package) + '` refreshes them'
|
|
431
553
|
})
|
|
432
554
|
}
|
|
555
|
+
if (0 < drift.ahead) {
|
|
556
|
+
log.info({
|
|
557
|
+
point: 'doctor-ahead', item, ...drift,
|
|
558
|
+
note: aheadNote(item, drift) + ' - `voxgig-sdkgen ' +
|
|
559
|
+
forwardCommand(drift.package as string) + '` moves it up to them'
|
|
560
|
+
})
|
|
561
|
+
}
|
|
433
562
|
}
|
|
434
563
|
|
|
435
564
|
log.info({
|
|
@@ -445,8 +574,14 @@ async function doctor(
|
|
|
445
574
|
orphanModel: report.orphanModel.length,
|
|
446
575
|
resyncPending: report.resyncPending.length,
|
|
447
576
|
aliasedDiff: report.aliasedDiff.length,
|
|
577
|
+
aliasedBehind: report.aliasedBehind.length,
|
|
448
578
|
outdated: report.outdated.length,
|
|
579
|
+
ahead: report.ahead.length,
|
|
580
|
+
unfolded: report.unfolded.length,
|
|
581
|
+
belowFloor: report.belowFloor.length,
|
|
582
|
+
unreadable: report.unreadable.length,
|
|
449
583
|
unresolved: report.unresolved.length,
|
|
584
|
+
untested: report.untested.length,
|
|
450
585
|
customized: report.customized.length,
|
|
451
586
|
note: report.ok ?
|
|
452
587
|
('.sdk matches the scaffold (' + report.additive.length + ' additive, ' +
|
|
@@ -454,7 +589,10 @@ async function doctor(
|
|
|
454
589
|
('.sdk has drifted: ' + report.forked.length + ' forked, ' +
|
|
455
590
|
report.edited.length + ' edited, ' + report.stale.length + ' stale, ' +
|
|
456
591
|
report.missing.length + ' missing, ' + report.outdated.length +
|
|
457
|
-
' outdated, ' + report.
|
|
592
|
+
' outdated, ' + report.ahead.length + ' ahead, ' +
|
|
593
|
+
report.unfolded.length + ' unfolded, ' + report.belowFloor.length +
|
|
594
|
+
' below the floor, ' + report.unreadable.length + ' unreadable, ' +
|
|
595
|
+
report.unresolved.length + ' unresolved, ' + report.untested.length + ' untested')
|
|
458
596
|
})
|
|
459
597
|
|
|
460
598
|
return { report }
|
|
@@ -525,6 +663,7 @@ function noteUnresolved(
|
|
|
525
663
|
report.byItem[item] = {
|
|
526
664
|
...pkgOf(declared.package),
|
|
527
665
|
outdated: 0,
|
|
666
|
+
ahead: 0,
|
|
528
667
|
changed: 0,
|
|
529
668
|
customized: 0,
|
|
530
669
|
unresolved: from,
|
|
@@ -681,9 +820,13 @@ function compareTrees(
|
|
|
681
820
|
|
|
682
821
|
const from = landed.get(rel) as string
|
|
683
822
|
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
823
|
+
const at = Path.join(tree.project, rel)
|
|
824
|
+
|
|
825
|
+
if (differs(fs, from, at, model, tree.replace, undefined, tree.rewrite)) {
|
|
826
|
+
found(tree.kind, label + rel, isTypeScript(rel) ? () => {
|
|
827
|
+
const { expected, actual } = renderPair(fs, from, at, model, tree.replace, tree.rewrite)
|
|
828
|
+
return missingExports(expected, actual)
|
|
829
|
+
} : undefined)
|
|
687
830
|
}
|
|
688
831
|
}
|
|
689
832
|
|
|
@@ -887,6 +1030,10 @@ function checkItemModel(
|
|
|
887
1030
|
|
|
888
1031
|
if (aliased) {
|
|
889
1032
|
report.aliasedDiff.push(label)
|
|
1033
|
+
const slots = slotsBehind(fs, kind, scaffold, origname, project, name)
|
|
1034
|
+
if (0 < slots.length) {
|
|
1035
|
+
report.aliasedBehind.push({ file: label, slots })
|
|
1036
|
+
}
|
|
890
1037
|
return
|
|
891
1038
|
}
|
|
892
1039
|
|
|
@@ -899,6 +1046,27 @@ function checkItemModel(
|
|
|
899
1046
|
}
|
|
900
1047
|
|
|
901
1048
|
|
|
1049
|
+
const PROVENANCE_SLOTS = ['base', 'origname', 'package']
|
|
1050
|
+
|
|
1051
|
+
// The slots the origin's model file declares that the alias's own file lacks.
|
|
1052
|
+
function slotsBehind(
|
|
1053
|
+
fs: any, kind: string, scaffold: string, origname: string, project: string, name: string,
|
|
1054
|
+
): string[] {
|
|
1055
|
+
const block = (path: string, key: string): Record<string, any> | undefined => {
|
|
1056
|
+
const text = migrateIncludes(String(fs.readFileSync(path, 'utf8')))
|
|
1057
|
+
const compiled = compileModel(text, path, { strict: false })
|
|
1058
|
+
return 0 === compiled.errors.length ? kindCollection(compiled.model, kind)[key] : undefined
|
|
1059
|
+
}
|
|
1060
|
+
const origin = block(scaffold, origname)
|
|
1061
|
+
const alias = block(project, name)
|
|
1062
|
+
if (null == origin || null == alias) {
|
|
1063
|
+
return []
|
|
1064
|
+
}
|
|
1065
|
+
return Object.keys(origin)
|
|
1066
|
+
.filter((slot: string) => !PROVENANCE_SLOTS.includes(slot) && !(slot in alias)).sort()
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
|
|
902
1070
|
// Files every finding through one place: a forked or edited copy the record
|
|
903
1071
|
// shows untouched is outdated instead, and every item keeps a tally.
|
|
904
1072
|
function noteDrift(
|
|
@@ -909,16 +1077,18 @@ function noteDrift(
|
|
|
909
1077
|
const item = itemKey(kind, source.name)
|
|
910
1078
|
const copied = copies.items[item]
|
|
911
1079
|
const merging = MERGE === projectCopyMode(actx)
|
|
1080
|
+
const ahead = null != source.package && copied?.package === source.package &&
|
|
1081
|
+
0 < (compareVersions(copied?.version ?? '', source.version ?? '') ?? 0)
|
|
912
1082
|
|
|
913
|
-
return (category: Category, label: string) => {
|
|
914
|
-
let into: Category | 'outdated' = category
|
|
1083
|
+
return (category: Category, label: string, lacking?: () => string[]) => {
|
|
1084
|
+
let into: Category | 'outdated' | 'ahead' = category
|
|
915
1085
|
let custom = false
|
|
916
1086
|
|
|
917
1087
|
if ('forked' === category || 'edited' === category) {
|
|
918
1088
|
const same = untouched(fs, actx.folder, copies, label)
|
|
919
1089
|
|
|
920
1090
|
if (true === same) {
|
|
921
|
-
into = 'outdated'
|
|
1091
|
+
into = ahead ? 'ahead' : 'outdated'
|
|
922
1092
|
}
|
|
923
1093
|
else if (undefined === same) {
|
|
924
1094
|
report.unrecorded.push(label)
|
|
@@ -926,23 +1096,37 @@ function noteDrift(
|
|
|
926
1096
|
else if (merging) {
|
|
927
1097
|
custom = true
|
|
928
1098
|
report.customized.push(label)
|
|
1099
|
+
|
|
1100
|
+
const names = lacking?.() ?? []
|
|
1101
|
+
if (0 < names.length) {
|
|
1102
|
+
report.unfolded.push({ file: label, item, names })
|
|
1103
|
+
}
|
|
929
1104
|
}
|
|
930
1105
|
}
|
|
931
1106
|
|
|
932
1107
|
report[into].push(label)
|
|
933
1108
|
|
|
1109
|
+
if (null == report.byItem[item] && belowFloor(copied)) {
|
|
1110
|
+
report.belowFloor.push(item)
|
|
1111
|
+
}
|
|
1112
|
+
|
|
934
1113
|
const drift = report.byItem[item] = report.byItem[item] ?? {
|
|
935
1114
|
...pkgOf(source.package ?? copied?.package),
|
|
936
1115
|
...(null == copied?.version ? {} : { from: copied.version }),
|
|
937
1116
|
...(null == source.version ? {} : { to: source.version }),
|
|
938
1117
|
outdated: 0,
|
|
1118
|
+
ahead: 0,
|
|
939
1119
|
changed: 0,
|
|
940
1120
|
customized: 0,
|
|
1121
|
+
...(belowFloor(copied) ? { belowFloor: true } : {}),
|
|
941
1122
|
}
|
|
942
1123
|
|
|
943
1124
|
if ('outdated' === into) {
|
|
944
1125
|
drift.outdated++
|
|
945
1126
|
}
|
|
1127
|
+
else if ('ahead' === into) {
|
|
1128
|
+
drift.ahead++
|
|
1129
|
+
}
|
|
946
1130
|
else {
|
|
947
1131
|
drift.changed++
|
|
948
1132
|
}
|
|
@@ -954,6 +1138,64 @@ function noteDrift(
|
|
|
954
1138
|
}
|
|
955
1139
|
|
|
956
1140
|
|
|
1141
|
+
// The floor holds for this generator's own copies; another package keeps its own.
|
|
1142
|
+
function belowFloor(copied?: { package?: string, version?: string }): boolean {
|
|
1143
|
+
return SHIPPED_PACKAGE === copied?.package &&
|
|
1144
|
+
0 > (compareVersions(copied?.version ?? '', COPY_FLOOR) ?? 0)
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
|
|
1148
|
+
function belowFloorNote(item: string, drift: ItemDrift): string {
|
|
1149
|
+
return item.replace('/', ' ') + ': ' + (drift.outdated + drift.changed) +
|
|
1150
|
+
' file(s) were copied from ' + drift.package + ' ' + drift.from +
|
|
1151
|
+
', older than ' + COPY_FLOOR + ', the oldest release whose copies this ' +
|
|
1152
|
+
'generator builds. Commit, then run `voxgig-sdkgen ' + refreshCommand(item) +
|
|
1153
|
+
' --force` to replace them.'
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
|
|
1157
|
+
function unreadableRemedy(item: string, oldSyntax: boolean): string {
|
|
1158
|
+
return (oldSyntax ? 'It uses `//` comments, as model files copied before ' +
|
|
1159
|
+
MODEL_FLOOR + ' do, and this generator does not read them. ' : '') +
|
|
1160
|
+
'Commit, then run `voxgig-sdkgen ' + refreshCommand(item) + ' --force` to ' +
|
|
1161
|
+
'replace it.'
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
// An included item model file that fails to compile leaves no error behind:
|
|
1166
|
+
// the model simply lacks the item. Compiled alone, the failure shows.
|
|
1167
|
+
function unreadableModels(actx: ActionContext, orphans: string[]): Unreadable[] {
|
|
1168
|
+
const fs = actx.fs()
|
|
1169
|
+
const root = actx.folder
|
|
1170
|
+
const found: Unreadable[] = []
|
|
1171
|
+
|
|
1172
|
+
for (const kind of Object.keys(KINDS).sort()) {
|
|
1173
|
+
const declared = kindCollection(actx.model, kind) ?? {}
|
|
1174
|
+
|
|
1175
|
+
for (const name of definitionNames(fs, root, kind)) {
|
|
1176
|
+
const path = definitionPath(root, kind, name)
|
|
1177
|
+
const file = Path.relative(root, path).split(Path.sep).join('/')
|
|
1178
|
+
|
|
1179
|
+
if (null != declared[name] || !fs.existsSync(path) || orphans.includes(file)) {
|
|
1180
|
+
continue
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
const text = String(fs.readFileSync(path, 'utf8'))
|
|
1184
|
+
const compiled = compileModel(migrateIncludes(text), path, { strict: false })
|
|
1185
|
+
|
|
1186
|
+
if (0 < compiled.errors.length) {
|
|
1187
|
+
found.push({
|
|
1188
|
+
file, item: itemKey(kind, name), error: compiled.errors[0],
|
|
1189
|
+
oldSyntax: 0 < slashComments(text).length,
|
|
1190
|
+
})
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
return found
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
|
|
957
1199
|
function pkgOf(name?: string): { package?: string } {
|
|
958
1200
|
return null == name ? {} : { package: name }
|
|
959
1201
|
}
|
|
@@ -971,6 +1213,19 @@ function refreshCommand(item: string, pkg?: string): string {
|
|
|
971
1213
|
}
|
|
972
1214
|
|
|
973
1215
|
|
|
1216
|
+
// Fetches the latest release, which a re-add from the installed one is not.
|
|
1217
|
+
function forwardCommand(pkg: string): string {
|
|
1218
|
+
return 'package update ' + pkg
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
function aheadNote(item: string, drift: ItemDrift): string {
|
|
1223
|
+
return item.replace('/', ' ') + ': ' + drift.ahead + ' file(s) are ' +
|
|
1224
|
+
'unchanged copies from ' + drift.package + ' ' + drift.from +
|
|
1225
|
+
', newer than the installed ' + drift.to
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
|
|
974
1229
|
function outdatedNote(item: string, drift: ItemDrift): string {
|
|
975
1230
|
return item.replace('/', ' ') + ': ' + drift.outdated +
|
|
976
1231
|
' file(s) are unchanged copies' + sinceCopied(drift.package, [drift])
|
|
@@ -1166,20 +1421,42 @@ function copyWarnings(report: DoctorReport): string[] {
|
|
|
1166
1421
|
groups.set(key, group)
|
|
1167
1422
|
}
|
|
1168
1423
|
|
|
1424
|
+
const lines: string[] = report.ignoredLog ? [IGNORED_LOG] : []
|
|
1425
|
+
|
|
1426
|
+
for (const { file, item, oldSyntax } of report.unreadable) {
|
|
1427
|
+
lines.push(file + ' does not compile, so this run leaves ' +
|
|
1428
|
+
item.replace('/', ' ') + ' out. ' + unreadableRemedy(item, oldSyntax)
|
|
1429
|
+
.replace('`voxgig-sdkgen', '`npx voxgig-sdkgen'))
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1169
1432
|
for (const item of Object.keys(report.byItem).sort()) {
|
|
1170
1433
|
const drift = report.byItem[item]
|
|
1171
1434
|
const command = refreshCommand(item, drift.package)
|
|
1172
1435
|
|
|
1436
|
+
if (true === drift.belowFloor) {
|
|
1437
|
+
lines.push(belowFloorNote(item, drift).replace('`voxgig-sdkgen', '`npx voxgig-sdkgen'))
|
|
1438
|
+
continue
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1173
1441
|
if (0 < drift.outdated) {
|
|
1174
1442
|
add('outdated\n' + command, item, drift.outdated, drift)
|
|
1175
1443
|
}
|
|
1176
1444
|
|
|
1445
|
+
if (0 < drift.ahead) {
|
|
1446
|
+
add('ahead\n' + forwardCommand(drift.package as string), item, drift.ahead, drift)
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1177
1449
|
if (0 < drift.changed - drift.customized) {
|
|
1178
1450
|
add('changed\n' + command, item, drift.changed - drift.customized, drift)
|
|
1179
1451
|
}
|
|
1180
1452
|
}
|
|
1181
1453
|
|
|
1182
|
-
const
|
|
1454
|
+
for (const { file, item, names } of report.unfolded) {
|
|
1455
|
+
lines.push(file + ': lacks ' + names.join(', ') + ', which the installed ' +
|
|
1456
|
+
'copy exports, so a copy that imports ' + (1 === names.length ? 'it' : 'them') +
|
|
1457
|
+
' does not compile. Fold the incoming change into it, or commit, then run ' +
|
|
1458
|
+
'`npx voxgig-sdkgen ' + refreshCommand(item) + ' --force` to take the incoming copy.')
|
|
1459
|
+
}
|
|
1183
1460
|
|
|
1184
1461
|
for (const item of report.unresolved) {
|
|
1185
1462
|
lines.push(item.replace('/', ' ') + ': declared from ' +
|
|
@@ -1202,6 +1479,14 @@ function copyWarnings(report: DoctorReport): string[] {
|
|
|
1202
1479
|
sinceCopied(pkg, group.drift) + ', so this run generates from ' +
|
|
1203
1480
|
'older templates. Run ' + refresh + ' to refresh them.')
|
|
1204
1481
|
}
|
|
1482
|
+
else if ('ahead' === what) {
|
|
1483
|
+
lines.push(group.items.join(', ') + ': ' + group.files +
|
|
1484
|
+
' file(s) in .sdk were copied from a newer ' + pkg + ' than the ' +
|
|
1485
|
+
'installed ' + installed + ', so this run generates from templates ' +
|
|
1486
|
+
'written for a generator this is not. Run ' + refresh + ' to move ' +
|
|
1487
|
+
'the installed package up to them; refreshing from ' + installed +
|
|
1488
|
+
' would put older copies back.')
|
|
1489
|
+
}
|
|
1205
1490
|
else {
|
|
1206
1491
|
lines.push(group.items.join(', ') + ': ' + group.files +
|
|
1207
1492
|
' file(s) in .sdk differ from what ' + installed + ' installs: ' +
|
|
@@ -1221,9 +1506,13 @@ export type {
|
|
|
1221
1506
|
DoctorReport,
|
|
1222
1507
|
DoctorScope,
|
|
1223
1508
|
ItemDrift,
|
|
1509
|
+
Unfolded,
|
|
1510
|
+
Unreadable,
|
|
1224
1511
|
}
|
|
1225
1512
|
|
|
1226
1513
|
export {
|
|
1514
|
+
COPY_FLOOR,
|
|
1515
|
+
MODEL_FLOOR,
|
|
1227
1516
|
action_doctor,
|
|
1228
1517
|
doctor,
|
|
1229
1518
|
copyCheck,
|
package/src/action/package.ts
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
import type { Manifest, Finding } from '../helpers/manifest'
|
|
23
23
|
|
|
24
24
|
import { satisfies } from '../helpers/semver'
|
|
25
|
+
import { SDKGEN_VERSION } from '../helpers/shipped'
|
|
25
26
|
|
|
26
27
|
import { npmCommand } from '../helpers/npm'
|
|
27
28
|
import type { NpmCommand, NpmHost } from '../helpers/npm'
|
|
@@ -152,19 +153,6 @@ function checkEngine(src: PackageSource, actx: ActionContext) {
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
|
|
155
|
-
// This generator's own version, read from the package.json beside `dist`.
|
|
156
|
-
// Not from the consumer's model: `engines.sdkgen` is about the GENERATOR
|
|
157
|
-
// doing the installing, and the model describes the SDK being generated.
|
|
158
|
-
const SDKGEN_VERSION: string = (() => {
|
|
159
|
-
try {
|
|
160
|
-
return require('../../package.json').version
|
|
161
|
-
}
|
|
162
|
-
catch (err: any) {
|
|
163
|
-
return '0.0.0'
|
|
164
|
-
}
|
|
165
|
-
})()
|
|
166
|
-
|
|
167
|
-
|
|
168
156
|
function selectItems(
|
|
169
157
|
src: PackageSource, only: string | undefined, log: any,
|
|
170
158
|
): Record<string, string[]> {
|
|
@@ -673,6 +661,16 @@ async function preCheck(
|
|
|
673
661
|
})
|
|
674
662
|
}
|
|
675
663
|
|
|
664
|
+
if (0 < report.ahead.length && true === flags.nofetch) {
|
|
665
|
+
actx.log.warn({
|
|
666
|
+
point: 'package-update-older', package: pkgname,
|
|
667
|
+
files: report.ahead.length,
|
|
668
|
+
note: pkgname + ': ' + report.ahead.length + ' file(s) were copied ' +
|
|
669
|
+
'from a newer release than the one installed; --no-fetch puts its ' +
|
|
670
|
+
'older copies back'
|
|
671
|
+
})
|
|
672
|
+
}
|
|
673
|
+
|
|
676
674
|
const changed = [...report.forked, ...report.edited]
|
|
677
675
|
|
|
678
676
|
if (0 === changed.length) {
|
package/src/action/remove.ts
CHANGED
|
@@ -31,6 +31,8 @@ import { doctor } from './doctor'
|
|
|
31
31
|
|
|
32
32
|
import { forgetCopies } from './copies'
|
|
33
33
|
|
|
34
|
+
import { readOverride, runOutput } from '../helpers/placement'
|
|
35
|
+
|
|
34
36
|
|
|
35
37
|
// Everything one `remove` would touch, decided before anything is written.
|
|
36
38
|
type RemovePlan = {
|
|
@@ -289,15 +291,28 @@ function planOutput(
|
|
|
289
291
|
) {
|
|
290
292
|
const fs = actx.fs()
|
|
291
293
|
const root = actx.folder
|
|
294
|
+
const output = Path.join(root, '..', plan.name)
|
|
292
295
|
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
+
// Where a generate run here would write, the run override included.
|
|
297
|
+
const targets = Object.keys((actx.model as any)?.main?.[KIT]?.target ?? {})
|
|
298
|
+
const { override, named } = readOverride(
|
|
299
|
+
actx.opts?.external, process.env.SDKGEN_EXTERNAL, targets)
|
|
300
|
+
const run = runOutput(declared?.output, override[plan.name])
|
|
301
|
+
|
|
302
|
+
// The base schema defaults the path to '', which declares no output.
|
|
303
|
+
if ('' !== (run.path ?? '') || true === run.root) {
|
|
304
|
+
const where = true === run.root ? 'at the project root' :
|
|
305
|
+
'out of tree (' + run.path +
|
|
306
|
+
(named.includes(plan.name) ? ', from SDKGEN_EXTERNAL' : '') + ')'
|
|
307
|
+
plan.notes.push(plan.name + ': generates ' + where + '; that output is not touched')
|
|
308
|
+
|
|
309
|
+
if (fs.existsSync(output)) {
|
|
310
|
+
plan.notes.push(plan.name + ': ' + rel(root, output) + ' is not where ' +
|
|
311
|
+
'it is generated, and is kept; remove it yourself if it is stale')
|
|
312
|
+
}
|
|
296
313
|
return
|
|
297
314
|
}
|
|
298
315
|
|
|
299
|
-
const output = Path.join(root, '..', plan.name)
|
|
300
|
-
|
|
301
316
|
if (!fs.existsSync(output)) {
|
|
302
317
|
return
|
|
303
318
|
}
|
package/src/action/resolve.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { kindCollection } from '../helpers/kindCollection'
|
|
2
2
|
|
|
3
|
+
import Fs from 'node:fs'
|
|
3
4
|
import Path from 'node:path'
|
|
4
5
|
|
|
5
6
|
import { getelem } from '@voxgig/struct'
|
|
@@ -9,6 +10,7 @@ import { KIT } from '../types'
|
|
|
9
10
|
import { SdkGenError } from '../utility'
|
|
10
11
|
|
|
11
12
|
import { definitionPathAny } from '../helpers/definition'
|
|
13
|
+
import { scaffoldFolder } from '../helpers/shipped'
|
|
12
14
|
import { readManifest, checkShape, ITEM_NAME_RE } from '../helpers/manifest'
|
|
13
15
|
|
|
14
16
|
|
|
@@ -364,12 +366,14 @@ function resolvesBundled(declared: any, name: string): boolean {
|
|
|
364
366
|
type TargetOrigins = {
|
|
365
367
|
bundled: string[]
|
|
366
368
|
external: { name: string, from: string }[]
|
|
369
|
+
owned: string[]
|
|
367
370
|
}
|
|
368
371
|
|
|
369
372
|
|
|
373
|
+
// A bare name the shipped scaffold lacks is the project's own.
|
|
370
374
|
function targetOrigins(model: any): TargetOrigins {
|
|
371
375
|
const targets = kindCollection(model, 'target')
|
|
372
|
-
const origins: TargetOrigins = { bundled: [], external: [] }
|
|
376
|
+
const origins: TargetOrigins = { bundled: [], external: [], owned: [] }
|
|
373
377
|
|
|
374
378
|
for (const name of Object.keys(targets).sort()) {
|
|
375
379
|
const target = targets[name]
|
|
@@ -377,11 +381,14 @@ function targetOrigins(model: any): TargetOrigins {
|
|
|
377
381
|
continue
|
|
378
382
|
}
|
|
379
383
|
|
|
380
|
-
if (resolvesBundled(target, name)) {
|
|
381
|
-
origins.
|
|
384
|
+
if (!resolvesBundled(target, name)) {
|
|
385
|
+
origins.external.push({ name, from: normaliseBase(target.base) })
|
|
386
|
+
}
|
|
387
|
+
else if (!Fs.existsSync(definitionPathAny(Fs, scaffoldFolder(), 'target', target.origname || name))) {
|
|
388
|
+
origins.owned.push(name)
|
|
382
389
|
}
|
|
383
390
|
else {
|
|
384
|
-
origins.
|
|
391
|
+
origins.bundled.push(name)
|
|
385
392
|
}
|
|
386
393
|
}
|
|
387
394
|
|