@voxgig/sdkgen-infrapack 0.0.5 → 0.0.7
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.
|
@@ -65,20 +65,32 @@ main: kit: target: 'seneca-provider': {
|
|
|
65
65
|
# `repo` defaults to the SDK's own repository, so normally only the ref is
|
|
66
66
|
# stated.
|
|
67
67
|
#
|
|
68
|
-
#
|
|
69
|
-
#
|
|
70
|
-
# TypeScript SDK into `ts
|
|
71
|
-
#
|
|
72
|
-
#
|
|
68
|
+
# WHICH KIND TO USE DEPENDS ON WHERE THE PACKAGE SITS. npm resolves a git
|
|
69
|
+
# dependency against the repository ROOT, and sdkgen generates the
|
|
70
|
+
# TypeScript SDK into `ts/` — so `git` suits an SDK that IS its repository
|
|
71
|
+
# root, and `release` suits this toolchain's own layout:
|
|
72
|
+
#
|
|
73
|
+
# kind: 'git' github:owner/repo#<ref>
|
|
74
|
+
# kind: 'release' https://github.com/owner/repo/releases/download/
|
|
75
|
+
# <ref>/<asset>.tgz
|
|
76
|
+
#
|
|
77
|
+
# A release asset is `npm pack` output attached to the tag; npm installs an
|
|
78
|
+
# https tarball natively and never looks at the repository layout. `asset`
|
|
79
|
+
# names the file when it is not the usual `<scope>-<name>-<version>.tgz`.
|
|
80
|
+
#
|
|
81
|
+
# There is no subdirectory option, deliberately. npm's spec parser accepts
|
|
82
|
+
# `#<ref>::path:ts` and reports a gitSubdir, so it reads as supported — but
|
|
83
|
+
# the INSTALLER ignores it and fails with ENOENT, on linux, macOS and
|
|
84
|
+
# Windows alike. A knob that produces an uninstallable dependency is worse
|
|
85
|
+
# than no knob.
|
|
73
86
|
#
|
|
74
87
|
# `spec` states the whole dependency value outright and wins over
|
|
75
|
-
# everything
|
|
76
|
-
# URL, say.
|
|
88
|
+
# everything.
|
|
77
89
|
sdk: dep: {
|
|
78
|
-
kind: *'npm' | 'git'
|
|
90
|
+
kind: *'npm' | 'git' | 'release'
|
|
79
91
|
ref: *'' | string
|
|
80
92
|
repo: *'' | string
|
|
81
|
-
|
|
93
|
+
asset: *'' | string
|
|
82
94
|
spec: *'' | string
|
|
83
95
|
}
|
|
84
96
|
|
|
@@ -1657,10 +1657,18 @@ jobs:
|
|
|
1657
1657
|
runs-on: \${{ matrix.os }}
|
|
1658
1658
|
|
|
1659
1659
|
steps:
|
|
1660
|
-
|
|
1660
|
+
# EVERY ACTION IS PINNED TO A SHA, with the version in a comment.
|
|
1661
|
+
#
|
|
1662
|
+
# Not a preference: an organisation can require it (the repository
|
|
1663
|
+
# setting is sha_pinning_required), and a workflow naming a TAG then
|
|
1664
|
+
# fails to START — no jobs, no logs, just a startup_failure on every
|
|
1665
|
+
# push. The senecajs org has that policy on, so this workflow never ran
|
|
1666
|
+
# once in the repository it was generated for, and weeks of red marks
|
|
1667
|
+
# said nothing about the code.
|
|
1668
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
1661
1669
|
|
|
1662
1670
|
- name: Use Node.js \${{ matrix.node-version }}
|
|
1663
|
-
uses: actions/setup-node@v7
|
|
1671
|
+
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
1664
1672
|
with:
|
|
1665
1673
|
node-version: \${{ matrix.node-version }}
|
|
1666
1674
|
|
|
@@ -1763,9 +1771,9 @@ jobs:
|
|
|
1763
1771
|
contents: read
|
|
1764
1772
|
|
|
1765
1773
|
steps:
|
|
1766
|
-
- uses: actions/checkout@
|
|
1774
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
1767
1775
|
|
|
1768
|
-
- uses: actions/setup-node@
|
|
1776
|
+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
|
|
1769
1777
|
with:
|
|
1770
1778
|
node-version: 24.x
|
|
1771
1779
|
registry-url: 'https://registry.npmjs.org'
|
|
@@ -708,14 +708,21 @@ const Main = cmp(function Main(props: any) {
|
|
|
708
708
|
// into every generated provider's CI.
|
|
709
709
|
const liveApp = true === live.app || (loopback(specBase) && '' === (live.base || ''))
|
|
710
710
|
|
|
711
|
+
const sdkDep = sdkDependency(model, target, {
|
|
712
|
+
sdkPkg, sdkVersion, sdkRepoUrl: repoInfo(model).repoUrl,
|
|
713
|
+
})
|
|
714
|
+
|
|
711
715
|
const provider = {
|
|
712
716
|
Name, lower, ENV, sdkClass, pluginName, fileBase,
|
|
713
717
|
sdkPkg, sdkVersion, entities,
|
|
714
|
-
//
|
|
715
|
-
//
|
|
716
|
-
//
|
|
717
|
-
|
|
718
|
-
|
|
718
|
+
// The SDK dependency, resolved ONCE. PackageJson emits it and the CI
|
|
719
|
+
// note describes it, and computing it twice is how the second caller
|
|
720
|
+
// came to pass a half-built provider object into it.
|
|
721
|
+
sdkDep,
|
|
722
|
+
// Whether that dependency comes from outside a registry. The generated
|
|
723
|
+
// CI note says so, because "npm install is all you need" stops being
|
|
724
|
+
// true the moment git or a tarball URL is in the path.
|
|
725
|
+
sdkGit: !sdkDep.startsWith('^'),
|
|
719
726
|
repoUrl: repo.url,
|
|
720
727
|
// The SDK's own repo, for pointing at the companion test server which is
|
|
721
728
|
// only distributed in source.
|
|
@@ -790,13 +797,21 @@ const Main = cmp(function Main(props: any) {
|
|
|
790
797
|
// `kind: 'git'` points at a GIT TAG instead, which needs no registry.
|
|
791
798
|
//
|
|
792
799
|
// NPM RESOLVES A GIT DEPENDENCY AGAINST THE REPOSITORY ROOT, and sdkgen
|
|
793
|
-
// generates the TypeScript SDK into `ts
|
|
794
|
-
//
|
|
795
|
-
//
|
|
796
|
-
//
|
|
797
|
-
//
|
|
798
|
-
//
|
|
799
|
-
//
|
|
800
|
+
// generates the TypeScript SDK into `ts/`. So `kind: 'git'` suits an SDK
|
|
801
|
+
// whose package.json IS the repository root, and NOT the layout this
|
|
802
|
+
// toolchain produces.
|
|
803
|
+
//
|
|
804
|
+
// THE `::path:` SUBDIRECTORY SYNTAX DOES NOT WORK, and it looks like it
|
|
805
|
+
// does. npm-package-arg parses `#<ref>::path:ts` and reports
|
|
806
|
+
// `gitSubdir: /ts`, so a spec built that way reads as correct — but the
|
|
807
|
+
// INSTALLER ignores it: npm clones the repository and opens package.json at
|
|
808
|
+
// the clone root, failing with ENOENT on linux, macOS and Windows alike.
|
|
809
|
+
// That was measured, on all three, after the parser had said otherwise.
|
|
810
|
+
//
|
|
811
|
+
// `kind: 'release'` is the form that works for a package in a subdirectory:
|
|
812
|
+
// a GitHub release asset, which is `npm pack` output attached to the tag.
|
|
813
|
+
// npm installs an https tarball natively and never looks at the repository
|
|
814
|
+
// layout at all.
|
|
800
815
|
//
|
|
801
816
|
// `spec` still wins over all of it, for anything the shorthand cannot say.
|
|
802
817
|
function sdkDependency(model: any, target: any, provider: any): string {
|
|
@@ -807,7 +822,8 @@ function sdkDependency(model: any, target: any, provider: any): string {
|
|
|
807
822
|
return spec
|
|
808
823
|
}
|
|
809
824
|
|
|
810
|
-
|
|
825
|
+
const kind = String(dep.kind || 'npm')
|
|
826
|
+
if ('git' !== kind && 'release' !== kind) {
|
|
811
827
|
return `^${provider.sdkVersion}`
|
|
812
828
|
}
|
|
813
829
|
|
|
@@ -837,11 +853,17 @@ function sdkDependency(model: any, target: any, provider: any): string {
|
|
|
837
853
|
'on, e.g. `sdk.dep.ref: "v' + provider.sdkVersion + '"`.')
|
|
838
854
|
}
|
|
839
855
|
|
|
840
|
-
|
|
841
|
-
|
|
856
|
+
if ('release' === kind) {
|
|
857
|
+
// The asset `npm pack` produces: scope and name flattened, then the
|
|
858
|
+
// version. `asset` overrides it for a project that names its own.
|
|
859
|
+
const asset = String(dep.asset || '').trim() || (
|
|
860
|
+
provider.sdkPkg.replace(/^@/, '').replace(/\//g, '-') +
|
|
861
|
+
'-' + provider.sdkVersion + '.tgz')
|
|
862
|
+
|
|
863
|
+
return `https://github.com/${repo}/releases/download/${ref}/${asset}`
|
|
864
|
+
}
|
|
842
865
|
|
|
843
|
-
return `github:${repo}#${ref}`
|
|
844
|
-
('' === sub || '.' === sub ? '' : `::path:${sub}`)
|
|
866
|
+
return `github:${repo}#${ref}`
|
|
845
867
|
}
|
|
846
868
|
|
|
847
869
|
|
|
@@ -948,7 +970,7 @@ const PackageJson = cmp(function PackageJson(props: any) {
|
|
|
948
970
|
// The SDK this plugin wraps. Published-and-pinned by default; a git
|
|
949
971
|
// tag when the project says so, because an unpublished SDK otherwise
|
|
950
972
|
// leaves this package unable to install at all. See sdkDependency.
|
|
951
|
-
[provider.sdkPkg]:
|
|
973
|
+
[provider.sdkPkg]: provider.sdkDep,
|
|
952
974
|
...dep('prod'),
|
|
953
975
|
},
|
|
954
976
|
peerDependencies: dep('peer'),
|
package/package.json
CHANGED