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

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.
Files changed (3) hide show
  1. package/README.md +23 -11
  2. package/lib/doctor.js +26 -3
  3. package/package.json +4 -3
package/README.md CHANGED
@@ -2,11 +2,7 @@
2
2
 
3
3
  Shared build, lint and test tooling for OX App Suite UI projects: core ui, plugins, customer plugins and services with a UI build.
4
4
 
5
- A project depends on this one package instead of vite, eslint, stylelint, vitest, lefthook and their plugins. A tool bump or a security fix becomes one SDK release. Renovate then rolls it out to every project with one automerged MR. Tracked in [IDEAS-16](https://jira.atlassian.open-xchange.com/browse/IDEAS-16).
6
-
7
- ## Status
8
-
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.
5
+ A project depends on this one package instead of vite, eslint, stylelint, vitest, lefthook and their plugins. A tool bump or a security fix becomes one SDK release. Renovate then rolls it out to every project with one automerged MR.
10
6
 
11
7
  ## Setup
12
8
 
@@ -18,6 +14,17 @@ pnpm install
18
14
 
19
15
  `doctor --fix` removes the tooling the SDK provides from `package.json`, points the scripts at `ui-sdk`, and writes the pnpm settings the SDK needs into `pnpm-workspace.yaml`.
20
16
 
17
+ For renovate, the project's `renovate.json` only extends the SDK preset:
18
+
19
+ ```json
20
+ {
21
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
22
+ "extends": ["local>openxchange/appsuite/web-foundation/renovate:app-suite-ui-sdk"]
23
+ }
24
+ ```
25
+
26
+ The preset automerges updates, and after an SDK bump it runs `ui-sdk doctor --fix` in the same MR. SDK minor releases below 1.0.0 and SDK majors wait for review.
27
+
21
28
  ## Commands
22
29
 
23
30
  | Command | Runs | Default arguments |
@@ -81,19 +88,24 @@ extends:
81
88
  - 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
89
  - `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
90
  - `lefthook.yml` extends the SDK config.
84
- - rlsy is installed globally, and `renovate.json` exists. Both are warnings only.
91
+ - `renovate.json` extends the `app-suite-ui-sdk` preset. `--fix` creates the file when it is missing. An existing file without the preset only gets a warning, because projects keep their own rules there.
92
+ - rlsy is installed globally. That is a warning only.
85
93
 
86
- CI runs `ui-sdk doctor`; it exits non-zero while errors remain.
94
+ `ui-sdk doctor` exits non-zero while errors remain, so a CI job that runs it fails on drift. Add that job to the project's pipeline.
87
95
 
88
96
  ## Security overrides
89
97
 
90
98
  pnpm reads `overrides` only from the project root, so the SDK cannot pin a patched transitive version for its consumers by itself. Instead, [security-overrides.json](security-overrides.json) lists the overrides, and `doctor --fix` writes them into the project's `pnpm-workspace.yaml` with a `# managed by ui-sdk` comment. Managed overrides that the SDK no longer lists are removed again. An override the project set itself always wins, and doctor only warns about it.
91
99
 
92
- To fix a CVE everywhere, add the override here and release. The renovate SDK bump in each project runs `ui-sdk doctor --fix` as a post-upgrade task and automerges. For an urgent fix in one project, run `pnpm exec ui-sdk audit --fix`.
100
+ A daily scheduled pipeline (with `SECURITY_OVERRIDES=true`) finds the overrides itself: it installs the packed SDK into a temporary project, runs `pnpm audit --fix` there and adds every new override to the list. If it finds one, it opens an MR with a `Security:` commit that merges once its pipeline passes, test projects included.
101
+
102
+ To add an override by hand, add it here and commit it with the `Security:` prefix. A push to `main` with such a commit releases right away instead of waiting for the weekly release. The renovate SDK bump in each project then runs `ui-sdk doctor --fix` as a post-upgrade task and automerges. For an urgent fix in one project, run `pnpm exec ui-sdk audit --fix`.
93
103
 
94
104
  ## Releasing
95
105
 
96
- Releasing stays out of the SDK. Projects release with a globally installed [rlsy](https://gitlab.com/openxchange/appsuite/web-foundation/rlsy) (`pnpm add -g rlsy`) and get no `release` script. The SDK itself publishes to npm from a tag pipeline: a tag like `0.2.0` that matches `package.json` publishes that version.
106
+ Releasing stays out of the SDK. Projects release with a globally installed [rlsy](https://gitlab.com/openxchange/appsuite/web-foundation/rlsy) (`pnpm add -g rlsy`) and get no `release` script.
107
+
108
+ The SDK itself releases once a week. A scheduled pipeline on `main` runs `rlsy --yes`, which picks the version from the commits since the last release and counts renovate's "Update dependency" commits as changes. A security change does not wait: when a push to `main` brings a commit with `[SECURITY]` (renovate's security updates) or a `Security:` commit, the release job releases right away. Running a pipeline on `main` by hand also releases. The tag the release job pushes starts the publish job.
97
109
 
98
110
  ## Decisions
99
111
 
@@ -107,9 +119,9 @@ Agreed on 2026-11-03.
107
119
  - **`doctor --fix` writes visible settings** into `package.json` and `pnpm-workspace.yaml` instead of injecting them at install time.
108
120
  - **Same tools everywhere.** lefthook, the SDK's pnpm and Node version, enforced by `ui-sdk doctor` in CI.
109
121
  - **`@open-xchange/lint` stays its own package.** The SDK pins it and re-exports it.
110
- - **Semver, released on merge.** A tool bump that breaks consumers is a major. Consumers automerge minor and patch updates and review majors.
122
+ - **Semver, released weekly.** Security changes release right away. A tool bump that breaks consumers is a major. Consumers automerge minor and patch updates and review majors.
111
123
  - **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
- - **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`.
124
+ - **Renovate everywhere** through the `app-suite-ui-sdk` preset in [web-foundation/renovate](https://gitlab.com/openxchange/appsuite/web-foundation/renovate). Every project has the short `renovate.json` from Setup.
113
125
  - **e2e is out of scope** and gets its own SDK.
114
126
  - **Rollout:** core ui first, then the other vite projects, then the customer plugins.
115
127
 
package/lib/doctor.js CHANGED
@@ -186,6 +186,28 @@ export function checkLefthook (source) {
186
186
  return { findings: [{ level: 'warn', fixable: false, message: `lefthook.yml does not extend ${extendsPath}` }], fixed: source }
187
187
  }
188
188
 
189
+ export const RENOVATE_PRESET = 'local>openxchange/appsuite/web-foundation/renovate:app-suite-ui-sdk'
190
+
191
+ export function checkRenovate (source) {
192
+ if (source === undefined) {
193
+ return {
194
+ findings: [{ level: 'error', fixable: true, message: 'renovate.json is missing' }],
195
+ fixed: JSON.stringify({
196
+ $schema: 'https://docs.renovatebot.com/renovate-schema.json',
197
+ extends: [RENOVATE_PRESET]
198
+ }, null, 2) + '\n'
199
+ }
200
+ }
201
+ let config
202
+ try {
203
+ config = JSON.parse(source)
204
+ } catch {
205
+ return { findings: [{ level: 'error', fixable: false, message: 'renovate.json is not valid JSON' }], fixed: source }
206
+ }
207
+ if ((config.extends || []).includes(RENOVATE_PRESET)) return { findings: [], fixed: source }
208
+ return { findings: [{ level: 'warn', fixable: false, message: `renovate.json does not extend ${RENOVATE_PRESET}` }], fixed: source }
209
+ }
210
+
189
211
  function readIfExists (file) {
190
212
  return existsSync(file) ? readFileSync(file, 'utf8') : undefined
191
213
  }
@@ -198,7 +220,8 @@ export function doctor (cwd, { fix = false, log = console.log } = {}) {
198
220
  const files = {
199
221
  'package.json': path.join(cwd, 'package.json'),
200
222
  'pnpm-workspace.yaml': path.join(cwd, 'pnpm-workspace.yaml'),
201
- 'lefthook.yml': path.join(cwd, 'lefthook.yml')
223
+ 'lefthook.yml': path.join(cwd, 'lefthook.yml'),
224
+ 'renovate.json': path.join(cwd, 'renovate.json')
202
225
  }
203
226
 
204
227
  const pkgSource = readFileSync(files['package.json'], 'utf8')
@@ -208,12 +231,12 @@ export function doctor (cwd, { fix = false, log = console.log } = {}) {
208
231
  return { findings, fixed: JSON.stringify(fixed, null, 2) + '\n' }
209
232
  })(),
210
233
  'pnpm-workspace.yaml': checkWorkspace(readIfExists(files['pnpm-workspace.yaml'])),
211
- 'lefthook.yml': checkLefthook(readIfExists(files['lefthook.yml']))
234
+ 'lefthook.yml': checkLefthook(readIfExists(files['lefthook.yml'])),
235
+ 'renovate.json': checkRenovate(readIfExists(files['renovate.json']))
212
236
  }
213
237
 
214
238
  const general = []
215
239
  if (!hasCommand('rlsy')) general.push({ level: 'warn', fixable: false, message: 'rlsy is not installed globally (pnpm add -g rlsy); releases need it' })
216
- if (!existsSync(path.join(cwd, 'renovate.json'))) general.push({ level: 'warn', fixable: false, message: 'renovate.json is missing' })
217
240
 
218
241
  let remainingErrors = 0
219
242
  for (const [name, { findings, fixed }] of Object.entries(results)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-xchange/app-suite-ui-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Shared build, lint and test tooling for OX App Suite UI projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -57,11 +57,12 @@
57
57
  "yaml": "2.9.1"
58
58
  },
59
59
  "devDependencies": {
60
- "rlsy": "0.4.1"
60
+ "rlsy": "0.4.2"
61
61
  },
62
62
  "scripts": {
63
63
  "lint": "node bin/ui-sdk.js lint",
64
64
  "test": "vitest --run",
65
- "test:projects": "node scripts/test-projects.js"
65
+ "test:projects": "node scripts/test-projects.js",
66
+ "security:overrides": "node scripts/security-overrides.js"
66
67
  }
67
68
  }