repopo 0.5.0 → 0.7.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 +87 -0
- package/README.md +3 -5
- package/THIRD-PARTY-LICENSES.txt +6 -6
- package/esm/baseCommand.d.ts.map +1 -1
- package/esm/baseCommand.js +7 -9
- package/esm/baseCommand.js.map +1 -1
- package/esm/commands/check.d.ts +17 -6
- package/esm/commands/check.d.ts.map +1 -1
- package/esm/commands/check.js +162 -110
- package/esm/commands/check.js.map +1 -1
- package/esm/commands/list.d.ts.map +1 -1
- package/esm/commands/list.js +0 -1
- package/esm/commands/list.js.map +1 -1
- package/esm/config.d.ts +4 -15
- package/esm/config.d.ts.map +1 -1
- package/esm/config.js +3 -2
- package/esm/config.js.map +1 -1
- package/esm/context.d.ts +3 -3
- package/esm/context.d.ts.map +1 -1
- package/esm/context.js.map +1 -1
- package/esm/generators.d.ts +21 -0
- package/esm/generators.d.ts.map +1 -0
- package/esm/generators.js +2 -0
- package/esm/generators.js.map +1 -0
- package/esm/index.d.ts +5 -11
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +3 -9
- package/esm/index.js.map +1 -1
- package/esm/makePolicy.d.ts +9 -0
- package/esm/makePolicy.d.ts.map +1 -0
- package/esm/makePolicy.js +28 -0
- package/esm/makePolicy.js.map +1 -0
- package/esm/policies/HtmlFileHeaders.d.ts +2 -2
- package/esm/policies/HtmlFileHeaders.d.ts.map +1 -1
- package/esm/policies/HtmlFileHeaders.js +2 -2
- package/esm/policies/HtmlFileHeaders.js.map +1 -1
- package/esm/policies/JsTsFileHeaders.d.ts +2 -2
- package/esm/policies/JsTsFileHeaders.d.ts.map +1 -1
- package/esm/policies/JsTsFileHeaders.js +2 -2
- package/esm/policies/JsTsFileHeaders.js.map +1 -1
- package/esm/policies/LicenseFileExists.d.ts +20 -0
- package/esm/policies/LicenseFileExists.d.ts.map +1 -0
- package/esm/policies/LicenseFileExists.js +40 -0
- package/esm/policies/LicenseFileExists.js.map +1 -0
- package/esm/policies/NoJsFileExtensions.d.ts +2 -2
- package/esm/policies/NoJsFileExtensions.d.ts.map +1 -1
- package/esm/policies/NoJsFileExtensions.js +11 -15
- package/esm/policies/NoJsFileExtensions.js.map +1 -1
- package/esm/policies/NoLargeBinaryFiles.d.ts +30 -0
- package/esm/policies/NoLargeBinaryFiles.d.ts.map +1 -0
- package/esm/policies/NoLargeBinaryFiles.js +118 -0
- package/esm/policies/NoLargeBinaryFiles.js.map +1 -0
- package/esm/policies/PackageJsonProperties.d.ts +1 -1
- package/esm/policies/PackageJsonProperties.d.ts.map +1 -1
- package/esm/policies/PackageJsonProperties.js +3 -3
- package/esm/policies/PackageJsonProperties.js.map +1 -1
- package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts +1 -1
- package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts.map +1 -1
- package/esm/policies/PackageJsonRepoDirectoryProperty.js +24 -25
- package/esm/policies/PackageJsonRepoDirectoryProperty.js.map +1 -1
- package/esm/policies/PackageJsonSorted.d.ts +1 -1
- package/esm/policies/PackageJsonSorted.d.ts.map +1 -1
- package/esm/policies/PackageJsonSorted.js +3 -2
- package/esm/policies/PackageJsonSorted.js.map +1 -1
- package/esm/policies/PackageScripts.d.ts +25 -2
- package/esm/policies/PackageScripts.d.ts.map +1 -1
- package/esm/policies/PackageScripts.js +47 -10
- package/esm/policies/PackageScripts.js.map +1 -1
- package/esm/policies/RequiredGitignorePatterns.d.ts +24 -0
- package/esm/policies/RequiredGitignorePatterns.d.ts.map +1 -0
- package/esm/policies/RequiredGitignorePatterns.js +166 -0
- package/esm/policies/RequiredGitignorePatterns.js.map +1 -0
- package/esm/policies.d.ts +8 -3
- package/esm/policies.d.ts.map +1 -1
- package/esm/policies.js +8 -3
- package/esm/policies.js.map +1 -1
- package/esm/policy.d.ts +40 -13
- package/esm/policy.d.ts.map +1 -1
- package/esm/policy.js +18 -7
- package/esm/policy.js.map +1 -1
- package/esm/{policyGenerators/generateFileHeaderPolicy.d.ts → policyDefiners/defineFileHeaderPolicy.d.ts} +4 -4
- package/esm/policyDefiners/defineFileHeaderPolicy.d.ts.map +1 -0
- package/esm/{policyGenerators/generateFileHeaderPolicy.js → policyDefiners/defineFileHeaderPolicy.js} +3 -3
- package/esm/policyDefiners/defineFileHeaderPolicy.js.map +1 -0
- package/esm/policyDefiners/definePackagePolicy.d.ts +15 -0
- package/esm/policyDefiners/definePackagePolicy.d.ts.map +1 -0
- package/esm/{policyGenerators/generatePackagePolicy.js → policyDefiners/definePackagePolicy.js} +2 -2
- package/esm/policyDefiners/definePackagePolicy.js.map +1 -0
- package/esm/tsdoc-metadata.json +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +36 -31
- package/esm/policyGenerators/generateFileHeaderPolicy.d.ts.map +0 -1
- package/esm/policyGenerators/generateFileHeaderPolicy.js.map +0 -1
- package/esm/policyGenerators/generatePackagePolicy.d.ts +0 -9
- package/esm/policyGenerators/generatePackagePolicy.d.ts.map +0 -1
- package/esm/policyGenerators/generatePackagePolicy.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repopo",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Enforce policies on all or some of the files in a git repository.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"policy",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"bugs": "https://github.com/tylerbutler/tools-monorepo/issues",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
13
|
-
"url": "https://github.com/tylerbutler/tools-monorepo.git",
|
|
13
|
+
"url": "git+https://github.com/tylerbutler/tools-monorepo.git",
|
|
14
14
|
"directory": "packages/repopo"
|
|
15
15
|
},
|
|
16
16
|
"license": "MIT",
|
|
@@ -53,37 +53,35 @@
|
|
|
53
53
|
"repositoryPrefix": "<%- repo %>/blob/main/packages/repopo/<%- commandPath %>"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@fluid-tools/build-infrastructure": "
|
|
57
|
-
"@oclif/core": "^4.
|
|
58
|
-
"@oclif/plugin-help": "^6.2.
|
|
59
|
-
"@rushstack/node-core-library": "^5.
|
|
56
|
+
"@fluid-tools/build-infrastructure": "~0.60.0",
|
|
57
|
+
"@oclif/core": "^4.8.0",
|
|
58
|
+
"@oclif/plugin-help": "^6.2.35",
|
|
59
|
+
"@rushstack/node-core-library": "^5.18.0",
|
|
60
60
|
"defu": "^6.1.4",
|
|
61
|
-
"jsonfile": "^6.
|
|
61
|
+
"jsonfile": "^6.2.0",
|
|
62
62
|
"microdiff": "^1.5.0",
|
|
63
63
|
"pathe": "^2.0.3",
|
|
64
64
|
"picocolors": "^1.1.1",
|
|
65
|
-
"simple-git": "^3.
|
|
66
|
-
"@tylerbu/cli-api": "^0.
|
|
67
|
-
"@tylerbu/fundamentals": "^0.
|
|
65
|
+
"simple-git": "^3.30.0",
|
|
66
|
+
"@tylerbu/cli-api": "^0.8.0",
|
|
67
|
+
"@tylerbu/fundamentals": "^0.3.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@biomejs/biome": "
|
|
71
|
-
"@microsoft/api-extractor": "^7.
|
|
72
|
-
"@oclif/plugin-command-snapshot": "^5.
|
|
73
|
-
"@oclif/test": "^4.1.
|
|
70
|
+
"@biomejs/biome": "2.2.5",
|
|
71
|
+
"@microsoft/api-extractor": "^7.54.0",
|
|
72
|
+
"@oclif/plugin-command-snapshot": "^5.3.8",
|
|
73
|
+
"@oclif/test": "^4.1.14",
|
|
74
74
|
"@types/jsonfile": "^6.1.4",
|
|
75
|
-
"@types/node": "^20.
|
|
75
|
+
"@types/node": "^20.19.24",
|
|
76
76
|
"@types/tmp": "^0.2.6",
|
|
77
|
-
"generate-license-file": "^4.
|
|
78
|
-
"oclif": "^4.
|
|
79
|
-
"rimraf": "^6.0
|
|
80
|
-
"serve": "^14.2.4",
|
|
81
|
-
"start-server-and-test": "^2.0.11",
|
|
77
|
+
"generate-license-file": "^4.1.0",
|
|
78
|
+
"oclif": "^4.22.44",
|
|
79
|
+
"rimraf": "^6.1.0",
|
|
82
80
|
"tmp-promise": "^3.0.3",
|
|
83
81
|
"ts-node": "^10.9.2",
|
|
84
|
-
"type-fest": "^
|
|
85
|
-
"typescript": "~5.
|
|
86
|
-
"vitest": "^3.
|
|
82
|
+
"type-fest": "^5.2.0",
|
|
83
|
+
"typescript": "~5.9.3",
|
|
84
|
+
"vitest": "^3.2.4"
|
|
87
85
|
},
|
|
88
86
|
"peerDependencies": {
|
|
89
87
|
"sort-package-json": "*"
|
|
@@ -96,25 +94,32 @@
|
|
|
96
94
|
"engines": {
|
|
97
95
|
"node": ">=18.0.0"
|
|
98
96
|
},
|
|
97
|
+
"nx": {
|
|
98
|
+
"targets": {
|
|
99
|
+
"build": {
|
|
100
|
+
"executor": "nx:noop"
|
|
101
|
+
},
|
|
102
|
+
"ci": {}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
99
105
|
"scripts": {
|
|
100
|
-
"api": "api-extractor run --local",
|
|
101
106
|
"api:markdown": "api-documenter markdown -i _temp/api-extractor -o _temp/docs",
|
|
102
|
-
"build": "
|
|
107
|
+
"build:api": "api-extractor run --local",
|
|
108
|
+
"build:compile": "tsc --project ./tsconfig.json",
|
|
109
|
+
"build:manifest": "oclif manifest",
|
|
110
|
+
"build:readme": "concurrently npm:readme:*",
|
|
103
111
|
"check": "concurrently npm:check:format",
|
|
104
112
|
"check:format": "biome check . --linter-enabled=false",
|
|
105
|
-
"check:snapshot": "./bin/dev.js snapshot:compare --filepath test/commands/__snapshots__/commands.json",
|
|
106
113
|
"clean": "concurrently npm:clean:build npm:clean:manifest",
|
|
107
114
|
"clean:build": "rimraf esm *.tsbuildinfo *.done.build.log",
|
|
108
115
|
"clean:manifest": "rimraf oclif.manifest.json",
|
|
109
|
-
"compile": "tsc --project ./tsconfig.json",
|
|
110
116
|
"format": "biome check . --linter-enabled=false --write",
|
|
111
|
-
"full": "fluid-build . --task full",
|
|
112
117
|
"lint": "biome lint .",
|
|
113
118
|
"lint:fix": "biome lint . --write",
|
|
114
|
-
"manifest": "oclif manifest",
|
|
115
|
-
"readme": "concurrently npm:readme:*",
|
|
116
119
|
"readme:docs": "oclif readme --no-aliases --readme-path=../repopo-docs/src/content/docs/cli-reference.md",
|
|
117
120
|
"readme:main": "oclif readme --no-aliases",
|
|
118
|
-
"release:license
|
|
121
|
+
"release:license": "generate-license-file -c ../../.generatelicensefile.cjs",
|
|
122
|
+
"test": "vitest run",
|
|
123
|
+
"test:snapshots": "./bin/dev.js snapshot:compare --filepath test/commands/__snapshots__/commands.json"
|
|
119
124
|
}
|
|
120
125
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateFileHeaderPolicy.d.ts","sourceRoot":"","sources":["../../src/policyGenerators/generateFileHeaderPolicy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAkC,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/E;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,yBAChB,SAAQ,OAAO,CAAC,sBAAsB,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,KAAK,MAAM,CAAC;CACtE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACvC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,yBAAyB,GAC/B,UAAU,CAAC,sBAAsB,CAAC,CAiEpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generateFileHeaderPolicy.js","sourceRoot":"","sources":["../../src/policyGenerators/generateFileHeaderPolicy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,GAAG,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAGhC,MAAM,cAAc,GAAG,aAAa,CAAC;AA+CrC;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACvC,IAAY,EACZ,MAAiC;IAEjC,MAAM,GAAG,GAAG,MAAM,CAAC,WAAW,EAAE,MAAM,IAAI,EAAE,CAAC;IAC7C,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC;IACtC,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;IAClC,MAAM,IAAI,GAAG,MAAM,CAAC,SAAS,EAAE,MAAM,IAAI,EAAE,CAAC;IAE5C,2EAA2E;IAC3E,mGAAmG;IACnG,MAAM,OAAO,GAAG,CAAC,IAAY,EAAU,EAAE,CACxC,IAAI;SACF,KAAK,CAAC,OAAO,CAAC;SACd,GAAG,CACH,CAAC,IAAI,EAAE,EAAE,CACR,GAAG,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAAG,GAAG,EAAE,CAC/D;SACA,IAAI,CAAC,EAAE,CAAC;SACR,OAAO,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC,CAAC,uCAAuC;IAE9E,wFAAwF;IACxF,0FAA0F;IAC1F,MAAM,KAAK,GAAG,IAAI,MAAM,CACvB,IAAI,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,IAAI,EAAE,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,WAAW,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE,CAC1F,CAAC;IAEF,OAAO;QACN,IAAI;QACJ,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;YAC1D,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAChC,OAAO,IAAI,CAAC;YACb,CAAC;YAED,MAAM,UAAU,GAAkB;gBACjC,IAAI;gBACJ,IAAI;gBACJ,WAAW,EAAE,IAAI;aACjB,CAAC;YAEF,+EAA+E;YAC/E,gCAAgC;YAChC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YAC3D,MAAM,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAEpC,IAAI,MAAM,EAAE,CAAC;gBACZ,UAAU,CAAC,YAAY,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC;YAClE,CAAC;YAED,IAAI,MAAM,EAAE,CAAC;gBACZ,IAAI,OAAO,EAAE,CAAC;oBACb,MAAM,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;oBAC1D,MAAM,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;oBAElC,MAAM,SAAS,GAAoB;wBAClC,GAAG,UAAU;wBACb,QAAQ,EAAE,IAAI;qBACd,CAAC;oBAEF,OAAO,SAAS,CAAC;gBAClB,CAAC;gBACD,OAAO,UAAU,CAAC;YACnB,CAAC;YAED,OAAO,IAAI,CAAC;QACb,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { readFile, writeFile } from \"node:fs/promises\";\nimport { EOL as newline } from \"node:os\";\nimport { extname } from \"pathe\";\nimport type { PolicyFailure, PolicyFixResult, RepoPolicy } from \"../policy.js\";\n\nconst trailingSpaces = /\\s*\\\\r\\?\\\\n/;\n\n/**\n * @alpha\n */\nexport interface FileHeaderPolicyConfig {\n\t/**\n\t * The text to use as the header.\n\t */\n\theaderText: string;\n\n\t/**\n\t * An optional string that will be appended to the headerText.\n\t */\n\tautoGenText?: string;\n}\n\n/**\n * @alpha\n */\nexport interface FileHeaderGeneratorConfig\n\textends Partial<FileHeaderPolicyConfig> {\n\tmatch: RegExp;\n\n\t/**\n\t * Regex matching header prefix (e.g. `/*!\\r?\\n`)\n\t */\n\theaderStart?: RegExp;\n\n\t/**\n\t * Regex matching beginning of each line (e.g. ' * ')\n\t */\n\tlineStart: RegExp;\n\n\t/**\n\t * Regex matching the end of each line (e.g., `\\r?\\n`)\n\t */\n\tlineEnd: RegExp;\n\n\t/**\n\t * Regex matching the header postfix.\n\t */\n\theaderEnd?: RegExp;\n\n\treplacer: (content: string, config: FileHeaderPolicyConfig) => string;\n}\n\n/**\n * Given a `FileHeaderGeneratorConfig`, produces a function that detects correct file headers\n * and returns an error string if the header is missing or incorrect.\n *\n * @alpha\n */\nexport function generateFileHeaderPolicy(\n\tname: string,\n\tconfig: FileHeaderGeneratorConfig,\n): RepoPolicy<FileHeaderPolicyConfig> {\n\tconst pre = config.headerStart?.source ?? \"\";\n\tconst start = config.lineStart.source;\n\tconst end = config.lineEnd.source;\n\tconst post = config.headerEnd?.source ?? \"\";\n\n\t// Helper which constructs a matching RegExp from a given multiline string.\n\t// (See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#escaping)\n\tconst toRegex = (text: string): string =>\n\t\ttext\n\t\t\t.split(newline)\n\t\t\t.map(\n\t\t\t\t(line) =>\n\t\t\t\t\t`${start}${line.replace(/[$()*+.?[\\\\\\]^{|}]/g, \"\\\\$&\")}${end}`,\n\t\t\t)\n\t\t\t.join(\"\")\n\t\t\t.replace(trailingSpaces, \"\\\\r?\\\\n\"); // Trim trailing spaces at end-of-line.\n\n\t// Detection regex matches the header start (if any), followed by lines in 'headerText',\n\t// optionally followed by lines in the 'autoGenText', and finally the header end (if any).\n\tconst regex = new RegExp(\n\t\t`^${pre}${toRegex(config.headerText ?? \"\")}(${toRegex(config.autoGenText ?? \"\")})?${post}`,\n\t);\n\n\treturn {\n\t\tname,\n\t\tmatch: config.match,\n\t\thandler: async ({ file, resolve, config: policyConfig }) => {\n\t\t\tif (policyConfig === undefined) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tconst failResult: PolicyFailure = {\n\t\t\t\tname,\n\t\t\t\tfile,\n\t\t\t\tautoFixable: true,\n\t\t\t};\n\n\t\t\t// TODO: Consider reading only the first 512B or so since headers are typically\n\t\t\t// at the beginning of the file.\n\t\t\tconst content = await readFile(file, { encoding: \"utf8\" });\n\t\t\tconst failed = !regex.test(content);\n\n\t\t\tif (failed) {\n\t\t\t\tfailResult.errorMessage = `${extname(file)} file missing header`;\n\t\t\t}\n\n\t\t\tif (failed) {\n\t\t\t\tif (resolve) {\n\t\t\t\t\tconst newContent = config.replacer(content, policyConfig);\n\t\t\t\t\tawait writeFile(file, newContent);\n\n\t\t\t\t\tconst fixResult: PolicyFixResult = {\n\t\t\t\t\t\t...failResult,\n\t\t\t\t\t\tresolved: true,\n\t\t\t\t\t};\n\n\t\t\t\t\treturn fixResult;\n\t\t\t\t}\n\t\t\t\treturn failResult;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PackageJson } from "type-fest";
|
|
2
|
-
import type { PackageJsonHandler, RepoPolicy } from "../policy.js";
|
|
3
|
-
/**
|
|
4
|
-
* Define a repo policy for package.json files.
|
|
5
|
-
*
|
|
6
|
-
* @alpha
|
|
7
|
-
*/
|
|
8
|
-
export declare function generatePackagePolicy<J = PackageJson, C = undefined>(name: string, packagePolicy: PackageJsonHandler<J, C>): RepoPolicy<C>;
|
|
9
|
-
//# sourceMappingURL=generatePackagePolicy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generatePackagePolicy.d.ts","sourceRoot":"","sources":["../../src/policyGenerators/generatePackagePolicy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAInE;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,GAAG,WAAW,EAAE,CAAC,GAAG,SAAS,EACnE,IAAI,EAAE,MAAM,EACZ,aAAa,EAAE,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,GAErC,UAAU,CAAC,CAAC,CAAC,CAUf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generatePackagePolicy.js","sourceRoot":"","sources":["../../src/policyGenerators/generatePackagePolicy.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAGjE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,QAAQ,CAAC;AAExC;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CACpC,IAAY,EACZ,aAAuC;IAGvC,0CAA0C;IAC1C,OAAO;QACN,IAAI;QACJ,KAAK,EAAE,qBAAqB;QAC5B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;YAC5B,MAAM,IAAI,GAAM,MAAM,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YAC/C,OAAO,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACvC,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import jsonfile from \"jsonfile\";\nimport type { PackageJson } from \"type-fest\";\nimport { PackageJsonRegexMatch } from \"../policies/constants.js\";\nimport type { PackageJsonHandler, RepoPolicy } from \"../policy.js\";\n\nconst { readFile: readJson } = jsonfile;\n\n/**\n * Define a repo policy for package.json files.\n *\n * @alpha\n */\nexport function generatePackagePolicy<J = PackageJson, C = undefined>(\n\tname: string,\n\tpackagePolicy: PackageJsonHandler<J, C>,\n\t// args: PolicyFunctionArguments<C>,\n): RepoPolicy<C> {\n\t// const func = () => handler(json, args);\n\treturn {\n\t\tname,\n\t\tmatch: PackageJsonRegexMatch,\n\t\thandler: async (innerArgs) => {\n\t\t\tconst json: J = await readJson(innerArgs.file);\n\t\t\treturn packagePolicy(json, innerArgs);\n\t\t},\n\t};\n}\n"]}
|