@igstack/app-catalog-shared-core 0.16.0 → 0.17.1-alpha-20260821043201

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.
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igstack/app-catalog-shared-core",
3
- "version": "0.16.0",
3
+ "version": "0.17.1-alpha-20260821043201",
4
4
  "description": "Shared core utilities for App Catalog",
5
5
  "homepage": "https://github.com/lislon/app-catalog",
6
6
  "repository": {
@@ -42,7 +42,7 @@
42
42
  "engines": {
43
43
  "node": ">=16"
44
44
  },
45
- "gitHead": "8ef46d75c527a6d4a00965f7529e000c03cf0bc6",
45
+ "gitHead": "304d9c364de826d155069ac01370baffb0620c78",
46
46
  "scripts": {
47
47
  "build": "vite build",
48
48
  "clean": "premove ./dist ./coverage ./dist-ts",
@@ -0,0 +1,90 @@
1
+ import { existsSync, readFileSync, readdirSync } from 'node:fs'
2
+ import { dirname, join } from 'node:path'
3
+ import { describe, expect, it } from 'vitest'
4
+
5
+ // The @ai-sdk packages publish many times a day and hard-pin each other to exact
6
+ // versions. A floating range therefore resolves to a release that may be minutes
7
+ // old, and npm's registry metadata is not consistent that fast — a fresh install
8
+ // intermittently fails with ERR_PNPM_NO_MATCHING_VERSION on a transitive @ai-sdk
9
+ // dependency. Downstream consumers install from the registry without a lockfile,
10
+ // so an exact version in a *published* dependency field is what protects them.
11
+
12
+ // Walk up from the vitest cwd rather than resolving import.meta.url, which vitest
13
+ // serves through its /@fs/ prefix.
14
+ const findRepoRoot = () => {
15
+ let dir = process.cwd()
16
+ while (!existsSync(join(dir, 'pnpm-workspace.yaml'))) {
17
+ const parent = dirname(dir)
18
+ if (parent === dir) throw new Error('workspace root not found above cwd')
19
+ dir = parent
20
+ }
21
+ return dir
22
+ }
23
+
24
+ const repoRoot = findRepoRoot()
25
+ const workspaceDirs = ['packages', 'examples']
26
+ const dependencyFields = [
27
+ 'dependencies',
28
+ 'devDependencies',
29
+ 'peerDependencies',
30
+ 'optionalDependencies',
31
+ ] as const
32
+
33
+ const isAiSdkPackage = (name: string) =>
34
+ name === 'ai' || name.startsWith('@ai-sdk/')
35
+
36
+ const isExactVersion = (range: string) => /^\d+\.\d+\.\d+/.test(range)
37
+
38
+ const collectPackageJsonPaths = () => {
39
+ const paths = [join(repoRoot, 'package.json')]
40
+ for (const dir of workspaceDirs) {
41
+ for (const entry of readdirSync(join(repoRoot, dir), {
42
+ withFileTypes: true,
43
+ })) {
44
+ if (entry.isDirectory()) {
45
+ paths.push(join(repoRoot, dir, entry.name, 'package.json'))
46
+ }
47
+ }
48
+ }
49
+ return paths
50
+ }
51
+
52
+ const collectAiSdkRanges = () => {
53
+ const found: { where: string; name: string; range: string }[] = []
54
+ for (const path of collectPackageJsonPaths()) {
55
+ let raw: string
56
+ try {
57
+ raw = readFileSync(path, 'utf8')
58
+ } catch {
59
+ continue
60
+ }
61
+ const pkg = JSON.parse(raw) as Record<string, Record<string, string>>
62
+ for (const field of dependencyFields) {
63
+ for (const [name, range] of Object.entries(pkg[field] ?? {})) {
64
+ if (isAiSdkPackage(name)) {
65
+ found.push({
66
+ where: `${path.slice(repoRoot.length + 1)} (${field})`,
67
+ name,
68
+ range,
69
+ })
70
+ }
71
+ }
72
+ }
73
+ }
74
+ return found
75
+ }
76
+
77
+ describe('@ai-sdk dependency pins', () => {
78
+ it('finds the @ai-sdk dependencies it is meant to guard', () => {
79
+ expect(collectAiSdkRanges().length).toBeGreaterThan(0)
80
+ })
81
+
82
+ it('declares every ai / @ai-sdk dependency as an exact version', () => {
83
+ const floating = collectAiSdkRanges().filter(
84
+ ({ range }) => !isExactVersion(range),
85
+ )
86
+ expect(
87
+ floating.map(({ where, name, range }) => `${where}: ${name}@${range}`),
88
+ ).toEqual([])
89
+ })
90
+ })