repopo 0.12.0 → 0.13.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 +53 -0
- package/README.md +50 -90
- package/THIRD-PARTY-LICENSES.txt +169 -11
- package/bin/dev.js +0 -0
- package/esm/adapters/fluidFramework.d.ts +13 -9
- package/esm/adapters/fluidFramework.d.ts.map +1 -1
- package/esm/adapters/fluidFramework.js +20 -43
- package/esm/adapters/fluidFramework.js.map +1 -1
- package/esm/api.d.ts +64 -1
- package/esm/api.d.ts.map +1 -1
- package/esm/api.js +17 -1
- package/esm/api.js.map +1 -1
- package/esm/baseCommand.d.ts.map +1 -1
- package/esm/baseCommand.js +2 -2
- package/esm/baseCommand.js.map +1 -1
- package/esm/commands/check-native.d.ts +3 -3
- package/esm/commands/check-native.d.ts.map +1 -1
- package/esm/commands/check-native.js +26 -7
- package/esm/commands/check-native.js.map +1 -1
- package/esm/commands/check.d.ts +6 -21
- package/esm/commands/check.d.ts.map +1 -1
- package/esm/commands/check.js +73 -153
- package/esm/commands/check.js.map +1 -1
- package/esm/commands/list.d.ts.map +1 -1
- package/esm/commands/list.js +2 -1
- package/esm/commands/list.js.map +1 -1
- package/esm/concurrency.d.ts +3 -0
- package/esm/concurrency.d.ts.map +1 -0
- package/esm/concurrency.js +8 -0
- package/esm/concurrency.js.map +1 -0
- package/esm/config.d.ts +5 -39
- package/esm/config.d.ts.map +1 -1
- package/esm/config.js +3 -7
- package/esm/config.js.map +1 -1
- package/esm/context.d.ts +8 -1
- package/esm/context.d.ts.map +1 -1
- package/esm/context.js +8 -1
- package/esm/context.js.map +1 -1
- package/esm/executionContractError.d.ts +4 -0
- package/esm/executionContractError.d.ts.map +1 -0
- package/esm/executionContractError.js +4 -0
- package/esm/executionContractError.js.map +1 -0
- package/esm/fileCache.d.ts +12 -0
- package/esm/fileCache.d.ts.map +1 -0
- package/esm/fileCache.js +37 -0
- package/esm/fileCache.js.map +1 -0
- package/esm/filePaths.d.ts +2 -0
- package/esm/filePaths.d.ts.map +1 -0
- package/esm/filePaths.js +9 -0
- package/esm/filePaths.js.map +1 -0
- package/esm/generators.d.ts +0 -20
- package/esm/generators.d.ts.map +1 -1
- package/esm/generators.js.map +1 -1
- package/esm/index.d.ts +3 -16
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +3 -17
- package/esm/index.js.map +1 -1
- package/esm/makePolicy.d.ts +20 -100
- package/esm/makePolicy.d.ts.map +1 -1
- package/esm/makePolicy.js +44 -132
- package/esm/makePolicy.js.map +1 -1
- package/esm/perf.d.ts +5 -2
- package/esm/perf.d.ts.map +1 -1
- package/esm/perf.js +10 -9
- package/esm/perf.js.map +1 -1
- package/esm/policies/CargoLicenceValidated.d.ts +4 -4
- package/esm/policies/CargoLicenceValidated.d.ts.map +1 -1
- package/esm/policies/CargoLicenceValidated.js +9 -7
- package/esm/policies/CargoLicenceValidated.js.map +1 -1
- package/esm/policies/CargoLintsConfigured.d.ts +4 -4
- package/esm/policies/CargoLintsConfigured.d.ts.map +1 -1
- package/esm/policies/CargoLintsConfigured.js +19 -15
- package/esm/policies/CargoLintsConfigured.js.map +1 -1
- package/esm/policies/CargoLockPolicy.d.ts +4 -4
- package/esm/policies/CargoLockPolicy.d.ts.map +1 -1
- package/esm/policies/CargoLockPolicy.js +15 -11
- package/esm/policies/CargoLockPolicy.js.map +1 -1
- package/esm/policies/CargoTomlRequired.d.ts +5 -5
- package/esm/policies/CargoTomlRequired.d.ts.map +1 -1
- package/esm/policies/CargoTomlRequired.js +7 -7
- package/esm/policies/CargoTomlRequired.js.map +1 -1
- package/esm/policies/CargoTomlSorted.d.ts +4 -4
- package/esm/policies/CargoTomlSorted.d.ts.map +1 -1
- package/esm/policies/CargoTomlSorted.js +21 -17
- package/esm/policies/CargoTomlSorted.js.map +1 -1
- package/esm/policies/ConditionalScripts.d.ts +10 -8
- package/esm/policies/ConditionalScripts.d.ts.map +1 -1
- package/esm/policies/ConditionalScripts.js +24 -22
- package/esm/policies/ConditionalScripts.js.map +1 -1
- package/esm/policies/ExactScripts.d.ts +8 -6
- package/esm/policies/ExactScripts.d.ts.map +1 -1
- package/esm/policies/ExactScripts.js +15 -18
- package/esm/policies/ExactScripts.js.map +1 -1
- package/esm/policies/GleamDepVersions.d.ts +5 -5
- package/esm/policies/GleamDepVersions.d.ts.map +1 -1
- package/esm/policies/GleamDepVersions.js +5 -5
- package/esm/policies/GleamDepVersions.js.map +1 -1
- package/esm/policies/GleamDocExists.d.ts +4 -4
- package/esm/policies/GleamDocExists.d.ts.map +1 -1
- package/esm/policies/GleamDocExists.js +6 -6
- package/esm/policies/GleamDocExists.js.map +1 -1
- package/esm/policies/GleamInternalModulesConfigured.d.ts +4 -4
- package/esm/policies/GleamInternalModulesConfigured.d.ts.map +1 -1
- package/esm/policies/GleamInternalModulesConfigured.js +8 -6
- package/esm/policies/GleamInternalModulesConfigured.js.map +1 -1
- package/esm/policies/GleamLicenceConfigured.d.ts +4 -4
- package/esm/policies/GleamLicenceConfigured.d.ts.map +1 -1
- package/esm/policies/GleamLicenceConfigured.js +8 -6
- package/esm/policies/GleamLicenceConfigured.js.map +1 -1
- package/esm/policies/GleamManifestCommitted.d.ts +10 -3
- package/esm/policies/GleamManifestCommitted.d.ts.map +1 -1
- package/esm/policies/GleamManifestCommitted.js +10 -9
- package/esm/policies/GleamManifestCommitted.js.map +1 -1
- package/esm/policies/GleamMonorepoConsistency.d.ts +13 -5
- package/esm/policies/GleamMonorepoConsistency.d.ts.map +1 -1
- package/esm/policies/GleamMonorepoConsistency.js +10 -10
- package/esm/policies/GleamMonorepoConsistency.js.map +1 -1
- package/esm/policies/GleamNameRestrictions.d.ts +4 -4
- package/esm/policies/GleamNameRestrictions.d.ts.map +1 -1
- package/esm/policies/GleamNameRestrictions.js +6 -6
- package/esm/policies/GleamNameRestrictions.js.map +1 -1
- package/esm/policies/GleamNoPathDepsInPublished.d.ts +4 -4
- package/esm/policies/GleamNoPathDepsInPublished.d.ts.map +1 -1
- package/esm/policies/GleamNoPathDepsInPublished.js +6 -6
- package/esm/policies/GleamNoPathDepsInPublished.js.map +1 -1
- package/esm/policies/GleamPathDepsValid.d.ts +3 -3
- package/esm/policies/GleamPathDepsValid.d.ts.map +1 -1
- package/esm/policies/GleamPathDepsValid.js +5 -5
- package/esm/policies/GleamPathDepsValid.js.map +1 -1
- package/esm/policies/GleamProjectStructure.d.ts +11 -4
- package/esm/policies/GleamProjectStructure.d.ts.map +1 -1
- package/esm/policies/GleamProjectStructure.js +7 -8
- package/esm/policies/GleamProjectStructure.js.map +1 -1
- package/esm/policies/GleamSharedDependencyVersions.d.ts +12 -4
- package/esm/policies/GleamSharedDependencyVersions.d.ts.map +1 -1
- package/esm/policies/GleamSharedDependencyVersions.js +10 -10
- package/esm/policies/GleamSharedDependencyVersions.js.map +1 -1
- package/esm/policies/GleamTomlRequired.d.ts +4 -4
- package/esm/policies/GleamTomlRequired.d.ts.map +1 -1
- package/esm/policies/GleamTomlRequired.js +5 -5
- package/esm/policies/GleamTomlRequired.js.map +1 -1
- package/esm/policies/GleamTomlSorted.d.ts +4 -4
- package/esm/policies/GleamTomlSorted.d.ts.map +1 -1
- package/esm/policies/GleamTomlSorted.js +21 -17
- package/esm/policies/GleamTomlSorted.js.map +1 -1
- package/esm/policies/GleamVersionConstraint.d.ts +4 -4
- package/esm/policies/GleamVersionConstraint.d.ts.map +1 -1
- package/esm/policies/GleamVersionConstraint.js +14 -10
- package/esm/policies/GleamVersionConstraint.js.map +1 -1
- package/esm/policies/HtmlFileHeaders.d.ts +4 -2
- package/esm/policies/HtmlFileHeaders.d.ts.map +1 -1
- package/esm/policies/HtmlFileHeaders.js +1 -1
- package/esm/policies/HtmlFileHeaders.js.map +1 -1
- package/esm/policies/JsTsFileHeaders.d.ts +4 -2
- package/esm/policies/JsTsFileHeaders.d.ts.map +1 -1
- package/esm/policies/JsTsFileHeaders.js +1 -1
- package/esm/policies/JsTsFileHeaders.js.map +1 -1
- package/esm/policies/LicenseFileExists.d.ts +10 -4
- package/esm/policies/LicenseFileExists.d.ts.map +1 -1
- package/esm/policies/LicenseFileExists.js +27 -20
- package/esm/policies/LicenseFileExists.js.map +1 -1
- package/esm/policies/MutuallyExclusiveScripts.d.ts +8 -6
- package/esm/policies/MutuallyExclusiveScripts.d.ts.map +1 -1
- package/esm/policies/MutuallyExclusiveScripts.js +9 -13
- package/esm/policies/MutuallyExclusiveScripts.js.map +1 -1
- package/esm/policies/NoBuildDirectory.d.ts +9 -3
- package/esm/policies/NoBuildDirectory.d.ts.map +1 -1
- package/esm/policies/NoBuildDirectory.js +8 -13
- package/esm/policies/NoBuildDirectory.js.map +1 -1
- package/esm/policies/NoJsFileExtensions.d.ts +9 -3
- package/esm/policies/NoJsFileExtensions.d.ts.map +1 -1
- package/esm/policies/NoJsFileExtensions.js +9 -14
- package/esm/policies/NoJsFileExtensions.js.map +1 -1
- package/esm/policies/NoLargeBinaryFiles.d.ts +9 -4
- package/esm/policies/NoLargeBinaryFiles.d.ts.map +1 -1
- package/esm/policies/NoLargeBinaryFiles.js +10 -16
- package/esm/policies/NoLargeBinaryFiles.js.map +1 -1
- package/esm/policies/NoPrivateWorkspaceDependencies.d.ts +10 -6
- package/esm/policies/NoPrivateWorkspaceDependencies.d.ts.map +1 -1
- package/esm/policies/NoPrivateWorkspaceDependencies.js +12 -14
- package/esm/policies/NoPrivateWorkspaceDependencies.js.map +1 -1
- package/esm/policies/NoTargetArtifacts.d.ts +9 -3
- package/esm/policies/NoTargetArtifacts.d.ts.map +1 -1
- package/esm/policies/NoTargetArtifacts.js +9 -14
- package/esm/policies/NoTargetArtifacts.js.map +1 -1
- package/esm/policies/NoUnsafeWithoutJustification.d.ts +11 -4
- package/esm/policies/NoUnsafeWithoutJustification.d.ts.map +1 -1
- package/esm/policies/NoUnsafeWithoutJustification.js +8 -9
- package/esm/policies/NoUnsafeWithoutJustification.js.map +1 -1
- package/esm/policies/NoWildcardDependencies.d.ts +5 -5
- package/esm/policies/NoWildcardDependencies.d.ts.map +1 -1
- package/esm/policies/NoWildcardDependencies.js +6 -6
- package/esm/policies/NoWildcardDependencies.js.map +1 -1
- package/esm/policies/PackageAllowedScopes.d.ts +9 -5
- package/esm/policies/PackageAllowedScopes.d.ts.map +1 -1
- package/esm/policies/PackageAllowedScopes.js +15 -16
- package/esm/policies/PackageAllowedScopes.js.map +1 -1
- package/esm/policies/PackageEsmType.d.ts +7 -5
- package/esm/policies/PackageEsmType.d.ts.map +1 -1
- package/esm/policies/PackageEsmType.js +31 -31
- package/esm/policies/PackageEsmType.js.map +1 -1
- package/esm/policies/PackageFolderName.d.ts +8 -6
- package/esm/policies/PackageFolderName.d.ts.map +1 -1
- package/esm/policies/PackageFolderName.js +13 -16
- package/esm/policies/PackageFolderName.js.map +1 -1
- package/esm/policies/PackageJsonProperties.d.ts +5 -3
- package/esm/policies/PackageJsonProperties.d.ts.map +1 -1
- package/esm/policies/PackageJsonProperties.js +6 -17
- package/esm/policies/PackageJsonProperties.js.map +1 -1
- package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts +2 -7
- package/esm/policies/PackageJsonRepoDirectoryProperty.d.ts.map +1 -1
- package/esm/policies/PackageJsonRepoDirectoryProperty.js +28 -42
- package/esm/policies/PackageJsonRepoDirectoryProperty.js.map +1 -1
- package/esm/policies/PackageJsonSorted.d.ts +2 -2
- package/esm/policies/PackageJsonSorted.d.ts.map +1 -1
- package/esm/policies/PackageJsonSorted.js +15 -30
- package/esm/policies/PackageJsonSorted.js.map +1 -1
- package/esm/policies/PackageLicense.d.ts +4 -4
- package/esm/policies/PackageLicense.d.ts.map +1 -1
- package/esm/policies/PackageLicense.js +31 -52
- package/esm/policies/PackageLicense.js.map +1 -1
- package/esm/policies/PackagePrivateField.d.ts +12 -8
- package/esm/policies/PackagePrivateField.d.ts.map +1 -1
- package/esm/policies/PackagePrivateField.js +31 -23
- package/esm/policies/PackagePrivateField.js.map +1 -1
- package/esm/policies/PackageReadme.d.ts +6 -5
- package/esm/policies/PackageReadme.d.ts.map +1 -1
- package/esm/policies/PackageReadme.js +22 -59
- package/esm/policies/PackageReadme.js.map +1 -1
- package/esm/policies/PackageScripts.d.ts +26 -22
- package/esm/policies/PackageScripts.d.ts.map +1 -1
- package/esm/policies/PackageScripts.js +39 -36
- package/esm/policies/PackageScripts.js.map +1 -1
- package/esm/policies/PackageTestScripts.d.ts +10 -6
- package/esm/policies/PackageTestScripts.d.ts.map +1 -1
- package/esm/policies/PackageTestScripts.js +14 -16
- package/esm/policies/PackageTestScripts.js.map +1 -1
- package/esm/policies/PublicApiDocumented.d.ts +4 -4
- package/esm/policies/PublicApiDocumented.d.ts.map +1 -1
- package/esm/policies/PublicApiDocumented.js +10 -8
- package/esm/policies/PublicApiDocumented.js.map +1 -1
- package/esm/policies/RequiredGitignorePatterns.d.ts +11 -4
- package/esm/policies/RequiredGitignorePatterns.d.ts.map +1 -1
- package/esm/policies/RequiredGitignorePatterns.js +29 -36
- package/esm/policies/RequiredGitignorePatterns.js.map +1 -1
- package/esm/policies/RequiredScripts.d.ts +9 -7
- package/esm/policies/RequiredScripts.d.ts.map +1 -1
- package/esm/policies/RequiredScripts.js +24 -24
- package/esm/policies/RequiredScripts.js.map +1 -1
- package/esm/policies/RustDocExists.d.ts +4 -4
- package/esm/policies/RustDocExists.d.ts.map +1 -1
- package/esm/policies/RustDocExists.js +6 -6
- package/esm/policies/RustDocExists.js.map +1 -1
- package/esm/policies/RustToolchainExists.d.ts +11 -4
- package/esm/policies/RustToolchainExists.d.ts.map +1 -1
- package/esm/policies/RustToolchainExists.js +10 -9
- package/esm/policies/RustToolchainExists.js.map +1 -1
- package/esm/policies/RustfmtConfigExists.d.ts +11 -4
- package/esm/policies/RustfmtConfigExists.d.ts.map +1 -1
- package/esm/policies/RustfmtConfigExists.js +10 -9
- package/esm/policies/RustfmtConfigExists.js.map +1 -1
- package/esm/policies/ScriptContains.d.ts +9 -7
- package/esm/policies/ScriptContains.d.ts.map +1 -1
- package/esm/policies/ScriptContains.js +9 -13
- package/esm/policies/ScriptContains.js.map +1 -1
- package/esm/policies/SharedDependencyVersions.d.ts +9 -4
- package/esm/policies/SharedDependencyVersions.d.ts.map +1 -1
- package/esm/policies/SharedDependencyVersions.js +28 -20
- package/esm/policies/SharedDependencyVersions.js.map +1 -1
- package/esm/policies/WorkspaceInheritance.d.ts +11 -4
- package/esm/policies/WorkspaceInheritance.d.ts.map +1 -1
- package/esm/policies/WorkspaceInheritance.js +10 -11
- package/esm/policies/WorkspaceInheritance.js.map +1 -1
- package/esm/policies/WorkspaceMembersValid.d.ts +11 -4
- package/esm/policies/WorkspaceMembersValid.d.ts.map +1 -1
- package/esm/policies/WorkspaceMembersValid.js +10 -11
- package/esm/policies/WorkspaceMembersValid.js.map +1 -1
- package/esm/policies/constants.d.ts.map +1 -1
- package/esm/policies/constants.js +1 -1
- package/esm/policies/constants.js.map +1 -1
- package/esm/policies.d.ts +13 -5
- package/esm/policies.d.ts.map +1 -1
- package/esm/policies.js +12 -5
- package/esm/policies.js.map +1 -1
- package/esm/policy.d.ts +61 -289
- package/esm/policy.d.ts.map +1 -1
- package/esm/policy.js +1 -122
- package/esm/policy.js.map +1 -1
- package/esm/policyDefiners/defineCargoPolicy.d.ts +25 -9
- package/esm/policyDefiners/defineCargoPolicy.d.ts.map +1 -1
- package/esm/policyDefiners/defineCargoPolicy.js +10 -28
- package/esm/policyDefiners/defineCargoPolicy.js.map +1 -1
- package/esm/policyDefiners/defineFileHeaderPolicy.d.ts +27 -14
- package/esm/policyDefiners/defineFileHeaderPolicy.d.ts.map +1 -1
- package/esm/policyDefiners/defineFileHeaderPolicy.js +16 -35
- package/esm/policyDefiners/defineFileHeaderPolicy.js.map +1 -1
- package/esm/policyDefiners/defineGleamPolicy.d.ts +25 -9
- package/esm/policyDefiners/defineGleamPolicy.d.ts.map +1 -1
- package/esm/policyDefiners/defineGleamPolicy.js +10 -27
- package/esm/policyDefiners/defineGleamPolicy.js.map +1 -1
- package/esm/policyDefiners/definePackagePolicy.d.ts +24 -13
- package/esm/policyDefiners/definePackagePolicy.d.ts.map +1 -1
- package/esm/policyDefiners/definePackagePolicy.js +9 -32
- package/esm/policyDefiners/definePackagePolicy.js.map +1 -1
- package/esm/policyDefiners/spdxValidator.d.ts +4 -12
- package/esm/policyDefiners/spdxValidator.d.ts.map +1 -1
- package/esm/policyDefiners/spdxValidator.js +26 -14
- package/esm/policyDefiners/spdxValidator.js.map +1 -1
- package/esm/policyExecution.d.ts +19 -0
- package/esm/policyExecution.d.ts.map +1 -0
- package/esm/policyExecution.js +224 -0
- package/esm/policyExecution.js.map +1 -0
- package/esm/repositoryFiles.d.ts +4 -0
- package/esm/repositoryFiles.d.ts.map +1 -0
- package/esm/repositoryFiles.js +8 -0
- package/esm/repositoryFiles.js.map +1 -0
- package/esm/runner.d.ts +72 -47
- package/esm/runner.d.ts.map +1 -1
- package/esm/runner.js +153 -138
- package/esm/runner.js.map +1 -1
- package/esm/settlePolicyPromise.d.ts +4 -0
- package/esm/settlePolicyPromise.d.ts.map +1 -0
- package/esm/settlePolicyPromise.js +10 -0
- package/esm/settlePolicyPromise.js.map +1 -0
- package/esm/tsdoc-metadata.json +1 -1
- package/esm/utils/safePaths.d.ts +9 -0
- package/esm/utils/safePaths.d.ts.map +1 -0
- package/esm/utils/safePaths.js +40 -0
- package/esm/utils/safePaths.js.map +1 -0
- package/oclif.manifest.json +19 -2
- package/package.json +42 -27
- package/scripts/benchmark.mjs +341 -0
- package/sidecar/sidecar.mjs +348 -417
|
@@ -5,7 +5,7 @@ const MANUAL_FIX = "Use valid SPDX licence identifiers (e.g., MIT, Apache-2.0, M
|
|
|
5
5
|
/**
|
|
6
6
|
* A policy that ensures licence metadata is properly configured in gleam.toml.
|
|
7
7
|
*
|
|
8
|
-
* @
|
|
8
|
+
* @public
|
|
9
9
|
*/
|
|
10
10
|
export const GleamLicenceConfigured = defineGleamPolicy({
|
|
11
11
|
name: "GleamLicenceConfigured",
|
|
@@ -13,10 +13,12 @@ export const GleamLicenceConfigured = defineGleamPolicy({
|
|
|
13
13
|
handler: async (toml, { file, root, resolve: shouldResolve, config }) => {
|
|
14
14
|
const licences = toml.licences;
|
|
15
15
|
if (!Array.isArray(licences) || licences.length === 0) {
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
return [
|
|
17
|
+
{
|
|
18
|
+
message: "Missing or empty licences field in gleam.toml.",
|
|
19
|
+
manualFix: 'Add licences = ["MIT"] (or appropriate SPDX identifier) to gleam.toml.',
|
|
20
|
+
},
|
|
21
|
+
];
|
|
20
22
|
}
|
|
21
23
|
const result = await validateLicenceField({
|
|
22
24
|
licences: licences,
|
|
@@ -28,7 +30,7 @@ export const GleamLicenceConfigured = defineGleamPolicy({
|
|
|
28
30
|
filePath: resolve(root, file),
|
|
29
31
|
manualFixMessage: MANUAL_FIX,
|
|
30
32
|
});
|
|
31
|
-
return result
|
|
33
|
+
return result;
|
|
32
34
|
},
|
|
33
35
|
});
|
|
34
36
|
//# sourceMappingURL=GleamLicenceConfigured.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamLicenceConfigured.js","sourceRoot":"","sources":["../../src/policies/GleamLicenceConfigured.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EACN,iBAAiB,GAEjB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAyB1E,MAAM,UAAU,GACf,sEAAsE,CAAC;AAExE;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"GleamLicenceConfigured.js","sourceRoot":"","sources":["../../src/policies/GleamLicenceConfigured.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAEhC,OAAO,EACN,iBAAiB,GAEjB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAyB1E,MAAM,UAAU,GACf,sEAAsE,CAAC;AAExE;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;IACvD,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACV,mEAAmE;IACpE,OAAO,EAAE,KAAK,EACb,IAAe,EACf,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,EAC7C,EAAE;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE/B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvD,OAAO;gBACN;oBACC,OAAO,EAAE,gDAAgD;oBACzD,SAAS,EACR,wEAAwE;iBACzE;aACD,CAAC;QACH,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC;YACzC,QAAQ,EAAE,QAAoB;YAC9B,GAAG,CAAC,MAAM,EAAE,eAAe,KAAK,SAAS,IAAI;gBAC5C,eAAe,EAAE,MAAM,CAAC,eAAe;aACvC,CAAC;YACF,YAAY,EAAE,MAAM,EAAE,YAAY,IAAI,KAAK;YAC3C,aAAa;YACb,QAAQ,EAAE,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC;YAC7B,gBAAgB,EAAE,UAAU;SAC5B,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IACf,CAAC;CACD,CAA8D,CAAC","sourcesContent":["import { resolve } from \"pathe\";\nimport type { FilePolicyDefinition } from \"../policy.js\";\nimport {\n\tdefineGleamPolicy,\n\ttype GleamToml,\n} from \"../policyDefiners/defineGleamPolicy.js\";\nimport { validateLicenceField } from \"../policyDefiners/spdxValidator.js\";\n\n/**\n * Configuration for the GleamLicenceConfigured policy.\n *\n * @public\n */\nexport interface GleamLicenceConfiguredConfig {\n\t/**\n\t * Allowed SPDX licence identifiers. If set, only these are accepted.\n\t */\n\tallowedLicences?: string[];\n\n\t/**\n\t * If true, validate licence values against the SPDX licence list\n\t * using `spdx-correct`. When enabled, typos like \"MIIT\" are detected\n\t * and can be auto-fixed to the correct identifier (\"MIT\").\n\t *\n\t * Requires the optional peer dependency `spdx-correct` to be installed.\n\t *\n\t * @defaultValue false\n\t */\n\tvalidateSpdx?: boolean;\n}\n\nconst MANUAL_FIX =\n\t\"Use valid SPDX licence identifiers (e.g., MIT, Apache-2.0, MPL-2.0).\";\n\n/**\n * A policy that ensures licence metadata is properly configured in gleam.toml.\n *\n * @public\n */\nexport const GleamLicenceConfigured = defineGleamPolicy({\n\tname: \"GleamLicenceConfigured\",\n\tdescription:\n\t\t\"Ensures gleam.toml has valid SPDX licence identifiers configured.\",\n\thandler: async (\n\t\ttoml: GleamToml,\n\t\t{ file, root, resolve: shouldResolve, config },\n\t) => {\n\t\tconst licences = toml.licences;\n\n\t\tif (!Array.isArray(licences) || licences.length === 0) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tmessage: \"Missing or empty licences field in gleam.toml.\",\n\t\t\t\t\tmanualFix:\n\t\t\t\t\t\t'Add licences = [\"MIT\"] (or appropriate SPDX identifier) to gleam.toml.',\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\tconst result = await validateLicenceField({\n\t\t\tlicences: licences as string[],\n\t\t\t...(config?.allowedLicences !== undefined && {\n\t\t\t\tallowedLicences: config.allowedLicences,\n\t\t\t}),\n\t\t\tvalidateSpdx: config?.validateSpdx ?? false,\n\t\t\tshouldResolve,\n\t\t\tfilePath: resolve(root, file),\n\t\t\tmanualFixMessage: MANUAL_FIX,\n\t\t});\n\t\treturn result;\n\t},\n}) satisfies FilePolicyDefinition<GleamLicenceConfiguredConfig>;\n"]}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
-
import type { PolicyDefinition } from "../policy.js";
|
|
2
1
|
/**
|
|
3
2
|
* A policy that ensures manifest.toml is committed alongside gleam.toml
|
|
4
3
|
* for reproducible Gleam builds.
|
|
5
4
|
*
|
|
6
|
-
* @
|
|
5
|
+
* @public
|
|
7
6
|
*/
|
|
8
|
-
export declare const GleamManifestCommitted:
|
|
7
|
+
export declare const GleamManifestCommitted: {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
match: RegExp;
|
|
11
|
+
handler: ({ file, root }: import("../policy.js").PolicyArgs<void>) => Promise<{
|
|
12
|
+
message: string;
|
|
13
|
+
manualFix: string;
|
|
14
|
+
}[]>;
|
|
15
|
+
};
|
|
9
16
|
//# sourceMappingURL=GleamManifestCommitted.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamManifestCommitted.d.ts","sourceRoot":"","sources":["../../src/policies/GleamManifestCommitted.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"GleamManifestCommitted.d.ts","sourceRoot":"","sources":["../../src/policies/GleamManifestCommitted.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;CAqBH,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import path from "pathe";
|
|
3
|
-
import { makePolicyDefinition } from "../makePolicy.js";
|
|
4
3
|
/**
|
|
5
4
|
* A policy that ensures manifest.toml is committed alongside gleam.toml
|
|
6
5
|
* for reproducible Gleam builds.
|
|
7
6
|
*
|
|
8
|
-
* @
|
|
7
|
+
* @public
|
|
9
8
|
*/
|
|
10
|
-
export const GleamManifestCommitted =
|
|
9
|
+
export const GleamManifestCommitted = {
|
|
11
10
|
name: "GleamManifestCommitted",
|
|
12
11
|
description: "Ensures manifest.toml is committed alongside gleam.toml for reproducible builds.",
|
|
13
12
|
match: /gleam\.toml$/,
|
|
@@ -15,12 +14,14 @@ export const GleamManifestCommitted = makePolicyDefinition({
|
|
|
15
14
|
const dir = path.dirname(path.resolve(root, file));
|
|
16
15
|
const manifestPath = path.join(dir, "manifest.toml");
|
|
17
16
|
if (existsSync(manifestPath)) {
|
|
18
|
-
return
|
|
17
|
+
return [];
|
|
19
18
|
}
|
|
20
|
-
return
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
message: "Missing manifest.toml. Gleam projects should commit manifest.toml for reproducible builds.",
|
|
22
|
+
manualFix: "Run `gleam build` to generate manifest.toml, then commit it to source control.",
|
|
23
|
+
},
|
|
24
|
+
];
|
|
24
25
|
},
|
|
25
|
-
}
|
|
26
|
+
};
|
|
26
27
|
//# sourceMappingURL=GleamManifestCommitted.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamManifestCommitted.js","sourceRoot":"","sources":["../../src/policies/GleamManifestCommitted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GleamManifestCommitted.js","sourceRoot":"","sources":["../../src/policies/GleamManifestCommitted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,OAAO,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACrC,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACV,kFAAkF;IACnF,KAAK,EAAE,cAAc;IACrB,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;QACjC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACnD,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;QAErD,IAAI,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;YAC9B,OAAO,EAAE,CAAC;QACX,CAAC;QACD,OAAO;YACN;gBACC,OAAO,EACN,4FAA4F;gBAC7F,SAAS,EACR,gFAAgF;aACjF;SACD,CAAC;IACH,CAAC;CAC8B,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"pathe\";\nimport type { FilePolicyDefinition } from \"../policy.js\";\n/**\n * A policy that ensures manifest.toml is committed alongside gleam.toml\n * for reproducible Gleam builds.\n *\n * @public\n */\nexport const GleamManifestCommitted = {\n\tname: \"GleamManifestCommitted\",\n\tdescription:\n\t\t\"Ensures manifest.toml is committed alongside gleam.toml for reproducible builds.\",\n\tmatch: /gleam\\.toml$/,\n\thandler: async ({ file, root }) => {\n\t\tconst dir = path.dirname(path.resolve(root, file));\n\t\tconst manifestPath = path.join(dir, \"manifest.toml\");\n\n\t\tif (existsSync(manifestPath)) {\n\t\t\treturn [];\n\t\t}\n\t\treturn [\n\t\t\t{\n\t\t\t\tmessage:\n\t\t\t\t\t\"Missing manifest.toml. Gleam projects should commit manifest.toml for reproducible builds.\",\n\t\t\t\tmanualFix:\n\t\t\t\t\t\"Run `gleam build` to generate manifest.toml, then commit it to source control.\",\n\t\t\t},\n\t\t];\n\t},\n} satisfies FilePolicyDefinition;\n"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { PolicyDefinition } from "../policy.js";
|
|
2
1
|
/**
|
|
3
2
|
* Configuration for the GleamMonorepoConsistency policy.
|
|
4
3
|
*
|
|
5
|
-
* @
|
|
4
|
+
* @public
|
|
6
5
|
*/
|
|
7
6
|
export interface GleamMonorepoConsistencyConfig {
|
|
8
7
|
/**
|
|
@@ -17,14 +16,23 @@ export interface GleamMonorepoConsistencyConfig {
|
|
|
17
16
|
syncGleamVersion?: boolean;
|
|
18
17
|
/**
|
|
19
18
|
* Paths to gleam.toml files to compare (relative to repo root).
|
|
20
|
-
*
|
|
19
|
+
* With fewer than two paths, the policy reports no findings.
|
|
21
20
|
*/
|
|
22
21
|
packages?: string[];
|
|
23
22
|
}
|
|
24
23
|
/**
|
|
25
24
|
* A policy that enforces consistent metadata across Gleam packages in a monorepo.
|
|
26
25
|
*
|
|
27
|
-
* @
|
|
26
|
+
* @public
|
|
28
27
|
*/
|
|
29
|
-
export declare const GleamMonorepoConsistency:
|
|
28
|
+
export declare const GleamMonorepoConsistency: {
|
|
29
|
+
name: string;
|
|
30
|
+
requiresConfig: true;
|
|
31
|
+
description: string;
|
|
32
|
+
match: RegExp;
|
|
33
|
+
handler: ({ root, config }: import("../policy.js").PolicyArgs<GleamMonorepoConsistencyConfig>) => Promise<{
|
|
34
|
+
message: string;
|
|
35
|
+
manualFix: string;
|
|
36
|
+
}[]>;
|
|
37
|
+
};
|
|
30
38
|
//# sourceMappingURL=GleamMonorepoConsistency.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamMonorepoConsistency.d.ts","sourceRoot":"","sources":["../../src/policies/GleamMonorepoConsistency.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GleamMonorepoConsistency.d.ts","sourceRoot":"","sources":["../../src/policies/GleamMonorepoConsistency.ts"],"names":[],"mappings":"AAKA;;;;GAIG;AACH,MAAM,WAAW,8BAA8B;IAC9C;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAuCD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;CA8C2B,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import path from "pathe";
|
|
3
|
-
import { makePolicyDefinition } from "../makePolicy.js";
|
|
4
3
|
import { parseToml } from "../policyDefiners/tomlParser.js";
|
|
5
4
|
const DEFAULT_SYNC_FIELDS = ["licences"];
|
|
6
5
|
async function loadGleamToml(filePath) {
|
|
@@ -32,16 +31,17 @@ function checkFieldConsistency(packages, field) {
|
|
|
32
31
|
/**
|
|
33
32
|
* A policy that enforces consistent metadata across Gleam packages in a monorepo.
|
|
34
33
|
*
|
|
35
|
-
* @
|
|
34
|
+
* @public
|
|
36
35
|
*/
|
|
37
|
-
export const GleamMonorepoConsistency =
|
|
36
|
+
export const GleamMonorepoConsistency = {
|
|
38
37
|
name: "GleamMonorepoConsistency",
|
|
38
|
+
requiresConfig: true,
|
|
39
39
|
description: "Enforces consistent metadata (licences, gleam version, etc.) across Gleam packages in a monorepo.",
|
|
40
40
|
match: /^gleam\.toml$/,
|
|
41
41
|
handler: async ({ root, config }) => {
|
|
42
42
|
const packagePaths = config?.packages;
|
|
43
43
|
if (!packagePaths || packagePaths.length < 2) {
|
|
44
|
-
return
|
|
44
|
+
return [];
|
|
45
45
|
}
|
|
46
46
|
const syncFields = config?.syncFields ?? DEFAULT_SYNC_FIELDS;
|
|
47
47
|
const syncGleamVersion = config?.syncGleamVersion ?? true;
|
|
@@ -53,7 +53,7 @@ export const GleamMonorepoConsistency = makePolicyDefinition({
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
if (packages.size < 2) {
|
|
56
|
-
return
|
|
56
|
+
return [];
|
|
57
57
|
}
|
|
58
58
|
const errors = [];
|
|
59
59
|
for (const field of syncFields) {
|
|
@@ -63,12 +63,12 @@ export const GleamMonorepoConsistency = makePolicyDefinition({
|
|
|
63
63
|
errors.push(...checkFieldConsistency(packages, "gleam"));
|
|
64
64
|
}
|
|
65
65
|
if (errors.length > 0) {
|
|
66
|
-
return {
|
|
67
|
-
|
|
66
|
+
return errors.map((message) => ({
|
|
67
|
+
message,
|
|
68
68
|
manualFix: "Ensure all Gleam packages in the monorepo use consistent metadata values.",
|
|
69
|
-
};
|
|
69
|
+
}));
|
|
70
70
|
}
|
|
71
|
-
return
|
|
71
|
+
return [];
|
|
72
72
|
},
|
|
73
|
-
}
|
|
73
|
+
};
|
|
74
74
|
//# sourceMappingURL=GleamMonorepoConsistency.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamMonorepoConsistency.js","sourceRoot":"","sources":["../../src/policies/GleamMonorepoConsistency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GleamMonorepoConsistency.js","sourceRoot":"","sources":["../../src/policies/GleamMonorepoConsistency.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,OAAO,CAAC;AAEzB,OAAO,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AA2B5D,MAAM,mBAAmB,GAAG,CAAC,UAAU,CAAC,CAAC;AAEzC,KAAK,UAAU,aAAa,CAC3B,QAAgB;IAEhB,IAAI,CAAC;QACJ,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,OAAO,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED,SAAS,qBAAqB,CAC7B,QAA8C,EAC9C,KAAa;IAEb,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;IAE3C,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC;QAClD,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACxB,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,CAAC;QAC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C;gBACV,QAAQ,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAC7B,CAAC;QACF,CAAC;QAED,IAAI,QAAQ,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,EAAE,CAAC;QACX,CAAC;QAED,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,KAAK,MAAM,KAAK,IAAI,UAAU,EAAE,CAAC;YAChC,MAAM,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QACxD,CAAC;QAED,IAAI,gBAAgB,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC,GAAG,qBAAqB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC/B,OAAO;gBACP,SAAS,EACR,2EAA2E;aAC5E,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CAC8D,CAAC","sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport path from \"pathe\";\nimport type { FilePolicyDefinition } from \"../policy.js\";\nimport { parseToml } from \"../policyDefiners/tomlParser.js\";\n\n/**\n * Configuration for the GleamMonorepoConsistency policy.\n *\n * @public\n */\nexport interface GleamMonorepoConsistencyConfig {\n\t/**\n\t * Top-level fields that should be consistent across all packages.\n\t * @defaultValue [\"licences\"]\n\t */\n\tsyncFields?: string[];\n\n\t/**\n\t * If true, ensure the `gleam` version constraint is consistent.\n\t * @defaultValue true\n\t */\n\tsyncGleamVersion?: boolean;\n\n\t/**\n\t * Paths to gleam.toml files to compare (relative to repo root).\n\t * With fewer than two paths, the policy reports no findings.\n\t */\n\tpackages?: string[];\n}\n\nconst DEFAULT_SYNC_FIELDS = [\"licences\"];\n\nasync function loadGleamToml(\n\tfilePath: string,\n): Promise<Record<string, unknown> | undefined> {\n\ttry {\n\t\tconst content = await readFile(filePath, \"utf-8\");\n\t\treturn await parseToml(content);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction checkFieldConsistency(\n\tpackages: Map<string, Record<string, unknown>>,\n\tfield: string,\n): string[] {\n\tconst values = new Map<string, string[]>();\n\n\tfor (const [pkg, toml] of packages) {\n\t\tconst value = JSON.stringify(toml[field] ?? null);\n\t\tif (!values.has(value)) {\n\t\t\tvalues.set(value, []);\n\t\t}\n\t\tvalues.get(value)?.push(pkg);\n\t}\n\n\tif (values.size <= 1) {\n\t\treturn [];\n\t}\n\n\tconst details = [...values.entries()]\n\t\t.map(([val, pkgs]) => `${val} in ${pkgs.join(\", \")}`)\n\t\t.join(\"; \");\n\treturn [`Inconsistent \"${field}\" across packages: ${details}`];\n}\n\n/**\n * A policy that enforces consistent metadata across Gleam packages in a monorepo.\n *\n * @public\n */\nexport const GleamMonorepoConsistency = {\n\tname: \"GleamMonorepoConsistency\",\n\trequiresConfig: true,\n\tdescription:\n\t\t\"Enforces consistent metadata (licences, gleam version, etc.) across Gleam packages in a monorepo.\",\n\tmatch: /^gleam\\.toml$/,\n\thandler: async ({ root, config }) => {\n\t\tconst packagePaths = config?.packages;\n\t\tif (!packagePaths || packagePaths.length < 2) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst syncFields = config?.syncFields ?? DEFAULT_SYNC_FIELDS;\n\t\tconst syncGleamVersion = config?.syncGleamVersion ?? true;\n\n\t\tconst packages = new Map<string, Record<string, unknown>>();\n\t\tfor (const pkgPath of packagePaths) {\n\t\t\tconst toml = await loadGleamToml(path.resolve(root, pkgPath));\n\t\t\tif (toml) {\n\t\t\t\tpackages.set(pkgPath, toml);\n\t\t\t}\n\t\t}\n\n\t\tif (packages.size < 2) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst errors: string[] = [];\n\n\t\tfor (const field of syncFields) {\n\t\t\terrors.push(...checkFieldConsistency(packages, field));\n\t\t}\n\n\t\tif (syncGleamVersion) {\n\t\t\terrors.push(...checkFieldConsistency(packages, \"gleam\"));\n\t\t}\n\n\t\tif (errors.length > 0) {\n\t\t\treturn errors.map((message) => ({\n\t\t\t\tmessage,\n\t\t\t\tmanualFix:\n\t\t\t\t\t\"Ensure all Gleam packages in the monorepo use consistent metadata values.\",\n\t\t\t}));\n\t\t}\n\t\treturn [];\n\t},\n} satisfies FilePolicyDefinition<GleamMonorepoConsistencyConfig>;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FilePolicyDefinition } from "../policy.js";
|
|
2
2
|
/**
|
|
3
3
|
* Configuration for the GleamNameRestrictions policy.
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
5
|
+
* @public
|
|
6
6
|
*/
|
|
7
7
|
export interface GleamNameRestrictionsConfig {
|
|
8
8
|
/**
|
|
@@ -19,7 +19,7 @@ export interface GleamNameRestrictionsConfig {
|
|
|
19
19
|
/**
|
|
20
20
|
* A policy that enforces naming conventions for Gleam packages.
|
|
21
21
|
*
|
|
22
|
-
* @
|
|
22
|
+
* @public
|
|
23
23
|
*/
|
|
24
|
-
export declare const GleamNameRestrictions:
|
|
24
|
+
export declare const GleamNameRestrictions: FilePolicyDefinition<GleamNameRestrictionsConfig>;
|
|
25
25
|
//# sourceMappingURL=GleamNameRestrictions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamNameRestrictions.d.ts","sourceRoot":"","sources":["../../src/policies/GleamNameRestrictions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"GleamNameRestrictions.d.ts","sourceRoot":"","sources":["../../src/policies/GleamNameRestrictions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAMzD;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AAiBD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,mDAkC4B,CAAC"}
|
|
@@ -12,7 +12,7 @@ function checkDeniedPrefixes(name, prefixes) {
|
|
|
12
12
|
/**
|
|
13
13
|
* A policy that enforces naming conventions for Gleam packages.
|
|
14
14
|
*
|
|
15
|
-
* @
|
|
15
|
+
* @public
|
|
16
16
|
*/
|
|
17
17
|
export const GleamNameRestrictions = defineGleamPolicy({
|
|
18
18
|
name: "GleamNameRestrictions",
|
|
@@ -20,7 +20,7 @@ export const GleamNameRestrictions = defineGleamPolicy({
|
|
|
20
20
|
handler: async (toml, { config }) => {
|
|
21
21
|
const name = toml.name;
|
|
22
22
|
if (!name) {
|
|
23
|
-
return
|
|
23
|
+
return [];
|
|
24
24
|
}
|
|
25
25
|
const errors = [];
|
|
26
26
|
const denyPrefixes = config?.denyPrefixes ?? DEFAULT_DENY_PREFIXES;
|
|
@@ -33,12 +33,12 @@ export const GleamNameRestrictions = defineGleamPolicy({
|
|
|
33
33
|
errors.push(`Package name "${name}" is not snake_case. Gleam package names should use lowercase letters, digits, and underscores.`);
|
|
34
34
|
}
|
|
35
35
|
if (errors.length > 0) {
|
|
36
|
-
return {
|
|
37
|
-
|
|
36
|
+
return errors.map((message) => ({
|
|
37
|
+
message,
|
|
38
38
|
manualFix: "Rename the package to follow Gleam naming conventions (snake_case, no gleam_ prefix).",
|
|
39
|
-
};
|
|
39
|
+
}));
|
|
40
40
|
}
|
|
41
|
-
return
|
|
41
|
+
return [];
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
44
|
//# sourceMappingURL=GleamNameRestrictions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamNameRestrictions.js","sourceRoot":"","sources":["../../src/policies/GleamNameRestrictions.ts"],"names":[],"mappings":"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AAI,CAAC,IAAI,EAAE,CAAC;YACX,OAAO,EAAE,CAAC;QACX,CAAC;QAED,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,MAAM,YAAY,GAAG,MAAM,EAAE,YAAY,IAAI,qBAAqB,CAAC;QACnE,MAAM,gBAAgB,GAAG,MAAM,EAAE,gBAAgB,IAAI,IAAI,CAAC;QAE1D,MAAM,WAAW,GAAG,mBAAmB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC5D,IAAI,WAAW,EAAE,CAAC;YACjB,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1B,CAAC;QAED,IAAI,gBAAgB,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACtD,MAAM,CAAC,IAAI,CACV,iBAAiB,IAAI,iGAAiG,CACtH,CAAC;QACH,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC/B,OAAO;gBACP,SAAS,EACR,uFAAuF;aACxF,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAA6D,CAAC","sourcesContent":["import type { FilePolicyDefinition } from \"../policy.js\";\nimport {\n\tdefineGleamPolicy,\n\ttype GleamToml,\n} from \"../policyDefiners/defineGleamPolicy.js\";\n\n/**\n * Configuration for the GleamNameRestrictions policy.\n *\n * @public\n */\nexport interface GleamNameRestrictionsConfig {\n\t/**\n\t * Prefixes that are denied for package names.\n\t * @defaultValue [\"gleam_\"]\n\t */\n\tdenyPrefixes?: string[];\n\n\t/**\n\t * If true, require snake_case naming.\n\t * @defaultValue true\n\t */\n\trequireSnakeCase?: boolean;\n}\n\nconst DEFAULT_DENY_PREFIXES = [\"gleam_\"];\nconst SNAKE_CASE_REGEX = /^[a-z][a-z0-9]*(_[a-z0-9]+)*$/;\n\nfunction checkDeniedPrefixes(\n\tname: string,\n\tprefixes: string[],\n): string | undefined {\n\tfor (const prefix of prefixes) {\n\t\tif (name.startsWith(prefix)) {\n\t\t\treturn `Package name \"${name}\" uses reserved prefix \"${prefix}\". The \"gleam_\" prefix is reserved for official Gleam packages.`;\n\t\t}\n\t}\n\treturn undefined;\n}\n\n/**\n * A policy that enforces naming conventions for Gleam packages.\n *\n * @public\n */\nexport const GleamNameRestrictions = defineGleamPolicy({\n\tname: \"GleamNameRestrictions\",\n\tdescription:\n\t\t'Enforces Gleam package naming conventions: no \"gleam_\" prefix, snake_case required.',\n\thandler: async (toml: GleamToml, { config }) => {\n\t\tconst name = toml.name as string | undefined;\n\t\tif (!name) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst errors: string[] = [];\n\t\tconst denyPrefixes = config?.denyPrefixes ?? DEFAULT_DENY_PREFIXES;\n\t\tconst requireSnakeCase = config?.requireSnakeCase ?? true;\n\n\t\tconst prefixError = checkDeniedPrefixes(name, denyPrefixes);\n\t\tif (prefixError) {\n\t\t\terrors.push(prefixError);\n\t\t}\n\n\t\tif (requireSnakeCase && !SNAKE_CASE_REGEX.test(name)) {\n\t\t\terrors.push(\n\t\t\t\t`Package name \"${name}\" is not snake_case. Gleam package names should use lowercase letters, digits, and underscores.`,\n\t\t\t);\n\t\t}\n\n\t\tif (errors.length > 0) {\n\t\t\treturn errors.map((message) => ({\n\t\t\t\tmessage,\n\t\t\t\tmanualFix:\n\t\t\t\t\t\"Rename the package to follow Gleam naming conventions (snake_case, no gleam_ prefix).\",\n\t\t\t}));\n\t\t}\n\t\treturn [];\n\t},\n}) satisfies FilePolicyDefinition<GleamNameRestrictionsConfig>;\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FilePolicyDefinition } from "../policy.js";
|
|
2
2
|
/**
|
|
3
3
|
* Configuration for the GleamNoPathDepsInPublished policy.
|
|
4
4
|
*
|
|
5
|
-
* @
|
|
5
|
+
* @public
|
|
6
6
|
*/
|
|
7
7
|
export interface GleamNoPathDepsInPublishedConfig {
|
|
8
8
|
/**
|
|
@@ -16,7 +16,7 @@ export interface GleamNoPathDepsInPublishedConfig {
|
|
|
16
16
|
/**
|
|
17
17
|
* A policy that warns when path dependencies are used in packages intended for publishing.
|
|
18
18
|
*
|
|
19
|
-
* @
|
|
19
|
+
* @public
|
|
20
20
|
*/
|
|
21
|
-
export declare const GleamNoPathDepsInPublished:
|
|
21
|
+
export declare const GleamNoPathDepsInPublished: FilePolicyDefinition<GleamNoPathDepsInPublishedConfig>;
|
|
22
22
|
//# sourceMappingURL=GleamNoPathDepsInPublished.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamNoPathDepsInPublished.d.ts","sourceRoot":"","sources":["../../src/policies/GleamNoPathDepsInPublished.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"GleamNoPathDepsInPublished.d.ts","sourceRoot":"","sources":["../../src/policies/GleamNoPathDepsInPublished.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAMzD;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAChD;;;;;OAKG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC1B;AAeD;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,wDA8B4B,CAAC"}
|
|
@@ -14,14 +14,14 @@ function findPathDeps(deps) {
|
|
|
14
14
|
/**
|
|
15
15
|
* A policy that warns when path dependencies are used in packages intended for publishing.
|
|
16
16
|
*
|
|
17
|
-
* @
|
|
17
|
+
* @public
|
|
18
18
|
*/
|
|
19
19
|
export const GleamNoPathDepsInPublished = defineGleamPolicy({
|
|
20
20
|
name: "GleamNoPathDepsInPublished",
|
|
21
21
|
description: "Warns when path dependencies are used in packages intended for publishing to Hex.",
|
|
22
22
|
handler: async (toml, { config }) => {
|
|
23
23
|
if (config?.onlyPublishable && !toml.description) {
|
|
24
|
-
return
|
|
24
|
+
return [];
|
|
25
25
|
}
|
|
26
26
|
const errors = [];
|
|
27
27
|
const deps = toml.dependencies;
|
|
@@ -32,12 +32,12 @@ export const GleamNoPathDepsInPublished = defineGleamPolicy({
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
if (errors.length > 0) {
|
|
35
|
-
return {
|
|
36
|
-
|
|
35
|
+
return errors.map((message) => ({
|
|
36
|
+
message,
|
|
37
37
|
manualFix: "Replace path dependencies with version constraints before publishing.",
|
|
38
|
-
};
|
|
38
|
+
}));
|
|
39
39
|
}
|
|
40
|
-
return
|
|
40
|
+
return [];
|
|
41
41
|
},
|
|
42
42
|
});
|
|
43
43
|
//# sourceMappingURL=GleamNoPathDepsInPublished.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamNoPathDepsInPublished.js","sourceRoot":"","sources":["../../src/policies/GleamNoPathDepsInPublished.ts"],"names":[],"mappings":"AACA,OAAO,EACN,iBAAiB,GAEjB,MAAM,wCAAwC,CAAC;AAiBhD,SAAS,YAAY,CAAC,IAA6B;IAClD,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACjD,MAAM,MAAM,GAAG,KAAgC,CAAC;YAChD,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACrC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC;QACF,CAAC;IACF,CAAC;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"GleamNoPathDep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AC,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC/B,OAAO;gBACP,SAAS,EACR,uEAAuE;aACxE,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAkE,CAAC","sourcesContent":["import type { FilePolicyDefinition } from \"../policy.js\";\nimport {\n\tdefineGleamPolicy,\n\ttype GleamToml,\n} from \"../policyDefiners/defineGleamPolicy.js\";\n\n/**\n * Configuration for the GleamNoPathDepsInPublished policy.\n *\n * @public\n */\nexport interface GleamNoPathDepsInPublishedConfig {\n\t/**\n\t * If true, only check packages that don't have a \"private\" marker.\n\t * Since Gleam doesn't have a native \"private\" field, this checks for\n\t * the absence of a description (unpublished packages often lack one).\n\t * @defaultValue false\n\t */\n\tonlyPublishable?: boolean;\n}\n\nfunction findPathDeps(deps: Record<string, unknown>): string[] {\n\tconst pathDeps: string[] = [];\n\tfor (const [name, value] of Object.entries(deps)) {\n\t\tif (typeof value === \"object\" && value !== null) {\n\t\t\tconst record = value as Record<string, unknown>;\n\t\t\tif (typeof record.path === \"string\") {\n\t\t\t\tpathDeps.push(name);\n\t\t\t}\n\t\t}\n\t}\n\treturn pathDeps;\n}\n\n/**\n * A policy that warns when path dependencies are used in packages intended for publishing.\n *\n * @public\n */\nexport const GleamNoPathDepsInPublished = defineGleamPolicy({\n\tname: \"GleamNoPathDepsInPublished\",\n\tdescription:\n\t\t\"Warns when path dependencies are used in packages intended for publishing to Hex.\",\n\thandler: async (toml: GleamToml, { config }) => {\n\t\tif (config?.onlyPublishable && !toml.description) {\n\t\t\treturn [];\n\t\t}\n\n\t\tconst errors: string[] = [];\n\n\t\tconst deps = toml.dependencies as Record<string, unknown> | undefined;\n\t\tif (deps) {\n\t\t\tconst pathDeps = findPathDeps(deps);\n\t\t\tfor (const dep of pathDeps) {\n\t\t\t\terrors.push(\n\t\t\t\t\t`[dependencies] \"${dep}\" uses a path dependency, which will break when published to Hex`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (errors.length > 0) {\n\t\t\treturn errors.map((message) => ({\n\t\t\t\tmessage,\n\t\t\t\tmanualFix:\n\t\t\t\t\t\"Replace path dependencies with version constraints before publishing.\",\n\t\t\t}));\n\t\t}\n\t\treturn [];\n\t},\n}) satisfies FilePolicyDefinition<GleamNoPathDepsInPublishedConfig>;\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { FilePolicyDefinition } from "../policy.js";
|
|
2
2
|
/**
|
|
3
3
|
* A policy that validates all path dependency targets in gleam.toml exist
|
|
4
4
|
* and contain a gleam.toml file.
|
|
5
5
|
*
|
|
6
|
-
* @
|
|
6
|
+
* @public
|
|
7
7
|
*/
|
|
8
|
-
export declare const GleamPathDepsValid:
|
|
8
|
+
export declare const GleamPathDepsValid: FilePolicyDefinition<void>;
|
|
9
9
|
//# sourceMappingURL=GleamPathDepsValid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamPathDepsValid.d.ts","sourceRoot":"","sources":["../../src/policies/GleamPathDepsValid.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"GleamPathDepsValid.d.ts","sourceRoot":"","sources":["../../src/policies/GleamPathDepsValid.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAkDzD;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,4BAoBE,CAAC"}
|
|
@@ -36,7 +36,7 @@ function checkSection(sectionName, data, baseDir) {
|
|
|
36
36
|
* A policy that validates all path dependency targets in gleam.toml exist
|
|
37
37
|
* and contain a gleam.toml file.
|
|
38
38
|
*
|
|
39
|
-
* @
|
|
39
|
+
* @public
|
|
40
40
|
*/
|
|
41
41
|
export const GleamPathDepsValid = defineGleamPolicy({
|
|
42
42
|
name: "GleamPathDepsValid",
|
|
@@ -48,12 +48,12 @@ export const GleamPathDepsValid = defineGleamPolicy({
|
|
|
48
48
|
...checkSection("dev-dependencies", toml["dev-dependencies"], baseDir),
|
|
49
49
|
];
|
|
50
50
|
if (errors.length > 0) {
|
|
51
|
-
return {
|
|
52
|
-
|
|
51
|
+
return errors.map((message) => ({
|
|
52
|
+
message,
|
|
53
53
|
manualFix: "Fix the path dependencies to point to valid Gleam project directories.",
|
|
54
|
-
};
|
|
54
|
+
}));
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return [];
|
|
57
57
|
},
|
|
58
58
|
});
|
|
59
59
|
//# sourceMappingURL=GleamPathDepsValid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamPathDepsValid.js","sourceRoot":"","sources":["../../src/policies/GleamPathDepsValid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,OAAO,CAAC;AAEzB,OAAO,EACN,iBAAiB,GAEjB,MAAM,wCAAwC,CAAC;AAEhD,SAAS,eAAe,CACvB,OAAe,EACf,QAAiB,EACjB,WAAmB,EACnB,OAAe;IAEf,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACvD,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,MAAM,GAAG,QAAmC,CAAC;IACnD,IAAI,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACrC,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAElD,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,WAAW,MAAM,OAAO,WAAW,MAAM,CAAC,IAAI,kBAAkB,CAAC;IAC7E,CAAC;IACD,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oB;IAC1B,WAAW,EACV,iFAAiF;IAClF,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE;QAClD,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QACvD,MAAM,MAAM,GAAa;YACxB,GAAG,YAAY,CAAC,cAAc,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC;YAC3D,GAAG,YAAY,CAAC,kBAAkB,EAAE,IAAI,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAC;SACtE,CAAC;QAEF,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC/B,OAAO;gBACP,SAAS,EACR,wEAAwE;aACzE,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CACD,CAAgC,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"pathe\";\nimport type { FilePolicyDefinition } from \"../policy.js\";\nimport {\n\tdefineGleamPolicy,\n\ttype GleamToml,\n} from \"../policyDefiners/defineGleamPolicy.js\";\n\nfunction validatePathDep(\n\tdepName: string,\n\tdepValue: unknown,\n\tsectionName: string,\n\tbaseDir: string,\n): string | undefined {\n\tif (typeof depValue !== \"object\" || depValue === null) {\n\t\treturn undefined;\n\t}\n\tconst record = depValue as Record<string, unknown>;\n\tif (typeof record.path !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\tconst depDir = path.resolve(baseDir, record.path);\n\n\tif (!existsSync(depDir)) {\n\t\treturn `[${sectionName}] \"${depName}\" path \"${record.path}\" does not exist`;\n\t}\n\tif (!existsSync(path.join(depDir, \"gleam.toml\"))) {\n\t\treturn `[${sectionName}] \"${depName}\" path \"${record.path}\" exists but has no gleam.toml`;\n\t}\n\treturn undefined;\n}\n\nfunction checkSection(\n\tsectionName: string,\n\tdata: unknown,\n\tbaseDir: string,\n): string[] {\n\tif (!data || typeof data !== \"object\") {\n\t\treturn [];\n\t}\n\tconst deps = data as Record<string, unknown>;\n\tconst errors: string[] = [];\n\tfor (const [depName, depValue] of Object.entries(deps)) {\n\t\tconst error = validatePathDep(depName, depValue, sectionName, baseDir);\n\t\tif (error) {\n\t\t\terrors.push(error);\n\t\t}\n\t}\n\treturn errors;\n}\n\n/**\n * A policy that validates all path dependency targets in gleam.toml exist\n * and contain a gleam.toml file.\n *\n * @public\n */\nexport const GleamPathDepsValid = defineGleamPolicy({\n\tname: \"GleamPathDepsValid\",\n\tdescription:\n\t\t\"Validates that all path dependency targets exist and contain a gleam.toml file.\",\n\thandler: async (toml: GleamToml, { file, root }) => {\n\t\tconst baseDir = path.resolve(root, path.dirname(file));\n\t\tconst errors: string[] = [\n\t\t\t...checkSection(\"dependencies\", toml.dependencies, baseDir),\n\t\t\t...checkSection(\"dev-dependencies\", toml[\"dev-dependencies\"], baseDir),\n\t\t];\n\n\t\tif (errors.length > 0) {\n\t\t\treturn errors.map((message) => ({\n\t\t\t\tmessage,\n\t\t\t\tmanualFix:\n\t\t\t\t\t\"Fix the path dependencies to point to valid Gleam project directories.\",\n\t\t\t}));\n\t\t}\n\t\treturn [];\n\t},\n}) satisfies FilePolicyDefinition;\n"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { PolicyDefinition } from "../policy.js";
|
|
2
1
|
/**
|
|
3
2
|
* Configuration for the GleamProjectStructure policy.
|
|
4
3
|
*
|
|
5
|
-
* @
|
|
4
|
+
* @public
|
|
6
5
|
*/
|
|
7
6
|
export interface GleamProjectStructureConfig {
|
|
8
7
|
/**
|
|
@@ -19,7 +18,15 @@ export interface GleamProjectStructureConfig {
|
|
|
19
18
|
/**
|
|
20
19
|
* A policy that validates standard Gleam project structure.
|
|
21
20
|
*
|
|
22
|
-
* @
|
|
21
|
+
* @public
|
|
23
22
|
*/
|
|
24
|
-
export declare const GleamProjectStructure:
|
|
23
|
+
export declare const GleamProjectStructure: {
|
|
24
|
+
name: string;
|
|
25
|
+
description: string;
|
|
26
|
+
match: RegExp;
|
|
27
|
+
handler: ({ file, root, config }: import("../policy.js").PolicyArgs<GleamProjectStructureConfig>) => Promise<{
|
|
28
|
+
message: string;
|
|
29
|
+
manualFix: string;
|
|
30
|
+
}[]>;
|
|
31
|
+
};
|
|
25
32
|
//# sourceMappingURL=GleamProjectStructure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamProjectStructure.d.ts","sourceRoot":"","sources":["../../src/policies/GleamProjectStructure.ts"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"GleamProjectStructure.d.ts","sourceRoot":"","sources":["../../src/policies/GleamProjectStructure.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC3C;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;CA6B2B,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import path from "pathe";
|
|
3
|
-
import { makePolicyDefinition } from "../makePolicy.js";
|
|
4
3
|
/**
|
|
5
4
|
* A policy that validates standard Gleam project structure.
|
|
6
5
|
*
|
|
7
|
-
* @
|
|
6
|
+
* @public
|
|
8
7
|
*/
|
|
9
|
-
export const GleamProjectStructure =
|
|
8
|
+
export const GleamProjectStructure = {
|
|
10
9
|
name: "GleamProjectStructure",
|
|
11
10
|
description: "Validates that Gleam projects have the standard directory structure (src/, test/).",
|
|
12
11
|
match: /gleam\.toml$/,
|
|
@@ -22,12 +21,12 @@ export const GleamProjectStructure = makePolicyDefinition({
|
|
|
22
21
|
errors.push("Missing test/ directory.");
|
|
23
22
|
}
|
|
24
23
|
if (errors.length > 0) {
|
|
25
|
-
return {
|
|
26
|
-
|
|
24
|
+
return errors.map((message) => ({
|
|
25
|
+
message,
|
|
27
26
|
manualFix: "Create the missing directories in your Gleam project.",
|
|
28
|
-
};
|
|
27
|
+
}));
|
|
29
28
|
}
|
|
30
|
-
return
|
|
29
|
+
return [];
|
|
31
30
|
},
|
|
32
|
-
}
|
|
31
|
+
};
|
|
33
32
|
//# sourceMappingURL=GleamProjectStructure.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GleamProjectStructure.js","sourceRoot":"","sources":["../../src/policies/GleamProjectStructure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"GleamProjectStructure.js","sourceRoot":"","sources":["../../src/policies/GleamProjectStructure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,OAAO,CAAC;AAqBzB;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACpC,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EACV,oFAAoF;IACrF,KAAK,EAAE,cAAc;IACrB,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE;QACzC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;QACnD,MAAM,UAAU,GAAG,MAAM,EAAE,aAAa,IAAI,IAAI,CAAC;QACjD,MAAM,WAAW,GAAG,MAAM,EAAE,cAAc,IAAI,KAAK,CAAC;QACpD,MAAM,MAAM,GAAa,EAAE,CAAC;QAE5B,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;YACtD,MAAM,CAAC,IAAI,CACV,qFAAqF,CACrF,CAAC;QACH,CAAC;QAED,IAAI,WAAW,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC;YACxD,MAAM,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QACzC,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBAC/B,OAAO;gBACP,SAAS,EAAE,uDAAuD;aAClE,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,EAAE,CAAC;IACX,CAAC;CAC2D,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport path from \"pathe\";\nimport type { FilePolicyDefinition } from \"../policy.js\";\n/**\n * Configuration for the GleamProjectStructure policy.\n *\n * @public\n */\nexport interface GleamProjectStructureConfig {\n\t/**\n\t * If true, require the src/ directory to exist.\n\t * @defaultValue true\n\t */\n\trequireSrcDir?: boolean;\n\n\t/**\n\t * If true, require the test/ directory to exist.\n\t * @defaultValue false\n\t */\n\trequireTestDir?: boolean;\n}\n\n/**\n * A policy that validates standard Gleam project structure.\n *\n * @public\n */\nexport const GleamProjectStructure = {\n\tname: \"GleamProjectStructure\",\n\tdescription:\n\t\t\"Validates that Gleam projects have the standard directory structure (src/, test/).\",\n\tmatch: /gleam\\.toml$/,\n\thandler: async ({ file, root, config }) => {\n\t\tconst dir = path.dirname(path.resolve(root, file));\n\t\tconst requireSrc = config?.requireSrcDir ?? true;\n\t\tconst requireTest = config?.requireTestDir ?? false;\n\t\tconst errors: string[] = [];\n\n\t\tif (requireSrc && !existsSync(path.join(dir, \"src\"))) {\n\t\t\terrors.push(\n\t\t\t\t\"Missing src/ directory. Gleam projects require a src/ directory for source modules.\",\n\t\t\t);\n\t\t}\n\n\t\tif (requireTest && !existsSync(path.join(dir, \"test\"))) {\n\t\t\terrors.push(\"Missing test/ directory.\");\n\t\t}\n\n\t\tif (errors.length > 0) {\n\t\t\treturn errors.map((message) => ({\n\t\t\t\tmessage,\n\t\t\t\tmanualFix: \"Create the missing directories in your Gleam project.\",\n\t\t\t}));\n\t\t}\n\t\treturn [];\n\t},\n} satisfies FilePolicyDefinition<GleamProjectStructureConfig>;\n"]}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { PolicyDefinition } from "../policy.js";
|
|
2
1
|
/**
|
|
3
2
|
* Configuration for the GleamSharedDependencyVersions policy.
|
|
4
3
|
*
|
|
5
|
-
* @
|
|
4
|
+
* @public
|
|
6
5
|
*/
|
|
7
6
|
export interface GleamSharedDependencyVersionsConfig {
|
|
8
7
|
/**
|
|
@@ -23,7 +22,16 @@ export interface GleamSharedDependencyVersionsConfig {
|
|
|
23
22
|
/**
|
|
24
23
|
* A policy that detects dependency version mismatches across Gleam packages in a monorepo.
|
|
25
24
|
*
|
|
26
|
-
* @
|
|
25
|
+
* @public
|
|
27
26
|
*/
|
|
28
|
-
export declare const GleamSharedDependencyVersions:
|
|
27
|
+
export declare const GleamSharedDependencyVersions: {
|
|
28
|
+
name: string;
|
|
29
|
+
requiresConfig: true;
|
|
30
|
+
description: string;
|
|
31
|
+
match: RegExp;
|
|
32
|
+
handler: ({ root, config }: import("../policy.js").PolicyArgs<GleamSharedDependencyVersionsConfig>) => Promise<{
|
|
33
|
+
message: string;
|
|
34
|
+
manualFix: string;
|
|
35
|
+
}[]>;
|
|
36
|
+
};
|
|
29
37
|
//# sourceMappingURL=GleamSharedDependencyVersions.d.ts.map
|