Created
December 3, 2020 15:52
-
-
Save csalzano/f54d5d32405fc3cdc5f40addef0c7649 to your computer and use it in GitHub Desktop.
Zips a directory while excluding .git, node_modules, and .gitingore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::plugin-zipper.bat | |
::Zips a directory while excluding .git, node_modules, and .gitingore | |
@echo off | |
set /p slug=Please enter a directory name/plugin slug: | |
If /I "%slug%"=="" goto earlyexit | |
tar -a -c -f "%slug%".zip --exclude ".git" --exclude ".gitignore" --exclude "node_modules" "%slug%" | |
:earlyexit |
plugin-zipper.sh, a macOS equivalent
#!/usr/local/bin/bash
#
# plugin-zipper.sh
#
# a script that creates WordPress plugin zip files ready for distribution
# version 1.0.1
#
# perhaps a plugin directory name name was passed as the first argument
if [ -z "$1" ]
then
# ask the user to type in a site name
echo "Please enter a directory name/plugin slug:"
read slug
else
slug=$1
fi
zip -r "${slug}".zip "${slug}" -x "/${slug}/*.git*" -x "/${slug}/node_modules/*" -x "/${slug}/*.DS_Store"
Usage
[~/]$ bash plugin-zipper.sh inventory-presser
Using git archive could make this platform agnostic https://stackoverflow.com/a/28357990/338432
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage on Windows