@open-xchange/app-suite-ui-sdk 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -6,7 +6,7 @@ A project depends on this one package instead of vite, eslint, stylelint, vitest
6
6
 
7
7
  ## Status
8
8
 
9
- Version 0.1 ships the CLI, the configs and `doctor`. Not in place yet: automatic release on merge, the downstream core ui pipeline that gates SDK MRs, and the SDK renovate preset with the `doctor --fix` post-upgrade task.
9
+ The CLI, the configs, `doctor` and the release on every merge are in place. Not in place yet: the SDK renovate preset with the `doctor --fix` post-upgrade task.
10
10
 
11
11
  ## Setup
12
12
 
@@ -33,7 +33,7 @@ pnpm install
33
33
 
34
34
  Arguments after the command replace the defaults and go straight to the tool, for example `ui-sdk lint src spec --fix`. `msgmerge` needs gettext installed.
35
35
 
36
- The tools run from the SDK's own dependencies. pnpm links only the binaries of direct dependencies, so `pnpm exec vite` does not work in a project; use `ui-sdk`.
36
+ The tools come from the SDK's own dependencies. After `ui-sdk doctor --fix`, the `publicHoistPattern` makes pnpm link `vite`, `vitest`, `eslint`, `stylelint` and `tsc` into `node_modules/.bin`, so `pnpm exec vite` works too. Scripts use `ui-sdk`, which falls back to the SDK config when the project has none; plain `vite` does not.
37
37
 
38
38
  ## Configs
39
39
 
@@ -79,7 +79,7 @@ extends:
79
79
  - `packageManager` and `engines.node` match the SDK.
80
80
  - `package.json` lists no tooling that the SDK or `@open-xchange/lint` provides, and none of the tools the SDK replaced (release-it, lint-staged, simple-git-hooks, husky, eslint-config-standard).
81
81
  - Scripts call `ui-sdk` instead of the tools. `--fix` rewrites simple cases like `vite build` or `eslint src` and keeps their arguments. Chained scripts get a warning and need a manual change.
82
- - `pnpm-workspace.yaml` has `publicHoistPattern` (so editors and test files find eslint, stylelint, typescript, vite and vitest), `allowBuilds`, and the SDK security overrides.
82
+ - `pnpm-workspace.yaml` has `publicHoistPattern` (so editors and test files find eslint, stylelint, typescript, vite and vitest), `allowBuilds`, `minimumReleaseAgeExclude` for `@open-xchange/*` (pnpm otherwise refuses a freshly released SDK version, which blocks the renovate bump), and the SDK security overrides.
83
83
  - `lefthook.yml` extends the SDK config.
84
84
  - rlsy is installed globally, and `renovate.json` exists. Both are warnings only.
85
85
 
@@ -108,11 +108,25 @@ Agreed on 2026-11-03.
108
108
  - **Same tools everywhere.** lefthook, the SDK's pnpm and Node version, enforced by `ui-sdk doctor` in CI.
109
109
  - **`@open-xchange/lint` stays its own package.** The SDK pins it and re-exports it.
110
110
  - **Semver, released on merge.** A tool bump that breaks consumers is a major. Consumers automerge minor and patch updates and review majors.
