<h3 dir="auto">Is there an existing issue for this?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have searched the existing issues</li>
</ul>
<h3 dir="auto">Current Behavior</h3>
<p dir="auto">Bundled dependencies do not export executables when packing.</p>
<h3 dir="auto">Expected Behavior</h3>
<p dir="auto"><code class="notranslate">npm pack</code> output should include scripts under <code class="notranslate">.bin</code> to launch any executables provided by the bundled depdency.</p>
<h3 dir="auto">Steps To Reproduce</h3>
<ol dir="auto">
<li>Install any dependency that exposes an executable, e.g. <code class="notranslate">lws</code>.</li>
<li>Include this dependency in <code class="notranslate">bundledDependencies</code></li>
<li><code class="notranslate">npm pack</code></li>
</ol>
<p dir="auto">The resulting artifact includes the <code class="notranslate">bundledDependency</code> under <code class="notranslate">node_modules</code>, but does not create a <code class="notranslate">.bin</code> directory at all, and so the depdency's executable(s) will not be available.</p>
<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Win10 20H2</li>
<li>Node: 14.15.4</li>
<li>npm: 7.4.0</li>
</ul>
<h3 dir="auto">Current Behavior:</h3>
<p dir="auto">Bundled dependencies do not export executables when packing.</p>
<h3 dir="auto">Expected Behavior:</h3>
<p dir="auto"><code class="notranslate">npm pack</code> output should include scripts under <code class="notranslate">.bin</code> to launch any executables provided by the bundled depdency.</p>
<h3 dir="auto">Steps To Reproduce:</h3>
<ol dir="auto">
<li>Install any dependency that exposes an executable, e.g. <code class="notranslate">lws</code>.</li>
<li>Include this dependency in <code class="notranslate">bundledDependencies</code></li>
<li><code class="notranslate">npm pack</code></li>
<li>The resulting artifact includes the <code class="notranslate">bundledDependency</code> under <code class="notranslate">node_modules</code>, but does not create a <code class="notranslate">.bin</code> directory at all, and so the depdency's executable(s) will not be available.</li>
</ol>
<h3 dir="auto">Environment:</h3>
<ul dir="auto">
<li>WIn10 20H2</li>
<li>Node: 14.15.4</li>
<li>npm: 6.14.10</li>
</ul>
<h3 dir="auto">Notes</h3>
<p dir="auto">I see from <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="681265889" data-permission-text="Title is private" data-url="https://github.com/npm/cli/issues/1689" data-hovercard-type="issue" data-hovercard-url="/npm/cli/issues/1689/hovercard" href="https://github.com/npm/cli/issues/1689">#1689</a> that <code class="notranslate">bundledDependencies</code> does not currently do special handling of the dep's <code class="notranslate">package.json</code>, such as looking at the <code class="notranslate">files</code> field.  It's probably impractical / undesirable to process the whole <code class="notranslate">bin</code> field from <code class="notranslate">package.json</code> during <code class="notranslate">pack</code>, but at least it would make sense to check the existing <code class="notranslate">node_modules/.bin</code> for scripts that exactly match the package name and include those in the output.</p>