diff --git a/src/check-project/readme/install.js b/src/check-project/readme/install.js
index 5e8ab8e13..c65a794a8 100644
--- a/src/check-project/readme/install.js
+++ b/src/check-project/readme/install.js
@@ -2,24 +2,37 @@
* @param {*} pkg
*/
export const INSTALL = (pkg) => {
- return `
-## Install
+ const nodeInstall = `
+ ## Install
-\`\`\`console
-$ npm i ${pkg.name}
-\`\`\`
+ \`\`\`console
+ $ npm i ${pkg.name}
+ \`\`\`
+`
+ const browserInstall = `### Browser \`
+ \`\`\`
+`
+ const scripts = pkg.scripts ?? {}
-\`\`\`html
-
-\`\`\`
- `
+ // if the module tests on browsers include browser install instructions
+ if (scripts['test:chrome'] != null || scripts['test:firefox'] != null || scripts['test:browser'] != null) {
+ return nodeInstall + browserInstall
+ }
+
+ // otherwise just include node install instructions
+ return nodeInstall
}
/**
+ * Esbuild uses the module name to determine the symbol that's added to
+ * the global scope by the minified build so replicate how it determines
+ * the name in order to add it to the docs.
+ *
* @param {string} name
* @returns {string}
*/