projen 0.61.14 โ†’ 0.61.15

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 (150) hide show
  1. package/.jsii +303 -27
  2. package/docs/api/API.md +165 -0
  3. package/docs/escape-hatches.md +3 -3
  4. package/lib/awscdk/auto-discover.js +5 -5
  5. package/lib/awscdk/awscdk-app-java.js +1 -1
  6. package/lib/awscdk/awscdk-app-py.js +1 -1
  7. package/lib/awscdk/awscdk-app-ts.js +1 -1
  8. package/lib/awscdk/awscdk-construct.js +2 -2
  9. package/lib/awscdk/awscdk-deps-java.js +1 -1
  10. package/lib/awscdk/awscdk-deps-js.js +1 -1
  11. package/lib/awscdk/awscdk-deps.js +1 -1
  12. package/lib/awscdk/cdk-config.js +1 -1
  13. package/lib/awscdk/cdk-tasks.js +1 -1
  14. package/lib/awscdk/integration-test.js +1 -1
  15. package/lib/awscdk/lambda-extension.js +1 -1
  16. package/lib/awscdk/lambda-function.js +2 -2
  17. package/lib/build/build-workflow.js +1 -1
  18. package/lib/cdk/auto-discover-base.js +2 -2
  19. package/lib/cdk/construct-lib.js +1 -1
  20. package/lib/cdk/integration-test-base.js +1 -1
  21. package/lib/cdk/jsii-docgen.js +1 -1
  22. package/lib/cdk/jsii-project.js +1 -1
  23. package/lib/cdk8s/auto-discover.js +2 -2
  24. package/lib/cdk8s/cdk8s-app-py.js +1 -1
  25. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  26. package/lib/cdk8s/cdk8s-construct.js +1 -1
  27. package/lib/cdk8s/cdk8s-deps-py.js +1 -1
  28. package/lib/cdk8s/cdk8s-deps.js +1 -1
  29. package/lib/cdk8s/integration-test.js +1 -1
  30. package/lib/cdktf/cdktf-construct.js +1 -1
  31. package/lib/circleci/circleci.js +1 -1
  32. package/lib/component.js +1 -1
  33. package/lib/dependencies.js +1 -1
  34. package/lib/dev-env.js +1 -1
  35. package/lib/docker-compose.js +2 -2
  36. package/lib/file.js +1 -1
  37. package/lib/gitattributes.js +1 -1
  38. package/lib/github/auto-approve.js +1 -1
  39. package/lib/github/auto-merge.js +1 -1
  40. package/lib/github/dependabot.js +1 -1
  41. package/lib/github/github-credentials.js +1 -1
  42. package/lib/github/github-project.js +1 -1
  43. package/lib/github/github.js +1 -1
  44. package/lib/github/mergify.js +1 -1
  45. package/lib/github/pr-template.js +1 -1
  46. package/lib/github/pull-request-lint.js +1 -1
  47. package/lib/github/stale.js +1 -1
  48. package/lib/github/task-workflow.js +1 -1
  49. package/lib/github/workflows.js +1 -1
  50. package/lib/gitlab/configuration.js +1 -1
  51. package/lib/gitlab/gitlab-configuration.js +1 -1
  52. package/lib/gitlab/nested-configuration.js +1 -1
  53. package/lib/gitpod.js +1 -1
  54. package/lib/ignore-file.js +1 -1
  55. package/lib/index.d.ts +1 -0
  56. package/lib/index.js +2 -1
  57. package/lib/ini.js +1 -1
  58. package/lib/java/java-project.js +1 -1
  59. package/lib/java/junit.js +1 -1
  60. package/lib/java/maven-compile.js +1 -1
  61. package/lib/java/maven-packaging.js +1 -1
  62. package/lib/java/maven-sample.js +1 -1
  63. package/lib/java/pom.js +1 -1
  64. package/lib/java/projenrc.js +1 -1
  65. package/lib/javascript/bundler.js +1 -1
  66. package/lib/javascript/eslint.js +1 -1
  67. package/lib/javascript/jest.js +1 -1
  68. package/lib/javascript/node-package.js +1 -1
  69. package/lib/javascript/node-project.js +1 -1
  70. package/lib/javascript/npm-config.js +1 -1
  71. package/lib/javascript/prettier.js +1 -1
  72. package/lib/javascript/projenrc.js +1 -1
  73. package/lib/javascript/typescript-config.js +1 -1
  74. package/lib/javascript/upgrade-dependencies.js +2 -2
  75. package/lib/json-patch.d.ts +75 -0
  76. package/lib/json-patch.js +105 -0
  77. package/lib/json.js +1 -1
  78. package/lib/license.js +1 -1
  79. package/lib/logger.js +1 -1
  80. package/lib/makefile.js +1 -1
  81. package/lib/object-file.d.ts +36 -0
  82. package/lib/object-file.js +39 -3
  83. package/lib/project-build.js +1 -1
  84. package/lib/project.js +1 -1
  85. package/lib/projects.js +1 -1
  86. package/lib/projenrc-json.js +1 -1
  87. package/lib/python/pip.js +1 -1
  88. package/lib/python/poetry.js +2 -2
  89. package/lib/python/projenrc.js +1 -1
  90. package/lib/python/pytest-sample.js +1 -1
  91. package/lib/python/pytest.js +1 -1
  92. package/lib/python/python-project.js +1 -1
  93. package/lib/python/python-sample.js +1 -1
  94. package/lib/python/requirements-file.js +1 -1
  95. package/lib/python/setuppy.js +1 -1
  96. package/lib/python/setuptools.js +1 -1
  97. package/lib/python/venv.js +1 -1
  98. package/lib/readme.js +1 -1
  99. package/lib/release/publisher.js +1 -1
  100. package/lib/release/release-trigger.js +1 -1
  101. package/lib/release/release.js +1 -1
  102. package/lib/renovatebot.js +1 -1
  103. package/lib/run-task.js +1833 -0
  104. package/lib/sample-file.js +2 -2
  105. package/lib/semver.js +1 -1
  106. package/lib/source-code.js +1 -1
  107. package/lib/task-runtime.js +1 -1
  108. package/lib/task.js +1 -1
  109. package/lib/tasks.js +1 -1
  110. package/lib/testing.js +1 -1
  111. package/lib/textfile.js +1 -1
  112. package/lib/toml.js +1 -1
  113. package/lib/typescript/projenrc.js +1 -1
  114. package/lib/typescript/typescript-typedoc.js +1 -1
  115. package/lib/typescript/typescript.js +3 -3
  116. package/lib/version.js +1 -1
  117. package/lib/vscode/devcontainer.js +1 -1
  118. package/lib/vscode/launch-config.js +1 -1
  119. package/lib/vscode/vscode.js +1 -1
  120. package/lib/web/next.js +3 -3
  121. package/lib/web/postcss.js +1 -1
  122. package/lib/web/react.js +4 -4
  123. package/lib/web/tailwind.js +1 -1
  124. package/lib/xmlfile.js +1 -1
  125. package/lib/yaml.js +1 -1
  126. package/node_modules/fast-json-patch/LICENSE.txt +22 -0
  127. package/node_modules/fast-json-patch/README.md +428 -0
  128. package/node_modules/fast-json-patch/commonjs/core.d.ts +111 -0
  129. package/node_modules/fast-json-patch/commonjs/core.js +441 -0
  130. package/node_modules/fast-json-patch/commonjs/duplex.d.ts +23 -0
  131. package/node_modules/fast-json-patch/commonjs/duplex.js +181 -0
  132. package/node_modules/fast-json-patch/commonjs/helpers.d.ts +41 -0
  133. package/node_modules/fast-json-patch/commonjs/helpers.js +181 -0
  134. package/node_modules/fast-json-patch/dist/fast-json-patch.js +928 -0
  135. package/node_modules/fast-json-patch/dist/fast-json-patch.min.js +14 -0
  136. package/node_modules/fast-json-patch/index.d.ts +34 -0
  137. package/node_modules/fast-json-patch/index.js +11 -0
  138. package/node_modules/fast-json-patch/index.mjs +29 -0
  139. package/node_modules/fast-json-patch/index.ts +31 -0
  140. package/node_modules/fast-json-patch/jasmine-run.mjs +23 -0
  141. package/node_modules/fast-json-patch/module/core.d.ts +111 -0
  142. package/node_modules/fast-json-patch/module/core.mjs +433 -0
  143. package/node_modules/fast-json-patch/module/duplex.d.ts +23 -0
  144. package/node_modules/fast-json-patch/module/duplex.mjs +176 -0
  145. package/node_modules/fast-json-patch/module/helpers.d.ts +41 -0
  146. package/node_modules/fast-json-patch/module/helpers.mjs +171 -0
  147. package/node_modules/fast-json-patch/package.json +65 -0
  148. package/node_modules/fast-json-patch/tsc-to-mjs.sh +10 -0
  149. package/node_modules/fast-json-patch/webpack.config.js +63 -0
  150. package/package.json +3 -1
