A simple packing tool built in Python to produce archives as defined in packster.json.
Working relative to the current working directory, files and folders can be defined and excluded in the packster.json file, and multiple zip files can be produced for things like deploying sections of projects, or for back up purposes.
This was built with 2 use cases in mind:
- Building AWS Elastic Beanstalk application zips for uploading to an environment.
- Building deployable archives for upload to multiple AWS Lambda Functions.
The packster.json config file can be committed to a code repository.
- Clone the repository
git clone https://github.com/techdyn/packster.git
cd packster- Install a symbolic link to the tool
sudo ln -s $PWD/packster /usr/local/bin/- Test installation
/usr/local/bin/packster --version- Create
packster.jsonin the folder you wish to act as your root (usually project root, but may vary)
# create packster.json
packster --initExample
This is an example for packing a Symfony project for upload to AWS Elastic Beanstalk.
It is assumed the packster.json is in the project root (eg the folder containing /src).
{
"packages": {
"SymfonyProject": {
"outDir": "dist",
"dirs": [
".ebextensions",
".platform",
"assets",
"app",
"bin",
"config",
"migrations",
"public",
"src",
"templates",
"tests",
"translations"
],
"files": [
"*"
],
"exclude": [
"*.md",
"*.pdf",
"*.dev",
"*.test",
"*.dev-example",
"*.zip"
]
}
}
}- Run
packsterin your project root folder
packsterOutput
$ packster
____ __ __
/ __ \ ____ _ _____ / /__ _____ / /_ ___ _____
/ /_/ // __ `// ___// //_// ___// __// _ \ / ___/
/ ____// /_/ // /__ / ,< (__ )/ /_ / __// /
/_/ \__,_/ \___//_/|_|/____/ \__/ \___//_/ v0.1.0
by TechDyn
Working in: /path/to/current/working/directory
Processing: SymfonyProject
Output to: dist/SymfonyProject_20221204052756.zip
-
--initCreate a basicpackster.jsonfile in the current working directory. -
--dir DIRBy default, Packster will search forpackster.jsonin the current working directory, this option will change the working directory for the execution of the tool, for instances where the packing root is nested under your project root. -
--package PACKAGESpecify a particular package. -
--verboseOutput additional log information. -
--quietSuppress log output, except for errors. -
--versionOutput current version information.
- packages (root)
-
outDir(optional) Target output directory relative to the current working directory. (default:dist) -
dirs(array) Directories to include, relative to the current working directory. Will include all files within directories, filtered byexclude. -
files(array) Files to include, relative to the current working directory. Supports*wildcards. Files are filtered byexclude.["*"]is not recursive, and will only package the files in the working directory. -
exclude(array) Exclude file patterns. Supports*wildcards.
-