@plaudit/pnpm-plugin-plaudit-config 1.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-04-15
9
+ ### Added
10
+ - Default `allowBuilds` and `overrides` values
11
+ - Code to forcibly pin WordPress dependencies
package/LICENSE.md ADDED
@@ -0,0 +1,13 @@
1
+ # License
2
+
3
+ Unless otherwise stated in a written and signed agreement with Plaudit, the following license terms apply to this software:
4
+ * **Definitions**: ‘Client’ means the legal entity that has engaged Plaudit under a signed Master Services Agreement (MSA) or similar written contract for a project with which this library is provided. ‘Authorized Vendors’ means Client’s employees, contractors, and third‑party service providers who access this library solely on Client’s behalf.
5
+ * **Use**: This library shall remain the exclusive property of Plaudit. Plaudit hereby grants the Client a nonexclusive, nontransferable, worldwide license to use this library only as necessary to use and maintain the final deliverables provided by Plaudit for Client. Authorized Vendors obtain no rights independent of Client, may not sublicense or transfer, and must comply with these restrictions. Client and Authorized Vendors may not directly or indirectly create derivative works or use the library for any other client or project.
6
+ * **Access and Transfer**: Access by Authorized Vendors is permitted only while performing services for Client on the relevant deliverables and must be subject to written obligations no less protective than these terms. Access ends when such services end.
7
+ * **Warranty Disclaimer**: This software is provided **“as is”** without warranty of any kind. Plaudit disclaims all warranties, express or implied, including but not limited to warranties of merchantability, fitness for a particular purpose, and non-infringement.
8
+ * **Limitation of Liability**: In no event shall Plaudit be liable for any damages, liabilities, costs, losses, or expenses arising out of or in connection with the use of this software, including but not limited to incidental, consequential, or punitive damages, even if advised of the possibility of such damages.
9
+ * **Support and Updates**: No support, maintenance, or future updates are provided under this license. The license does not grant rights to future versions of this software.
10
+
11
+ ---
12
+
13
+ (License revision: 1.0)
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # Plaudit's PNPM Config
2
+
3
+ The basic config state that all Plaudit-managed PNPM projects should use
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@plaudit/pnpm-plugin-plaudit-config",
3
+ "version": "1.0.0",
4
+ "license": "SEE LICENSE IN LICENSE.md",
5
+ "files": [
6
+ "./pnpmfile.cjs",
7
+ "CHANGELOG.md",
8
+ "LICENSE.md",
9
+ "README.md"
10
+ ],
11
+ "sideEffects": false
12
+ }
package/pnpmfile.cjs ADDED
@@ -0,0 +1,57 @@
1
+ const dependencyKeys = ['dependencies', 'devDependencies', 'peerDependencies', 'optionalDependencies'];
2
+ const globalForcePinDependenciesRegex = /^@wordpress\//;
3
+
4
+ let rootPkg = undefined;
5
+ module.exports = {
6
+ hooks: {
7
+ readPackage(pkg) {
8
+ if (globalForcePinDependenciesRegex) {
9
+ for (const dependencyKey of dependencyKeys) {
10
+ if (pkg[dependencyKey]) {
11
+ pkg[dependencyKey] = forcePinDependencies(globalForcePinDependenciesRegex, pkg[dependencyKey]);
12
+ }
13
+ }
14
+ }
15
+ if (rootPkg === undefined || pkg === rootPkg) {
16
+ rootPkg = pkg;
17
+ } else {
18
+ if (pkg.peerDependencies?.['@types/node']) {
19
+ pkg.peerDependencies['@types/node'] += " || >24";
20
+ }
21
+ }
22
+ return pkg;
23
+ },
24
+ updateConfig(config) {
25
+ config.allowBuilds = {
26
+ "core-js": true,
27
+ "core-js-pure": true,
28
+ "@parcel/watcher": false,
29
+ "unrs-resolver": false,
30
+ ...Object.fromEntries((config.onlyBuiltDependencies ?? []).map(dep => [dep, true])),
31
+ ...Object.fromEntries((config.ignoredBuiltDependencies ?? []).map(dep => [dep, false])),
32
+ ...config.allowBuilds,
33
+ };
34
+ config.overrides = {
35
+ ...(config.overrides ?? {}),
36
+ "micromatch": "^4",
37
+ "react-autosize-textarea>react": "*",
38
+ "react-autosize-textarea>react-dom": "*"
39
+ };
40
+ return config;
41
+ }
42
+ }
43
+ }
44
+
45
+ /**
46
+ * @param {RegExp} pattern
47
+ * @param {{[p: string]: string}|undefined} dependenciesObject
48
+ */
49
+ function forcePinDependencies(pattern, dependenciesObject) {
50
+ if (!dependenciesObject) {
51
+ return dependenciesObject;
52
+ }
53
+ return Object.fromEntries(
54
+ Object.entries(dependenciesObject)
55
+ .map(([key, value]) => pattern.test(key) ? [key, value.startsWith("^") ? value.substring(1) : value] : [key, value])
56
+ );
57
+ }