Title: WP scripts plugin-zip missing root-level files
Last modified: April 22, 2022

---

# WP scripts plugin-zip missing root-level files

 *  Resolved [Adam](https://wordpress.org/support/users/admturner/)
 * (@admturner)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/wp-scripts-plugin-zip-missing-root-level-files/)
 * Using the [@wordpress](https://wordpress.org/support/users/wordpress/)/scripts
   package, when I run the `wp-scripts plugin-zip` command it generates a zip file
   with the `/build` directory (and any other directories specified in `"files":[]`).
   But it misses all files at the root level (README, plugin entry point, etc.) 
   even when specifically providing the file name in package.json `files`.
 * I don’t receive any error messages — in fact the messaging in the console suggests
   it’s working. When I run the script I see the following in the console:
 *     ```
       > wp-scripts plugin-zip
   
       Creating archive for <code>@washingtonstateuniversity/hrswp-employee-recognition</code> plugin... 🎁
   
       Using Plugin Handbook best practices to discover files:
   
         Adding <code>CHANGELOG.md</code>.
         Adding <code>LICENSE.md</code>.
         Adding <code>README.md</code>.
         Adding <code>build/index.asset.php</code>.
         Adding <code>build/index.css</code>.
         Adding <code>build/index.js</code>.
         Adding <code>build/style-index.css</code>.
         Adding <code>build/blocks/er-award-description/block.json</code>.
         Adding <code>build/blocks/er-award-meta-year/block.json</code>.
   
       Done. <code>@washingtonstateuniversity/hrswp-employee-recognition.zip</code> is ready! 🎉
       ```
   
 * But all I see in the generated zip file is the `build` directory. It misses the
   entrypoint entirely and, although it says “Adding LICENSE.md”, etc., those root-
   level files are not in the zip.
 * There appear to be two issues here:
 * 1. The `plugin-zip.js` script doesn’t check for namespaces on the plugin name,
   and passing `@namespace\plugin-name` to `zip.addLocalFile()` seems to fail silently.
   The can be circumvented easily enough using `"files": []`, but is unexpected 
   per the documentation.
    2. The `plugin-zip.js` script `zip.addLocalFile( file,
   dirname( file ) );` appears to fail when `dirname( file )` is `'.'`.
 * If I replace the existing:
 * `zip.addLocalFile( file, dirname( file ) );`
 * with:
 *     ```
       if ( '.' !== dirname( file ) ) {
           zip.addLocalFile( file, dirname( file ) );
       } else {
           zip.addLocalFile( file );
       }
       ```
   
 * Then it appears to run as expected. That said, I don’t know if there is something
   wrong with my environment or my use of wp-scripts, as I haven’t been able to 
   find anyone else with this problem.
 * My environment:
    – [@wordpress](https://wordpress.org/support/users/wordpress/)/
   scrips v22.5.0 – Node.js v16.14.2, npm v8.5.0 (same behavior seen with Node 14
   and npm 6) – WSL 2 on Windows 10

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [threadi](https://wordpress.org/support/users/threadi/)
 * (@threadi)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/wp-scripts-plugin-zip-missing-root-level-files/#post-15579640)
 * I would recommend that you contact the developers of the package directly: [https://github.com/WordPress/gutenberg/issues](https://github.com/WordPress/gutenberg/issues)
 *  Thread Starter [Adam](https://wordpress.org/support/users/admturner/)
 * (@admturner)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/wp-scripts-plugin-zip-missing-root-level-files/#post-15579864)
 * Thanks! I’ll do that

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘WP scripts plugin-zip missing root-level files’ is closed to new replies.

## Tags

 * [zip](https://wordpress.org/support/topic-tag/zip/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Adam](https://wordpress.org/support/users/admturner/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/wp-scripts-plugin-zip-missing-root-level-files/#post-15579864)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
