@voxgig/sdkgen 4.37.0 → 4.39.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 +13 -2
- package/dist/action/copies.d.ts +6 -1
- package/dist/action/copies.js +43 -1
- package/dist/action/copies.js.map +1 -1
- package/dist/action/doctor.d.ts +2 -0
- package/dist/action/doctor.js +25 -6
- package/dist/action/doctor.js.map +1 -1
- package/dist/action/edition.js +3 -0
- package/dist/action/edition.js.map +1 -1
- package/dist/action/feature.js +3 -0
- package/dist/action/feature.js.map +1 -1
- package/dist/action/package.js +15 -0
- package/dist/action/package.js.map +1 -1
- package/dist/action/target.js +3 -0
- package/dist/action/target.js.map +1 -1
- package/dist/helpers/copymerge.d.ts +35 -0
- package/dist/helpers/copymerge.js +508 -0
- package/dist/helpers/copymerge.js.map +1 -0
- package/dist/helpers/flowGuard.js +4 -4
- package/dist/helpers/flowGuard.js.map +1 -1
- package/dist/helpers/liveDiscovery.d.ts +7 -0
- package/dist/helpers/liveDiscovery.js +20 -0
- package/dist/helpers/liveDiscovery.js.map +1 -0
- package/dist/helpers/opShape.d.ts +2 -1
- package/dist/helpers/opShape.js +4 -0
- package/dist/helpers/opShape.js.map +1 -1
- package/dist/helpers/pointPath.d.ts +2 -1
- package/dist/helpers/pointPath.js +6 -0
- package/dist/helpers/pointPath.js.map +1 -1
- package/dist/helpers/testPolicy.d.ts +14 -4
- package/dist/helpers/testPolicy.js +152 -54
- package/dist/helpers/testPolicy.js.map +1 -1
- package/dist/sdkgen.d.ts +8 -6
- package/dist/sdkgen.js +11 -5
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/utility.js +7 -3
- package/dist/utility.js.map +1 -1
- package/model/sdkgen.aontu +4 -0
- package/package.json +1 -1
- package/project/.sdk/src/cmp/c/TestDirect_c.ts +3 -2
- package/project/.sdk/src/cmp/cpp/TestDirect_cpp.ts +3 -2
- package/project/.sdk/src/cmp/cpp/TestEntity_cpp.ts +33 -10
- package/project/.sdk/src/cmp/csharp/TestDirect_csharp.ts +12 -12
- package/project/.sdk/src/cmp/csharp/TestEntity_csharp.ts +73 -28
- package/project/.sdk/src/cmp/go/TestDirect_go.ts +12 -10
- package/project/.sdk/src/cmp/go/TestEntity_go.ts +67 -23
- package/project/.sdk/src/cmp/java/TestDirect_java.ts +12 -11
- package/project/.sdk/src/cmp/java/TestEntity_java.ts +71 -23
- package/project/.sdk/src/cmp/js/TestDirect_js.ts +13 -12
- package/project/.sdk/src/cmp/js/TestEntity_js.ts +41 -17
- package/project/.sdk/src/cmp/kotlin/TestDirect_kotlin.ts +12 -10
- package/project/.sdk/src/cmp/kotlin/TestEntity_kotlin.ts +64 -23
- package/project/.sdk/src/cmp/lua/TestDirect_lua.ts +9 -5
- package/project/.sdk/src/cmp/lua/TestEntity_lua.ts +61 -23
- package/project/.sdk/src/cmp/perl/TestDirect_perl.ts +9 -5
- package/project/.sdk/src/cmp/perl/TestEntity_perl.ts +58 -24
- package/project/.sdk/src/cmp/php/TestDirect_php.ts +9 -5
- package/project/.sdk/src/cmp/php/TestEntity_php.ts +61 -23
- package/project/.sdk/src/cmp/py/TestDirect_py.ts +10 -6
- package/project/.sdk/src/cmp/py/TestEntity_py.ts +59 -27
- package/project/.sdk/src/cmp/rb/TestDirect_rb.ts +9 -5
- package/project/.sdk/src/cmp/rb/TestEntity_rb.ts +59 -23
- package/project/.sdk/src/cmp/rust/TestDirect_rust.ts +9 -8
- package/project/.sdk/src/cmp/rust/TestEntity_rust.ts +56 -24
- package/project/.sdk/src/cmp/scala/TestDirect_scala.ts +3 -2
- package/project/.sdk/src/cmp/scala/TestEntity_scala.ts +36 -9
- package/project/.sdk/src/cmp/ts/TestDirect_ts.ts +15 -32
- package/project/.sdk/src/cmp/ts/TestEntity_ts.ts +41 -17
- package/project/.sdk/tm/c/tests/transport_test.c +33 -0
- package/project/.sdk/tm/c/utility/fetcher.c +151 -2
- package/project/.sdk/tm/c/utility/make_url.c +8 -6
- package/project/.sdk/tm/clojure/src/sdk/core.clj +17 -10
- package/project/.sdk/tm/clojure/test/sdk/test/pipeline.clj +38 -0
- package/project/.sdk/tm/cpp/utility/pipeline.hpp +5 -4
- package/project/.sdk/tm/csharp/test/PrimaryUtilityTest.cs +69 -0
- package/project/.sdk/tm/csharp/utility/Fetcher.cs +3 -1
- package/project/.sdk/tm/csharp/utility/MakeUrl.cs +5 -4
- package/project/.sdk/tm/elixir/lib/projectname/utility.ex +10 -6
- package/project/.sdk/tm/elixir/test/pipeline_test.exs +61 -0
- package/project/.sdk/tm/go/test/primary_utility_test.go +60 -0
- package/project/.sdk/tm/go/utility/fetcher.go +15 -4
- package/project/.sdk/tm/go/utility/make_url.go +4 -3
- package/project/.sdk/tm/java/test/PrimaryUtilityTest.java +47 -0
- package/project/.sdk/tm/java/utility/MakeUrl.java +5 -4
- package/project/.sdk/tm/js/src/utility/MakeUrlUtility.js +5 -3
- package/project/.sdk/tm/js/test/live-runner.js +4 -3
- package/project/.sdk/tm/js/test/utility/PrimaryUtility.test.js +40 -0
- package/project/.sdk/tm/kotlin/test/PrimaryUtilityTest.kt +41 -0
- package/project/.sdk/tm/kotlin/utility/MakeSpecUrl.kt +4 -3
- package/project/.sdk/tm/lua/test/primary_utility_test.lua +61 -0
- package/project/.sdk/tm/lua/utility/fetcher.lua +54 -6
- package/project/.sdk/tm/lua/utility/make_url.lua +5 -4
- package/project/.sdk/tm/ocaml/sdk_runtime.ml +5 -5
- package/project/.sdk/tm/perl/t/primary_utility.t +54 -0
- package/project/.sdk/tm/perl/utility/fetcher.pm +65 -11
- package/project/.sdk/tm/perl/utility/make_url.pm +4 -3
- package/project/.sdk/tm/php/test/PipelineTest.php +52 -0
- package/project/.sdk/tm/php/utility/Fetcher.php +81 -15
- package/project/.sdk/tm/php/utility/MakeUrl.php +5 -3
- package/project/.sdk/tm/py/pkg/utility/fetcher.py +1 -0
- package/project/.sdk/tm/py/pkg/utility/make_url.py +5 -4
- package/project/.sdk/tm/py/test/test_primary_utility.py +52 -0
- package/project/.sdk/tm/rb/test/primary_utility_test.rb +46 -0
- package/project/.sdk/tm/rb/utility/fetcher.rb +41 -5
- package/project/.sdk/tm/rb/utility/make_url.rb +5 -3
- package/project/.sdk/tm/rust/tests/primary_utility_test.rs +65 -0
- package/project/.sdk/tm/rust/utility/make_url.rs +7 -6
- package/project/.sdk/tm/scala/sdktest/SdkTestMain.scala +47 -1
- package/project/.sdk/tm/scala/utility/Make.scala +8 -6
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Fetcher.swift +59 -15
- package/project/.sdk/tm/swift/Sources/ProjectNameSDK/utility/Make.swift +4 -4
- package/project/.sdk/tm/swift/Tests/ProjectNameSDKTests/PrimaryUtilityTest.swift +72 -0
- package/project/.sdk/tm/ts/src/utility/MakeUrlUtility.ts +5 -3
- package/project/.sdk/tm/ts/test/live-runner.ts +4 -3
- package/project/.sdk/tm/ts/test/utility/PrimaryUtility.test.ts +40 -0
- package/project/.sdk/tm/zig/core/utility.zig +5 -5
- package/project/sdkgen-package.json +1 -1
- package/src/action/copies.ts +54 -0
- package/src/action/doctor.ts +36 -7
- package/src/action/edition.ts +9 -1
- package/src/action/feature.ts +7 -1
- package/src/action/package.ts +28 -1
- package/src/action/target.ts +7 -1
- package/src/helpers/copymerge.ts +707 -0
- package/src/helpers/flowGuard.ts +4 -4
- package/src/helpers/liveDiscovery.ts +31 -0
- package/src/helpers/opShape.ts +6 -0
- package/src/helpers/pointPath.ts +8 -0
- package/src/helpers/testPolicy.ts +193 -55
- package/src/sdkgen.ts +13 -3
- package/src/types.ts +2 -0
- package/src/utility.ts +10 -4
package/src/action/copies.ts
CHANGED
|
@@ -2,8 +2,14 @@ import Path from 'node:path'
|
|
|
2
2
|
|
|
3
3
|
import { createHash } from 'node:crypto'
|
|
4
4
|
|
|
5
|
+
import { KIT } from '../types'
|
|
5
6
|
import type { ActionContext } from '../types'
|
|
6
7
|
|
|
8
|
+
import { SdkGenError } from '../utility'
|
|
9
|
+
|
|
10
|
+
import { copyMode, gitVersions, withCopyMerge } from '../helpers/copymerge'
|
|
11
|
+
import type { CopyMode } from '../helpers/copymerge'
|
|
12
|
+
|
|
7
13
|
import {
|
|
8
14
|
definitionFileName, definitionFolder, indexName,
|
|
9
15
|
} from '../helpers/definition'
|
|
@@ -19,6 +25,11 @@ import type { Source } from './resolve'
|
|
|
19
25
|
// add or remove that changed the record, holding just the change.
|
|
20
26
|
const COPY_LOG = 'log/copies.jsonl'
|
|
21
27
|
|
|
28
|
+
// The base of each copy the project changed, and the incoming copies of a
|
|
29
|
+
// merge that stopped on a conflict.
|
|
30
|
+
const BASE_DIR = 'log/base'
|
|
31
|
+
const CONFLICT_DIR = 'log/conflict'
|
|
32
|
+
|
|
22
33
|
// Where 4.34.0 kept the whole record, until the next write moves it.
|
|
23
34
|
const LEGACY = 'sdkgen-copies.json'
|
|
24
35
|
|
|
@@ -317,6 +328,45 @@ function gone(
|
|
|
317
328
|
}
|
|
318
329
|
|
|
319
330
|
|
|
331
|
+
// `main.kit.copies` in the project's model.
|
|
332
|
+
function projectCopyMode(actx: ActionContext): CopyMode {
|
|
333
|
+
return copyMode((actx.model as any)?.main?.[KIT]?.copies)
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
// Runs an add so that a copy the project changed is merged rather than
|
|
338
|
+
// replaced. An add nested in another runs inside the outer guard.
|
|
339
|
+
async function guardCopies<T>(
|
|
340
|
+
actx: ActionContext, what: string, run: (actx: ActionContext) => Promise<T>,
|
|
341
|
+
): Promise<T> {
|
|
342
|
+
if (true === actx.copyGuarded) {
|
|
343
|
+
return run(actx)
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
const fs = actx.fs()
|
|
347
|
+
const files = readCopies(fs, actx.folder).files
|
|
348
|
+
const flags = actx.flags ?? {}
|
|
349
|
+
|
|
350
|
+
return withCopyMerge({
|
|
351
|
+
fs,
|
|
352
|
+
folder: actx.folder,
|
|
353
|
+
log: actx.log,
|
|
354
|
+
what,
|
|
355
|
+
mode: projectCopyMode(actx),
|
|
356
|
+
force: true === flags.force,
|
|
357
|
+
keep: true === flags.keep,
|
|
358
|
+
dryrun: true === actx.opts?.dryrun,
|
|
359
|
+
manage: isCopy,
|
|
360
|
+
recorded: (rel: string) => files[rel],
|
|
361
|
+
fingerprint,
|
|
362
|
+
basedir: BASE_DIR,
|
|
363
|
+
conflictdir: CONFLICT_DIR,
|
|
364
|
+
versions: gitVersions,
|
|
365
|
+
error: (msg: string) => new SdkGenError(msg),
|
|
366
|
+
}, (gfs: any) => run({ ...actx, fs: () => gfs, copyGuarded: true }))
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
|
|
320
370
|
// Was this project file left exactly as an add wrote it?
|
|
321
371
|
function untouched(
|
|
322
372
|
fs: any, folder: string, record: CopyRecord, rel: string,
|
|
@@ -339,6 +389,8 @@ export type {
|
|
|
339
389
|
}
|
|
340
390
|
|
|
341
391
|
export {
|
|
392
|
+
BASE_DIR,
|
|
393
|
+
CONFLICT_DIR,
|
|
342
394
|
COPY_LOG,
|
|
343
395
|
IGNORED_LOG,
|
|
344
396
|
ignoredLog,
|
|
@@ -347,6 +399,8 @@ export {
|
|
|
347
399
|
readCopies,
|
|
348
400
|
recordCopies,
|
|
349
401
|
forgetCopies,
|
|
402
|
+
guardCopies,
|
|
403
|
+
projectCopyMode,
|
|
350
404
|
untouched,
|
|
351
405
|
isCopy,
|
|
352
406
|
}
|
package/src/action/doctor.ts
CHANGED
|
@@ -38,10 +38,12 @@ import { findFeatureSources, featureExcludes } from '../helpers/featureSource'
|
|
|
38
38
|
import { isJunk } from '../helpers/junk'
|
|
39
39
|
|
|
40
40
|
import {
|
|
41
|
-
readCopies, untouched, itemKey, ignoredLog, IGNORED_LOG,
|
|
41
|
+
readCopies, untouched, itemKey, ignoredLog, IGNORED_LOG, projectCopyMode,
|
|
42
42
|
} from './copies'
|
|
43
43
|
import type { CopyRecord } from './copies'
|
|
44
44
|
|
|
45
|
+
import { MERGE } from '../helpers/copymerge'
|
|
46
|
+
|
|
45
47
|
|
|
46
48
|
const IGNORED_RE = /(~|-jostraca-off)$/
|
|
47
49
|
|
|
@@ -110,6 +112,11 @@ type DoctorReport = {
|
|
|
110
112
|
// nothing shows whether the project changed them.
|
|
111
113
|
unrecorded: string[]
|
|
112
114
|
|
|
115
|
+
// In merge mode, the forked and edited copies the record shows the project
|
|
116
|
+
// changed after an add wrote them. An add merges into these, so they are
|
|
117
|
+
// the project's own, not drift.
|
|
118
|
+
customized: string[]
|
|
119
|
+
|
|
113
120
|
// Declared items whose source is not installed; their copies are kept.
|
|
114
121
|
unresolved: string[]
|
|
115
122
|
|
|
@@ -136,6 +143,8 @@ type ItemDrift = {
|
|
|
136
143
|
// Forked, edited, missing and stale files.
|
|
137
144
|
changed: number
|
|
138
145
|
|
|
146
|
+
customized: number
|
|
147
|
+
|
|
139
148
|
unresolved?: string
|
|
140
149
|
}
|
|
141
150
|
|
|
@@ -288,7 +297,7 @@ async function doctor(
|
|
|
288
297
|
forked: [], edited: [], stale: [], missing: [], additive: [],
|
|
289
298
|
superseded: [], unwired: [], orphanModel: [],
|
|
290
299
|
resyncPending: [], aliasedDiff: [],
|
|
291
|
-
outdated: [], unrecorded: [], unresolved: [], byItem: {},
|
|
300
|
+
outdated: [], unrecorded: [], customized: [], unresolved: [], byItem: {},
|
|
292
301
|
ignoredLog: false, ok: true,
|
|
293
302
|
}
|
|
294
303
|
|
|
@@ -378,12 +387,15 @@ async function doctor(
|
|
|
378
387
|
// model file nothing reads is never a choice - it is either a file that
|
|
379
388
|
// should be included, or one that should be deleted, and it reads as
|
|
380
389
|
// authoritative either way.
|
|
381
|
-
report.ok = 0 === report.forked.length + report.edited.length
|
|
382
|
-
report.stale.length + report.missing.length + report.superseded.length +
|
|
390
|
+
report.ok = 0 === report.forked.length + report.edited.length -
|
|
391
|
+
report.customized.length + report.stale.length + report.missing.length + report.superseded.length +
|
|
383
392
|
report.orphanModel.length + report.outdated.length +
|
|
384
393
|
report.unresolved.length
|
|
385
394
|
|
|
395
|
+
const customized = new Set(report.customized)
|
|
396
|
+
|
|
386
397
|
for (const [kind, note] of [
|
|
398
|
+
['customized', 'CUSTOMIZED (an add merges its updates into it)'],
|
|
387
399
|
['forked', 'FORKED (will be reverted by `target add`)'],
|
|
388
400
|
['edited', 'EDITED template master'],
|
|
389
401
|
['stale', 'STALE (no longer written by `target add`)'],
|
|
@@ -398,6 +410,9 @@ async function doctor(
|
|
|
398
410
|
['unresolved', 'UNRESOLVED (declared, but its source is not installed; install it)'],
|
|
399
411
|
] as [keyof DoctorReport, string][]) {
|
|
400
412
|
for (const file of (report[kind] as string[])) {
|
|
413
|
+
if (('forked' === kind || 'edited' === kind) && customized.has(file)) {
|
|
414
|
+
continue
|
|
415
|
+
}
|
|
401
416
|
log.info({ point: 'doctor-finding', kind, file, note: note + ': ' + file })
|
|
402
417
|
}
|
|
403
418
|
}
|
|
@@ -428,8 +443,10 @@ async function doctor(
|
|
|
428
443
|
aliasedDiff: report.aliasedDiff.length,
|
|
429
444
|
outdated: report.outdated.length,
|
|
430
445
|
unresolved: report.unresolved.length,
|
|
446
|
+
customized: report.customized.length,
|
|
431
447
|
note: report.ok ?
|
|
432
|
-
('.sdk matches the scaffold (' + report.additive.length + ' additive
|
|
448
|
+
('.sdk matches the scaffold (' + report.additive.length + ' additive, ' +
|
|
449
|
+
report.customized.length + ' customized)') :
|
|
433
450
|
('.sdk has drifted: ' + report.forked.length + ' forked, ' +
|
|
434
451
|
report.edited.length + ' edited, ' + report.stale.length + ' stale, ' +
|
|
435
452
|
report.missing.length + ' missing, ' + report.outdated.length +
|
|
@@ -505,6 +522,7 @@ function noteUnresolved(
|
|
|
505
522
|
...pkgOf(declared.package),
|
|
506
523
|
outdated: 0,
|
|
507
524
|
changed: 0,
|
|
525
|
+
customized: 0,
|
|
508
526
|
unresolved: from,
|
|
509
527
|
}
|
|
510
528
|
|
|
@@ -886,9 +904,11 @@ function noteDrift(
|
|
|
886
904
|
const fs = actx.fs()
|
|
887
905
|
const item = itemKey(kind, source.name)
|
|
888
906
|
const copied = copies.items[item]
|
|
907
|
+
const merging = MERGE === projectCopyMode(actx)
|
|
889
908
|
|
|
890
909
|
return (category: Category, label: string) => {
|
|
891
910
|
let into: Category | 'outdated' = category
|
|
911
|
+
let custom = false
|
|
892
912
|
|
|
893
913
|
if ('forked' === category || 'edited' === category) {
|
|
894
914
|
const same = untouched(fs, actx.folder, copies, label)
|
|
@@ -899,6 +919,10 @@ function noteDrift(
|
|
|
899
919
|
else if (undefined === same) {
|
|
900
920
|
report.unrecorded.push(label)
|
|
901
921
|
}
|
|
922
|
+
else if (merging) {
|
|
923
|
+
custom = true
|
|
924
|
+
report.customized.push(label)
|
|
925
|
+
}
|
|
902
926
|
}
|
|
903
927
|
|
|
904
928
|
report[into].push(label)
|
|
@@ -909,6 +933,7 @@ function noteDrift(
|
|
|
909
933
|
...(null == source.version ? {} : { to: source.version }),
|
|
910
934
|
outdated: 0,
|
|
911
935
|
changed: 0,
|
|
936
|
+
customized: 0,
|
|
912
937
|
}
|
|
913
938
|
|
|
914
939
|
if ('outdated' === into) {
|
|
@@ -917,6 +942,10 @@ function noteDrift(
|
|
|
917
942
|
else {
|
|
918
943
|
drift.changed++
|
|
919
944
|
}
|
|
945
|
+
|
|
946
|
+
if (custom) {
|
|
947
|
+
drift.customized++
|
|
948
|
+
}
|
|
920
949
|
}
|
|
921
950
|
}
|
|
922
951
|
|
|
@@ -1141,8 +1170,8 @@ function copyWarnings(report: DoctorReport): string[] {
|
|
|
1141
1170
|
add('outdated\n' + command, item, drift.outdated, drift)
|
|
1142
1171
|
}
|
|
1143
1172
|
|
|
1144
|
-
if (0 < drift.changed) {
|
|
1145
|
-
add('changed\n' + command, item, drift.changed, drift)
|
|
1173
|
+
if (0 < drift.changed - drift.customized) {
|
|
1174
|
+
add('changed\n' + command, item, drift.changed - drift.customized, drift)
|
|
1146
1175
|
}
|
|
1147
1176
|
}
|
|
1148
1177
|
|
package/src/action/edition.ts
CHANGED
|
@@ -19,7 +19,7 @@ import type { TreeDef } from './kind'
|
|
|
19
19
|
import { registerInstalled } from './resolve'
|
|
20
20
|
import type { Source } from './resolve'
|
|
21
21
|
|
|
22
|
-
import { recordCopies } from './copies'
|
|
22
|
+
import { recordCopies, guardCopies } from './copies'
|
|
23
23
|
|
|
24
24
|
import { aliasCmpTree, pruneStaleTemplates } from './target'
|
|
25
25
|
|
|
@@ -78,6 +78,14 @@ async function cmd_edition_remove(
|
|
|
78
78
|
|
|
79
79
|
async function edition_add(
|
|
80
80
|
edition: string[], actx: ActionContext,
|
|
81
|
+
): Promise<ActionResult> {
|
|
82
|
+
return guardCopies(actx, 'edition add ' + edition.join(' '),
|
|
83
|
+
(gctx: ActionContext) => addEditions(edition, gctx))
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
async function addEditions(
|
|
88
|
+
edition: string[], actx: ActionContext,
|
|
81
89
|
): Promise<ActionResult> {
|
|
82
90
|
edition = edition.map(ref => !ref.includes('/') && !ref.includes('\\') &&
|
|
83
91
|
!kindCollection(actx.model, 'edition')[ref.split('~')[0]] ? '@voxgig/docgen/project/' + ref : ref)
|
package/src/action/feature.ts
CHANGED
|
@@ -34,7 +34,7 @@ import { copyOpts } from '../helpers/junk'
|
|
|
34
34
|
import { resolveKind, kindModel, kindIndex } from './kind'
|
|
35
35
|
import type { Source } from './resolve'
|
|
36
36
|
|
|
37
|
-
import { recordCopies } from './copies'
|
|
37
|
+
import { recordCopies, guardCopies } from './copies'
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
import {
|
|
@@ -84,6 +84,12 @@ async function cmd_feature_remove(args: string[], actx: ActionContext): Promise<
|
|
|
84
84
|
|
|
85
85
|
|
|
86
86
|
async function feature_add(features: string[], actx: ActionContext): Promise<ActionResult> {
|
|
87
|
+
return guardCopies(actx, 'feature add ' + features.join(' '),
|
|
88
|
+
(gctx: ActionContext) => addFeatures(features, gctx))
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
async function addFeatures(features: string[], actx: ActionContext): Promise<ActionResult> {
|
|
87
93
|
|
|
88
94
|
// Reuse the caller's Jostraca instance so feature generation honours the
|
|
89
95
|
// shared controls (notably `dryrun`). A fresh Jostraca() defaults dryrun
|
package/src/action/package.ts
CHANGED
|
@@ -32,7 +32,9 @@ import { cmd_package_check } from './check'
|
|
|
32
32
|
|
|
33
33
|
import { doctor } from './doctor'
|
|
34
34
|
|
|
35
|
-
import { COPY_LOG } from './copies'
|
|
35
|
+
import { COPY_LOG, guardCopies, projectCopyMode } from './copies'
|
|
36
|
+
|
|
37
|
+
import { MERGE } from '../helpers/copymerge'
|
|
36
38
|
|
|
37
39
|
import { resolveSource, registerInstalled, nameConflict } from './resolve'
|
|
38
40
|
import type { Source } from './resolve'
|
|
@@ -301,6 +303,14 @@ async function cmd_package_add(
|
|
|
301
303
|
|
|
302
304
|
async function package_add(
|
|
303
305
|
refs: string[], actx: ActionContext,
|
|
306
|
+
): Promise<ActionResult> {
|
|
307
|
+
return guardCopies(actx, 'package add ' + refs.join(' '),
|
|
308
|
+
(gctx: ActionContext) => addPackages(refs, gctx))
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
async function addPackages(
|
|
313
|
+
refs: string[], actx: ActionContext,
|
|
304
314
|
): Promise<ActionResult> {
|
|
305
315
|
const log = actx.log
|
|
306
316
|
const flags = actx.flags ?? {}
|
|
@@ -547,6 +557,14 @@ function installedFrom(pkgname: string, actx: ActionContext): Installed[] {
|
|
|
547
557
|
|
|
548
558
|
async function package_update(
|
|
549
559
|
names: string[], actx: ActionContext,
|
|
560
|
+
): Promise<ActionResult> {
|
|
561
|
+
return guardCopies(actx, 'package update ' + names.join(' '),
|
|
562
|
+
(gctx: ActionContext) => updatePackages(names, gctx))
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
async function updatePackages(
|
|
567
|
+
names: string[], actx: ActionContext,
|
|
550
568
|
): Promise<ActionResult> {
|
|
551
569
|
const log = actx.log
|
|
552
570
|
const flags = actx.flags ?? {}
|
|
@@ -661,6 +679,15 @@ async function preCheck(
|
|
|
661
679
|
return
|
|
662
680
|
}
|
|
663
681
|
|
|
682
|
+
if (MERGE === projectCopyMode(actx) && true !== flags.force) {
|
|
683
|
+
actx.log.info({
|
|
684
|
+
point: 'package-update-merge', package: pkgname, files: changed,
|
|
685
|
+
note: pkgname + ': ' + changed.length + ' locally-changed file(s) ' +
|
|
686
|
+
'will take the update by merge: ' + changed.join(', ')
|
|
687
|
+
})
|
|
688
|
+
return
|
|
689
|
+
}
|
|
690
|
+
|
|
664
691
|
if (true === flags.force) {
|
|
665
692
|
actx.log.warn({
|
|
666
693
|
point: 'package-update-forced', package: pkgname, files: changed,
|
package/src/action/target.ts
CHANGED
|
@@ -58,7 +58,7 @@ import { kindModel, kindIndex, resolveKind, escapeRe } from './kind'
|
|
|
58
58
|
import { BUNDLED, resolveSource, registerInstalled } from './resolve'
|
|
59
59
|
import type { Source } from './resolve'
|
|
60
60
|
|
|
61
|
-
import { recordCopies } from './copies'
|
|
61
|
+
import { recordCopies, guardCopies } from './copies'
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
const CMD_MAP: any = {
|
|
@@ -94,6 +94,12 @@ async function cmd_target_remove(args: string[], actx: ActionContext): Promise<A
|
|
|
94
94
|
|
|
95
95
|
// Code API
|
|
96
96
|
async function target_add(targets: string[], actx: ActionContext): Promise<ActionResult> {
|
|
97
|
+
return guardCopies(actx, 'target add ' + targets.join(' '),
|
|
98
|
+
(gctx: ActionContext) => addTargets(targets, gctx))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
async function addTargets(targets: string[], actx: ActionContext): Promise<ActionResult> {
|
|
97
103
|
const jostraca = actx.jostraca
|
|
98
104
|
|
|
99
105
|
const opts = {
|