@voxgig/sdkgen 3.2.0 → 3.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxgig/sdkgen",
3
- "version": "3.2.0",
3
+ "version": "3.3.0",
4
4
  "main": "dist/sdkgen.js",
5
5
  "type": "commonjs",
6
6
  "engines": {
@@ -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 environment that breaks it.
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. A pull_request build checks out the
633
- // merge ref, which records no such section.
634
- if ('pull_request' === process.env.GITHUB_EVENT_NAME) {
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
 
@@ -1026,6 +1029,102 @@ ${!provider.liveApp ? '' : `
1026
1029
  - run: npm i seneca seneca-entity seneca-promisify @seneca/provider @seneca/env
1027
1030
  - run: npm run build --if-present
1028
1031
  - run: npm test
1032
+ `)
1033
+ })
1034
+
1035
+ // --- publish.yml ---------------------------------------------------
1036
+ //
1037
+ // Release on a `v*` tag push, via GitHub OIDC Trusted Publishing — no
1038
+ // NPM_TOKEN secret anywhere. `id-token: write` lets npm exchange a
1039
+ // GitHub OIDC token for a short-lived publish credential, and npm
1040
+ // attaches provenance automatically.
1041
+ //
1042
+ // TWO THINGS ARE LOAD-BEARING AND EASY TO GET WRONG.
1043
+ //
1044
+ // The FILENAME. npm's trusted publisher is registered against this
1045
+ // file's name, so renaming it breaks publishing until the npm-side
1046
+ // configuration is changed to match. It is publish.yml deliberately.
1047
+ //
1048
+ // `npm install`, NOT `npm ci`. A Seneca plugin does not commit its
1049
+ // lockfile (see .gitignore), so there is nothing for ci to install
1050
+ // from — it fails outright. The SDK repo commits one and uses ci; this
1051
+ // package cannot.
1052
+ //
1053
+ // The host framework is installed explicitly for the same reason
1054
+ // build.yml does it: seneca and its plugins are PEER dependencies, and
1055
+ // the test suite requires them directly.
1056
+ File({ name: 'publish.yml' }, () => {
1057
+ Content(`# Generated by @voxgig/sdkgen. Do not edit.
1058
+ #
1059
+ # Publishes ${provider.pkgName} to npm on a \`v*\` tag push, via GitHub OIDC
1060
+ # Trusted Publishing — no NPM_TOKEN secret. The \`id-token: write\` permission
1061
+ # lets npm exchange a GitHub OIDC token for a short-lived publish credential,
1062
+ # and provenance is attached automatically.
1063
+ #
1064
+ # The trusted publisher must be registered on npmjs.com for this package
1065
+ # against THIS filename (publish.yml); renaming this file breaks publishing
1066
+ # until the npm-side config is updated to match.
1067
+ #
1068
+ # npm cannot publish a package's FIRST version this way — the settings page
1069
+ # that configures a trusted publisher only exists once a version is there. So
1070
+ # release ${provider.version} by hand once, configure the publisher, and every
1071
+ # release after that is a tag push.
1072
+ #
1073
+ # Release flow: bump the version in the SDK model
1074
+ # (\`main: kit: target: 'seneca-provider': publish: version\`), regenerate,
1075
+ # merge, then push a v* tag.
1076
+
1077
+ name: publish
1078
+
1079
+ on:
1080
+ push:
1081
+ tags: ['v*']
1082
+ workflow_dispatch:
1083
+
1084
+ jobs:
1085
+ publish:
1086
+ name: npm publish
1087
+ runs-on: ubuntu-latest
1088
+ timeout-minutes: 15
1089
+ permissions:
1090
+ id-token: write
1091
+ contents: read
1092
+
1093
+ steps:
1094
+ - uses: actions/checkout@v4
1095
+
1096
+ - uses: actions/setup-node@v4
1097
+ with:
1098
+ node-version: 24.x
1099
+ registry-url: 'https://registry.npmjs.org'
1100
+
1101
+ # Trusted publishing requires npm >= 11.5.1.
1102
+ - name: Use a trusted-publishing capable npm
1103
+ run: npm install -g npm@latest
1104
+
1105
+ # install, not ci: this package does not commit a lockfile.
1106
+ - run: npm install
1107
+
1108
+ # The Seneca host framework is a PEER dependency, so the test suite
1109
+ # needs it installed explicitly.
1110
+ - run: npm i seneca seneca-entity seneca-promisify @seneca/provider @seneca/env
1111
+
1112
+ - run: npm run build
1113
+ - run: npm test
1114
+
1115
+ # The tag must match what the manifest declares, or a tag push silently
1116
+ # republishes whatever version happens to be in package.json.
1117
+ - name: Check the tag matches the manifest version
1118
+ run: |
1119
+ TAG="\${GITHUB_REF_NAME#v}"
1120
+ PKG=$(node -p "require('./package.json').version")
1121
+ if [ "$TAG" != "$PKG" ]; then
1122
+ echo "tag v$TAG does not match package.json $PKG"
1123
+ exit 1
1124
+ fi
1125
+
1126
+ - name: Publish to npm
1127
+ run: npm publish --access public
1029
1128
  `)
1030
1129
  })
1031
1130
  })