@open-xchange/app-suite-ui-sdk 0.1.1 → 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 +17 -3
- package/lib/doctor.js +7 -7
- package/lib/tools.js +8 -0
- package/package.json +5 -3
- package/toolchain.json +4 -0
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
|
-
|
|
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
|
|
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
|
|
|
@@ -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
|
-
- **
|
|
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
|
|
|
@@ -57,14 +57,14 @@ export function checkPackageJson (pkg, { provided = providedPackages() } = {}) {
|
|
|
57
57
|
const findings = []
|
|
58
58
|
const fixed = structuredClone(pkg)
|
|
59
59
|
|
|
60
|
-
if (pkg.packageManager !==
|
|
61
|
-
findings.push({ level: 'error', fixable: true, message: `packageManager is ${pkg.packageManager ?? 'unset'}, expected ${
|
|
62
|
-
fixed.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
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
if (pkg.engines?.node !==
|
|
66
|
-
findings.push({ level: 'error', fixable: true, message: `engines.node is ${pkg.engines?.node ?? 'unset'}, expected ${
|
|
67
|
-
fixed.engines = { ...pkg.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 }
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
for (const field of ['dependencies', 'devDependencies']) {
|
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.
|
|
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",
|
|
@@ -60,6 +61,7 @@
|
|
|
60
61
|
},
|
|
61
62
|
"scripts": {
|
|
62
63
|
"lint": "node bin/ui-sdk.js lint",
|
|
63
|
-
"test": "vitest --run"
|
|
64
|
+
"test": "vitest --run",
|
|
65
|
+
"test:projects": "node scripts/test-projects.js"
|
|
64
66
|
}
|
|
65
67
|
}
|
package/toolchain.json
ADDED