pack-mmip, an automatic MMIP packer using Node.js

To discuss development of addons / skins / customization of MediaMonkey.

Moderators: jiri, drakinite, Addon Administrators

drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

pack-mmip, an automatic MMIP packer using Node.js

Post by drakinite »

Hey there! I wrote a tool that makes it quick and easy to pack and install MM5 extensions! I named it pack-mmip, and it's available on github and npm.

It requires Node.js. Install it with one of two methods:
  1. NPM: npm install --global pack-mmip
  2. Download the latest release from the github page, extract it into the folder of your choice, and add the folder to your system PATH.
Then you can use the pack-mmip and pack-zip commands from any folder.

Pack-mmip automatically creates an archive with an .mmip extension, and pack-zip automatically creates an archive with a .zip extension. MMIPs are just zip archives with a different filename, so the same tool can be used for both purposes.

Usage:

Code: Select all

USAGE:
        pack-mmip <path to project> <[optional] path to packed extension OR just its name> <options>
OPTIONS:
        -a      --AppendVersion         Read the project's version from its info.json and append it to the
                                        filename. For example: MyAddon-1.2.3.mmip
        -b      --PutFileIntoBin        Put resulting file into a subfolder named "bin"
        -d      --Debug                 Debug logs. Please use this if you encounter a bug, and paste the
                                        logs into a new GitHub issue.
        -h      --help                  Print this help text and exit
        -i      --IgnoreDefaults        Ignore configuration rules
        -o      --OpenAfterComplete     Open file (Install to MediaMonkey) after complete
        -s      --ShowAfterComplete     Show in folder after complete
        -v      --version               Print version and exit
        -y      --Yes                   Automatically answer "yes" to prompts

        -p      --PreambleFile <name>   File containing a preamble to be added to the top of text files.
        --preamble-<filetype> <pattern> Pattern for the preamble to be inserted into files of the specified
                                        patterns for comments. Use %s for where the preamble text should go.
