@voxgig/sdkgen-infrapack 0.0.10 → 0.0.12
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/.sdk/src/cmp/seneca-provider/Extras_seneca-provider.ts +98 -37
- package/.sdk/src/cmp/seneca-provider/Gitignore_seneca-provider.ts +9 -0
- package/.sdk/src/cmp/seneca-provider/Main_seneca-provider.ts +42 -3
- package/.sdk/tm/seneca-provider/Makefile +117 -1
- package/README.md +23 -0
- package/package.json +6 -6
- package/sdkgen-package.json +2 -2
|
@@ -18,6 +18,58 @@ import {
|
|
|
18
18
|
// generated provider is verified without a server.
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
// WHERE A FETCHED SDK CHECKOUT LIVES, inside this repo.
|
|
22
|
+
//
|
|
23
|
+
// Fixed, and the same under every layout, which is the whole point: it is
|
|
24
|
+
// what lets the generated docs, the live-test instructions and `make regen`
|
|
25
|
+
// name the SDK source without naming anyone's directory layout. Gitignored —
|
|
26
|
+
// the checkout is derived from the pin and disposable, so committing it would
|
|
27
|
+
// vendor the SDK into a repo that already depends on it.
|
|
28
|
+
//
|
|
29
|
+
// NOT a git submodule. A submodule pins a COMMIT and puts the pin in git's
|
|
30
|
+
// own plumbing, where updating it is a second repository operation and a
|
|
31
|
+
// stale one is invisible in a normal diff. The pin here is an ordinary
|
|
32
|
+
// committed file naming a TAG, regenerated from the model like everything
|
|
33
|
+
// else, so it moves with the SDK version it belongs to and shows up in review.
|
|
34
|
+
const SDK_SRC_DIR = '.sdksrc'
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
// The SDK this provider was generated from: repository, release tag, and the
|
|
38
|
+
// published package the tag corresponds to.
|
|
39
|
+
//
|
|
40
|
+
// Committed, and REGENERATED — so it cannot drift from the dependency in
|
|
41
|
+
// package.json, which comes from the same model version. The tag is
|
|
42
|
+
// `v<version>` because that is what the SDK's publish workflow cuts for its
|
|
43
|
+
// primary npm target.
|
|
44
|
+
//
|
|
45
|
+
// This is the file that makes the repo independently buildable: with it, the
|
|
46
|
+
// SDK that generates this provider can be fetched from scratch, at the exact
|
|
47
|
+
// revision that generated it, by a script that knows nothing else.
|
|
48
|
+
const SdkPin = cmp(function SdkPin(props: any) {
|
|
49
|
+
const { provider } = props
|
|
50
|
+
|
|
51
|
+
// Nothing to pin without a repository to fetch from. Emitting a pin with an
|
|
52
|
+
// empty `repo` would be a file that looks like a promise and cannot be
|
|
53
|
+
// kept.
|
|
54
|
+
if (!provider.sdkPinned) {
|
|
55
|
+
return
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
File({ name: 'sdk-pin.json' }, () => {
|
|
59
|
+
Content(JSON.stringify({
|
|
60
|
+
note: 'GENERATED. The SDK this provider is generated from. ' +
|
|
61
|
+
'`make sdk-src` fetches it; `make regen` regenerates this repo ' +
|
|
62
|
+
'from it. Edit the SDK project model, not this file.',
|
|
63
|
+
repo: provider.sdkRepoUrl,
|
|
64
|
+
tag: provider.sdkTag,
|
|
65
|
+
dir: provider.sdkSrc,
|
|
66
|
+
package: provider.sdkPkg,
|
|
67
|
+
version: provider.sdkVersion,
|
|
68
|
+
}, null, 2) + '\n')
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
|
|
21
73
|
// Does this entity's load op have a real identifying param (path or
|
|
22
74
|
// required query), e.g. GET /result?trace_id=? A paramless GET has none.
|
|
23
75
|
function loadHasKey(e: any): boolean {
|
|
@@ -710,7 +762,7 @@ const BasicMessages = require('../dist-test/basic.messages')
|
|
|
710
762
|
${'' === provider.liveBase ? '' : `
|
|
711
763
|
// The live tests run against the companion test server in the SDK repo
|
|
712
764
|
// (\`app/\`), which serves this by default. Start it with:
|
|
713
|
-
// cd ${provider.
|
|
765
|
+
// cd ${provider.sdkSrc}/app && npm start
|
|
714
766
|
const LIVE_BASE = process.env.${provider.ENV}_TEST_BASE || '${provider.liveBase}'
|
|
715
767
|
`}
|
|
716
768
|
|
|
@@ -1427,7 +1479,7 @@ async function makeSeneca() {
|
|
|
1427
1479
|
Content(`/* Manual script: read from a running ${provider.api} server.
|
|
1428
1480
|
*
|
|
1429
1481
|
* Start the companion test server from the SDK repo first:
|
|
1430
|
-
* cd ${provider.
|
|
1482
|
+
* cd ${provider.sdkSrc}/app && npm start
|
|
1431
1483
|
*
|
|
1432
1484
|
* Then: node test/live.js
|
|
1433
1485
|
*/
|
|
@@ -1501,7 +1553,7 @@ async function run() {
|
|
|
1501
1553
|
Content(`/* Manual script: exercise the full CRUD cycle against a running server.
|
|
1502
1554
|
*
|
|
1503
1555
|
* Start the companion test server from the SDK repo first:
|
|
1504
|
-
* cd ${provider.
|
|
1556
|
+
* cd ${provider.sdkSrc}/app && npm start
|
|
1505
1557
|
*
|
|
1506
1558
|
* Then: node test/quick.js
|
|
1507
1559
|
*
|
|
@@ -2220,7 +2272,7 @@ The companion test server is distributed in the SDK's source repository
|
|
|
2220
2272
|
only. From a checkout beside this one:
|
|
2221
2273
|
|
|
2222
2274
|
\`\`\`sh
|
|
2223
|
-
cd ${provider.
|
|
2275
|
+
cd ${provider.sdkSrc}/app && npm start
|
|
2224
2276
|
\`\`\`
|
|
2225
2277
|
|
|
2226
2278
|
Then \`node test/live.js\` reads from it, and \`node test/quick.js\` runs a
|
|
@@ -2476,30 +2528,27 @@ back as a puzzling 404.
|
|
|
2476
2528
|
|
|
2477
2529
|
`
|
|
2478
2530
|
|
|
2479
|
-
//
|
|
2480
|
-
//
|
|
2481
|
-
//
|
|
2482
|
-
//
|
|
2483
|
-
|
|
2484
|
-
const
|
|
2485
|
-
const appDir = '' === sdkRepo ? `${provider.sdkrel}/app` : `${sdkDir}/app`
|
|
2531
|
+
// ONE PATH, BOTH WAYS IN. `provider.sdkSrc` is where the SDK source is
|
|
2532
|
+
// reached: the pinned fetch target when the SDK has a repository, and the
|
|
2533
|
+
// relative walk back when it has none and nothing can be fetched. So the
|
|
2534
|
+
// instruction differs but the path does not, and neither spelling carries a
|
|
2535
|
+
// directory name off anyone's machine.
|
|
2536
|
+
const appDir = `${provider.sdkSrc}/app`
|
|
2486
2537
|
|
|
2487
|
-
const getServer =
|
|
2538
|
+
const getServer = provider.sdkPinned ?
|
|
2488
2539
|
`You also need a server to talk to. The SDK itself installs from npm,
|
|
2489
2540
|
but its test server does not — it ships only in the SDK's source
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
` :
|
|
2493
|
-
`You also need a server to talk to. The SDK itself installs from npm,
|
|
2494
|
-
but its test server does not — it ships only in the SDK's source
|
|
2495
|
-
repository, so clone that:
|
|
2541
|
+
repository. \`make sdk-src\` fetches that source at the tag this plugin
|
|
2542
|
+
was generated from, into \`${provider.sdkSrc}\`:
|
|
2496
2543
|
|
|
2497
2544
|
\`\`\`sh
|
|
2498
|
-
$
|
|
2545
|
+
$ make sdk-src
|
|
2499
2546
|
\`\`\`
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2547
|
+
` :
|
|
2548
|
+
`You also need a server to talk to. The SDK itself installs from npm,
|
|
2549
|
+
but its test server does not — it ships only in the SDK's source
|
|
2550
|
+
project, in its \`app\` folder, which is at \`${provider.sdkSrc}\`
|
|
2551
|
+
relative to this one.
|
|
2503
2552
|
`
|
|
2504
2553
|
|
|
2505
2554
|
// What a bare GET on the probe route answers with, when the model has one.
|
|
@@ -2921,11 +2970,11 @@ calls. Your seeded ids will not exist there, so read the ids you need
|
|
|
2921
2970
|
from a \`list$\` first.
|
|
2922
2971
|
|
|
2923
2972
|
`)
|
|
2924
|
-
if (hasServer &&
|
|
2973
|
+
if (hasServer && provider.sdkPinned) {
|
|
2925
2974
|
Content(`A test server that answers on that address is distributed in the SDK's
|
|
2926
|
-
source repository, which is the only place it ships.
|
|
2927
|
-
|
|
2928
|
-
\`npm start\` in its \`app\` folder.
|
|
2975
|
+
source repository, which is the only place it ships. \`make sdk-src\`
|
|
2976
|
+
fetches that source at the pinned tag; then run \`npm install\`,
|
|
2977
|
+
\`npm run build\` and \`npm start\` in its \`app\` folder.
|
|
2929
2978
|
|
|
2930
2979
|
`)
|
|
2931
2980
|
}
|
|
@@ -3495,20 +3544,27 @@ $ npm install
|
|
|
3495
3544
|
\`\`\`
|
|
3496
3545
|
|
|
3497
3546
|
If you are changing the SDK and this plugin together, point npm at a
|
|
3498
|
-
local checkout instead.
|
|
3499
|
-
|
|
3547
|
+
local checkout instead. \`make sdk-src\` fetches the SDK this repository is
|
|
3548
|
+
generated from — the repository and tag in \`sdk-pin.json\` — into
|
|
3549
|
+
\`${provider.sdkSrc}\`, then build it, because it does not commit its build
|
|
3550
|
+
output:
|
|
3500
3551
|
|
|
3501
3552
|
\`\`\`sh
|
|
3502
|
-
$
|
|
3503
|
-
|
|
3504
|
-
$ cd ${provider.sdkrel}/ts
|
|
3553
|
+
$ make sdk-src
|
|
3554
|
+
$ cd ${provider.sdkSrc}/ts
|
|
3505
3555
|
$ npm install && npm run build
|
|
3506
3556
|
\`\`\`
|
|
3507
3557
|
|
|
3558
|
+
Already have that checkout elsewhere? Point the same target at it:
|
|
3559
|
+
|
|
3560
|
+
\`\`\`sh
|
|
3561
|
+
$ make sdk-src SDK_SRC_FROM=../path/to/your/checkout
|
|
3562
|
+
\`\`\`
|
|
3563
|
+
|
|
3508
3564
|
Then link it in, without committing the change to \`package.json\`:
|
|
3509
3565
|
|
|
3510
3566
|
\`\`\`sh
|
|
3511
|
-
$ npm install --no-save ${provider.
|
|
3567
|
+
$ npm install --no-save ${provider.sdkSrc}/ts
|
|
3512
3568
|
\`\`\`
|
|
3513
3569
|
|
|
3514
3570
|
npm creates a symlink, so a rebuild of the SDK is picked up here with no
|
|
@@ -3562,10 +3618,12 @@ $ TEST_PATTERN=${pattern} npm run test-some
|
|
|
3562
3618
|
|
|
3563
3619
|
if ('' !== liveBase) {
|
|
3564
3620
|
sec('Run the live tests against a server', `The companion test server ships only in the SDK's source repository, not
|
|
3565
|
-
in the published package.
|
|
3621
|
+
in the published package. \`make sdk-src\` fetches that source at the pinned
|
|
3622
|
+
tag; the server is in its \`app\` folder:
|
|
3566
3623
|
|
|
3567
3624
|
\`\`\`sh
|
|
3568
|
-
$
|
|
3625
|
+
$ make sdk-src
|
|
3626
|
+
$ cd ${provider.sdkSrc}/app
|
|
3569
3627
|
$ npm install && npm run build && npm start
|
|
3570
3628
|
\`\`\`
|
|
3571
3629
|
|
|
@@ -4795,9 +4853,10 @@ edit: the edit will not survive. The next generation run overwrites this
|
|
|
4795
4853
|
repository, without a merge and without a warning. A fix applied here is a fix
|
|
4796
4854
|
that has to be applied again, silently, forever.
|
|
4797
4855
|
|
|
4798
|
-
The source of truth is the SDK project's model —
|
|
4799
|
-
|
|
4800
|
-
this target. A change to *what*
|
|
4856
|
+
The source of truth is the SDK project's model — the repository and tag named
|
|
4857
|
+
in \`sdk-pin.json\`, which \`make sdk-src\` fetches to \`${provider.sdkSrc}\` —
|
|
4858
|
+
together with the sdkgen component that emits this target. A change to *what*
|
|
4859
|
+
the API offers belongs in the model; a change to
|
|
4801
4860
|
*how* the provider expresses it belongs in the component. Both are versioned,
|
|
4802
4861
|
both regenerate every provider built this way rather than just this one, and
|
|
4803
4862
|
both are where a fix is worth making. See
|
|
@@ -4952,4 +5011,6 @@ export {
|
|
|
4952
5011
|
Docs,
|
|
4953
5012
|
seedRecord,
|
|
4954
5013
|
parentSeed,
|
|
5014
|
+
SdkPin,
|
|
5015
|
+
SDK_SRC_DIR,
|
|
4955
5016
|
}
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
// The content below is the template's, byte for byte. It carried no
|
|
21
21
|
// placeholder, so nothing about `stdrep` substitution changes by moving it.
|
|
22
22
|
|
|
23
|
+
import { SDK_SRC_DIR } from './Extras_seneca-provider'
|
|
24
|
+
|
|
23
25
|
import {
|
|
24
26
|
Content,
|
|
25
27
|
File,
|
|
@@ -151,6 +153,13 @@ test/local-env.js
|
|
|
151
153
|
# every regeneration leaves the provider repo dirty with hundreds of
|
|
152
154
|
# untracked files.
|
|
153
155
|
.jostraca/
|
|
156
|
+
|
|
157
|
+
# The SDK source, fetched by \`make sdk-src\` at the repository and tag in
|
|
158
|
+
# sdk-pin.json. DERIVED and disposable: the pin is the committed fact, and
|
|
159
|
+
# the checkout can be refetched from it at any time. Committing it would
|
|
160
|
+
# vendor the whole SDK into a repo that already depends on its published
|
|
161
|
+
# package.
|
|
162
|
+
${SDK_SRC_DIR}/
|
|
154
163
|
`)
|
|
155
164
|
})
|
|
156
165
|
})
|
|
@@ -15,7 +15,9 @@ import {
|
|
|
15
15
|
KIT,
|
|
16
16
|
} from '@voxgig/apidef'
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
Tests, Scripts, Workflow, Readme, Docs, SdkPin, SDK_SRC_DIR,
|
|
20
|
+
} from './Extras_seneca-provider'
|
|
19
21
|
import { Gitignore } from './Gitignore_seneca-provider'
|
|
20
22
|
|
|
21
23
|
|
|
@@ -675,6 +677,37 @@ const Main = cmp(function Main(props: any) {
|
|
|
675
677
|
// once by the external pass — see cmp/ExternalTarget.
|
|
676
678
|
const sdkrel = ctx$.sdkrelpath || '..'
|
|
677
679
|
|
|
680
|
+
// WHERE THE SDK SOURCE IS, AND WHY IT IS NOT `sdkrel`.
|
|
681
|
+
//
|
|
682
|
+
// `sdkrel` is a walk back through the FILESYSTEM, and it is committed here
|
|
683
|
+
// — into the docs, the live-test headers and the develop-locally recipe.
|
|
684
|
+
// That makes generated content depend on one machine's directory layout.
|
|
685
|
+
// voxgig-solardemo-sdk committed '../../voxgig-sdk/voxgig-solardemo-sdk',
|
|
686
|
+
// where `voxgig-sdk` is the name of a workspace directory on one laptop and
|
|
687
|
+
// no part of any model; a second developer with both repos under a
|
|
688
|
+
// differently named parent regenerates a diff in tracked files and follows
|
|
689
|
+
// instructions that are wrong on one of the two machines.
|
|
690
|
+
//
|
|
691
|
+
// So the SDK is named by its PIN instead — repository and release tag, both
|
|
692
|
+
// facts about the SDK rather than about anyone's disk — and fetched to a
|
|
693
|
+
// fixed path INSIDE this repo. `make sdk-src` puts it there. The path is
|
|
694
|
+
// then the same string on every machine and under every layout, which is
|
|
695
|
+
// what lets this repo regenerate itself from a checkout it fetched (see
|
|
696
|
+
// SdkPin and the Makefile).
|
|
697
|
+
//
|
|
698
|
+
// The tag is `v<version>`: the SDK's publish workflow cuts exactly that for
|
|
699
|
+
// its primary npm target, so the pin needs no separate bookkeeping and
|
|
700
|
+
// cannot drift from the dependency version.
|
|
701
|
+
const sdkRepoUrl = String(repoInfo(model).repoUrl || '')
|
|
702
|
+
const sdkTag = 'v' + sdkVersion
|
|
703
|
+
const sdkRepoDir = sdkRepoUrl.replace(/[/]+$/, '').split('/').pop() || 'sdk'
|
|
704
|
+
|
|
705
|
+
// With NO repo url there is nothing to pin and nothing to clone, so the
|
|
706
|
+
// only path anyone can be told is still the relative one. Honest, and the
|
|
707
|
+
// case the pin cannot improve.
|
|
708
|
+
const sdkPinned = '' !== sdkRepoUrl
|
|
709
|
+
const sdkSrc = sdkPinned ? SDK_SRC_DIR + '/' + sdkRepoDir : sdkrel
|
|
710
|
+
|
|
678
711
|
// Where a live run points — and whether there is anything honest to point
|
|
679
712
|
// it at.
|
|
680
713
|
//
|
|
@@ -746,10 +779,15 @@ const Main = cmp(function Main(props: any) {
|
|
|
746
779
|
repoUrl: repo.url,
|
|
747
780
|
// The SDK's own repo, for pointing at the companion test server which is
|
|
748
781
|
// only distributed in source.
|
|
749
|
-
sdkRepoUrl
|
|
782
|
+
sdkRepoUrl,
|
|
783
|
+
sdkTag,
|
|
784
|
+
sdkRepoDir,
|
|
785
|
+
sdkPinned,
|
|
786
|
+
// Where the SDK SOURCE is reached, as every generated file spells it.
|
|
787
|
+
// Layout-independent when the SDK has a repo to pin. See above.
|
|
788
|
+
sdkSrc,
|
|
750
789
|
api: apiName(model),
|
|
751
790
|
version: packageVersion(model, target.name),
|
|
752
|
-
sdkrel,
|
|
753
791
|
liveBase,
|
|
754
792
|
liveApp,
|
|
755
793
|
// The sponsor line. @seneca/maintain's `content_readme` check requires
|
|
@@ -793,6 +831,7 @@ const Main = cmp(function Main(props: any) {
|
|
|
793
831
|
replace: { ...ctx$.stdrep },
|
|
794
832
|
})
|
|
795
833
|
|
|
834
|
+
SdkPin({ provider })
|
|
796
835
|
PackageJson({ provider, target })
|
|
797
836
|
ProviderSource({ provider })
|
|
798
837
|
ProviderDoc({ provider })
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# GENERATED by @voxgig/sdkgen. Do not edit.
|
|
2
|
+
|
|
3
|
+
.PHONY: all build test clean reset sdk-src sdk-clean regen
|
|
2
4
|
|
|
3
5
|
all: build test
|
|
4
6
|
|
|
@@ -13,3 +15,117 @@ clean:
|
|
|
13
15
|
|
|
14
16
|
reset:
|
|
15
17
|
npm run reset
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
# ---------------------------------------------------------------------------
|
|
21
|
+
# THIS REPOSITORY IS GENERATED, AND CAN REGENERATE ITSELF.
|
|
22
|
+
#
|
|
23
|
+
# Everything below fetches the SDK named in sdk-pin.json and runs the
|
|
24
|
+
# generator from it. Nothing here needs a sibling checkout or a particular
|
|
25
|
+
# directory layout: the pin names a repository and a TAG, and the checkout
|
|
26
|
+
# lands inside this repo at a fixed path.
|
|
27
|
+
#
|
|
28
|
+
# NOT a git submodule, deliberately. A submodule pins a commit in git's own
|
|
29
|
+
# plumbing, where a stale one is invisible in a normal diff and updating it is
|
|
30
|
+
# a second repository operation. sdk-pin.json is an ordinary committed file,
|
|
31
|
+
# regenerated from the model with everything else, so it moves with the SDK
|
|
32
|
+
# version it belongs to and shows up in review.
|
|
33
|
+
# ---------------------------------------------------------------------------
|
|
34
|
+
|
|
35
|
+
SDK_PIN := sdk-pin.json
|
|
36
|
+
SDK_REPO := $(shell node -p "require('./$(SDK_PIN)').repo" 2>/dev/null)
|
|
37
|
+
SDK_TAG := $(shell node -p "require('./$(SDK_PIN)').tag" 2>/dev/null)
|
|
38
|
+
SDK_DIR := $(shell node -p "require('./$(SDK_PIN)').dir" 2>/dev/null)
|
|
39
|
+
|
|
40
|
+
# Point at a checkout you already have instead of fetching one:
|
|
41
|
+
# make sdk-src SDK_SRC_FROM=../path/to/sdk
|
|
42
|
+
SDK_SRC_FROM ?=
|
|
43
|
+
|
|
44
|
+
# Fetch (or update) the SDK source at the pinned tag.
|
|
45
|
+
#
|
|
46
|
+
# A TAG, not a branch: the point is the exact revision this repository was
|
|
47
|
+
# generated from, so that regenerating reproduces what is committed here
|
|
48
|
+
# rather than whatever main happens to say today.
|
|
49
|
+
sdk-src:
|
|
50
|
+
@set -e; \
|
|
51
|
+
test -n "$(SDK_REPO)" || { echo "sdk-src: no repo in $(SDK_PIN)"; exit 1; }; \
|
|
52
|
+
test -n "$(SDK_TAG)" || { echo "sdk-src: no tag in $(SDK_PIN)"; exit 1; }; \
|
|
53
|
+
if [ -n "$(SDK_SRC_FROM)" ]; then \
|
|
54
|
+
echo "sdk-src: using $(SDK_SRC_FROM) (not fetching)"; \
|
|
55
|
+
rm -rf "$(SDK_DIR)"; mkdir -p "$$(dirname "$(SDK_DIR)")"; \
|
|
56
|
+
ln -s "$$(cd "$(SDK_SRC_FROM)" && pwd)" "$(SDK_DIR)"; \
|
|
57
|
+
exit 0; \
|
|
58
|
+
fi; \
|
|
59
|
+
if [ -d "$(SDK_DIR)/.git" ]; then \
|
|
60
|
+
echo "sdk-src: fetching $(SDK_TAG) in $(SDK_DIR)"; \
|
|
61
|
+
git -C "$(SDK_DIR)" fetch --depth 1 origin "refs/tags/$(SDK_TAG):refs/tags/$(SDK_TAG)" 2>/dev/null || \
|
|
62
|
+
git -C "$(SDK_DIR)" fetch origin "refs/tags/$(SDK_TAG):refs/tags/$(SDK_TAG)"; \
|
|
63
|
+
git -C "$(SDK_DIR)" checkout -q "refs/tags/$(SDK_TAG)"; \
|
|
64
|
+
else \
|
|
65
|
+
echo "sdk-src: cloning $(SDK_REPO) at $(SDK_TAG) into $(SDK_DIR)"; \
|
|
66
|
+
rm -rf "$(SDK_DIR)"; mkdir -p "$$(dirname "$(SDK_DIR)")"; \
|
|
67
|
+
git clone --depth 1 --branch "$(SDK_TAG)" "$(SDK_REPO).git" "$(SDK_DIR)"; \
|
|
68
|
+
fi; \
|
|
69
|
+
echo "sdk-src: $(SDK_DIR) is at $(SDK_TAG)"
|
|
70
|
+
|
|
71
|
+
# Removes the fetched checkout AND the folder that held it. `rm -rf` on the
|
|
72
|
+
# checkout alone left an empty `.sdksrc/` behind — gitignored, so harmless,
|
|
73
|
+
# but it makes `sdk-clean` look like it did not finish. rmdir rather than
|
|
74
|
+
# another rm -rf: if anything else is in there, someone put it there, and
|
|
75
|
+
# removing it is not this target's business.
|
|
76
|
+
sdk-clean:
|
|
77
|
+
rm -rf "$(SDK_DIR)"
|
|
78
|
+
@rmdir "$$(dirname "$(SDK_DIR)")" 2>/dev/null || true
|
|
79
|
+
|
|
80
|
+
# Regenerate this repository from the pinned SDK.
|
|
81
|
+
#
|
|
82
|
+
# The SDK's model says where its provider goes, and that value is a fact about
|
|
83
|
+
# ONE developer's checkout layout — it cannot describe being cloned in here.
|
|
84
|
+
# So the destination is given to the generator AT RUN TIME instead:
|
|
85
|
+
#
|
|
86
|
+
# path ../.. — from the SDK checkout up to this repository root
|
|
87
|
+
# enclosing the output folder CONTAINS the SDK project, which the
|
|
88
|
+
# generator refuses unless asked, because one `..` too many
|
|
89
|
+
# writes a package over an unrelated repo
|
|
90
|
+
#
|
|
91
|
+
# See @voxgig/sdkgen docs/explanation/out-of-tree-targets.md.
|
|
92
|
+
# The generate-time output override arrived in @voxgig/sdkgen 4.16.0, and
|
|
93
|
+
# older versions IGNORE it SILENTLY: generation falls back to the destination
|
|
94
|
+
# in the SDK's own model, which from in here resolves to a folder that does
|
|
95
|
+
# not exist, gets skipped, and reports success having written nothing. That is
|
|
96
|
+
# not hypothetical — it is what this target did on its first end-to-end run,
|
|
97
|
+
# against a pin whose floor was set one release too low.
|
|
98
|
+
#
|
|
99
|
+
# So the floor is the version that actually ships the feature, not the version
|
|
100
|
+
# that happened to be current when it was written.
|
|
101
|
+
SDKGEN_MIN := 4.16.0
|
|
102
|
+
|
|
103
|
+
regen: sdk-src
|
|
104
|
+
@set -e; \
|
|
105
|
+
if [ -L "$(SDK_DIR)" ]; then \
|
|
106
|
+
echo "regen: $(SDK_DIR) is a symlink, and regenerating through one writes"; \
|
|
107
|
+
echo " the package somewhere else. Node resolves a module's own"; \
|
|
108
|
+
echo " directory through symlinks, so the generator computes its"; \
|
|
109
|
+
echo " destination from where the checkout REALLY is — not from"; \
|
|
110
|
+
echo " here — and \`enclosing\` then permits the result."; \
|
|
111
|
+
echo " SDK_SRC_FROM is for building and linking against a local"; \
|
|
112
|
+
echo " SDK (make sdk-src). To regenerate, use a fetched checkout:"; \
|
|
113
|
+
echo " make sdk-clean && make regen"; \
|
|
114
|
+
exit 1; \
|
|
115
|
+
fi; \
|
|
116
|
+
echo "regen: building the generator in $(SDK_DIR)/.sdk"; \
|
|
117
|
+
npm --prefix "$(SDK_DIR)/.sdk" install; \
|
|
118
|
+
have=$$(node -e "console.log(JSON.parse(require('fs').readFileSync('$(SDK_DIR)/.sdk/node_modules/@voxgig/sdkgen/package.json','utf8')).version)"); \
|
|
119
|
+
node -e 'const a=process.argv[1].split(".").map(Number),b=process.argv[2].split(".").map(Number); \
|
|
120
|
+
for(let i=0;i<3;i++){if(a[i]>b[i])process.exit(0);if(a[i]<b[i])process.exit(1)} process.exit(0)' \
|
|
121
|
+
"$$have" "$(SDKGEN_MIN)" || { \
|
|
122
|
+
echo "regen: $(SDK_TAG) uses @voxgig/sdkgen $$have, and regenerating from"; \
|
|
123
|
+
echo " inside this repo needs >= $(SDKGEN_MIN) (the generate-time output"; \
|
|
124
|
+
echo " override). Older versions IGNORE it and silently write nothing."; \
|
|
125
|
+
echo " Pin a newer SDK tag, or regenerate from a checkout of the SDK."; \
|
|
126
|
+
exit 1; }; \
|
|
127
|
+
echo "regen: generating"; \
|
|
128
|
+
cd "$(SDK_DIR)/.sdk" && \
|
|
129
|
+
SDKGEN_EXTERNAL='{"seneca-provider":{"path":"../..","enclosing":true}}' \
|
|
130
|
+
npm run generate
|
|
131
|
+
@echo "regen: done — review the diff in this repository"
|
package/README.md
CHANGED
|
@@ -114,6 +114,29 @@ Validate the package itself with:
|
|
|
114
114
|
npx voxgig-sdkgen package check .
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
+
## Releasing — OIDC dispatch, never a local publish
|
|
118
|
+
|
|
119
|
+
**NOTHING IS PUBLISHED FROM A WORKSTATION.** The release is performed by
|
|
120
|
+
GitHub Actions over OIDC trusted publishing, and the way you start it is a
|
|
121
|
+
workflow dispatch:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
gh workflow run publish.yml --ref main -f expect_sha=$(git rev-parse HEAD)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Bump the version in **both** `package.json` and `sdkgen-package.json` first,
|
|
128
|
+
on `main`, in a reviewable commit — nothing in the workflow commits. The
|
|
129
|
+
workflow verifies, publishes to npm, then tags `v<version>`.
|
|
130
|
+
|
|
131
|
+
Never `npm publish` from a checkout: it goes out over a stored token with no
|
|
132
|
+
provenance. The one exception is a package's very first version, which npm
|
|
133
|
+
gives no way to automate — see [`release/README.md`](release/README.md), which
|
|
134
|
+
carries the full record, the `npm trust` registration, and what the 404 at the
|
|
135
|
+
end of a green run actually means.
|
|
136
|
+
|
|
137
|
+
Never hand a release back as "run this locally yourself". A release is a
|
|
138
|
+
dispatch: prepare the commit, then dispatch the workflow.
|
|
139
|
+
|
|
117
140
|
## Provenance
|
|
118
141
|
|
|
119
142
|
`seneca-provider` was generated from the same trees that shipped inside
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voxgig/sdkgen-infrapack",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "Infrastructure-provider targets for the Voxgig SDK Generator: Seneca provider.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,18 +58,18 @@
|
|
|
58
58
|
"import from an emitted string; expect that from any target generating a",
|
|
59
59
|
"Node package.",
|
|
60
60
|
"",
|
|
61
|
-
"No @voxgig/struct either
|
|
61
|
+
"No @voxgig/struct either — haskell needs it, this target does not.",
|
|
62
62
|
"",
|
|
63
63
|
"The apidef floor MATCHES SDKGEN'S OWN peer range rather than being",
|
|
64
64
|
"chosen here. A consumer satisfies this package through sdkgen, so a",
|
|
65
65
|
"looser range would only let npm resolve an apidef that sdkgen itself",
|
|
66
|
-
"rejects
|
|
66
|
+
"rejects — a package that installs and then fails to generate.",
|
|
67
67
|
"",
|
|
68
68
|
"THE SDKGEN FLOOR IS THE OLDEST PUBLISHED VERSION THIS SUITE IS RUN",
|
|
69
69
|
"AGAINST, which is 4.9.0. Not the oldest that might work: a floor nobody",
|
|
70
70
|
"tests is the shape of the old >=3.5.0, which accepted versions where a",
|
|
71
71
|
"target's components install and then die at generation on a missing",
|
|
72
|
-
"export
|
|
72
|
+
"export — this target calls `pointSegments`, which sdkgen first exported",
|
|
73
73
|
"in 4.8.0. 4.9.0 is also the first release carrying the test kit this",
|
|
74
74
|
"suite runs on.",
|
|
75
75
|
"",
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
],
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@voxgig/apidef": ">=8.4.0",
|
|
88
|
-
"@voxgig/sdkgen": ">=4.
|
|
88
|
+
"@voxgig/sdkgen": ">=4.16.0"
|
|
89
89
|
},
|
|
90
90
|
"devDependencies": {
|
|
91
91
|
"@voxgig/apidef": ">=8.4.0",
|
|
92
|
-
"@voxgig/sdkgen": ">=4.
|
|
92
|
+
"@voxgig/sdkgen": ">=4.16.0",
|
|
93
93
|
"aontu": ">=0.52",
|
|
94
94
|
"memfs": "4.68.1",
|
|
95
95
|
"typescript": "7.0.2",
|