projen 0.101.6 → 0.101.8

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 (153) hide show
  1. package/.jsii +5063 -398
  2. package/lib/ai-instructions.js +2 -2
  3. package/lib/awscdk/auto-discover.js +6 -6
  4. package/lib/awscdk/awscdk-app-java.js +1 -1
  5. package/lib/awscdk/awscdk-app-py.js +1 -1
  6. package/lib/awscdk/awscdk-app-ts.js +1 -1
  7. package/lib/awscdk/awscdk-construct.js +1 -1
  8. package/lib/awscdk/awscdk-deps-java.js +1 -1
  9. package/lib/awscdk/awscdk-deps-js.js +1 -1
  10. package/lib/awscdk/awscdk-deps-py.js +1 -1
  11. package/lib/awscdk/awscdk-deps.js +1 -1
  12. package/lib/awscdk/cdk-config.js +3 -3
  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-build.js +1 -1
  22. package/lib/cdk/jsii-docgen.js +1 -1
  23. package/lib/cdk/jsii-project.js +1 -1
  24. package/lib/cdk8s/auto-discover.js +2 -2
  25. package/lib/cdk8s/cdk8s-app-py.js +1 -1
  26. package/lib/cdk8s/cdk8s-app-ts.js +1 -1
  27. package/lib/cdk8s/cdk8s-construct.js +1 -1
  28. package/lib/cdk8s/cdk8s-deps-py.js +1 -1
  29. package/lib/cdk8s/cdk8s-deps.js +1 -1
  30. package/lib/cdk8s/integration-test.js +1 -1
  31. package/lib/cdktf/cdktf-construct.js +1 -1
  32. package/lib/circleci/circleci.js +1 -1
  33. package/lib/cli/util.js +2 -2
  34. package/lib/component.js +2 -2
  35. package/lib/dependencies.js +1 -1
  36. package/lib/dev-env.js +1 -1
  37. package/lib/docker-compose/docker-compose-service.js +1 -1
  38. package/lib/docker-compose/docker-compose.js +1 -1
  39. package/lib/file.js +1 -1
  40. package/lib/gitattributes.js +1 -1
  41. package/lib/github/actions-provider.js +1 -1
  42. package/lib/github/auto-approve.js +1 -1
  43. package/lib/github/auto-merge.js +6 -7
  44. package/lib/github/auto-queue.js +1 -1
  45. package/lib/github/dependabot.js +1 -1
  46. package/lib/github/dependency-review.js +1 -1
  47. package/lib/github/github-credentials.js +1 -1
  48. package/lib/github/github-project.js +1 -1
  49. package/lib/github/github.js +1 -1
  50. package/lib/github/merge-queue.js +1 -1
  51. package/lib/github/mergify.d.ts +32 -1
  52. package/lib/github/mergify.js +5 -2
  53. package/lib/github/pr-template.js +1 -1
  54. package/lib/github/pull-request-backport.js +1 -1
  55. package/lib/github/pull-request-lint.js +1 -1
  56. package/lib/github/stale.js +1 -1
  57. package/lib/github/task-workflow-job.js +1 -1
  58. package/lib/github/task-workflow.js +1 -1
  59. package/lib/github/workflow-actions.js +1 -1
  60. package/lib/github/workflow-jobs.js +1 -1
  61. package/lib/github/workflow-steps.js +1 -1
  62. package/lib/github/workflows.js +1 -1
  63. package/lib/gitlab/configuration.js +1 -1
  64. package/lib/gitlab/gitlab-configuration.js +1 -1
  65. package/lib/gitlab/nested-configuration.js +1 -1
  66. package/lib/gitpod.js +1 -1
  67. package/lib/ignore-file.js +1 -1
  68. package/lib/ini.js +1 -1
  69. package/lib/java/java-project.js +1 -1
  70. package/lib/java/junit.js +1 -1
  71. package/lib/java/maven-compile.js +1 -1
  72. package/lib/java/maven-packaging.js +1 -1
  73. package/lib/java/maven-sample.js +1 -1
  74. package/lib/java/pom.js +2 -2
  75. package/lib/java/projenrc.js +1 -1
  76. package/lib/javascript/biome/biome.js +1 -1
  77. package/lib/javascript/bundler.js +1 -1
  78. package/lib/javascript/eslint.js +1 -1
  79. package/lib/javascript/index.d.ts +2 -0
  80. package/lib/javascript/index.js +3 -1
  81. package/lib/javascript/jest.js +4 -4
  82. package/lib/javascript/license-checker.js +1 -1
  83. package/lib/javascript/node-package.d.ts +113 -0
  84. package/lib/javascript/node-package.js +159 -3
  85. package/lib/javascript/node-project.js +1 -1
  86. package/lib/javascript/npm-config.js +1 -1
  87. package/lib/javascript/pnpm-workspace-config.d.ts +1256 -0
  88. package/lib/javascript/pnpm-workspace-config.js +492 -0
  89. package/lib/javascript/pnpm-workspace.d.ts +23 -0
  90. package/lib/javascript/pnpm-workspace.js +34 -0
  91. package/lib/javascript/prettier.js +1 -1
  92. package/lib/javascript/projenrc.js +1 -1
  93. package/lib/javascript/typescript-config.js +2 -2
  94. package/lib/javascript/upgrade-dependencies.js +2 -2
  95. package/lib/javascript/yarnrc.js +1 -1
  96. package/lib/json-patch.js +1 -1
  97. package/lib/json.js +1 -1
  98. package/lib/license.js +1 -1
  99. package/lib/logger.js +1 -1
  100. package/lib/makefile.js +1 -1
  101. package/lib/object-file.js +1 -1
  102. package/lib/project-build.js +1 -1
  103. package/lib/project-tree.js +1 -1
  104. package/lib/project.js +1 -1
  105. package/lib/projects.js +1 -1
  106. package/lib/projenrc-json.js +1 -1
  107. package/lib/projenrc.js +1 -1
  108. package/lib/python/pip.js +1 -1
  109. package/lib/python/poetry.js +2 -2
  110. package/lib/python/projenrc.js +1 -1
  111. package/lib/python/pyproject-toml-file.js +1 -1
  112. package/lib/python/pytest-sample.js +1 -1
  113. package/lib/python/pytest.js +1 -1
  114. package/lib/python/python-project.js +1 -1
  115. package/lib/python/python-sample.js +1 -1
  116. package/lib/python/requirements-file.js +1 -1
  117. package/lib/python/setuppy.js +1 -1
  118. package/lib/python/setuptools.js +1 -1
  119. package/lib/python/uv.js +1 -1
  120. package/lib/python/venv.js +1 -1
  121. package/lib/readme.js +1 -1
  122. package/lib/release/publisher.js +1 -1
  123. package/lib/release/release-trigger.js +1 -1
  124. package/lib/release/release.js +1 -1
  125. package/lib/renovatebot.js +1 -1
  126. package/lib/run-task.cjs +9 -1
  127. package/lib/sample-file.js +2 -2
  128. package/lib/script-runner.js +1 -1
  129. package/lib/source-code.js +1 -1
  130. package/lib/task-shell.js +1 -1
  131. package/lib/task.js +1 -1
  132. package/lib/tasks.js +1 -1
  133. package/lib/testing.js +1 -1
  134. package/lib/textfile.js +1 -1
  135. package/lib/toml.js +1 -1
  136. package/lib/typescript/projenrc-ts.js +1 -1
  137. package/lib/typescript/projenrc.js +1 -1
  138. package/lib/typescript/typescript-runner.js +1 -1
  139. package/lib/typescript/typescript-typedoc.js +1 -1
  140. package/lib/typescript/typescript.js +5 -5
  141. package/lib/version.js +2 -2
  142. package/lib/vscode/devcontainer.js +1 -1
  143. package/lib/vscode/extensions.js +1 -1
  144. package/lib/vscode/launch-config.js +1 -1
  145. package/lib/vscode/settings.js +1 -1
  146. package/lib/vscode/vscode.js +1 -1
  147. package/lib/web/next.js +3 -3
  148. package/lib/web/postcss.js +1 -1
  149. package/lib/web/react.js +3 -3
  150. package/lib/web/tailwind.js +1 -1
  151. package/lib/xmlfile.js +1 -1
  152. package/lib/yaml.js +1 -1
  153. package/package.json +9 -1