TO IGNORE CERTAIN FILES:
                                        Add a file named .mmipignore or .archiveignore in your project root.
                                        It uses glob syntax similar to .gitignore
                                        (see https://www.npmjs.com/package/glob)
        pack-mmip config                Different configuration files are saved for pack-mmip and pack-zip.
If path to packed extension is not specified, it will default to the name of the folder.

        --create-symlink <path>         Tool that creates a symbolic link from your install's scripts folder to
                                        your project folder, making it easier for development. Just restart
                                        MediaMonkey for your changes to take effect, instead of having to
                                        re-pack and re-install the addon.
        --init                          Tool that automatically creates a new info.json file in the current
                                        folder, after prompting for title, ID, version, etc. Similar to `npm init`.
You can set your own default options with the following commands:

Code: Select all

pack-mmip config
pack-zip config
Examples:

Code: Select all

# Packs C:/projects/MyPackage into C:/projects/MyPackage.mmip
pack-mmip C:/projects/MyPackage C:/projects/MyPackage.mmip

# Does the same as above, but with relative paths instead of absolute paths
# If you do not add a .mmip file extension, it will do it for you.
cd C:/projects/MyPackage
pack-mmip ./ ../MyPackage

# If you do not specify a file name, it will automatically give it the name of the original folder.
cd C:/projects
pack-mmip MyPackage MyCustomPackageName
# result: C:/projects/MyCustomPackageName.mmip
pack-mmip MyPackage
# result: C:/projects/MyPackage.mmip
pack-zip MyPackage
# result: C:/projects/MyPackage.zip

# The -s argument will open a file explorer window containing the newly packed file.
pack-mmip MyPackage -s

# The -o argument will attempt to run the file, causing MediaMonkey to install it.
pack-mmip MyPackage -o

# The -b argument will place your packaged file into a subfoler named "bin".
pack-mmip MyPackage -b
# result: C:/projects/bin/MyPackage.mmip
So for example, if you have PowerShell/cmd open in your project's parent folder, and the project is named MyExtension, this will pack MyExtension.mmip and immediately install it.

Code: Select all

pack-mmip MyExtension MyExtension.mmip -o
I've been working on this tool for a few months, and it's reaching the point where it's becoming a genuinely useful tool.

I really hope this is helpful! Let me know if any of you use it, or if you have suggestions for improvements!
Last edited by drakinite on Sat Nov 28, 2020 10:56 pm, edited 2 times in total.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

pack-mmip Release v0.0.3

Post by drakinite »

Published version 0.0.3! You can download it here: https://github.com/JL102/pack-mmip/releases/tag/v0.0.3

Now, if you just specify the source folder, it'll automatically give the resultant MMIP the same name as the source folder.
Last edited by drakinite on Sat Nov 28, 2020 10:27 pm, edited 1 time in total.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Ludek
Posts: 4947
Joined: Fri Mar 09, 2007 9:00 am

Re: pack-mmip, an automatic MMIP packer using Node.js

Post by Ludek »

Nice!
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

pack-mmip Release v0.0.4

Post by drakinite »

New release, v0.0.4: Node screws up command-line arguments if you include a backslash before a quotation mark, which occurs in PowerShell when you automatically populate a directory. I did as much as much as I could to rectify those situations when process.argv is broken. https://github.com/JL102/pack-mmip/releases/tag/v0.0.4

Also, thanks Ludek! :slight_smile:
Last edited by drakinite on Sat Nov 28, 2020 10:27 pm, edited 1 time in total.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

pack-mmip Release v0.0.5

Post by drakinite »

New release, v0.0.5: Better recognition & handling of broken command-line arguments, and changed the destination-inside-source warning to have a default answer of no. https://github.com/JL102/pack-mmip/releases/tag/v0.0.5
Last edited by drakinite on Sat Nov 28, 2020 10:27 pm, edited 1 time in total.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

pack-mmip Release v1.0.0

Post by drakinite »

I'm proud to announce pack-mmip version 1.0.0! This is a major release, which brings some great new usability features and improvements:
  • Configurable default settings
  • Ability to easily archive .zip files as well, with pack-zip
  • Ability to automatically put your packed files into a "bin" subfolder
You can download it here: https://github.com/JL102/pack-mmip/releases/tag/v1.0.0
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: pack-mmip, an automatic MMIP packer using Node.js

Post by drakinite »

Pack-MMIP is now available on NPM, making it easier than ever to install! https://www.npmjs.com/package/pack-mmip

Install it with npm install --global pack-mmip.

Additionally, a new feature has been added for version 1.0.2. Run pack-mmip --create-symlink and follow the instructions to create a symbolic link to your project folder, so you don't even have to re-pack your addon while testing it during development.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: pack-mmip, an automatic MMIP packer using Node.js

Post by drakinite »

New release, v1.1.1: Ignore rule support! You can now add a file, .mmipignore, to your project directory, containing file patterns to ignore. Operates similarly to .gitignore. The .mmipignore file is always skipped when creating a zip/mmip.

NPM: https://www.npmjs.com/package/pack-mmip
Github: https://github.com/JL102/pack-mmip/releases/tag/v1.1.1

Install it with npm install --global pack-mmip.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
programmer1311
Posts: 1
Joined: Fri Dec 17, 2021 4:00 am

Re: pack-mmip, an automatic MMIP packer using Node.js

Post by programmer1311 »

Thank you very much for the information provided, it will be helpful for the installation.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: pack-mmip, an automatic MMIP packer using Node.js

Post by drakinite »

New release, v1.2.0: Major update!
  • Can now automatically detect the addon version and append it to the file, e.g. MyAddon-1.0.0.mmip, with the command-line argument -a / --appendversion
  • Now prints its own version with the command-line argument -v / --version
  • Now supports "preamble" comments to be automatically added to the top of any specified text file, in case you wish to include something like licensing agreements. Specify the file containing your preamble with --preamblefile <filename> and specify the comment pattern with --preamble-<filetype> <pattern>.
  • The --create-symlink tool now works more easily, and it outputs to the AppData folder by default instead of the MM5 install folder.
  • If you just type pack-mmip or pack-zip into the command line, it'll now print the entire help text.
  • .archiveignore is also now supported as an ignore file.
NPM: https://www.npmjs.com/package/pack-mmip
Github: https://github.com/JL102/pack-mmip/releases/tag/v1.2.0

Install it with npm install --global pack-mmip.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: pack-mmip, an automatic MMIP packer using Node.js

Post by drakinite »

New release, v1.3.0: Major archive bugfix + minor improvements
  • Updated dependencies, including a new version of archiver which seems to fix the occasional issue where the archive gets corrupted
  • When there's an error creating a symlink (pack-mmip --create-symlink), it'll now open the problematic folder in file explorer so that you can fix the symlink issue by hand
  • Added the ability to insert a "LICENSE" file into the archive, via pack-mmip -l <filename> or pack-mmip --LicenseFile <filename> (undocumented; mostly for use in https://github.com/ventismedia/mediamonkey-addons)
NPM: https://www.npmjs.com/package/pack-mmip
Github: https://github.com/JL102/pack-mmip/releases/tag/v1.3.0

Install it with Install it with npm install --global pack-mmip.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Post Reply