Repository navigation
Expand file tree
/
Copy pathsyncpack.config.mjs
More file actions
255 lines (246 loc) · 6.26 KB
/
Copy pathsyncpack.config.mjs
File metadata and controls
255 lines (246 loc) · 6.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
// @ts-check
/**
* Keeps families of packages that are released together on the same version.
*
* Payload, Storybook, Sentry and the others each publish a dozen packages from
* one repo on a shared release train — mixing versions within a family causes
* subtle runtime breakage rather than an install error, so it is worth
* enforcing. Each family is held to a single range with `sameRange`: `snapTo` targets a
* local workspace package, which this single-package repo does not have, so
* matching ranges is the equivalent guarantee.
*
* Run `bun run deps:lint` to check, `bun run deps:fix` to apply.
*
* @type {import('syncpack').RcFile}
*/
export default {
sortPackages: true,
// Mirrors sort-package-json's own default `sortOrder`/alphabetized-content
// list exactly (node_modules/sort-package-json's `fields` array — the
// fields there marked `over: sortObject`/`sortDependencies`), so a
// `syncpack fix` run and a `sort-package-json` run agree on both key
// order (sortFirst below) and content order for these fields, instead of
// re-shuffling each other's output on alternating commits.
sortAz: [
'maintainers',
'contributors',
'resolutions',
'overrides',
'dependencies',
'devDependencies',
'peerDependencies',
'optionalDependencies',
'bundledDependencies',
'bundleDependencies',
'extensionPack',
'extensionDependencies',
'engines',
'engineStrict',
'preferGlobal',
'publishConfig',
],
// Full sort-package-json default field order (see that package's `fields`
// array) — kept complete rather than trimmed to this repo's current
// fields, so it stays correct as fields are added later.
sortFirst: [
'$schema',
'name',
'displayName',
'version',
'stableVersion',
'private',
'description',
'categories',
'keywords',
'homepage',
'bugs',
'repository',
'funding',
'license',
'qna',
'author',
'maintainers',
'contributors',
'publisher',
'sideEffects',
'type',
'imports',
'exports',
'main',
'svelte',
'umd:main',
'jsdelivr',
'unpkg',
'module',
'source',
'jsnext:main',
'browser',
'react-native',
'types',
'typesVersions',
'typings',
'style',
'example',
'examplestyle',
'assets',
'bin',
'man',
'directories',
'files',
'workspaces',
'binary',
'scripts',
'betterScripts',
'wireit',
'l10n',
'contributes',
'activationEvents',
'husky',
'simple-git-hooks',
'pre-commit',
'commitlint',
'lint-staged',
'nano-staged',
'config',
'nodemonConfig',
'browserify',
'babel',
'browserslist',
'xo',
'prettier',
'eslintConfig',
'eslintIgnore',
'npmpkgjsonlint',
'npmPackageJsonLintConfig',
'npmpackagejsonlint',
'release',
'remarkConfig',
'stylelint',
'ava',
'jest',
'jest-junit',
'jest-stare',
'mocha',
'nyc',
'c8',
'tap',
'oclif',
'resolutions',
'overrides',
'dependencies',
'devDependencies',
'dependenciesMeta',
'peerDependencies',
'peerDependenciesMeta',
'optionalDependencies',
'bundledDependencies',
'bundleDependencies',
'extensionPack',
'extensionDependencies',
'flat',
'packageManager',
'engines',
'engineStrict',
'devEngines',
'volta',
'languageName',
'os',
'cpu',
'preferGlobal',
'publishConfig',
'icon',
'badges',
'galleryBanner',
'preview',
'markdown',
],
source: ['package.json', 'apps/*/package.json', 'packages/*/package.json'],
versionGroups: [
/**
* Packages that live in a family's namespace but are versioned
* independently. Listing them first means the family rules below never
* see them.
*/
{
label: 'Independently versioned, despite the shared namespace',
dependencies: [
// Storybook's compiler addons track the bundler, not Storybook
'@storybook/addon-webpack5-compiler-swc',
// each Radix primitive ships on its own release line
'@radix-ui/**',
// changelog-github is 0.x while the CLI is 2.x
'@changesets/changelog-github',
],
packages: ['**'],
isIgnored: true,
},
{
label: 'Payload CMS packages share a release train',
dependencies: ['payload', '@payloadcms/**'],
packages: ['**'],
policy: 'sameRange',
},
{
label: 'Storybook packages share a release train',
dependencies: ['storybook', '@storybook/**'],
packages: ['**'],
policy: 'sameRange',
},
{
label: 'Sentry packages share a release train',
dependencies: ['@sentry/**'],
packages: ['**'],
preferVersion: 'highestSemver',
},
{
label: 'Vitest packages share a release train',
dependencies: ['vitest', '@vitest/**'],
packages: ['**'],
policy: 'sameRange',
},
/**
* `playwright` and `@playwright/test` must match exactly: the Docker image
* tag in scripts/e2e-docker.sh is pinned to this version, and a mismatch
* means the bundled browser revisions disagree.
*/
{
label: 'Playwright must match the pinned browser image',
dependencies: ['playwright', '@playwright/**'],
packages: ['**'],
policy: 'sameRange',
},
{
label: 'React and its DOM/type packages move together',
dependencies: ['react', 'react-dom'],
packages: ['**'],
policy: 'sameRange',
},
],
/** Range styles, so a family bump does not silently change pinning strategy. */
semverGroups: [
{
label: 'Playwright is pinned to a patch range to match the Docker image',
dependencies: ['playwright', '@playwright/**'],
packages: ['**'],
range: '~',
},
{
label: 'Exact pins that must not become ranges',
dependencies: [
// the bun patch (patchedDependencies) is keyed to an exact version; a range would silently
// stop applying it
'pdfjs-dist',
// pinned deliberately via overrides to hold the v4 API
'redis',
],
packages: ['**'],
range: '',
},
{
label: 'Everything else uses caret ranges',
dependencies: ['**'],
packages: ['**'],
range: '^',
},
],
}