package/.jsii CHANGED
@@ -15,6 +15,7 @@
15
15
  "case": "^1.6.3",
16
16
  "chalk": "^4.1.2",
17
17
  "conventional-changelog-config-spec": "^2.1.0",
18
+ "fast-json-patch": "^3.1.1",
18
19
  "fs-extra": "^9.1.0",
19
20
  "glob": "^7",
20
21
  "ini": "^2.0.0",
@@ -61,49 +62,49 @@
61
62
  "projen.awscdk": {
62
63
  "locationInModule": {
63
64
  "filename": "src/index.ts",
64
- "line": 47
65
+ "line": 48
65
66
  },
66
67
  "symbolId": "src/awscdk/index:"
67
68
  },
68
69
  "projen.build": {
69
70
  "locationInModule": {
70
71
  "filename": "src/index.ts",
71
- "line": 51
72
+ "line": 52
72
73
  },
73
74
  "symbolId": "src/build/index:"
74
75
  },
75
76
  "projen.cdk": {
76
77
  "locationInModule": {
77
78
  "filename": "src/index.ts",
78
- "line": 50
79
+ "line": 51
79
80
  },
80
81
  "symbolId": "src/cdk/index:"
81
82
  },
82
83
  "projen.cdk8s": {
83
84
  "locationInModule": {
84
85
  "filename": "src/index.ts",
85
- "line": 48
86
+ "line": 49
86
87
  },
87
88
  "symbolId": "src/cdk8s/index:"
88
89
  },