@@ -1,3 +1,4 @@
1
+ import type { PnpmWorkspaceYamlOptions } from "./pnpm-workspace";
1
2
  import type { YarnrcOptions } from "./yarnrc";
2
3
  import { Component } from "../component";
3
4
  import { JsonFile } from "../json";
@@ -288,6 +289,12 @@ export interface NodePackageOptions {
288
289
  * @default - Yarn Berry v4 with all default options
289
290
  */
290
291
  readonly yarnBerryOptions?: YarnBerryOptions;
292
+ /**
293
+ * Options for pnpm
294
+ *
295
+ * @default - all default options
296
+ */
297
+ readonly pnpmOptions?: PnpmOptions;
291
298
  /**
292
299
  * Configure the `devEngines` field in `package.json`.
293
300
  *
@@ -315,6 +322,39 @@ export interface NodePackageOptions {
315
322
  * @default true
316
323
  */
317
324
  readonly deleteOrphanedLockFiles?: boolean;
325
+ /**
326
+ * List of dependency (package) names that are allowed to run lifecycle
327
+ * install scripts (`preinstall`, `install`, `postinstall`, `prepare`)
328
+ * during dependency installation.
329
+ *
330
+ * These scripts can execute arbitrary code, making them a common
331
+ * supply-chain attack vector. Package managers are moving toward
332
+ * blocking them by default and requiring an explicit allowlist.
333
+ * Configuring `allowScripts` sets up that allowlist so scripts only run
334
+ * for the packages you have explicitly reviewed and trust.
335
+ *
336
+ * Support for this setting depends on the configured `packageManager`:
337
+ *
338
+ * - `NPM`: written to the native `allowScripts` field in `package.json`
339
+ * (requires npm >= 11.16; see https://docs.npmjs.com/cli/v11/commands/npm-approve-scripts).
340
+ * - `BUN`: written to the native `trustedDependencies` field in
341
+ * `package.json` (see https://bun.com/docs/pm/lifecycle).
342
+ * - `PNPM`: written to the `onlyBuiltDependencies` setting in
343
+ * `pnpm-workspace.yaml` (see https://pnpm.io/settings#onlybuiltdependencies).
344
+ * - `YARN2`, `YARN_BERRY`: written to the native
345
+ * `dependenciesMeta.<pkg>.built` allowlist in `package.json`, combined
346
+ * with `enableScripts: false` in `.yarnrc.yml` (see
347
+ * https://yarnpkg.com/features/security#postinstalls). If you set
348
+ * `yarnBerryOptions.yarnRcOptions.enableScripts` explicitly, that value
349
+ * is respected instead of being overridden.
350
+ * - `YARN`, `YARN_CLASSIC`: not supported. Yarn Classic has no native
351
+ * mechanism to allowlist install scripts for specific dependencies.
352
+ * Setting this option with one of these package managers throws an
353
+ * error at synthesis time.
354
+ *
355
+ * @default - all install scripts are allowed to run (package manager default)
356
+ */
357
+ readonly allowScripts?: string[];
318
358
  }
