@voxgig/sdkgen 3.2.0 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -623,15 +623,18 @@ describe('${provider.fileBase}', () => {
|
|
|
623
623
|
// Repository hygiene, from the @seneca/maintain dependency this package
|
|
624
624
|
// declares. Two of its checks report a fault that is not there, because
|
|
625
625
|
// of WHERE they run rather than what they find, so each is excluded
|
|
626
|
-
// only in the
|
|
626
|
+
// only in the environments that break it.
|
|
627
627
|
Content(`
|
|
628
628
|
it('maintain', async () => {
|
|
629
629
|
const exclude = []
|
|
630
630
|
|
|
631
631
|
// check_default proves the default branch is main by looking for
|
|
632
|
-
// [branch "main"] in .git/config.
|
|
633
|
-
// merge ref,
|
|
634
|
-
|
|
632
|
+
// [branch "main"] in .git/config. Only a branch checkout records that
|
|
633
|
+
// section: a pull_request build checks out the merge ref, and the
|
|
634
|
+
// publish build checks out a tag as a detached HEAD. Neither says
|
|
635
|
+
// anything about what the default branch is, so skip rather than fail.
|
|
636
|
+
if ('pull_request' === process.env.GITHUB_EVENT_NAME ||
|
|
637
|
+
'tag' === process.env.GITHUB_REF_TYPE) {
|
|
635
638
|
exclude.push('check_default')
|
|
636
639
|
}
|
|
637
640
|
|
|
@@ -1023,9 +1026,118 @@ ${!provider.liveApp ? '' : `
|
|
|
1023
1026
|
echo "server did not start; live tests will skip"
|
|
1024
1027
|
`}
|
|
1025
1028
|
- run: npm install
|
|
1026
|
-
|
|
1029
|
+
|
|
1030
|
+
# The Seneca host framework is a PEER dependency, so the test suite needs
|
|
1031
|
+
# it installed explicitly. --no-save keeps npm from rewriting the peer
|
|
1032
|
+
# ranges in package.json to carets on what it happened to resolve, which
|
|
1033
|
+
# would have the build testing a manifest the repo never authored.
|
|
1034
|
+
- run: npm i --no-save seneca seneca-entity seneca-promisify @seneca/provider @seneca/env
|
|
1035
|
+
|
|
1027
1036
|
- run: npm run build --if-present
|
|
1028
1037
|
- run: npm test
|
|
1038
|
+
`)
|
|
1039
|
+
})
|
|
1040
|
+
|
|
1041
|
+
// --- publish.yml ---------------------------------------------------
|
|
1042
|
+
//
|
|
1043
|
+
// Release on a `v*` tag push, via GitHub OIDC Trusted Publishing — no
|
|
1044
|
+
// NPM_TOKEN secret anywhere. `id-token: write` lets npm exchange a
|
|
1045
|
+
// GitHub OIDC token for a short-lived publish credential, and npm
|
|
1046
|
+
// attaches provenance automatically.
|
|
1047
|
+
//
|
|
1048
|
+
// TWO THINGS ARE LOAD-BEARING AND EASY TO GET WRONG.
|
|
1049
|
+
//
|
|
1050
|
+
// The FILENAME. npm's trusted publisher is registered against this
|
|
1051
|
+
// file's name, so renaming it breaks publishing until the npm-side
|
|
1052
|
+
// configuration is changed to match. It is publish.yml deliberately.
|
|
1053
|
+
//
|
|
1054
|
+
// `npm install`, NOT `npm ci`. A Seneca plugin does not commit its
|
|
1055
|
+
// lockfile (see .gitignore), so there is nothing for ci to install
|
|
1056
|
+
// from — it fails outright. The SDK repo commits one and uses ci; this
|
|
1057
|
+
// package cannot.
|
|
1058
|
+
//
|
|
1059
|
+
// The host framework is installed explicitly for the same reason
|
|
1060
|
+
// build.yml does it: seneca and its plugins are PEER dependencies, and
|
|
1061
|
+
// the test suite requires them directly.
|
|
1062
|
+
File({ name: 'publish.yml' }, () => {
|
|
1063
|
+
Content(`# Generated by @voxgig/sdkgen. Do not edit.
|
|
1064
|
+
#
|
|
1065
|
+
# Publishes ${provider.pkgName} to npm on a \`v*\` tag push, via GitHub OIDC
|
|
1066
|
+
# Trusted Publishing — no NPM_TOKEN secret. The \`id-token: write\` permission
|
|
1067
|
+
# lets npm exchange a GitHub OIDC token for a short-lived publish credential,
|
|
1068
|
+
# and provenance is attached automatically.
|
|
1069
|
+
#
|
|
1070
|
+
# The trusted publisher must be registered on npmjs.com for this package
|
|
1071
|
+
# against THIS filename (publish.yml); renaming this file breaks publishing
|
|
1072
|
+
# until the npm-side config is updated to match.
|
|
1073
|
+
#
|
|
1074
|
+
# npm cannot publish a package's FIRST version this way — the settings page
|
|
1075
|
+
# that configures a trusted publisher only exists once a version is there. So
|
|
1076
|
+
# release ${provider.version} by hand once, configure the publisher, and every
|
|
1077
|
+
# release after that is a tag push.
|
|
1078
|
+
#
|
|
1079
|
+
# Release flow: bump the version in the SDK model
|
|
1080
|
+
# (\`main: kit: target: 'seneca-provider': publish: version\`), regenerate,
|
|
1081
|
+
# merge, then push a v* tag.
|
|
1082
|
+
|
|
1083
|
+
name: publish
|
|
1084
|
+
|
|
1085
|
+
on:
|
|
1086
|
+
push:
|
|
1087
|
+
tags: ['v*']
|
|
1088
|
+
workflow_dispatch:
|
|
1089
|
+
|
|
1090
|
+
jobs:
|
|
1091
|
+
publish:
|
|
1092
|
+
name: npm publish
|
|
1093
|
+
runs-on: ubuntu-latest
|
|
1094
|
+
timeout-minutes: 15
|
|
1095
|
+
permissions:
|
|
1096
|
+
id-token: write
|
|
1097
|
+
contents: read
|
|
1098
|
+
|
|
1099
|
+
steps:
|
|
1100
|
+
- uses: actions/checkout@v4
|
|
1101
|
+
|
|
1102
|
+
- uses: actions/setup-node@v4
|
|
1103
|
+
with:
|
|
1104
|
+
node-version: 24.x
|
|
1105
|
+
registry-url: 'https://registry.npmjs.org'
|
|
1106
|
+
|
|
1107
|
+
# Trusted publishing requires npm >= 11.5.1.
|
|
1108
|
+
- name: Use a trusted-publishing capable npm
|
|
1109
|
+
run: npm install -g npm@latest
|
|
1110
|
+
|
|
1111
|
+
# install, not ci: this package does not commit a lockfile.
|
|
1112
|
+
- run: npm install
|
|
1113
|
+
|
|
1114
|
+
# The Seneca host framework is a PEER dependency, so the test suite
|
|
1115
|
+
# needs it installed explicitly.
|
|
1116
|
+
#
|
|
1117
|
+
# --no-save IS LOAD-BEARING. Without it npm rewrites the peer ranges in
|
|
1118
|
+
# package.json to carets on whatever it resolved, and \`npm publish\`
|
|
1119
|
+
# below then ships that rewritten manifest — so an authored \`>=26\`
|
|
1120
|
+
# reaches consumers as \`^28.1.0\` and the package refuses to install for
|
|
1121
|
+
# anyone on a newer major. The repo looks fine; only the artifact is
|
|
1122
|
+
# narrowed. Install into node_modules, leave the manifest alone.
|
|
1123
|
+
- run: npm i --no-save seneca seneca-entity seneca-promisify @seneca/provider @seneca/env
|
|
1124
|
+
|
|
1125
|
+
- run: npm run build
|
|
1126
|
+
- run: npm test
|
|
1127
|
+
|
|
1128
|
+
# The tag must match what the manifest declares, or a tag push silently
|
|
1129
|
+
# republishes whatever version happens to be in package.json.
|
|
1130
|
+
- name: Check the tag matches the manifest version
|
|
1131
|
+
run: |
|
|
1132
|
+
TAG="\${GITHUB_REF_NAME#v}"
|
|
1133
|
+
PKG=$(node -p "require('./package.json').version")
|
|
1134
|
+
if [ "$TAG" != "$PKG" ]; then
|
|
1135
|
+
echo "tag v$TAG does not match package.json $PKG"
|
|
1136
|
+
exit 1
|
|
1137
|
+
fi
|
|
1138
|
+
|
|
1139
|
+
- name: Publish to npm
|
|
1140
|
+
run: npm publish --access public
|
|
1029
1141
|
`)
|
|
1030
1142
|
})
|
|
1031
1143
|
})
|