89
90
  "projen.cdktf": {
90
91
  "locationInModule": {
91
92
  "filename": "src/index.ts",
92
- "line": 49
93
+ "line": 50
93
94
  },
94
95
  "symbolId": "src/cdktf/index:"
95
96
  },
96
97
  "projen.circleci": {
97
98
  "locationInModule": {
98
99
  "filename": "src/index.ts",
99
- "line": 40
100
+ "line": 41
100
101
  },
101
102
  "symbolId": "src/circleci/index:"
102
103
  },
103
104
  "projen.github": {
104
105
  "locationInModule": {
105
106
  "filename": "src/index.ts",
106
- "line": 38
107
+ "line": 39
107
108
  },
108
109
  "symbolId": "src/github/index:"
109
110
  },
@@ -117,56 +118,56 @@
117
118
  "projen.gitlab": {
118
119
  "locationInModule": {
119
120
  "filename": "src/index.ts",
120
- "line": 39
121
+ "line": 40
121
122
  },
122
123
  "symbolId": "src/gitlab/index:"
123
124
  },
124
125
  "projen.java": {
125
126
  "locationInModule": {
126
127
  "filename": "src/index.ts",
127
- "line": 42
128
+ "line": 43
128
129
  },
129
130
  "symbolId": "src/java/index:"
130
131
  },
131
132
  "projen.javascript": {
132
133
  "locationInModule": {
133
134
  "filename": "src/index.ts",
134
- "line": 45
135
+ "line": 46
135
136
  },
136
137
  "symbolId": "src/javascript/index:"
137
138
  },
138
139
  "projen.python": {
139
140
  "locationInModule": {
140
141
  "filename": "src/index.ts",
141
- "line": 43
142
+ "line": 44
142
143
  },
143
144
  "symbolId": "src/python/index:"
144
145
  },
145
146
  "projen.release": {
146
147
  "locationInModule": {
147
148
  "filename": "src/index.ts",
148
- "line": 46
149
+ "line": 47
149
150
  },
150
151
  "symbolId": "src/release/index:"
151
152
  },
152
153
  "projen.typescript": {
153
154
  "locationInModule": {
154
155
  "filename": "src/index.ts",
155
- "line": 44
156
+ "line": 45
156
157
  },
157
158
  "symbolId": "src/typescript/index:"
158
159
  },
159
160
  "projen.vscode": {
160
161
  "locationInModule": {
161
162
  "filename": "src/index.ts",
162
- "line": 41
163
+ "line": 42
163
164
  },
164
165
  "symbolId": "src/vscode/index:"
165
166
  },
166
167
  "projen.web": {
167
168
  "locationInModule": {
168
169
  "filename": "src/index.ts",
169
- "line": 37
170
+ "line": 38
170
171
  },
171
172
  "symbolId": "src/web/index:"
172
173
  }