319
359
  /**
320
360
  * A dependency entry for the `devEngines` field in `package.json`.
@@ -555,6 +595,7 @@ export declare class NodePackage extends Component {
555
595
  private readonly scripts;
556
596
  private readonly scriptsToBeRemoved;
557
597
  private readonly keywords;
598
+ private readonly allowedScripts;
558
599
  private readonly bin;
559
600
  private readonly engines;
560
601
  private readonly peerDependencyOptions;
@@ -620,6 +661,27 @@ export declare class NodePackage extends Component {
620
661
  * @param keywords The keywords to add
621
662
  */
622
663
  addKeywords(...keywords: string[]): void;
664
+ /**
665
+ * Allows the given dependency (package) names to run lifecycle install
666
+ * scripts (`preinstall`, `install`, `postinstall`, `prepare`), in addition
667
+ * to any already allowed via the `allowScripts` option or previous calls.
668
+ *
669
+ * Useful for project types that want to allowlist a package by default
670
+ * while still letting consumers add further packages via `allowScripts`.
671
+ *
672
+ * @param packages The dependency (package) names to allow.
673
+ * @see NodePackageOptions.allowScripts
674
+ */
675
+ addAllowedScripts(...packages: string[]): void;
676
+ /**
677
+ * Removes the given dependency (package) names from the `allowScripts`
678
+ * allowlist, whether they were added via the `allowScripts` option, a
679
+ * project type default, or a previous call to `addAllowedScripts`.
680
+ *
681
+ * @param packages The dependency (package) names to remove.
682
+ * @see NodePackageOptions.allowScripts
683
+ */
684
+ removeAllowedScripts(...packages: string[]): void;
623
685
  addBin(bins: Record<string, string>): void;
