@voxgig/sdkgen-infrapack 0.0.16 → 0.0.18

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.
@@ -2,6 +2,7 @@ import {
2
2
  cmp, each,
3
3
  File, Content, Folder,
4
4
  jsKey, jsProp,
5
+ npmTrustScript,
5
6
  pointSegments,
6
7
  } from '@voxgig/sdkgen'
7
8
 
@@ -1399,9 +1400,38 @@ async function run() {
1399
1400
 
1400
1401
 
1401
1402
 
1403
+ const PUBLISH_WORKFLOW = 'publish.yml'
1404
+
1405
+
1402
1406
  const Workflow = cmp(function Workflow(props: any) {
1403
1407
  const { provider } = props
1404
1408
 
1409
+ // The script runs from the provider's own .sdk, which only a standalone
1410
+ // builder has, and npm trusts GitHub Actions only on github.com.
1411
+ const repository = 'github.com' === String(provider.repoHost).toLowerCase() ?
1412
+ provider.repoPath : null
1413
+ const trusted = provider.standalone && null != repository
1414
+ const trustNote = !trusted ? '' :
1415
+ '#\n' +
1416
+ '# .sdk/admin/setup-npm-trust.sh registers exactly this, and with --check\n' +
1417
+ '# reports any drift from it:\n' +
1418
+ '#\n' +
1419
+ `# npm trust github ${provider.pkgName} \\\n` +
1420
+ `# --repository ${provider.repoPath} \\\n` +
1421
+ `# --file ${PUBLISH_WORKFLOW} \\\n` +
1422
+ '# --allow-publish\n'
1423
+
1424
+ if (provider.standalone) {
1425
+ Folder({ name: '.sdk' }, () => {
1426
+ Folder({ name: 'admin' }, () => {
1427
+ File({ name: 'setup-npm-trust.sh', mode: 0o755 }, () => {
1428
+ Content(npmTrustScript(repository,
1429
+ [{ pkg: provider.pkgName, file: PUBLISH_WORKFLOW }]))
1430
+ })
1431
+ })
1432
+ })
1433
+ }
1434
+
1405
1435
  Folder({ name: '.github' }, () => {
1406
1436
  Folder({ name: 'workflows' }, () => {
1407
1437
  File({ name: 'build.yml' }, () => {
@@ -1504,7 +1534,7 @@ ${!provider.liveApp ? '' : `
1504
1534
  `)
1505
1535
  })
1506
1536
 
1507
- File({ name: 'publish.yml' }, () => {
1537
+ File({ name: PUBLISH_WORKFLOW }, () => {
1508
1538
  Content(`# Generated by @voxgig/sdkgen. Do not edit.
1509
1539
  #
1510
1540
  # Publishes ${provider.pkgName} to npm on a \`v*\` tag push, via GitHub OIDC
@@ -1529,9 +1559,9 @@ ${!provider.liveApp ? '' : `
1529
1559
  # is what makes the isolation real rather than nominal.
1530
1560
  #
1531
1561
  # The trusted publisher must be registered on npmjs.com for this package
1532
- # against THIS filename (publish.yml); renaming this file breaks publishing
1562
+ # against THIS filename (${PUBLISH_WORKFLOW}); renaming this file breaks publishing
1533
1563
  # until the npm-side config is updated to match.
1534
- #
1564
+ ${trustNote}#
1535
1565
  # npm cannot configure a trusted publisher for a package that does not exist
1536
1566
  # yet — the settings page appears once a version is on the registry. So the
1537
1567
  # FIRST version of a new package is published by hand, once, with an
@@ -319,13 +319,13 @@ function parentEntityOf(key: string, names: string[]): string {
319
319
 
320
320
 
321
321
  function providerRepo(model: any, lower: string, tname: string):
322
- { url: string, path: string } {
322
+ { url: string, path: string, host: string } {
323
323
  const host = model?.main?.[KIT]?.repo?.host || 'github.com'
324
324
  const declared = model?.main?.[KIT]?.target?.[tname]?.output?.repo
325
325
  const path = null != declared && '' !== declared ?
326
326
  String(declared) : `senecajs/seneca-${lower}-provider`
327
327
 
328
- return { url: `https://${host}/${path}`, path }
328
+ return { url: `https://${host}/${path}`, path, host }
329
329
  }
330
330
 
331
331
 
@@ -544,6 +544,8 @@ const Main = cmp(function Main(props: any) {
544
544
  sdkInstallFlag: sdkDep.startsWith('github:') ? ' --allow-git=all' :
545
545
  (sdkDep.startsWith('http') ? ' --allow-remote=all' : ''),
546
546
  repoUrl: repo.url,
547
+ repoPath: repo.path,
548
+ repoHost: repo.host,
547
549
  sdkRepoUrl,
548
550
  sdkTag,
549
551
  sdkRepoDir,
@@ -721,7 +723,7 @@ const PackageJson = cmp(function PackageJson(props: any) {
721
723
  'npm run build && npm run test && npm run repo-tag && ' +
722
724
  'npm publish --access public --registry https://registry.npmjs.org',
723
725
  },
724
- files: ['dist', 'doc', 'src/**/*.ts', 'LICENSE'],
726
+ files: ['dist', 'doc', 'src/**/*.ts', 'LICENSE', 'README.md'],
725
727
  engines: { node: '>=24' },
726
728
  dependencies: {
727
729
  // The SDK this plugin wraps. Published-and-pinned by default; a git
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@voxgig/sdkgen-infrapack",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "Infrastructure-provider targets for the Voxgig SDK Generator: Seneca provider.",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
@@ -19,7 +19,8 @@
19
19
  },
20
20
  "files": [
21
21
  ".sdk",
22
- "sdkgen-package.json"
22
+ "sdkgen-package.json",
23
+ "README.md"
23
24
  ],
24
25
  "scripts": {
25
26
  "test": "node tools/comment-gate.cjs && node tools/dep-gate.cjs && node --test tools/dep-gate.test.cjs && node --enable-source-maps --test test/*.test.js",
@@ -105,11 +106,11 @@
105
106
  ],
106
107
  "peerDependencies": {
107
108
  "@voxgig/apidef": ">=8.17.0",
108
- "@voxgig/sdkgen": ">=4.25.0"
109
+ "@voxgig/sdkgen": ">=4.30.0"
109
110
  },
110
111
  "devDependencies": {
111
112
  "@voxgig/apidef": ">=8.17.0",
112
- "@voxgig/sdkgen": ">=4.25.0",
113
+ "@voxgig/sdkgen": ">=4.30.0",
113
114
  "aontu": ">=0.75.0",
114
115
  "memfs": "4.68.1",
115
116
  "typescript": "7.0.2",
@@ -3,9 +3,9 @@
3
3
  "package": 1
4
4
  },
5
5
  "name": "@voxgig/sdkgen-infrapack",
6
- "version": "0.0.16",
6
+ "version": "0.0.18",
7
7
  "engines": {
8
- "sdkgen": ">=4.25.0"
8
+ "sdkgen": ">=4.30.0"
9
9
  },
10
10
  "provides": {
11
11
  "target": [