@@ -4289,6 +4290,256 @@
4289
4290
  ],
4290
4291
  "symbolId": "src/json:JsonFileOptions"
4291
4292
  },
4293
+ "projen.JsonPatch": {
4294
+ "assembly": "projen",
4295
+ "docs": {
4296
+ "example": "const output = JsonPatch.apply(input,\n JsonPatch.replace('/world/hi/there', 'goodbye'),\n JsonPatch.add('/world/foo/', 'boom'),\n JsonPatch.remove('/hello'));",
4297
+ "remarks": "Use the the `JsonPatch.apply(doc, ...ops)` function to apply a set of\noperations to a JSON document and return the result.\n\nOperations can be created using the factory methods `JsonPatch.add()`,\n`JsonPatch.remove()`, etc.",
4298
+ "stability": "experimental",
4299
+ "summary": "Utility for applying RFC-6902 JSON-Patch to a document."
4300
+ },
4301
+ "fqn": "projen.JsonPatch",
4302
+ "kind": "class",
4303
+ "locationInModule": {
4304
+ "filename": "src/json-patch.ts",
4305
+ "line": 22
4306
+ },
4307
+ "methods": [
4308
+ {
4309
+ "docs": {
4310
+ "example": "JsonPatch.add('/biscuits/1', { \"name\": \"Ginger Nut\" })",
4311
+ "remarks": "In the case of an\narray, the value is inserted before the given index. The - character can be\nused instead of an index to insert at the end of an array.",
4312
+ "stability": "experimental",
4313
+ "summary": "Adds a value to an object or inserts it into an array."
4314
+ },
4315
+ "locationInModule": {
4316
+ "filename": "src/json-patch.ts",
4317
+ "line": 44
4318
+ },
4319
+ "name": "add",
4320
+ "parameters": [
4321
+ {
4322
+ "name": "path",
4323
+ "type": {
4324
+ "primitive": "string"
4325
+ }
4326
+ },
4327
+ {
4328
+ "name": "value",
4329
+ "type": {
4330
+ "primitive": "any"
4331
+ }
4332
+ }
4333
+ ],
4334
+ "returns": {
4335
+ "type": {
4336
+ "fqn": "projen.JsonPatch"
4337
+ }
4338
+ },
4339
+ "static": true
4340
+ },
4341
+ {
4342
+ "docs": {
4343
+ "returns": "The result document",
4344
+ "stability": "experimental",
4345
+ "summary": "Applies a set of JSON-Patch (RFC-6902) operations to `document` and returns the result."
4346
+ },
4347
+ "locationInModule": {
4348
+ "filename": "src/json-patch.ts",
4349
+ "line": 29
4350
+ },
4351
+ "name": "apply",
4352
+ "parameters": [
4353
+ {
4354
+ "docs": {
4355
+ "summary": "The document to patch."
4356
+ },
4357
+ "name": "document",
4358
+ "type": {
4359
+ "primitive": "any"
4360
+ }
4361
+ },
4362
+ {
4363
+ "docs": {
4364
+ "summary": "The operations to apply."
4365
+ },
4366
+ "name": "ops",
4367
+ "type": {
4368
+ "fqn": "projen.JsonPatch"
4369
+ },
4370
+ "variadic": true
4371
+ }
4372
+ ],
4373
+ "returns": {
4374
+ "type": {
4375
+ "primitive": "any"
4376
+ }
4377
+ },
4378
+ "static": true,
4379
+ "variadic": true
4380
+ },
4381
+ {
4382
+ "docs": {
4383
+ "example": "JsonPatch.copy('/biscuits/0', '/best_biscuit')",
4384
+ "remarks": "Both\nfrom and path are JSON Pointers.",
4385
+ "stability": "experimental",
4386
+ "summary": "Copies a value from one location to another within the JSON document."
4387
+ },
4388
+ "locationInModule": {
4389
+ "filename": "src/json-patch.ts",
4390
+ "line": 73
4391
+ },
4392
+ "name": "copy",
4393
+ "parameters": [
4394
+ {
4395
+ "name": "from",
4396
+ "type": {
4397
+ "primitive": "string"
4398
+ }
4399
+ },
4400
+ {
4401
+ "name": "path",
4402
+ "type": {
4403
+ "primitive": "string"
4404
+ }
4405
+ }
4406
+ ],
4407
+ "returns": {
4408
+ "type": {
4409
+ "fqn": "projen.JsonPatch"
4410
+ }
4411
+ },
4412
+ "static": true
4413
+ },
4414
+ {
4415
+ "docs": {
4416
+ "example": "JsonPatch.move('/biscuits', '/cookies')",
4417
+ "remarks": "Both from and path are JSON Pointers.",
4418
+ "stability": "experimental",
4419
+ "summary": "Moves a value from one location to the other."
4420
+ },
4421
+ "locationInModule": {
4422
+ "filename": "src/json-patch.ts",
4423
+ "line": 82
4424
+ },
4425
+ "name": "move",
4426
+ "parameters": [
4427
+ {
4428
+ "name": "from",
4429
+ "type": {
4430
+ "primitive": "string"
4431
+ }
4432
+ },
4433
+ {
4434
+ "name": "path",
4435
+ "type": {
4436
+ "primitive": "string"
4437
+ }
4438
+ }
4439
+ ],
4440
+ "returns": {
4441
+ "type": {
4442
+ "fqn": "projen.JsonPatch"
4443
+ }
4444
+ },
4445
+ "static": true
4446
+ },
4447
+ {
4448
+ "docs": {
4449
+ "example": "JsonPatch.remove('/biscuits/0')",
4450
+ "stability": "experimental",
4451
+ "summary": "Removes a value from an object or array."
4452
+ },
4453
+ "locationInModule": {
4454
+ "filename": "src/json-patch.ts",
4455
+ "line": 54
4456
+ },
4457
+ "name": "remove",
4458
+ "parameters": [
4459
+ {
4460
+ "name": "path",
4461
+ "type": {
4462
+ "primitive": "string"
4463
+ }
4464
+ }
4465
+ ],
4466
+ "returns": {
4467
+ "type": {
4468
+ "fqn": "projen.JsonPatch"
4469
+ }
4470
+ },
4471
+ "static": true
4472
+ },
4473
+ {
4474
+ "docs": {
4475
+ "example": "JsonPatch.replace('/biscuits/0/name', 'Chocolate Digestive')",
4476
+ "remarks": "Equivalent to a โ€œremoveโ€ followed by an โ€œaddโ€.",
4477
+ "stability": "experimental",
4478
+ "summary": "Replaces a value."
4479
+ },
4480
+ "locationInModule": {
4481
+ "filename": "src/json-patch.ts",
4482
+ "line": 63
4483
+ },
4484
+ "name": "replace",
4485
+ "parameters": [
4486
+ {
4487
+ "name": "path",
4488
+ "type": {
4489
+ "primitive": "string"
4490
+ }
4491
+ },
4492
+ {
4493
+ "name": "value",
4494
+ "type": {
4495
+ "primitive": "any"
4496
+ }
4497
+ }
4498
+ ],
4499
+ "returns": {
4500
+ "type": {
4501
+ "fqn": "projen.JsonPatch"
4502
+ }
4503
+ },
4504
+ "static": true
4505
+ },
4506
+ {
4507
+ "docs": {
4508
+ "example": "JsonPatch.test('/best_biscuit/name', 'Choco Leibniz')",
4509
+ "remarks": "If the test fails,\nthen the patch as a whole should not apply.",
4510
+ "stability": "experimental",
4511
+ "summary": "Tests that the specified value is set in the document."
4512
+ },
4513
+ "locationInModule": {
4514
+ "filename": "src/json-patch.ts",
4515
+ "line": 92
4516
+ },
4517
+ "name": "test",
4518
+ "parameters": [
4519
+ {
4520
+ "name": "path",
4521
+ "type": {
4522
+ "primitive": "string"
4523
+ }
4524
+ },
4525
+ {
4526
+ "name": "value",
4527
+ "type": {
4528
+ "primitive": "any"
4529
+ }
4530
+ }
4531
+ ],
4532
+ "returns": {
4533
+ "type": {
4534
+ "fqn": "projen.JsonPatch"
4535
+ }
4536
+ },
4537
+ "static": true
4538
+ }
4539
+ ],
4540
+ "name": "JsonPatch",
4541
+ "symbolId": "src/json-patch:JsonPatch"
4542
+ },
4292
4543
  "projen.License": {
4293
4544
  "assembly": "projen",
4294
4545
  "base": "projen.FileBase",
@@ -5011,7 +5262,7 @@
5011
5262
  },
