@open-xchange/app-suite-ui-sdk 0.1.2 → 0.1.4
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 +44 -17
- package/bin/ui-sdk.js +10 -7
- package/configs/vite-plugin-copy.js +35 -0
- package/configs/vite.js +8 -4
- package/lib/commands.js +27 -8
- package/lib/doctor.js +181 -71
- package/package.json +11 -9
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.
|
|
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
|
|
|
@@ -16,7 +12,18 @@ pnpm exec ui-sdk doctor --fix
|
|
|
16
12
|
pnpm install
|
|
17
13
|
```
|
|
18
14
|
|
|
19
|
-
`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`.
|
|
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`. [docs/migration.md](docs/migration.md) walks through moving an existing project, including what doctor leaves to you.
|
|
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.
|
|
20
27
|
|
|
21
28
|
## Commands
|
|
22
29
|
|
|
@@ -29,7 +36,7 @@ pnpm install
|
|
|
29
36
|
| `ui-sdk stylelint` | stylelint | `src/**/*.{scss,css} --allow-empty-input` |
|
|
30
37
|
| `ui-sdk msgmerge [po] [pot]` | gettext `msgmerge` for each po file | `src/i18n/*.po dist/ox.pot` |
|
|
31
38
|
| `ui-sdk doctor [--fix]` | checks the project setup, `--fix` writes the changes | |
|
|
32
|
-
| `ui-sdk audit [--fix]` | `pnpm audit`, `--fix`
|
|
39
|
+
| `ui-sdk audit [--fix]` | `pnpm audit`, `--fix` first writes only the SDK security overrides into `pnpm-workspace.yaml` and reinstalls | |
|
|
33
40
|
|
|
34
41
|
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
42
|
|
|
@@ -52,6 +59,19 @@ export default defineConfig({
|
|
|
52
59
|
})
|
|
53
60
|
```
|
|
54
61
|
|
|
62
|
+
To copy files into place when vite starts, for example assets from `node_modules` into `public/`, pass `copy` targets. Each match of `src` lands in `dest` under its own name, folders are copied as folders, and `rename` and `transform` change the file name and content:
|
|
63
|
+
|
|
64
|
+
```js
|
|
65
|
+
defineConfig({
|
|
66
|
+
copy: [
|
|
67
|
+
{ src: 'node_modules/pdfjs-dist/cmaps', dest: 'public/pdfjs' },
|
|
68
|
+
{ src: 'node_modules/flag-icons/flags/4x3/*', dest: 'public/flags', rename: name => `${name}.webp`, transform: svg => toWebp(svg) }
|
|
69
|
+
]
|
|
70
|
+
})
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
With an own vite config, `import copyPlugin from '@open-xchange/app-suite-ui-sdk/vite-plugin-copy'` gives the same plugin.
|
|
74
|
+
|
|
55
75
|
`defineConfig` builds the usual plugin setup: `src` as root and `dist` as output, the dev proxy to `SERVER` from `.env`, manifests, `$` externals, css and po2json. Vitest runs with jsdom on `spec/**/*_test.{js,mjs}` and `src/**/*.test.{js,mjs}`. `options.vite` and `options.test` are merged over the defaults.
|
|
56
76
|
|
|
57
77
|
```js
|
|
@@ -77,23 +97,29 @@ extends:
|
|
|
77
97
|
## What doctor checks
|
|
78
98
|
|
|
79
99
|
- `packageManager` and `engines.node` match the SDK.
|
|
80
|
-
- `
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
- `
|
|
84
|
-
-
|
|
100
|
+
- `devDependencies` 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). The same packages in `dependencies` only get a warning, because the project may need them at runtime.
|
|
101
|
+
- Workspace packages from the `packages` list in `pnpm-workspace.yaml` get the same dependency check. Their scripts only get warnings, because the SDK is a dependency of the workspace root.
|
|
102
|
+
- Scripts call `ui-sdk` instead of the tools. `--fix` rewrites single commands like `vite build` or `eslint src` and keeps their arguments. Scripts that chain commands, pipe or redirect get a warning and need a manual change.
|
|
103
|
+
- `pnpm-workspace.yaml` has `publicHoistPattern` (so editors and test files find eslint, stylelint, typescript, vite and vitest, and the project's own configs still find every SDK package doctor removed from `package.json`), `allowBuilds`, `minimumReleaseAgeExclude` for `@open-xchange/*` (pnpm otherwise refuses a freshly released SDK version, which blocks the renovate bump), and the SDK security overrides.
|
|
104
|
+
- `lefthook.yml` (or `.lefthook.yml`) extends the SDK config.
|
|
105
|
+
- `renovate.json` (or `.renovaterc.json`, `renovate.json5` and the other names renovate reads) 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.
|
|
106
|
+
- rlsy is installed globally, unless the project has its own `release` script. That is a warning only.
|
|
85
107
|
|
|
86
|
-
|
|
108
|
+
`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
109
|
|
|
88
110
|
## Security overrides
|
|
89
111
|
|
|
90
112
|
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
113
|
|
|
92
|
-
|
|
114
|
+
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.
|
|
115
|
+
|
|
116
|
+
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
117
|
|
|
94
118
|
## Releasing
|
|
95
119
|
|
|
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.
|
|
120
|
+
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.
|
|
121
|
+
|
|
122
|
+
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, from the GitLab UI or with `glab ci run -b main`. The tag the release job pushes starts the publish job.
|
|
97
123
|
|
|
98
124
|
## Decisions
|
|
99
125
|
|
|
@@ -107,9 +133,9 @@ Agreed on 2026-11-03.
|
|
|
107
133
|
- **`doctor --fix` writes visible settings** into `package.json` and `pnpm-workspace.yaml` instead of injecting them at install time.
|
|
108
134
|
- **Same tools everywhere.** lefthook, the SDK's pnpm and Node version, enforced by `ui-sdk doctor` in CI.
|
|
109
135
|
- **`@open-xchange/lint` stays its own package.** The SDK pins it and re-exports it.
|
|
110
|
-
- **Semver, released
|
|
136
|
+
- **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
137
|
- **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
|
|
138
|
+
- **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
139
|
- **e2e is out of scope** and gets its own SDK.
|
|
114
140
|
- **Rollout:** core ui first, then the other vite projects, then the customer plugins.
|
|
115
141
|
|
|
@@ -126,6 +152,7 @@ pnpm test:projects vite-vue # only one project
|
|
|
126
152
|
- `customer-plugin`: a drifted customer plugin with eslint 8, release-it and no build.
|
|
127
153
|
- `vite-vue`: vite with Vue, scss, po files and a unit test.
|
|
128
154
|
- `vite-tailwind`: vite with Tailwind.
|
|
155
|
+
- `ui-like`: shaped like core ui, with a workspace package, its own lefthook and renovate files, a chained build script, a runtime dependency and no vite config.
|
|
129
156
|
|
|
130
157
|
## License
|
|
131
158
|
|
package/bin/ui-sdk.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { commands } from '../lib/commands.js'
|
|
3
|
-
import { doctor } from '../lib/doctor.js'
|
|
3
|
+
import { doctor, syncSecurityOverrides } from '../lib/doctor.js'
|
|
4
4
|
import { runCommand, sdkPackage } from '../lib/tools.js'
|
|
5
5
|
|
|
6
6
|
const USAGE = `ui-sdk ${sdkPackage.version}
|
|
@@ -14,20 +14,23 @@ Usage: ui-sdk <command> [args]
|
|
|
14
14
|
stylelint run stylelint (default: src/**/*.{scss,css})
|
|
15
15
|
msgmerge [po] [pot] merge po files with the pot (default: src/i18n/*.po dist/ox.pot)
|
|
16
16
|
doctor [--fix] check the project setup against the SDK, --fix writes the changes
|
|
17
|
-
audit [--fix] run pnpm audit, --fix
|
|
17
|
+
audit [--fix] run pnpm audit, --fix first writes the SDK security overrides and reinstalls
|
|
18
18
|
|
|
19
19
|
Arguments after the command are passed to the underlying tool.`
|
|
20
20
|
|
|
21
21
|
const [name, ...args] = process.argv.slice(2)
|
|
22
22
|
const cwd = process.cwd()
|
|
23
23
|
|
|
24
|
-
function audit (
|
|
24
|
+
function audit (args) {
|
|
25
|
+
const fix = args.includes('--fix')
|
|
26
|
+
const auditArgs = args.filter(arg => arg !== '--fix')
|
|
25
27
|
if (fix) {
|
|
26
|
-
|
|
27
|
-
const status = runCommand('pnpm', ['install', '--no-frozen-lockfile'], { cwd })
|
|
28
|
+
const status = syncSecurityOverrides(cwd, { fix: true })
|
|
28
29
|
if (status !== 0) return status
|
|
30
|
+
const installStatus = runCommand('pnpm', ['install', '--no-frozen-lockfile'], { cwd })
|
|
31
|
+
if (installStatus !== 0) return installStatus
|
|
29
32
|
}
|
|
30
|
-
return runCommand('pnpm', ['audit'], { cwd })
|
|
33
|
+
return runCommand('pnpm', ['audit', ...auditArgs], { cwd })
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
let status
|
|
@@ -40,7 +43,7 @@ if (!name || name === '--help' || name === '-h') {
|
|
|
40
43
|
} else if (name === 'doctor') {
|
|
41
44
|
status = doctor(cwd, { fix: args.includes('--fix') })
|
|
42
45
|
} else if (name === 'audit') {
|
|
43
|
-
status = audit(args
|
|
46
|
+
status = audit(args)
|
|
44
47
|
} else if (commands[name]) {
|
|
45
48
|
status = commands[name](cwd, args)
|
|
46
49
|
} else {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { cp, glob, mkdir, readFile, stat, writeFile } from 'node:fs/promises'
|
|
2
|
+
import path from 'node:path'
|
|
3
|
+
|
|
4
|
+
async function copyMatch (match, { dest, rename, transform }) {
|
|
5
|
+
const { name, ext, base } = path.parse(match)
|
|
6
|
+
const target = path.join(dest, rename ? rename(name, ext.slice(1), match) : base)
|
|
7
|
+
if ((await stat(match)).isDirectory()) {
|
|
8
|
+
await cp(match, target, { recursive: true })
|
|
9
|
+
return
|
|
10
|
+
}
|
|
11
|
+
await mkdir(path.dirname(target), { recursive: true })
|
|
12
|
+
const contents = await readFile(match)
|
|
13
|
+
await writeFile(target, transform ? await transform(contents, base) : contents)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Copies files and folders into place when vite starts, for dev and build.
|
|
18
|
+
* Every match of a target's `src` globs lands in `dest` under its own name.
|
|
19
|
+
*
|
|
20
|
+
* @param {Array<{src: string|string[], dest: string, rename?: Function, transform?: Function}>} targets
|
|
21
|
+
*/
|
|
22
|
+
export default function copyPlugin (targets) {
|
|
23
|
+
return {
|
|
24
|
+
name: 'ox-copy',
|
|
25
|
+
async config () {
|
|
26
|
+
for (const target of targets) {
|
|
27
|
+
for (const pattern of [target.src].flat()) {
|
|
28
|
+
for await (const match of glob(pattern.replace(/\/$/, ''))) {
|
|
29
|
+
await copyMatch(match, target)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
package/configs/vite.js
CHANGED
|
@@ -8,6 +8,7 @@ import vitePluginOxExternals from '@open-xchange/vite-plugin-ox-externals'
|
|
|
8
8
|
import vitePluginProxy from '@open-xchange/vite-plugin-proxy'
|
|
9
9
|
import vitePluginOxCss from '@open-xchange/vite-plugin-ox-css'
|
|
10
10
|
import gettextPlugin from '@open-xchange/vite-plugin-po2json'
|
|
11
|
+
import copyPlugin from './vite-plugin-copy.js'
|
|
11
12
|
|
|
12
13
|
function loadEnv () {
|
|
13
14
|
for (const file of ['.env', '.env.defaults']) {
|
|
@@ -66,6 +67,7 @@ export function proxyConfig (env) {
|
|
|
66
67
|
* @param {boolean} [options.tailwind] add @tailwindcss/vite
|
|
67
68
|
* @param {false|object} [options.gettext] options for @open-xchange/vite-plugin-po2json, false to disable; on by default when src/i18n has po files
|
|
68
69
|
* @param {object} [options.meta] extra manifest meta data
|
|
70
|
+
* @param {Array} [options.copy] targets for the copy plugin, copied when vite starts
|
|
69
71
|
* @param {object} [options.test] vitest options, merged over the defaults
|
|
70
72
|
* @param {import('vite').UserConfig | ((env: import('vite').ConfigEnv) => import('vite').UserConfig)} [options.vite] merged over the generated config
|
|
71
73
|
*/
|
|
@@ -73,11 +75,12 @@ export function defineConfig (options = {}) {
|
|
|
73
75
|
const {
|
|
74
76
|
id = readProjectName(),
|
|
75
77
|
name = id,
|
|
76
|
-
entryPoints = ['src/**/*.js'],
|
|
78
|
+
entryPoints = ['src/**/*.js', '!src/**/*.test.js', '!src/**/*.spec.js'],
|
|
77
79
|
vue = true,
|
|
78
80
|
tailwind = false,
|
|
79
81
|
gettext = globSync('src/i18n/*.po').length > 0 && { poFiles: 'src/i18n/*.po', outFile: 'ox.pot', defaultDictionary: id, defaultLanguage: 'en_US' },
|
|
80
82
|
meta = {},
|
|
83
|
+
copy = [],
|
|
81
84
|
test = {},
|
|
82
85
|
vite = {}
|
|
83
86
|
} = options
|
|
@@ -112,12 +115,12 @@ export function defineConfig (options = {}) {
|
|
|
112
115
|
},
|
|
113
116
|
server: {
|
|
114
117
|
port: env.port,
|
|
115
|
-
hmr: { overlay:
|
|
118
|
+
hmr: env.hmr && { overlay: true },
|
|
116
119
|
https: serving ? { key: env.hostKey, cert: env.hostCrt } : undefined,
|
|
117
120
|
fs: { strict: env.strictFilesystem }
|
|
118
121
|
},
|
|
119
122
|
resolve: {
|
|
120
|
-
alias: [{ find: '@/', replacement: '
|
|
123
|
+
alias: [{ find: '@/', replacement: `${path.resolve('src')}/` }]
|
|
121
124
|
},
|
|
122
125
|
plugins: [
|
|
123
126
|
vue && vitePluginVue(),
|
|
@@ -139,7 +142,8 @@ export function defineConfig (options = {}) {
|
|
|
139
142
|
}),
|
|
140
143
|
vitePluginOxExternals({ prefix: '$' }),
|
|
141
144
|
!testing && vitePluginOxCss(),
|
|
142
|
-
gettext && gettextPlugin(gettext)
|
|
145
|
+
gettext && gettextPlugin(gettext),
|
|
146
|
+
!testing && copy.length > 0 && copyPlugin(copy)
|
|
143
147
|
].filter(Boolean),
|
|
144
148
|
test: mergeConfig({
|
|
145
149
|
root: '.',
|
package/lib/commands.js
CHANGED
|
@@ -1,14 +1,33 @@
|
|
|
1
|
-
import { globSync } from 'node:fs'
|
|
1
|
+
import { globSync, readFileSync } from 'node:fs'
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import { findConfig, resolveBin, runCommand, runNode, sdkRoot } from './tools.js'
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const ESLINT_CONFIGS = ['eslint.config.js', 'eslint.config.mjs', 'eslint.config.cjs', 'eslint.config.ts']
|
|
8
|
-
const STYLELINT_CONFIGS = ['stylelint.config.js', 'stylelint.config.mjs', '.stylelintrc.json', '.stylelintrc']
|
|
5
|
+
const SCRIPT_EXTENSIONS = ['js', 'mjs', 'cjs', 'ts', 'mts', 'cts']
|
|
6
|
+
const withExtensions = base => SCRIPT_EXTENSIONS.map(ext => `${base}.${ext}`)
|
|
9
7
|
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export const VITE_CONFIGS = withExtensions('vite.config')
|
|
9
|
+
export const VITEST_CONFIGS = [...withExtensions('vitest.config'), ...VITE_CONFIGS]
|
|
10
|
+
export const ESLINT_CONFIGS = withExtensions('eslint.config')
|
|
11
|
+
export const STYLELINT_CONFIGS = [
|
|
12
|
+
...withExtensions('stylelint.config'),
|
|
13
|
+
...['', '.json', '.yml', '.yaml', '.js', '.mjs', '.cjs'].map(ext => `.stylelintrc${ext}`)
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
function hasConfigArg (args) {
|
|
17
|
+
return args.some(arg => arg === '--config' || arg === '-c' || arg.startsWith('--config=') || arg.startsWith('-c='))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function hasPackageJsonKey (cwd, key) {
|
|
21
|
+
try {
|
|
22
|
+
return key in JSON.parse(readFileSync(path.join(cwd, 'package.json'), 'utf8'))
|
|
23
|
+
} catch {
|
|
24
|
+
return false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function withConfig (cwd, names, fallback, args, { packageJsonKey } = {}) {
|
|
29
|
+
if (hasConfigArg(args) || findConfig(cwd, names)) return args
|
|
30
|
+
if (packageJsonKey && hasPackageJsonKey(cwd, packageJsonKey)) return args
|
|
12
31
|
return ['--config', path.join(sdkRoot, 'configs', fallback), ...args]
|
|
13
32
|
}
|
|
14
33
|
|
|
@@ -33,7 +52,7 @@ export const commands = {
|
|
|
33
52
|
|
|
34
53
|
stylelint: (cwd, args) => {
|
|
35
54
|
const stylelintArgs = args.length ? args : ['src/**/*.{scss,css}', '--allow-empty-input']
|
|
36
|
-
return runNode(resolveBin('stylelint'), withConfig(cwd, STYLELINT_CONFIGS, 'stylelint.js', stylelintArgs), { cwd })
|
|
55
|
+
return runNode(resolveBin('stylelint'), withConfig(cwd, STYLELINT_CONFIGS, 'stylelint.js', stylelintArgs, { packageJsonKey: 'stylelint' }), { cwd })
|
|
37
56
|
},
|
|
38
57
|
|
|
39
58
|
msgmerge: (cwd, args) => {
|
package/lib/doctor.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { spawnSync } from 'node:child_process'
|
|
2
|
-
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
|
|
2
|
+
import { existsSync, globSync, 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'
|
|
@@ -15,6 +15,12 @@ export const ALLOW_BUILDS = ['@parcel/watcher', 'lefthook']
|
|
|
15
15
|
|
|
16
16
|
export const RELEASE_AGE_EXCLUDE = ['@open-xchange/*']
|
|
17
17
|
|
|
18
|
+
export const RENOVATE_PRESET = 'local>openxchange/appsuite/web-foundation/renovate:app-suite-ui-sdk'
|
|
19
|
+
|
|
20
|
+
const RENOVATE_FILES = ['renovate.json', 'renovate.json5', '.renovaterc', '.renovaterc.json', '.renovaterc.json5', '.github/renovate.json', '.gitlab/renovate.json']
|
|
21
|
+
|
|
22
|
+
const LEFTHOOK_FILES = ['lefthook.yml', 'lefthook.yaml', '.lefthook.yml', '.lefthook.yaml']
|
|
23
|
+
|
|
18
24
|
const REPLACED_PACKAGES = [
|
|
19
25
|
'release-it',
|
|
20
26
|
'@j-ulrich/release-it-regex-bumper',
|
|
@@ -28,75 +34,98 @@ const REPLACED_PACKAGES = [
|
|
|
28
34
|
'eslint-plugin-promise'
|
|
29
35
|
]
|
|
30
36
|
|
|
37
|
+
const SINGLE_ARGS = String.raw`(?:\s+([^&|;<>]*?))?\s*$`
|
|
38
|
+
|
|
31
39
|
const TOOL_SCRIPTS = {
|
|
32
|
-
dev:
|
|
33
|
-
build:
|
|
34
|
-
test:
|
|
35
|
-
lint:
|
|
36
|
-
stylelint:
|
|
40
|
+
dev: new RegExp(String.raw`^(?:npx )?vite(?!\s+build\b)` + SINGLE_ARGS),
|
|
41
|
+
build: new RegExp(String.raw`^(?:npx )?vite build` + SINGLE_ARGS),
|
|
42
|
+
test: new RegExp(String.raw`^(?:npx )?vitest` + SINGLE_ARGS + '|^true$'),
|
|
43
|
+
lint: new RegExp(String.raw`^(?:npx )?eslint` + SINGLE_ARGS),
|
|
44
|
+
stylelint: new RegExp(String.raw`^(?:npx )?stylelint` + SINGLE_ARGS)
|
|
37
45
|
}
|
|
38
46
|
|
|
47
|
+
const DIRECT_TOOL_CALL = /(?:^|[\s&;|(])(?:npx )?(?:vite|vitest|eslint|stylelint)\b/
|
|
48
|
+
|
|
39
49
|
function lintDependencies () {
|
|
40
50
|
const manifest = JSON.parse(readFileSync(require.resolve('@open-xchange/lint/package.json'), 'utf8'))
|
|
41
51
|
return Object.keys(manifest.dependencies || {})
|
|
42
52
|
}
|
|
43
53
|
|
|
54
|
+
export function installedPackages () {
|
|
55
|
+
return new Set([...Object.keys(sdkPackage.dependencies), ...lintDependencies()])
|
|
56
|
+
}
|
|
57
|
+
|
|
44
58
|
export function providedPackages () {
|
|
45
|
-
return new Set([
|
|
46
|
-
...Object.keys(sdkPackage.dependencies),
|
|
47
|
-
...lintDependencies(),
|
|
48
|
-
...REPLACED_PACKAGES
|
|
49
|
-
])
|
|
59
|
+
return new Set([...installedPackages(), ...REPLACED_PACKAGES])
|
|
50
60
|
}
|
|
51
61
|
|
|
52
62
|
export function securityOverrides () {
|
|
53
63
|
return JSON.parse(readFileSync(path.join(sdkRoot, 'security-overrides.json'), 'utf8'))
|
|
54
64
|
}
|
|
55
65
|
|
|
56
|
-
|
|
66
|
+
function asList (value) {
|
|
67
|
+
if (value === undefined || value === null) return []
|
|
68
|
+
return Array.isArray(value) ? value : [value]
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function packageManagerMatches (actual, expected) {
|
|
72
|
+
return typeof actual === 'string' && actual.split('+')[0] === expected
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function checkPackageJson (pkg, { provided = providedPackages(), installed = installedPackages(), root = true } = {}) {
|
|
76
|
+
if (!toolchain.packageManager || !toolchain.node) {
|
|
77
|
+
throw new Error('The SDK package has no toolchain.json; reinstall @open-xchange/app-suite-ui-sdk')
|
|
78
|
+
}
|
|
57
79
|
const findings = []
|
|
80
|
+
const hoist = new Set()
|
|
58
81
|
const fixed = structuredClone(pkg)
|
|
59
82
|
|
|
60
|
-
if (pkg.packageManager
|
|
83
|
+
if (root && !packageManagerMatches(pkg.packageManager, toolchain.packageManager)) {
|
|
61
84
|
findings.push({ level: 'error', fixable: true, message: `packageManager is ${pkg.packageManager ?? 'unset'}, expected ${toolchain.packageManager}` })
|
|
62
85
|
fixed.packageManager = toolchain.packageManager
|
|
63
86
|
}
|
|
64
87
|
|
|
65
|
-
if (pkg.engines?.node !== toolchain.node) {
|
|
88
|
+
if (root && pkg.engines?.node !== toolchain.node) {
|
|
66
89
|
findings.push({ level: 'error', fixable: true, message: `engines.node is ${pkg.engines?.node ?? 'unset'}, expected ${toolchain.node}` })
|
|
67
90
|
fixed.engines = { ...pkg.engines, node: toolchain.node }
|
|
68
91
|
}
|
|
69
92
|
|
|
70
|
-
for (const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
93
|
+
for (const name of Object.keys(pkg.devDependencies || {})) {
|
|
94
|
+
if (!provided.has(name)) continue
|
|
95
|
+
findings.push({ level: 'error', fixable: true, message: `devDependencies lists ${name}, which the SDK provides` })
|
|
96
|
+
delete fixed.devDependencies[name]
|
|
97
|
+
if (installed.has(name)) hoist.add(name)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
for (const name of Object.keys(pkg.dependencies || {})) {
|
|
101
|
+
if (!provided.has(name)) continue
|
|
102
|
+
findings.push({ level: 'warn', fixable: false, message: `dependencies lists ${name}, which the SDK also provides; keep it if the project needs it at runtime, otherwise remove it by hand` })
|
|
76
103
|
}
|
|
77
104
|
|
|
78
|
-
if (!pkg.devDependencies?.[sdkPackage.name] && !pkg.dependencies?.[sdkPackage.name]) {
|
|
105
|
+
if (root && !pkg.devDependencies?.[sdkPackage.name] && !pkg.dependencies?.[sdkPackage.name]) {
|
|
79
106
|
findings.push({ level: 'error', fixable: true, message: `devDependencies does not list ${sdkPackage.name}` })
|
|
80
107
|
fixed.devDependencies = { ...fixed.devDependencies, [sdkPackage.name]: sdkPackage.version }
|
|
81
108
|
}
|
|
82
109
|
|
|
83
110
|
for (const [name, command] of Object.entries(pkg.scripts || {})) {
|
|
84
111
|
const pattern = TOOL_SCRIPTS[name]
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
112
|
+
const match = pattern && command.match(pattern)
|
|
113
|
+
if (match && !root) {
|
|
114
|
+
findings.push({ level: 'warn', fixable: false, message: `script "${name}" runs the tool directly; the SDK is only a dependency of the workspace root: ${command}` })
|
|
115
|
+
continue
|
|
116
|
+
}
|
|
117
|
+
if (match) {
|
|
118
|
+
const args = match[1]
|
|
119
|
+
fixed.scripts[name] = args ? `ui-sdk ${name} ${args}` : `ui-sdk ${name}`
|
|
120
|
+
findings.push({ level: 'error', fixable: true, message: command === 'true' ? `script "${name}" is a placeholder` : `script "${name}" runs the tool directly: ${command}` })
|
|
121
|
+
continue
|
|
93
122
|
}
|
|
94
123
|
if (/\b(?:release-it|simple-git-hooks|husky|lint-staged)\b/.test(command)) {
|
|
95
124
|
delete fixed.scripts[name]
|
|
96
125
|
findings.push({ level: 'error', fixable: true, message: `script "${name}" uses a tool the SDK replaced: ${command}` })
|
|
97
126
|
continue
|
|
98
127
|
}
|
|
99
|
-
if (
|
|
128
|
+
if (DIRECT_TOOL_CALL.test(command.replace(/\bui-sdk \w+/g, ''))) {
|
|
100
129
|
findings.push({ level: 'warn', fixable: false, message: `script "${name}" calls a tool directly, switch it to ui-sdk by hand: ${command}` })
|
|
101
130
|
}
|
|
102
131
|
}
|
|
@@ -104,12 +133,23 @@ export function checkPackageJson (pkg, { provided = providedPackages() } = {}) {
|
|
|
104
133
|
if (fixed.devDependencies && !Object.keys(fixed.devDependencies).length) delete fixed.devDependencies
|
|
105
134
|
if (fixed.dependencies && !Object.keys(fixed.dependencies).length) delete fixed.dependencies
|
|
106
135
|
|
|
107
|
-
return { findings, fixed }
|
|
136
|
+
return { findings, fixed, hoist: [...hoist].sort() }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function globToRegExp (pattern) {
|
|
140
|
+
return new RegExp('^' + pattern.split('*').map(part => part.replace(/[.+?^${}()|[\]\\/]/g, '\\$&')).join('.*') + '$')
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function coveredBy (entry, patterns) {
|
|
144
|
+
return patterns.some(pattern => pattern === entry || (pattern.includes('*') && globToRegExp(pattern).test(entry)))
|
|
108
145
|
}
|
|
109
146
|
|
|
110
147
|
function ensureList (doc, key, required, findings) {
|
|
111
|
-
const current = doc.get(key)?.toJSON?.() ??
|
|
112
|
-
const missing =
|
|
148
|
+
const current = asList(doc.get(key)?.toJSON?.() ?? doc.get(key))
|
|
149
|
+
const missing = []
|
|
150
|
+
for (const entry of required) {
|
|
151
|
+
if (!coveredBy(entry, [...current, ...missing])) missing.push(entry)
|
|
152
|
+
}
|
|
113
153
|
if (!missing.length) return
|
|
114
154
|
findings.push({ level: 'error', fixable: true, message: `${key} misses ${missing.join(', ')}` })
|
|
115
155
|
doc.set(key, [...current, ...missing])
|
|
@@ -127,6 +167,11 @@ function isManaged (node) {
|
|
|
127
167
|
return isScalar(node) && node.comment?.trim() === MANAGED_MARK
|
|
128
168
|
}
|
|
129
169
|
|
|
170
|
+
function markManaged (node) {
|
|
171
|
+
node.comment = ` ${MANAGED_MARK}`
|
|
172
|
+
return node
|
|
173
|
+
}
|
|
174
|
+
|
|
130
175
|
function syncOverrides (doc, wanted, findings) {
|
|
131
176
|
let overrides = doc.get('overrides', true)
|
|
132
177
|
if (!isMap(overrides)) {
|
|
@@ -144,8 +189,11 @@ function syncOverrides (doc, wanted, findings) {
|
|
|
144
189
|
|
|
145
190
|
for (const [key, version] of Object.entries(wanted)) {
|
|
146
191
|
const node = overrides.get(key, true)
|
|
147
|
-
if (isScalar(node) && node.value === version) {
|
|
148
|
-
if (!isManaged(node))
|
|
192
|
+
if (isScalar(node) && String(node.value) === version) {
|
|
193
|
+
if (!isManaged(node)) {
|
|
194
|
+
findings.push({ level: 'error', fixable: true, message: `override ${key} matches the SDK and becomes managed` })
|
|
195
|
+
markManaged(node)
|
|
196
|
+
}
|
|
149
197
|
continue
|
|
150
198
|
}
|
|
151
199
|
if (node && !isManaged(node)) {
|
|
@@ -153,80 +201,142 @@ function syncOverrides (doc, wanted, findings) {
|
|
|
153
201
|
continue
|
|
154
202
|
}
|
|
155
203
|
findings.push({ level: 'error', fixable: true, message: `security override ${key}: ${version} is missing` })
|
|
156
|
-
|
|
157
|
-
scalar.comment = ` ${MANAGED_MARK}`
|
|
158
|
-
overrides.set(key, scalar)
|
|
204
|
+
overrides.set(key, markManaged(new Scalar(version)))
|
|
159
205
|
}
|
|
160
206
|
|
|
161
207
|
if (!overrides.items.length) doc.delete('overrides')
|
|
162
208
|
}
|
|
163
209
|
|
|
164
|
-
export function checkWorkspace (source, { overrides = securityOverrides() } = {}) {
|
|
210
|
+
export function checkWorkspace (source, { overrides = securityOverrides(), hoist = [], settings = true } = {}) {
|
|
165
211
|
const findings = []
|
|
166
212
|
const doc = parseDocument(source || '')
|
|
167
213
|
if (doc.contents === null) doc.contents = doc.createNode({})
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
214
|
+
if (settings) {
|
|
215
|
+
ensureList(doc, 'publicHoistPattern', [...PUBLIC_HOIST_PATTERN, ...hoist], findings)
|
|
216
|
+
ensureList(doc, 'minimumReleaseAgeExclude', RELEASE_AGE_EXCLUDE, findings)
|
|
217
|
+
ensureAllowBuilds(doc, findings)
|
|
218
|
+
}
|
|
171
219
|
syncOverrides(doc, overrides, findings)
|
|
172
220
|
return { findings, fixed: doc.toString({ singleQuote: true }) }
|
|
173
221
|
}
|
|
174
222
|
|
|
175
|
-
export function checkLefthook (source) {
|
|
223
|
+
export function checkLefthook (source, name = 'lefthook.yml') {
|
|
176
224
|
const extendsPath = `node_modules/${sdkPackage.name}/configs/lefthook.yml`
|
|
177
225
|
if (source === undefined) {
|
|
178
226
|
return {
|
|
179
|
-
findings: [{ level: 'error', fixable: true, message:
|
|
227
|
+
findings: [{ level: 'error', fixable: true, message: `${name} is missing` }],
|
|
180
228
|
fixed: `extends:\n - ${extendsPath}\n`
|
|
181
229
|
}
|
|
182
230
|
}
|
|
183
231
|
const doc = parseDocument(source)
|
|
184
|
-
const current = doc.get('extends')?.toJSON?.() ??
|
|
232
|
+
const current = asList(doc.get('extends')?.toJSON?.() ?? doc.get('extends'))
|
|
185
233
|
if (current.includes(extendsPath)) return { findings: [], fixed: source }
|
|
186
|
-
return { findings: [{ level: 'warn', fixable: false, message:
|
|
234
|
+
return { findings: [{ level: 'warn', fixable: false, message: `${name} does not extend ${extendsPath}` }], fixed: source }
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export function checkRenovate (source, name = 'renovate.json') {
|
|
238
|
+
if (source === undefined) {
|
|
239
|
+
return {
|
|
240
|
+
findings: [{ level: 'error', fixable: true, message: 'renovate.json is missing' }],
|
|
241
|
+
fixed: JSON.stringify({
|
|
242
|
+
$schema: 'https://docs.renovatebot.com/renovate-schema.json',
|
|
243
|
+
extends: [RENOVATE_PRESET]
|
|
244
|
+
}, null, 2) + '\n'
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (name.endsWith('.json5') || name === '.renovaterc') {
|
|
248
|
+
if (source.includes(RENOVATE_PRESET)) return { findings: [], fixed: source }
|
|
249
|
+
return { findings: [{ level: 'warn', fixable: false, message: `${name} does not mention ${RENOVATE_PRESET}` }], fixed: source }
|
|
250
|
+
}
|
|
251
|
+
let config
|
|
252
|
+
try {
|
|
253
|
+
config = JSON.parse(source)
|
|
254
|
+
} catch {
|
|
255
|
+
return { findings: [{ level: 'error', fixable: false, message: `${name} is not valid JSON` }], fixed: source }
|
|
256
|
+
}
|
|
257
|
+
if (asList(config.extends).includes(RENOVATE_PRESET)) return { findings: [], fixed: source }
|
|
258
|
+
return { findings: [{ level: 'warn', fixable: false, message: `${name} does not extend ${RENOVATE_PRESET}` }], fixed: source }
|
|
187
259
|
}
|
|
188
260
|
|
|
189
261
|
function readIfExists (file) {
|
|
190
262
|
return existsSync(file) ? readFileSync(file, 'utf8') : undefined
|
|
191
263
|
}
|
|
192
264
|
|
|
265
|
+
function firstExisting (cwd, names) {
|
|
266
|
+
return names.find(name => existsSync(path.join(cwd, name)))
|
|
267
|
+
}
|
|
268
|
+
|
|
193
269
|
function hasCommand (name) {
|
|
194
270
|
return spawnSync(process.platform === 'win32' ? 'where' : 'which', [name], { stdio: 'ignore' }).status === 0
|
|
195
271
|
}
|
|
196
272
|
|
|
197
|
-
export function
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
const results = {
|
|
206
|
-
'package.json': (() => {
|
|
207
|
-
const { findings, fixed } = checkPackageJson(JSON.parse(pkgSource))
|
|
208
|
-
return { findings, fixed: JSON.stringify(fixed, null, 2) + '\n' }
|
|
209
|
-
})(),
|
|
210
|
-
'pnpm-workspace.yaml': checkWorkspace(readIfExists(files['pnpm-workspace.yaml'])),
|
|
211
|
-
'lefthook.yml': checkLefthook(readIfExists(files['lefthook.yml']))
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
const general = []
|
|
215
|
-
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' })
|
|
273
|
+
export function workspacePackages (cwd, workspaceSource) {
|
|
274
|
+
const patterns = asList(parseDocument(workspaceSource || '').toJSON()?.packages)
|
|
275
|
+
const include = patterns.filter(p => !p.startsWith('!'))
|
|
276
|
+
const exclude = patterns.filter(p => p.startsWith('!')).map(p => p.slice(1))
|
|
277
|
+
if (!include.length) return []
|
|
278
|
+
const manifests = globSync(include.map(p => `${p.replace(/\/$/, '')}/package.json`), { cwd, exclude: exclude.map(p => `${p.replace(/\/$/, '')}/package.json`) })
|
|
279
|
+
return manifests.filter(file => !file.split(path.sep).includes('node_modules')).sort()
|
|
280
|
+
}
|
|
217
281
|
|
|
282
|
+
function report (results, { fix, log }) {
|
|
218
283
|
let remainingErrors = 0
|
|
219
|
-
for (const
|
|
284
|
+
for (const { label, file, findings, fixed } of results) {
|
|
220
285
|
for (const finding of findings) {
|
|
221
286
|
const applied = fix && finding.fixable
|
|
222
287
|
if (finding.level === 'error' && !applied) remainingErrors++
|
|
223
|
-
log(`${applied ? 'fixed' : finding.level} ${
|
|
288
|
+
log(`${applied ? 'fixed' : finding.level} ${label}: ${finding.message}`)
|
|
224
289
|
}
|
|
225
|
-
if (fix && findings.some(finding => finding.fixable)) writeFileSync(
|
|
290
|
+
if (fix && file && findings.some(finding => finding.fixable)) writeFileSync(file, fixed)
|
|
226
291
|
}
|
|
227
|
-
|
|
292
|
+
return remainingErrors
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
function toJson (value) {
|
|
296
|
+
return JSON.stringify(value, null, 2) + '\n'
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export function syncSecurityOverrides (cwd, { fix = false, log = console.log } = {}) {
|
|
300
|
+
const file = path.join(cwd, 'pnpm-workspace.yaml')
|
|
301
|
+
const result = checkWorkspace(readIfExists(file), { settings: false })
|
|
302
|
+
return report([{ label: 'pnpm-workspace.yaml', file, ...result }], { fix, log }) ? 1 : 0
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export function doctor (cwd, { fix = false, log = console.log } = {}) {
|
|
306
|
+
const workspaceFile = path.join(cwd, 'pnpm-workspace.yaml')
|
|
307
|
+
const workspaceSource = readIfExists(workspaceFile)
|
|
308
|
+
const rootManifest = path.join(cwd, 'package.json')
|
|
309
|
+
const rootPkg = JSON.parse(readFileSync(rootManifest, 'utf8'))
|
|
310
|
+
|
|
311
|
+
const results = []
|
|
312
|
+
const hoist = new Set()
|
|
313
|
+
|
|
314
|
+
const rootResult = checkPackageJson(rootPkg)
|
|
315
|
+
rootResult.hoist.forEach(name => hoist.add(name))
|
|
316
|
+
results.push({ label: 'package.json', file: rootManifest, findings: rootResult.findings, fixed: toJson(rootResult.fixed) })
|
|
317
|
+
|
|
318
|
+
for (const relative of workspacePackages(cwd, workspaceSource)) {
|
|
319
|
+
const file = path.join(cwd, relative)
|
|
320
|
+
const result = checkPackageJson(JSON.parse(readFileSync(file, 'utf8')), { root: false })
|
|
321
|
+
result.hoist.forEach(name => hoist.add(name))
|
|
322
|
+
results.push({ label: relative, file, findings: result.findings, fixed: toJson(result.fixed) })
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
results.push({ label: 'pnpm-workspace.yaml', file: workspaceFile, ...checkWorkspace(workspaceSource, { hoist: [...hoist].sort() }) })
|
|
326
|
+
|
|
327
|
+
const lefthookName = firstExisting(cwd, LEFTHOOK_FILES) ?? 'lefthook.yml'
|
|
328
|
+
results.push({ label: lefthookName, file: path.join(cwd, lefthookName), ...checkLefthook(readIfExists(path.join(cwd, lefthookName)), lefthookName) })
|
|
329
|
+
|
|
330
|
+
const renovateName = firstExisting(cwd, RENOVATE_FILES) ?? 'renovate.json'
|
|
331
|
+
results.push({ label: renovateName, file: path.join(cwd, renovateName), ...checkRenovate(readIfExists(path.join(cwd, renovateName)), renovateName) })
|
|
332
|
+
|
|
333
|
+
if (!rootPkg.scripts?.release && !hasCommand('rlsy')) {
|
|
334
|
+
results.push({ label: 'release', findings: [{ level: 'warn', fixable: false, message: 'rlsy is not installed globally (pnpm add -g rlsy); releases need it' }] })
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const remainingErrors = report(results, { fix, log })
|
|
228
338
|
|
|
229
|
-
if (fix && results
|
|
339
|
+
if (fix && results.some(({ file, findings }) => file?.endsWith('package.json') && findings.some(finding => finding.fixable))) {
|
|
230
340
|
log('Run pnpm install to apply the changes.')
|
|
231
341
|
}
|
|
232
342
|
return remainingErrors ? 1 : 0
|
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.4",
|
|
4
4
|
"description": "Shared build, lint and test tooling for OX App Suite UI projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"exports": {
|
|
10
10
|
"./vite": "./configs/vite.js",
|
|
11
|
+
"./vite-plugin-copy": "./configs/vite-plugin-copy.js",
|
|
11
12
|
"./eslint": "./configs/eslint.js",
|
|
12
13
|
"./stylelint": "./configs/stylelint.js",
|
|
13
14
|
"./lefthook.yml": "./configs/lefthook.yml",
|
|
@@ -37,31 +38,32 @@
|
|
|
37
38
|
"@open-xchange/vite-plugin-ox-bundle": "1.0.1",
|
|
38
39
|
"@open-xchange/vite-plugin-ox-css": "1.0.2",
|
|
39
40
|
"@open-xchange/vite-plugin-ox-externals": "1.0.1",
|
|
40
|
-
"@open-xchange/vite-plugin-ox-manifests": "1.0.
|
|
41
|
-
"@open-xchange/vite-plugin-po2json": "1.1.
|
|
41
|
+
"@open-xchange/vite-plugin-ox-manifests": "1.0.7",
|
|
42
|
+
"@open-xchange/vite-plugin-po2json": "1.1.7",
|
|
42
43
|
"@open-xchange/vite-plugin-proxy": "1.0.5",
|
|
43
44
|
"@tailwindcss/vite": "4.3.3",
|
|
44
45
|
"@vitejs/plugin-vue": "6.0.10",
|
|
45
46
|
"@vitest/coverage-v8": "5.0.5",
|
|
46
47
|
"jsdom": "30.1.3",
|
|
47
48
|
"lefthook": "2.2.2",
|
|
48
|
-
"postcss": "8.5.
|
|
49
|
-
"sass": "1.
|
|
49
|
+
"postcss": "8.5.32",
|
|
50
|
+
"sass": "1.107.1",
|
|
50
51
|
"stylelint": "17.16.0",
|
|
51
52
|
"stylelint-config-standard": "40.0.0",
|
|
52
53
|
"stylelint-config-standard-scss": "17.0.0",
|
|
53
54
|
"tailwindcss": "4.3.3",
|
|
54
55
|
"typescript": "7.0.2",
|
|
55
|
-
"vite": "8.3.
|
|
56
|
+
"vite": "8.3.5",
|
|
56
57
|
"vitest": "5.0.5",
|
|
57
58
|
"yaml": "2.9.1"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"rlsy": "0.4.
|
|
61
|
+
"rlsy": "0.4.2"
|
|
61
62
|
},
|
|
62
63
|
"scripts": {
|
|
63
64
|
"lint": "node bin/ui-sdk.js lint",
|
|
64
|
-
"test": "vitest --run",
|
|
65
|
-
"test:projects": "node scripts/test-projects.js"
|
|
65
|
+
"test": "vitest --run --dir test",
|
|
66
|
+
"test:projects": "node scripts/test-projects.js",
|
|
67
|
+
"security:overrides": "node scripts/security-overrides.js"
|
|
66
68
|
}
|
|
67
69
|
}
|