extension-js / extension.js

🧩 Plug-and-play, zero-config, cross-browser extension development tool.
https://extension.js.org
MIT License
3.46k stars 80 forks source link

Add --zip flags to build command #89

Closed cezaraugusto closed 4 weeks ago

cezaraugusto commented 1 month ago

When users run npx extension build <path>, add a few flags related to the distribution package:

Screenshot 2024-06-06 at 19 57 12

How to test

  1. Have an extension
  2. Running yarn extension build <extension-path> --zip should generate a zip file from distribution files to (projectPath)/dist/<browser>/<zip-name>.zip
  3. Running yarn extension build <extension-path> --zip-source should generate a zip file from source files to (projectPath)/dist/<browser>/<zip-name>-source.zip
  4. Running yarn extension build <extension-path> --zip --zip-filename=my-custom-name should generate a zip file from distribution files (with custom name) to (projectPath)/dist/<browser>/<custom-zip-name>.zip.
OSpoon commented 1 month ago

Hi~ @cezaraugusto, I have verified these distribution package-related flags and confirmed that they are all working as expected. However, when using the --zip-source flag, have you considered excluding the node_modules directory from the zip file ❓

cezaraugusto commented 1 month ago

@OSpoon you're right! Now it only adds files not specified by .gitignore. I updated the output as well

Screenshot 2024-06-07 at 12 51 50
OSpoon commented 1 month ago

Hi~ @cezaraugusto, I think some further improvement is needed. The current zip file is missing the directory structure of the source.

image

OSpoon commented 4 weeks ago

LGTM++

Thank you very much for inviting me to review your code. I believe this PR can be merged, and I also find the addition of these flags very useful. 😁

cezaraugusto commented 4 weeks ago

Thanks @OSpoon!