* Validate that the changesets meet our rules for an Alpha release * changeset, logging and killing the script otherwise. * * The validations are: * - no major or minor changesets are allowed
(changesets)
| 60 | * - no major or minor changesets are allowed |
| 61 | */ |
| 62 | function validateChangesets(changesets) { |
| 63 | if (changesets.length === 0) { |
| 64 | console.log("No new changesets found."); |
| 65 | process.exit(0); |
| 66 | } |
| 67 | |
| 68 | let validationFailed = false; |
| 69 | |
| 70 | for (const { frontMatter, path: changesetPath } of changesets) { |
| 71 | if (/: (major|minor)\s*$/m.test(frontMatter)) { |
| 72 | validationFailed = true; |
| 73 | console.log( |
| 74 | `Error: ${changesetPath}: No "major" or "minor" changesets are allowed in Alpha`, |
| 75 | ); |
| 76 | } |
| 77 | } |
| 78 | |
| 79 | if (validationFailed) { |
| 80 | process.exit(1); |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Checks whether a new changeset should be created for the package. |