forked from microsoft/FluidFramework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fluidBuild.config.cjs
612 lines (587 loc) · 20.8 KB
/
fluidBuild.config.cjs
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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
/*!
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
* Licensed under the MIT License.
*/
// Enable TypeScript type-checking for this file.
// See https://www.typescriptlang.org/docs/handbook/intro-to-js-ts.html#ts-check
// @ts-check
const tscDependsOn = ["^tsc", "^api", "build:genver", "ts2esm"];
/**
* The settings in this file configure the Fluid build tools, such as fluid-build and flub. Some settings apply to the
* whole repo, while others apply only to the client release group.
*
* See https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/build-tools/src/common/fluidTaskDefinitions.ts
* for details on the task and dependency definition format.
*
* @type {import("@fluidframework/build-tools").IFluidBuildConfig & import("@fluid-tools/build-cli").FlubConfig}
*/
module.exports = {
version: 1,
tasks: {
"ci:build": {
dependsOn: [
"compile",
"lint",
"ci:build:api-reports",
"ci:build:docs",
"build:manifest",
"build:readme",
],
script: false,
},
"full": {
dependsOn: ["build", "webpack"],
script: false,
},
"build": {
dependsOn: [
"check:format",
"compile",
"lint",
"build:api-reports",
"build:docs",
"build:manifest",
"build:readme",
],
script: false,
},
"compile": {
dependsOn: ["commonjs", "build:esnext", "api", "build:test", "build:copy"],
script: false,
},
"commonjs": {
dependsOn: ["tsc", "build:test"],
script: false,
},
"lint": {
dependsOn: ["eslint", "good-fences", "depcruise", "check:exports", "check:release-tags"],
script: false,
},
"checks": {
dependsOn: ["check:format"],
script: false,
},
"checks:fix": {
dependsOn: [],
script: false,
},
"build:copy": [],
"build:genver": [],
"typetests:gen": [],
"ts2esm": [],
"tsc": tscDependsOn,
"build:esnext": [...tscDependsOn, "^build:esnext"],
// Generic build:test script should be replaced by :esm or :cjs specific versions.
// "tsc" would be nice to eliminate from here, but plenty of packages still focus
// on CommonJS.
"build:test": ["typetests:gen", "tsc", "api-extractor:commonjs", "api-extractor:esnext"],
"build:test:cjs": ["typetests:gen", "tsc", "api-extractor:commonjs"],
"build:test:esm": ["typetests:gen", "build:esnext", "api-extractor:esnext"],
"api": {
dependsOn: ["api-extractor:commonjs", "api-extractor:esnext"],
// dependsOn: ["api-extractor:commonjs", "api-extractor:esnext"],
script: false,
},
"api-extractor:commonjs": ["tsc"],
"api-extractor:esnext": {
dependsOn: ["build:esnext"],
script: true,
},
// build:api-reports may be handled in one step with build:docs when a
// package only uses api-extractor supported exports, which is a single
// export/entrypoint. For packages with /legacy exports, we need to
// generate reports from legacy entrypoint as well as the "current" one.
// The "current" entrypoint should be the broadest of "public.d.ts",
// "beta.d.ts", and "alpha.d.ts".
"build:api-reports:current": ["api-extractor:esnext"],
"build:api-reports:legacy": ["api-extractor:esnext"],
"ci:build:api-reports:current": ["api-extractor:esnext"],
"ci:build:api-reports:legacy": ["api-extractor:esnext"],
// With most packages in client building ESM first, there is ideally just "build:esnext" dependency.
// The package's local 'api-extractor.json' may use the entrypoint from either CJS or ESM,
// therefore we need to require both before running api-extractor.
"build:docs": ["tsc", "build:esnext"],
"ci:build:docs": ["tsc", "build:esnext"],
"build:readme": {
dependsOn: ["compile"],
script: true,
},
"build:manifest": {
dependsOn: ["compile"],
script: true,
},
"depcruise": [],
"check:exports": ["api"],
// The package's local 'api-extractor-lint.json' may use the entrypoint from either CJS or ESM,
// therefore we need to require both before running api-extractor.
"check:release-tags": ["tsc", "build:esnext"],
"check:are-the-types-wrong": ["build"],
"check:format": {
dependencies: [],
script: true,
},
"format": {
dependencies: [],
script: true,
},
"check:biome": [],
"check:prettier": [],
// ADO #7297: Review why the direct dependency on 'build:esm:test' is necessary.
// Should 'compile' be enough? compile -> build:test -> build:test:esm
"eslint": ["compile", "build:test:esm"],
"good-fences": [],
"format:biome": [],
"format:prettier": [],
"prettier": [],
"prettier:fix": [],
"webpack": ["^tsc", "^build:esnext"],
"webpack:profile": ["^tsc", "^build:esnext"],
"clean": {
before: ["*"],
},
// alias for back compat
"build:full": {
dependsOn: ["full"],
script: false,
},
"build:compile": {
dependsOn: ["compile"],
script: false,
},
"build:commonjs": {
dependsOn: ["commonjs"],
script: false,
},
},
multiCommandExecutables: ["oclif", "syncpack"],
declarativeTasks: {
"jssm-viz": {
inputGlobs: ["src/**/*.fsl"],
outputGlobs: ["src/**/*.fsl.svg"],
},
"oclif manifest": {
inputGlobs: ["package.json", "src/**"],
outputGlobs: ["oclif.manifest.json"],
},
"oclif readme": {
inputGlobs: ["package.json", "src/**"],
outputGlobs: ["README.md", "docs/**"],
},
"syncpack lint-semver-ranges": {
inputGlobs: [
"syncpack.config.cjs",
"package.json",
// release group packages; while ** is supported, it is very slow, so these entries capture all the levels we
// have packages at today. Once we can upgrade to a later version of
// globby things might be faster.
"{azure,examples,experimental,packages}/*/*/package.json",
"{azure,examples,experimental,packages}/*/*/*/package.json",
"{azure,examples,experimental,packages}/*/*/*/*/package.json",
"tools/markdown-magic/package.json",
],
outputGlobs: [
"package.json",
// release group packages
"{azure,examples,experimental,packages}/*/*/package.json",
"{azure,examples,experimental,packages}/*/*/*/package.json",
"{azure,examples,experimental,packages}/*/*/*/*/package.json",
"tools/markdown-magic/package.json",
],
gitignore: ["input", "output"],
},
"syncpack list-mismatches": {
inputGlobs: [
"syncpack.config.cjs",
"package.json",
// release group packages; while ** is supported, it is very slow, so these entries capture all the levels we
// have packages at today. Once we can upgrade to a later version of
// globby things might be faster.
"{azure,examples,experimental,packages}/*/*/package.json",
"{azure,examples,experimental,packages}/*/*/*/package.json",
"{azure,examples,experimental,packages}/*/*/*/*/package.json",
"tools/markdown-magic/package.json",
],
outputGlobs: [
"package.json",
// release group packages
"{azure,examples,experimental,packages}/*/*/package.json",
"{azure,examples,experimental,packages}/*/*/*/package.json",
"{azure,examples,experimental,packages}/*/*/*/*/package.json",
"tools/markdown-magic/package.json",
],
gitignore: ["input", "output"],
},
},
// This defines the layout of the repo for fluid-build. It applies to the whole repo.
repoPackages: {
// Release groups
"client": {
directory: "",
ignoredDirs: [],
defaultInterdependencyRange: "workspace:~",
},
"build-tools": {
directory: "build-tools",
},
"server": {
directory: "server/routerlicious",
},
"gitrest": {
directory: "server/gitrest",
},
"historian": {
directory: "server/historian",
},
// Independent packages
"build": "common/build",
"common-utils": "common/lib/common-utils",
"protocol-def": "common/lib/protocol-definitions",
// Tools
"tools": [
"tools/api-markdown-documenter",
"tools/benchmark",
"tools/getkeys",
"tools/test-tools",
],
},
// `flub check policy` config. It applies to the whole repo.
policy: {
// Entries here are COMPLETELY ignored by the policy checker. Instead of adding entries here, consider adding
// entries to the handlerExclusions list below to ignore a particular.
exclusions: [
// The paths below are for fluidframework.com layouts and code and are not subject to policy.
"docs/layouts/",
"docs/themes/thxvscode/assets/",
"docs/themes/thxvscode/layouts/",
"docs/themes/thxvscode/static/assets/",
// This file is a test file.
"tools/markdown-magic/test/package.json",
// Not a real package
"docs/api/",
// Source to output package.json files - not real packages
// These should only be files that are not in an pnpm workspace.
"common/build/build-common/src/cjs/package.json",
"common/build/build-common/src/esm/package.json",
"packages/framework/presence/src/cjs/package.json",
],
// Exclusion per handler
handlerExclusions: {
"extraneous-lockfiles": [
"tools/telemetry-generator/package-lock.json", // Workaround to allow version 2 while we move it to pnpm
],
"fluid-build-tasks-eslint": [
// eslint doesn't really depend on build. Doing so just slows down a package build.
"^packages/test/snapshots/package.json",
"^packages/test/test-utils/package.json",
// TODO: AB#7630 uses lint only ts projects for coverage which don't have representative tsc scripts
"^packages/tools/fluid-runner/package.json",
],
"fluid-build-tasks-tsc": [],
"html-copyright-file-header": [
// Tests generate HTML "snapshot" artifacts
"tools/api-markdown-documenter/src/test/snapshots/.*",
],
"js-ts-copyright-file-header": [
// These files all require a node shebang at the top of the file.
"azure/packages/azure-local-service/src/index.ts",
"experimental/PropertyDDS/packages/property-query/test/get_config.js",
"server/routerlicious/packages/tinylicious/src/index.ts",
// Type test files can be excluded since they're generated and known to have the correct header.
// This can be removed once the whole repo uses build-tools v0.35.0+.
/.*\/validate.*\.generated\.ts/,
],
"no-js-file-extensions": [
// PropertyDDS uses .js files which should be renamed eventually.
"experimental/PropertyDDS/.*",
"build-tools/packages/build-cli/bin/dev.js",
"build-tools/packages/build-cli/bin/run.js",
"build-tools/packages/build-cli/test/helpers/init.js",
"build-tools/packages/version-tools/bin/dev.js",
"build-tools/packages/version-tools/bin/run.js",
"common/build/build-common/gen_version.js",
"common/build/eslint-config-fluid/.*",
"common/lib/common-utils/jest-puppeteer.config.js",
"common/lib/common-utils/jest.config.js",
"common/build/eslint-plugin-fluid/.*",
"docs/api-markdown-documenter/.*",
"docs/api/fallback/index.js",
"docs/build-redirects.js",
"docs/download-apis.js",
"docs/local-api-rollup.js",
"docs/static/js/add-code-copy-button.js",
"examples/data-objects/monaco/loaders/blobUrl.js",
"examples/data-objects/monaco/loaders/compile.js",
"examples/service-clients/odsp-client/shared-tree-demo/tailwind.config.js",
"packages/test/mocha-test-setup/mocharc-common.js",
"packages/test/test-service-load/scripts/usePrereleaseDeps.js",
"packages/tools/devtools/devtools-browser-extension/test-setup.js",
"tools/changelog-generator-wrapper/src/getDependencyReleaseLine.js",
"tools/changelog-generator-wrapper/src/getReleaseLine.js",
"tools/changelog-generator-wrapper/src/index.js",
"tools/getkeys/index.js",
],
"npm-package-metadata-and-sorting": [
// The root package.json is not checked temporarily due to AB#8640
"^package.json",
],
"package-lockfiles-npm-version": [
"tools/telemetry-generator/package-lock.json", // Workaround to allow version 2 while we move it to pnpm
],
"npm-package-json-prettier": [
// This rule is temporarily disabled for all projects while we update the repo to use different formatting
".*",
],
"npm-package-json-scripts-args": [
// server/routerlicious and server/routerlicious/packages/routerlicious use
// linux only scripts that would require extra logic to validate properly.
// Ideally no packages would use OS specific scripts.
"^server/routerlicious/package.json",
"^server/routerlicious/packages/routerlicious/package.json",
],
"npm-package-json-script-clean": [
// eslint-config-fluid's build step generate printed configs that are checked in. No need to clean
"common/build/eslint-config-fluid/package.json",
// markdown-magic's build step update the README.md file that are checked in. No need to clean.
"tools/markdown-magic/package.json",
],
"npm-package-json-script-mocha-config": [
// these don't use mocha config for reporters yet.
"^server/",
"^build-tools/",
"^common/lib/common-utils/package.json",
],
"npm-package-json-test-scripts": [
"common/build/eslint-config-fluid/package.json",
"packages/test/mocha-test-setup/package.json",
"examples/apps/attributable-map/package.json",
],
"npm-package-json-test-scripts-split": [
"server/",
"tools/",
"package.json",
"packages/test/test-service-load/package.json",
"packages/tools/devtools/devtools-browser-extension/package.json",
"packages/tools/devtools/devtools-view/package.json",
],
"npm-package-exports-apis-linted": [
// Rollout suppressions - enable only after tools are updated to support policy
// as new build-tools will have the concurrently fluid-build support it uses.
"^common/",
// Packages that violate the API linting rules
// ae-missing-release-tags, ae-incompatible-release-tags
"^examples/data-objects/table-document/",
// AB#8147: ./test/EditLog export should be ./internal/... or tagged for support
"^experimental/dds/tree/",
// comments in api-extractor JSON files fail parsing - PR #22498 to fix
"^packages/framework/presence/",
// Packages with APIs that don't need strict API linting
"^build-tools/",
"^common/build/",
"^experimental/PropertyDDS/",
"^tools/api-markdown-documenter/",
],
// This handler will be rolled out slowly, so excluding most packages here while we roll it out.
"npm-package-exports-field": [
// We deliberately improperly import from deep in the package tree while we migrate everything into other
// packages. This is temporary and can be fixed once the build-tools/build-cli pigration is complete.
"^azure/",
"^build-tools/packages/build-tools/package.json",
"^common/",
"^examples/",
"^experimental/",
"^packages/",
"^server/",
"^tools/",
],
"npm-package-json-clean-script": [
"server/gitrest/package.json",
"server/historian/package.json",
// getKeys has a fake tsconfig.json to make ./eslintrc.cjs work, but we don't need clean script
"tools/getkeys/package.json",
// this package has a irregular build pattern, so our clean script rule doesn't apply.
"tools/markdown-magic/package.json",
// Docs directory breaks cleaning down into multiple scripts.
"docs/package.json",
],
"npm-strange-package-name": [
"server/gitrest/package.json",
"server/historian/package.json",
"package.json",
],
"npm-package-readmes": [
"server/gitrest/package.json",
"server/historian/package.json",
"package.json",
],
"npm-package-folder-name": [
"server/gitrest/package.json",
"server/historian/package.json",
"package.json",
],
"npm-package-json-script-dep": [],
"npm-package-license": [
// test packages
"^build-tools/packages/build-infrastructure/src/test/data/testRepo/",
],
"npm-private-packages": [
// test packages
"^build-tools/packages/build-infrastructure/src/test/data/testRepo/",
],
"pnpm-npm-package-json-preinstall": [
// test packages
"^build-tools/packages/build-infrastructure/src/test/data/testRepo/",
],
},
packageNames: {
// The allowed package scopes for the repo.
allowedScopes: [
"@fluidframework",
"@fluid-example",
"@fluid-experimental",
"@fluid-internal",
"@fluid-private",
"@fluid-tools",
],
// These packages are known unscoped packages.
unscopedPackages: ["fluid-framework", "fluidframework-docs", "tinylicious"],
mustPublish: {
// These packages will always be published to npm. This is called the "public" feed.
npm: [
"@fluidframework",
"fluid-framework",
"@fluid-internal/client-utils",
"@fluid-internal/mocha-test-setup",
"@fluid-internal/test-driver-definitions",
"tinylicious",
],
// A list of packages published to our internal-build feed. Note that packages published
// to npm will also be published to this feed. This should be a minimal set required for legacy compat of
// internal partners or internal CI requirements.
internalFeed: [
// TODO: We may not need to publish test packages to the internal feed, remove these exceptions if possible.
"@fluid-internal/test-service-load",
// Most examples should be private, but table-document needs to publish internally for legacy compat
"@fluid-example/table-document",
],
},
mayPublish: {
// These packages may be published to npm in some cases. Policy doesn't enforce this.
npm: ["@fluid-experimental", "@fluid-tools"],
// These packages may be published to the internal-build feed in some cases. Policy doesn't enforce this.
internalFeed: ["@fluid-internal", "@fluid-private"],
},
},
dependencies: {
// use by npm-package-json-script-dep policy
// A list of script commands and the package that contains the command
commandPackages: [
["api-extractor", "@microsoft/api-extractor"],
["attw", "@arethetypeswrong/cli"],
["biome", "@biomejs/biome"],
["c8", "c8"],
["concurrently", "concurrently"],
["copyfiles", "copyfiles"],
["cross-env", "cross-env"],
["depcruise", "dependency-cruiser"],
["eslint", "eslint"],
["flub", "@fluid-tools/build-cli"],
["fluid-build", "@fluidframework/build-tools"],
["gf", "good-fences"],
["mocha", "mocha"],
["nyc", "nyc"],
["oclif", "oclif"],
["prettier", "prettier"],
["rimraf", "rimraf"],
["tinylicious", "tinylicious"],
["ts2esm", "ts2esm"],
["tsc", "typescript"],
["webpack", "webpack"],
],
},
// These packages are independently versioned and released, but we use pnpm workspaces in single packages to work
// around nested pnpm workspace behavior. These packages are not checked for the preinstall script that standard
// pnpm workspaces should have.
pnpmSinglePackageWorkspace: [
"@fluid-private/changelog-generator-wrapper",
"@fluid-tools/api-markdown-documenter",
"@fluid-tools/benchmark",
"@fluid-tools/markdown-magic",
"@fluid-tools/telemetry-generator",
"@fluidframework/build-common",
"@fluidframework/common-utils",
"@fluidframework/eslint-config-fluid",
"@fluid-internal/eslint-plugin-fluid",
"@fluidframework/protocol-definitions",
"@fluidframework/test-tools",
"fluidframework-docs",
],
fluidBuildTasks: {
tsc: {
ignoreDevDependencies: ["@fluid-example/webpack-fluid-loader"],
ignoreTasks: [
// Outside of normal build and packages/dd/matrix version includes tsc
"bench:profile",
],
},
},
// Requirements applied to all `public` packages.
publicPackageRequirements: {
// The following scripts combined with npm-package-exports-apis-linted policy are all currently required
// to ensure api-extractor is run correctly in local builds and pipelines.
requiredScripts: [
// TODO: Add as a requirement once all packages have been updated to produce dual esm/commonjs builds
// {
// name: "api",
// body: "fluid-build . --task api",
// },
],
requiredDevDependencies: [],
},
},
assertTagging: {
enabledPaths: [
/^common\/lib\/common-utils/i,
/^experimental/i,
/^packages/i,
/^server\/routerlicious\/packages\/protocol-base/i,
],
assertionFunctions: {
assert: 1,
},
},
// `flub bump` config. These settings influence `flub bump` behavior for a release group. These settings can be
// overridden usig explicit CLI flags like `--interdependencyRange`.
bump: {
defaultInterdependencyRange: {
"client": "workspace:~",
"build-tools": "workspace:~",
"server": "workspace:~",
"gitrest": "^",
"historian": "^",
},
},
// This defines the branch release types for type tests. It applies only to the client release group. Settings for
// other release groups is in their root fluid-build config.
branchReleaseTypes: {
"main": "minor",
"lts": "minor",
"release/**": "patch",
"next": "major",
},
releaseNotes: {
sections: {
feature: { heading: "✨ New Features" },
tree: { heading: "🌳 SharedTree DDS Changes" },
fix: { heading: "🐛 Bug Fixes" },
deprecation: { heading: "⚠️ Deprecations" },
legacy: { heading: "Legacy API Changes" },
other: { heading: "Other Changes" },
},
},
// This setting influence `flub release report` behavior. This defines the legacy compat range for release group or independent packages.
releaseReport: {
legacyCompatInterval: {
"client": 10,
},
},
};