624
686
  /**
625
687
  * Add a npm package.json script.
@@ -722,6 +784,46 @@ export declare class NodePackage extends Component {
722
784
  */
723
785
  private resolveDepsAndWritePackageJson;
724
786
  private renderPackageResolutions;
787
+ /**
788
+ * Renders the native npm `allowScripts` field (`{ "pkg": true }`) from the
789
+ * `allowScripts` allowlist.
790
+ *
791
+ * @see https://docs.npmjs.com/cli/v11/commands/npm-approve-scripts
792
+ */
793
+ private renderNpmAllowScripts;
794
+ /**
795
+ * Renders the native bun `trustedDependencies` field from the
796
+ * `allowScripts` allowlist.
797
+ *
798
+ * @see https://bun.com/docs/pm/lifecycle
799
+ */
800
+ private renderBunTrustedDependencies;
801
+ /**
802
+ * Renders the native yarn berry per-package script allowlist via
803
+ * `dependenciesMeta.<pkg>.built = true`. Combined with the global
804
+ * `enableScripts: false` yarnrc setting (set in `configureYarnBerry`),
805
+ * this allows install scripts to run only for the listed packages.
806
+ *
807
+ * @see https://yarnpkg.com/configuration/manifest#dependenciesMeta.built
808
+ * @see https://yarnpkg.com/features/security#postinstalls
809
+ */
810
+ private renderYarnBerryDependenciesMeta;
811
+ /**
812
+ * Validates and configures the `allowScripts` allowlist for the resolved
813
+ * package manager, throwing a descriptive error for package managers that
814
+ * have no native way to allowlist install scripts per-dependency.
815
+ */
816
+ private configureAllowScripts;
817
+ /**
818
+ * Configures the `PnpmWorkspaceYaml` component, merging `onlyBuiltDependencies`
819
+ * from `allowScripts` and any explicit `pnpmOptions.workspaceYamlOptions`.
820
+ * The merge is resolved lazily (at synthesis time), so calls to
821
+ * `addAllowedScripts`/`removeAllowedScripts` made after this runs are
822
+ * still reflected. The file is only written if it ends up with actual
823
+ * content (see `omitEmpty`), so this is safe to call unconditionally for
824
+ * every pnpm project.
825
+ */
826
+ private configurePnpm;
725
827
  private renderPublishConfig;
726
828
  private renderKeywords;
727
829
  private renderEngines;
@@ -841,6 +943,17 @@ export interface YarnBerryOptions {
841
943
  */
842
944
  readonly zeroInstalls?: boolean;
843
945
  }
946
+ /**
947
+ * Configure pnpm
948
+ */
949
+ export interface PnpmOptions {
950
+ /**
951
+ * The `pnpm-workspace.yaml` configuration.
952
+ *
953
+ * @default - a blank pnpm-workspace.yaml file
954
+ */
955
+ readonly workspaceYamlOptions?: PnpmWorkspaceYamlOptions;
956
+ }
844
957
  /**
845
958
  * Why a dependency install was triggered during synthesis.
846
959
  */