5012
5263
  "locationInModule": {
5013
5264
  "filename": "src/object-file.ts",
5014
- "line": 44
5265
+ "line": 50
5015
5266
  },
5016
5267
  "parameters": [
5017
5268
  {
@@ -5037,7 +5288,7 @@
5037
5288
  "kind": "class",
5038
5289
  "locationInModule": {
5039
5290
  "filename": "src/object-file.ts",
5040
- "line": 27
5291
+ "line": 28
5041
5292
  },
5042
5293
  "methods": [
5043
5294
  {
@@ -5047,7 +5298,7 @@
5047
5298
  },
5048
5299
  "locationInModule": {
5049
5300
  "filename": "src/object-file.ts",
5050
- "line": 181
5301
+ "line": 222
5051
5302
  },
5052
5303
  "name": "addDeletionOverride",
5053
5304
  "parameters": [
@@ -5070,7 +5321,7 @@
5070
5321
  },
5071
5322
  "locationInModule": {
5072
5323
  "filename": "src/object-file.ts",
5073
- "line": 86
5324
+ "line": 93
5074
5325
  },
5075
5326
  "name": "addOverride",
5076
5327
  "parameters": [
@@ -5104,7 +5355,7 @@
5104
5355
  },
5105
5356
  "locationInModule": {
5106
5357
  "filename": "src/object-file.ts",
5107
- "line": 149
5358
+ "line": 156
5108
5359
  },
5109
5360
  "name": "addToArray",
5110
5361
  "parameters": [
@@ -5132,6 +5383,31 @@
5132
5383
  ],
5133
5384
  "variadic": true
5134
5385
  },
5386
+ {
5387
+ "docs": {
5388
+ "remarks": "For example, with the following object file\n```json\n\"compilerOptions\": {\n \"exclude\": [\"node_modules\"],\n \"lib\": [\"es2019\"]\n ...\n}\n...\n```\n\n```typescript\nproject.tsconfig.file.patch(JsonPatch.add(\"/compilerOptions/exclude/-\", \"coverage\"));\nproject.tsconfig.file.patch(JsonPatch.replace(\"/compilerOptions/lib\", [\"dom\", \"dom.iterable\", \"esnext\"]));\n```\nwould result in the following object file\n```json\n\"compilerOptions\": {\n \"exclude\": [\"node_modules\", \"coverage\"],\n \"lib\": [\"dom\", \"dom.iterable\", \"esnext\"]\n ...\n}\n...\n```",
5389
+ "stability": "experimental",
5390
+ "summary": "Applies an RFC 6902 JSON-patch to the synthesized object file. See https://datatracker.ietf.org/doc/html/rfc6902 for more information."
5391
+ },
5392
+ "locationInModule": {
5393
+ "filename": "src/object-file.ts",
5394
+ "line": 214
5395
+ },
5396
+ "name": "patch",
5397
+ "parameters": [
5398
+ {
5399
+ "docs": {
5400
+ "summary": "- The patch operations to apply."
5401
+ },
5402
+ "name": "patches",
5403
+ "type": {
5404
+ "fqn": "projen.JsonPatch"
5405
+ },
5406
+ "variadic": true
5407
+ }
5408
+ ],
5409
+ "variadic": true
5410
+ },
5135
5411
  {
5136
5412
  "docs": {
5137
5413
  "stability": "experimental",
@@ -5139,7 +5415,7 @@
5139
5415
  },
5140
5416
  "locationInModule": {
5141
5417
  "filename": "src/object-file.ts",
5142
- "line": 185
5418
+ "line": 226
5143
5419
  },
5144
5420
  "name": "synthesizeContent",
5145
5421
  "overrides": "projen.FileBase",
@@ -5170,7 +5446,7 @@
5170
5446
  "immutable": true,
5171
5447
  "locationInModule": {
5172
5448
  "filename": "src/object-file.ts",
5173
- "line": 42
5449
+ "line": 43
5174
5450
  },
5175
5451
  "name": "omitEmpty",
5176
5452
  "type": {
@@ -5194,7 +5470,7 @@
5194
5470
  "kind": "interface",
5195
5471
  "locationInModule": {
5196
5472
  "filename": "src/object-file.ts",
5197
- "line": 8
5473
+ "line": 9
5198
5474
  },
5199
5475
  "name": "ObjectFileOptions",
5200
5476
  "properties": [
@@ -5209,7 +5485,7 @@
5209
5485
  "immutable": true,
5210
5486
  "locationInModule": {
5211
5487
  "filename": "src/object-file.ts",
5212
- "line": 15
5488
+ "line": 16
5213
5489
  },
5214
5490
  "name": "obj",
5215
5491
  "optional": true,
@@ -5227,7 +5503,7 @@
5227
5503
  "immutable": true,
5228
5504
  "locationInModule": {
5229
5505
  "filename": "src/object-file.ts",
5230
- "line": 21
5506
+ "line": 22
5231
5507
  },
5232
5508
  "name": "omitEmpty",
5233
5509
  "optional": true,
@@ -48957,6 +49233,6 @@
48957
49233
  "symbolId": "src/web/tailwind:TailwindConfigOptions"
48958
49234
  }
48959
49235
  },
48960
- "version": "0.61.14",
48961
- "fingerprint": "EhrSKh0kx94eNeQlgUZitYQmCXUnx1Ndle7Z6d0LXnw="
49236
+ "version": "0.61.15",
49237
+ "fingerprint": "5y14ikbHdek9YTEDc7wOytRDacO9tp5lNx2XNY2SzN0="
48962
49238
  }
package/docs/api/API.md CHANGED
@@ -15,6 +15,7 @@ Name|Description
15
15
  [IgnoreFile](#projen-ignorefile)|*No description*
16
16
  [IniFile](#projen-inifile)|Represents an INI file.
17
17
  [JsonFile](#projen-jsonfile)|Represents a JSON file.
18
+ [JsonPatch](#projen-jsonpatch)|Utility for applying RFC-6902 JSON-Patch to a document.
18
19
  [License](#projen-license)|*No description*
19
20
  [Logger](#projen-logger)|Project-level logging utilities.
20
21
  [Makefile](#projen-makefile)|Minimal Makefile.
@@ -1347,6 +1348,133 @@ __Returns__:
1347
1348
 
1348
1349
 
1349
1350
 
1351
+ ## class JsonPatch ๐Ÿ”น <a id="projen-jsonpatch"></a>
1352
+
1353
+ Utility for applying RFC-6902 JSON-Patch to a document.
1354
+
1355
+ Use the the `JsonPatch.apply(doc, ...ops)` function to apply a set of
1356
+ operations to a JSON document and return the result.
1357
+
1358
+ Operations can be created using the factory methods `JsonPatch.add()`,
1359
+ `JsonPatch.remove()`, etc.
1360
+
1361
+
1362
+ ### Methods
1363
+
1364
+
1365
+ #### *static* add(path, value)๐Ÿ”น <a id="projen-jsonpatch-add"></a>
1366
+
1367
+ Adds a value to an object or inserts it into an array.
1368
+
1369
+ In the case of an
1370
+ array, the value is inserted before the given index. The - character can be
1371
+ used instead of an index to insert at the end of an array.
1372
+
1373
+ ```ts
1374
+ static add(path: string, value: any): JsonPatch
1375
+ ```
1376
+
1377
+ * **path** (<code>string</code>) *No description*
1378
+ * **value** (<code>any</code>) *No description*
1379
+
1380
+ __Returns__:
1381
+ * <code>[JsonPatch](#projen-jsonpatch)</code>
1382
+
1383
+ #### *static* apply(document, ...ops)๐Ÿ”น <a id="projen-jsonpatch-apply"></a>
1384
+
1385
+ Applies a set of JSON-Patch (RFC-6902) operations to `document` and returns the result.
1386
+
1387
+ ```ts
1388
+ static apply(document: any, ...ops: JsonPatch[]): any
1389
+ ```
1390
+
1391
+ * **document** (<code>any</code>) The document to patch.
1392
+ * **ops** (<code>[JsonPatch](#projen-jsonpatch)</code>) The operations to apply.
1393
+
1394
+ __Returns__:
1395
+ * <code>any</code>
1396
+
1397
+ #### *static* copy(from, path)๐Ÿ”น <a id="projen-jsonpatch-copy"></a>
1398
+
1399
+ Copies a value from one location to another within the JSON document.
1400
+
1401
+ Both
1402
+ from and path are JSON Pointers.
1403
+
1404
+ ```ts
1405
+ static copy(from: string, path: string): JsonPatch
1406
+ ```
1407
+
1408
+ * **from** (<code>string</code>) *No description*
1409
+ * **path** (<code>string</code>) *No description*
1410
+
1411
+ __Returns__:
1412
+ * <code>[JsonPatch](#projen-jsonpatch)</code>
1413
+
1414
+ #### *static* move(from, path)๐Ÿ”น <a id="projen-jsonpatch-move"></a>
1415
+
1416
+ Moves a value from one location to the other.
1417
+
1418
+ Both from and path are JSON Pointers.
1419
+
1420
+ ```ts
1421
+ static move(from: string, path: string): JsonPatch
1422
+ ```
1423
+
1424
+ * **from** (<code>string</code>) *No description*
1425
+ * **path** (<code>string</code>) *No description*
1426
+
1427
+ __Returns__:
1428
+ * <code>[JsonPatch](#projen-jsonpatch)</code>
1429
+
1430
+ #### *static* remove(path)๐Ÿ”น <a id="projen-jsonpatch-remove"></a>
1431
+
1432
+ Removes a value from an object or array.
1433
+
1434
+ ```ts
1435
+ static remove(path: string): JsonPatch
1436
+ ```
1437
+
1438
+ * **path** (<code>string</code>) *No description*
1439
+
1440
+ __Returns__:
1441
+ * <code>[JsonPatch](#projen-jsonpatch)</code>
1442
+
1443
+ #### *static* replace(path, value)๐Ÿ”น <a id="projen-jsonpatch-replace"></a>
1444
+
1445
+ Replaces a value.
1446
+
1447
+ Equivalent to a โ€œremoveโ€ followed by an โ€œaddโ€.
1448
+
1449
+ ```ts
1450
+ static replace(path: string, value: any): JsonPatch
1451
+ ```
1452
+
1453
+ * **path** (<code>string</code>) *No description*
1454
+ * **value** (<code>any</code>) *No description*
1455
+
1456
+ __Returns__:
1457
+ * <code>[JsonPatch](#projen-jsonpatch)</code>
1458
+
1459
+ #### *static* test(path, value)๐Ÿ”น <a id="projen-jsonpatch-test"></a>
1460
+
1461
+ Tests that the specified value is set in the document.
1462
+
1463
+ If the test fails,
1464
+ then the patch as a whole should not apply.
1465
+
1466
+ ```ts
1467
+ static test(path: string, value: any): JsonPatch
1468
+ ```
1469
+
1470
+ * **path** (<code>string</code>) *No description*
1471
+ * **value** (<code>any</code>) *No description*
1472
+
1473
+ __Returns__:
1474
+ * <code>[JsonPatch](#projen-jsonpatch)</code>
1475
+
1476
+
1477
+
1350
1478
  ## class License ๐Ÿ”น <a id="projen-license"></a>
1351
1479
 
1352
1480
 
@@ -1746,6 +1874,43 @@ addToArray(path: string, ...values: any[]): void
1746
1874
 
1747
1875
 
1748
1876
 
1877
+ #### patch(...patches)๐Ÿ”น <a id="projen-objectfile-patch"></a>
1878
+
1879
+ Applies an RFC 6902 JSON-patch to the synthesized object file. See https://datatracker.ietf.org/doc/html/rfc6902 for more information.
1880
+
1881
+ For example, with the following object file
1882
+ ```json
1883
+ "compilerOptions": {
1884
+ "exclude": ["node_modules"],
1885
+ "lib": ["es2019"]
1886
+ ...
1887
+ }
1888
+ ...
1889
+ ```
1890
+
1891
+ ```typescript
1892
+ project.tsconfig.file.patch(JsonPatch.add("/compilerOptions/exclude/-", "coverage"));
1893
+ project.tsconfig.file.patch(JsonPatch.replace("/compilerOptions/lib", ["dom", "dom.iterable", "esnext"]));
1894
+ ```
1895
+ would result in the following object file
1896
+ ```json
1897
+ "compilerOptions": {
1898
+ "exclude": ["node_modules", "coverage"],
1899
+ "lib": ["dom", "dom.iterable", "esnext"]
1900
+ ...
1901
+ }
1902
+ ...
1903
+ ```
1904
+
1905
+ ```ts
1906
+ patch(...patches: JsonPatch[]): void
1907
+ ```
1908
+
1909
+ * **patches** (<code>[JsonPatch](#projen-jsonpatch)</code>) - The patch operations to apply.
1910
+
1911
+
1912
+
1913
+
1749
1914
  #### protected synthesizeContent(resolver)๐Ÿ”น <a id="projen-objectfile-synthesizecontent"></a>
1750
1915
 
1751
1916
  Implemented by derived classes and returns the contents of the file to emit.