111
- - **Core ui gates releases.** Every SDK MR runs a downstream core ui pipeline with the candidate package.
111
+ - **Test projects gate releases.** Every SDK pipeline installs the packed SDK into the projects in [test-projects](test-projects) and runs `doctor --fix`, `lint`, `stylelint`, `test`, `build` and `audit` there. A core ui pipeline per SDK MR was too heavy for every dependency bump.
112
112
  - **Renovate everywhere** through an SDK preset in [web-foundation/renovate](https://gitlab.com/openxchange/appsuite/web-foundation/renovate). Every project has a one-line `renovate.json`.
113
113
  - **e2e is out of scope** and gets its own SDK.
114
114
  - **Rollout:** core ui first, then the other vite projects, then the customer plugins.
115
115
 
116
+ ## Development
117
+
118
+ ```sh
119
+ pnpm test # unit tests
120
+ pnpm test:projects # packs the SDK and runs it in each test project
121
+ pnpm test:projects vite-vue # only one project
122
+ ```
123
+
124
+ `pnpm test:projects` copies each project from [test-projects](test-projects) into a temporary directory, installs the packed SDK there, and deletes the directory afterwards. It needs network access for the install and the audit. The test projects:
125
+
126
+ - `customer-plugin`: a drifted customer plugin with eslint 8, release-it and no build.
127
+ - `vite-vue`: vite with Vue, scss, po files and a unit test.
128
+ - `vite-tailwind`: vite with Tailwind.
129
+
116
130
  ## License
117
131
 
118
132
  MIT
package/lib/doctor.js CHANGED
@@ -3,7 +3,7 @@ import { existsSync, readFileSync, writeFileSync } from 'node:fs'
3
3
  import { createRequire } from 'node:module'
4
4
  import path from 'node:path'
5
5
  import { isMap, isScalar, parseDocument, Scalar } from 'yaml'
6
- import { sdkPackage, sdkRoot } from './tools.js'
6
+ import { sdkPackage, sdkRoot, toolchain } from './tools.js'
7
7
 
8
8
  const require = createRequire(import.meta.url)
9
9
 
@@ -13,6 +13,8 @@ export const PUBLIC_HOIST_PATTERN = ['*eslint*', '*stylelint*', 'typescript', 'v
13
13
 
14
14
  export const ALLOW_BUILDS = ['@parcel/watcher', 'lefthook']
15
15
 
16
+ export const RELEASE_AGE_EXCLUDE = ['@open-xchange/*']
17
+
16
18
  const REPLACED_PACKAGES = [
17
19
  'release-it',
18
20
  '@j-ulrich/release-it-regex-bumper',
@@ -55,14 +57,14 @@ export function checkPackageJson (pkg, { provided = providedPackages() } = {}) {
55
57
  const findings = []
56
58
  const fixed = structuredClone(pkg)
57
59
 
58
- if (pkg.packageManager !== sdkPackage.packageManager) {
59
- findings.push({ level: 'error', fixable: true, message: `packageManager is ${pkg.packageManager ?? 'unset'}, expected ${sdkPackage.packageManager}` })
60
- fixed.packageManager = sdkPackage.packageManager
60
+ if (pkg.packageManager !== toolchain.packageManager) {
61
+ findings.push({ level: 'error', fixable: true, message: `packageManager is ${pkg.packageManager ?? 'unset'}, expected ${toolchain.packageManager}` })
62
+ fixed.packageManager = toolchain.packageManager
61
63
  }
62
64
 
63
- if (pkg.engines?.node !== sdkPackage.engines.node) {
64
- findings.push({ level: 'error', fixable: true, message: `engines.node is ${pkg.engines?.node ?? 'unset'}, expected ${sdkPackage.engines.node}` })
65
- fixed.engines = { ...pkg.engines, node: sdkPackage.engines.node }
65
+ if (pkg.engines?.node !== toolchain.node) {
66
+ findings.push({ level: 'error', fixable: true, message: `engines.node is ${pkg.engines?.node ?? 'unset'}, expected ${toolchain.node}` })
67
+ fixed.engines = { ...pkg.engines, node: toolchain.node }
66
68
  }
67
69
 
68
70
  for (const field of ['dependencies', 'devDependencies']) {
@@ -164,6 +166,7 @@ export function checkWorkspace (source, { overrides = securityOverrides() } = {}
164
166
  const doc = parseDocument(source || '')
165
167
  if (doc.contents === null) doc.contents = doc.createNode({})
166
168
  ensureList(doc, 'publicHoistPattern', PUBLIC_HOIST_PATTERN, findings)
169
+ ensureList(doc, 'minimumReleaseAgeExclude', RELEASE_AGE_EXCLUDE, findings)
167
170
  ensureAllowBuilds(doc, findings)
168
171
  syncOverrides(doc, overrides, findings)
169
172
  return { findings, fixed: doc.toString({ singleQuote: true }) }
package/lib/tools.js CHANGED
@@ -9,6 +9,14 @@ const require = createRequire(import.meta.url)
9
9
  export const sdkRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
10
10
  export const sdkPackage = JSON.parse(readFileSync(path.join(sdkRoot, 'package.json'), 'utf8'))
11
11
 
12
+ function readToolchain () {
13
+ const file = path.join(sdkRoot, 'toolchain.json')
14
+ if (existsSync(file)) return JSON.parse(readFileSync(file, 'utf8'))
15
+ return { packageManager: sdkPackage.packageManager, node: sdkPackage.engines.node }
16
+ }
17
+
18
+ export const toolchain = readToolchain()
19
+
12
20
  export function resolveBin (pkg, { bin: binName = pkg, via } = {}) {
13
21
  const resolver = via ? createRequire(require.resolve(`${via}/package.json`)) : require
14
22
  const manifestPath = resolver.resolve(`${pkg}/package.json`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/app-suite-ui-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Shared build, lint and test tooling for OX App Suite UI projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -17,7 +17,8 @@
17
17
  "bin",
18
18
  "configs",
19
19
  "lib",
20
- "security-overrides.json"
20
+ "security-overrides.json",
21
+ "toolchain.json"
21
22
  ],
22
23
  "repository": {
23
24
  "type": "git",
@@ -55,8 +56,12 @@
55
56
  "vitest": "5.0.5",
56
57
  "yaml": "2.9.1"
57
58
  },
59
+ "devDependencies": {
60
+ "rlsy": "0.4.1"
61
+ },
58
62
  "scripts": {
59
63
  "lint": "node bin/ui-sdk.js lint",
60
- "test": "vitest --run"
64
+ "test": "vitest --run",
65
+ "test:projects": "node scripts/test-projects.js"
61
66
  }
62
67
  }
package/toolchain.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "packageManager": "pnpm@12.16.1",
3
+ "node": ">=26.0.0"
4
+ }