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

To discuss development of addons / skins / customization of MediaMonkey v5 / v2024

Moderadores: jiri, drakinite, Addon Administrators

drakinite
Mensagens: 983
Registado: terça mai 12, 2020 10:06 am

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

Mensagem por 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:

Código: Selecionar todos

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:

Código: Selecionar todos

pack-mmip config
pack-zip config
Examples:

Código: Selecionar todos

# 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.

Código: Selecionar todos

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!
Última edição por drakinite em sábado nov 28, 2020 10:56 pm, editado 2 vezes no total.
Imagem
Data scientist, 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
Mensagens: 983
Registado: terça mai 12, 2020 10:06 am

pack-mmip Release v0.0.3

Mensagem por 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.
Última edição por drakinite em sábado nov 28, 2020 10:27 pm, editado 1 vez no total.
Imagem
Data scientist, 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
Mensagens: 5061
Registado: sexta mar 09, 2007 9:00 am

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

Mensagem por Ludek »

Nice!
drakinite
Mensagens: 983
Registado: terça mai 12, 2020 10:06 am

pack-mmip Release v0.0.4

Mensagem por 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:
Última edição por drakinite em sábado nov 28, 2020 10:27 pm, editado 1 vez no total.
Imagem
Data scientist, 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
Mensagens: 983
Registado: terça mai 12, 2020 10:06 am

pack-mmip Release v0.0.5

Mensagem por 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
Última edição por drakinite em sábado nov 28, 2020 10:27 pm, editado 1 vez no total.
Imagem
Data scientist, 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
Mensagens: 983
Registado: terça mai 12, 2020 10:06 am

pack-mmip Release v1.0.0

Mensagem por 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
Imagem
Data scientist, 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
Mensagens: 983
Registado: terça mai 12, 2020 10:06 am

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

Mensagem por 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.
Imagem
Data scientist, 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
Mensagens: 983
Registado: terça mai 12, 2020 10:06 am

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

Mensagem por 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.
Imagem
Data scientist, 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
Mensagens: 1
Registado: sexta dez 17, 2021 4:00 am

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

Mensagem por programmer1311 »

Thank you very much for the information provided, it will be helpful for the installation.
drakinite
Mensagens: 983
Registado: terça mai 12, 2020 10:06 am

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

Mensagem por 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.
Imagem
Data scientist, 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
Mensagens: 983
Registado: terça mai 12, 2020 10:06 am

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

Mensagem por 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.
Imagem
Data scientist, 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
Mensagens: 983
Registado: terça mai 12, 2020 10:06 am

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

Mensagem por drakinite »

New minor release, v1.4.0:
  • Fixed the pack-mmip --init command failing. (this was fixed in patch 1.3.2)
  • Fixed pack-mmip --create-symlink putting the symlink for skins into the wrong folder
NPM: https://www.npmjs.com/package/pack-mmip
Github: https://github.com/JL102/pack-mmip/releases/tag/v1.4.0

Install it with npm install --global pack-mmip.
Imagem
Data scientist, 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.
Responder