MCPcopy Create free account
hub / github.com/MetaMask/rpc-errors / expectReadme

Function expectReadme

yarn.config.cjs:140–162  ·  view source on GitHub ↗

* Expect that the workspace has a README.md file, and that it is a non-empty * string. The README.md is expected to: * * - Not contain template instructions (unless the workspace is the module * template itself). * - Match the version of Node.js specified in the `.nvmrc` file. * * @param {Wor

(workspace, workspaceName)

Source from the content-addressed store, hash-verified

138 * @returns {Promise<void>}
139 */
140async function expectReadme(workspace, workspaceName) {
141 const readme = await getWorkspaceFile(workspace, 'README.md');
142 if (
143 workspaceName !== 'metamask-module-template' &&
144 readme.includes('## Template Instructions')
145 ) {
146 workspace.error(
147 'The README.md contains template instructions. These instructions should be removed.',
148 );
149 }
150
151 if (!readme.includes(`yarn add @metamask/${workspaceName}`)) {
152 workspace.error(
153 `The README.md does not contain an example of how to install the package using Yarn (\`yarn add @metamask/${workspaceName}\`). Please add an example.`,
154 );
155 }
156
157 if (!readme.includes(`npm install @metamask/${workspaceName}`)) {
158 workspace.error(
159 `The README.md does not contain an example of how to install the package using npm (\`npm install @metamask/${workspaceName}\`). Please add an example.`,
160 );
161 }
162}
163
164/**
165 * Expect that the workspace has a pull_request_template.md file, and that it

Callers 1

constraintsFunction · 0.85

Calls 1

getWorkspaceFileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…