({ Yarn })
| 223 | |
| 224 | module.exports = defineConfig({ |
| 225 | async constraints({ Yarn }) { |
| 226 | const workspace = Yarn.workspace(); |
| 227 | const workspaceName = getWorkspaceName(workspace); |
| 228 | const workspaceRepository = `${BASE_URL}${workspaceName}`; |
| 229 | |
| 230 | // The package must have a name, version, description, and license. |
| 231 | expectWorkspaceField(workspace, 'name', `@metamask/${workspaceName}`); |
| 232 | expectWorkspaceField(workspace, 'version'); |
| 233 | expectWorkspaceField(workspace, 'license'); |
| 234 | expectWorkspaceDescription(workspace); |
| 235 | |
| 236 | // The package must have a valid README.md file. |
| 237 | await expectReadme(workspace, workspaceName); |
| 238 | |
| 239 | // The package must have a valid pull request template. |
| 240 | await expectPullRequestTemplate(workspace, workspaceName); |
| 241 | |
| 242 | expectWorkspaceDependencies(workspace); |
| 243 | |
| 244 | // The homepage of the package must match its name. |
| 245 | workspace.set('homepage', `${workspaceRepository}#readme`); |
| 246 | |
| 247 | // The bugs URL of the package must point to the Issues page for the |
| 248 | // repository. |
| 249 | workspace.set('bugs.url', `${workspaceRepository}/issues`); |
| 250 | |
| 251 | // The package must specify Git as the repository type, and match the URL of |
| 252 | // a repository within the MetaMask organization. |
| 253 | workspace.set('repository.type', 'git'); |
| 254 | workspace.set('repository.url', `${workspaceRepository}.git`); |
| 255 | |
| 256 | // The package must specify the expected minimum Node versions |
| 257 | workspace.set('engines.node', '^18.20 || ^20.17 || >=22'); |
| 258 | |
| 259 | // The package must provide the location of the CommonJS-compatible |
| 260 | // entrypoint and its matching type declaration file. |
| 261 | workspace.set('main', './dist/index.cjs'); |
| 262 | workspace.set('exports["."].require.default', './dist/index.cjs'); |
| 263 | workspace.set('types', './dist/index.d.cts'); |
| 264 | workspace.set('exports["."].require.types', './dist/index.d.cts'); |
| 265 | |
| 266 | // The package must provide the location of the ESM-compatible JavaScript |
| 267 | // entrypoint and its matching type declaration file. |
| 268 | workspace.set('module', './dist/index.mjs'); |
| 269 | workspace.set('exports["."].import.default', './dist/index.mjs'); |
| 270 | workspace.set('exports["."].import.types', './dist/index.d.mts'); |
| 271 | |
| 272 | // The package must export a `package.json` file. |
| 273 | workspace.set('exports["./package.json"]', './package.json'); |
| 274 | |
| 275 | expectExports(workspace); |
| 276 | |
| 277 | // The list of files included in the package must only include files |
| 278 | // generated during the build process. |
| 279 | workspace.set('files', ['dist']); |
| 280 | |
| 281 | // The package is public, and should be published to the npm registry. |
| 282 | workspace.unset('private'); |
nothing calls this directly
no test coverage detected
searching dependent graphs…