1. Are you planning to upload your awesome tool to Hive? Please review the rules here.
    July 9, 2018: The rules for the Tool Section have been revised. Please be sure to read the revisions.
    Dismiss Notice
  2. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  3. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still haven't received your rank award? Then please contact the administration.
    Dismiss Notice
  4. Weave light to take you to your highest hopes - the 6th Special Effect Contest is here!
    Dismiss Notice
  5. Lead your forces to battle in the 15th Techtree Contest. The call is yours, commander!
    Dismiss Notice
  6. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Warcraft 3 Lua Package Manager (WLPM) 0.7-beta

Submitted by ScorpioT1000
This bundle is marked as awaiting update. A staff member has requested changes to it before it can be approved.
GitHub Source URL

A modern solution for Warcraft 3 map development!

Brings package management and es6-like Lua modules to your map project.

Features


WLPM consists of a Package Manager and a Module Manager with it's own Lua part of code.

We introduce a new way of working with dependencies - WLPM Module Manager

Package Manager Features


- Works with maps in a map-as-directory mode
- Own package config format in JSON
- Install packages with dependencies from Github and Bitbucket
- Install Lua files directly from Github, Bitbucket or custom hosts in config
- File and directory watcher (war3map.lua, sources, config)
- Dependency version resolution

Module Manager Features


- Include custom user directories as advanced sources
- Right dependency order in the target file
- ES6-like imports and exports in the Lua script
- Really fast target builder on-the-go (C# watcher)

Download



WLPM for Windows 10 x64

WLPM for any Windows (legacy)

WLPM for macOS (planned, waiting for Warcraft 3 fixes)

Quick Start



1. Install WLPM
2. Save your map as a directory (Save as... menu item)
3. Open any terminal window (press Win+R and enter "cmd")
4. enter cd <your map directory>
5. then enter wlpm - it shows all applicable commands

To initialize your package enter wlpm update. It will create wlpm-package.json and .wlpm directory with the dependencies. If you use git (mercurial/svn/...) add .wlpm to your ignore file (.gitignore).

To add new dependency enter wlpm install <package> <version>

Example:



Code (Text):

wlpm install https://github.com/Indaxia/wlpm-wc3-demo-hello-user
 
We don't recommend to use "any" version in public projects. Some scammers or stolen accs may update the code and make it malicious.

Specific version example (retrieve from git tag):



Code (Text):

wlpm install https://github.com/Indaxia/wlpm-wc3-demo-hello-user 1.1
 

Use wlpm watch to let watcher notify PM and MM if something changed and perform download new packages and/or rebuild modules.

To get help about module management refer the MM documents.

Advanced Usage



Including files


You can include files directly (Big Integer in the example):

Code (Text):

wlpm install https://raw.githubusercontent.com/DeBos99/lua-bigint/master/bigint.lua * file
 

Disabling Module Manager (MM) script


If you don't want to use MM on the client (Lua) side you can disable it by adding a new option to your wlpm-package.json:

"insertModuleLoader": false

With this option MM just includes code of the dependencies without the MM

Executing a command after building


It's possible execute a terminal command when the building process finishes:

Code (Text):

"afterBuild": "echo \"hello world\""
 
It works for root projects only.

Publishing Packages



If you want to publish your package folow these steps:
1. Create a git repository at Github or Bitbucket
2. Create wlpm-package.json in the repository root
3. Add the "dependencies" and "sources" parameters. Refer the full config example below.
4. (optional) add git tag to the repository
5. Now this is a WLPM package!

Full config example (wlpm-package.json)



Code (Text):

{
    "title": "WLPM - Demo Map Package", // (optional) your package or root project title
    "author": "ScorpioT1000 / scorpiot1000@yandex.ru", // (optional) author information
    "license": "MIT", // (optional) source code license
    "dependencies": { // list of packages and files required by your source code
        // github repository from a master branch
        "https://github.com/123/456": "*",
 
        // github repository from the release tagged as "1.1.1"
        "https://github.com/123/456": "1.1.1",
 
        // bitbucket repository from the release tagged as "1.0.0" in an object format
        "https://bitbucket.org/123/789": { "type": "package", "version": "1.0.0" },
 
        // inserts a file directly from the repository
        "https://github.com/123/456/blob/master/somefile.lua": {
            "type": "file",
            "topOrder": true  // omit this option or set to false to insert the file after repositories' sources
        }
    },
    // (optional for root project) where your sources are stored. It's important for the package, but can be omitted for root project (it watches "target")
    "sources": [
        "src"
    ],
    // (optional) where to store compiled lua build. It works for root project only.
    "target": "war3map.lua",
    // (optional) execute this command after build, e.g. "echo \"Hello!\""
    "afterBuild": "",
    // (optional) set this to false if you want to replace built-in module manager by your own
    "insertModuleLoader": true,
    // (optional) allow more hosts for direct file dependency (allows github.com and bitbucket.org by default). It works for root project only.
    "allowHosts": []
    // (optional) set custom file extensions when building "sources"
    "sourceExtensions": "*.lua"
}

Restrictions



1. It doesn't support partial version placeholders like 1.* because it doesn't use package registry
2. It performs full re-download on any config requirement change (planned to fix in the future)
3. No VSCode integration yet, but it's planned

For C# developers



You are free to fork and build your own modifications! My requirement is that any "author" fields in C# code are allowed to be supplemented only(!).

How to build



Code (Text):

dotnet publish -c Release --self-contained --runtime win10-x64 /property:Version=YOUR_VERSION
dotnet publish -c Release --self-contained --runtime win-x86 /property:Version=YOUR_VERSION
 
ScorpioT1000 © 2019
Contents

WLPM 0.7-beta (Binary)

  1. Toadcop

    Toadcop

    Joined:
    Jun 28, 2005
    Messages:
    102
    Resources:
    1
    Maps:
    1
    Resources:
    1
    vodka approves UuU
     
  2. ScorpioT1000

    ScorpioT1000

    Joined:
    Jun 26, 2013
    Messages:
    38
    Resources:
    0
    Resources:
    0
    Updated to 0.6.1-beta
    Fixed local source files inclusion
     
  3. Chaosy

    Chaosy

    Joined:
    Jun 9, 2011
    Messages:
    10,827
    Resources:
    17
    Maps:
    1
    Spells:
    10
    Tutorials:
    6
    Resources:
    17
    Seems a lot like NPM. That being said, wlpm is a pain to write.
    I do not like writing version number either, I'd leave that as optional and get the latest by default.
     
  4. yxq1122

    yxq1122

    Joined:
    Jun 5, 2018
    Messages:
    144
    Resources:
    0
    Resources:
    0
    Seems significant and promising for Lua users since Lua is now an officially integrated language for wc3.
    Continue your nice work!
     
  5. ScorpioT1000

    ScorpioT1000

    Joined:
    Jun 26, 2013
    Messages:
    38
    Resources:
    0
    Resources:
    0
    Updated to 0.7-beta
    - Command execution support (afterBuild)
    - Install function performance improved; start from scratch and file installation fixes
     
  6. G_Freak45

    G_Freak45

    Joined:
    Jan 27, 2011
    Messages:
    11
    Resources:
    0
    Resources:
    0
    Reactive Extension for Warcraft 3 Lua
    I used this for RxW3

    Some feedback:
    Need package initialization to set things like "sources" in the wlpm-package.json
    Need to be able to use local packages. I would like to do some integration testing of RxW3 without pushing to github publicly
    I would like to be able to compose packages, IE: Declare a piece of a package in another file like the operators section of RxW3
    Need better documentation on what can go in the wlpm-package.json
     
  7. eejin

    eejin

    Tool Moderator

    Joined:
    Mar 6, 2017
    Messages:
    154
    Resources:
    1
    Tools:
    1
    Resources:
    1
    Installing went fine. I'd prefer a portable executable that I would add to the system path myself, but I guess this might be easier for inexperienced users.

    Trying to install your demo package 1.0 gave me an error:
    upload_2020-5-11_12-42-54.png
    Installing 1.1 does seem to work.


    Trying to install packages with .git at the end of the URL will fail
    upload_2020-5-11_12-40-37.png
    Trying to install the package without the .git at the end will then also fail
    upload_2020-5-11_12-40-47.png
    If you then delete ".wlpm" and "wlpm-package.json" it will install fine again.


    I also couldn't get the demo package working. It would install, but then if I tried to use it my map would no longer launch. You can find the map attached with the 2 demo lines in the map script header. I'm setting this to Awaiting Update for now.
     

    Attached Files:

  8. ScorpioT1000

    ScorpioT1000

    Joined:
    Jun 26, 2013
    Messages:
    38
    Resources:
    0
    Resources:
    0
    Thanks for testing

    You've entered install twice


    About the compression problem are you sure your folder permissions are ok?

    Gonna test & fix everything and then let you know about the update here
     
  9. eejin

    eejin

    Tool Moderator

    Joined:
    Mar 6, 2017
    Messages:
    154
    Resources:
    1
    Tools:
    1
    Resources:
    1
    My bad, had to recreate some screenshots when I accidentally removed my post so hastily made a mistake. Here is the first problem again:
    upload_2020-5-13_18-42-34.png

    Tried it with CMD launched as admin, but same issue.
     
  10. ScorpioT1000

    ScorpioT1000

    Joined:
    Jun 26, 2013
    Messages:
    38
    Resources:
    0
    Resources:
    0
    Hi
    This is because the wlpm-wc3-demo-hello-user 1.0 package is broken (forgot to add colon in json, that's why I added 1.1)
     
  11. eejin

    eejin

    Tool Moderator

    Joined:
    Mar 6, 2017
    Messages:
    154
    Resources:
    1
    Tools:
    1
    Resources:
    1
    Ok so I figured that you can't use the WE for scripting, but have to do it all directly in war3map.lua which isn't a big issue, but it would be nice if it was mentioned.
    You also have to then run build after every time you save with the WE as it will overwrite your war3map.lua. Your feature lists says you have some kind of C# watcher in the Module Manager to do this automatically, but I don't see any .exes or .cs files in there. I'm also unsure why it is separate and not included with WLPM by default.

    I also get this error when I paste your demo-hello example code in the war3map.lua, but I have it installed and it is listed in the wlpm-package.json as a dependency.
    upload_2020-6-1_10-45-30.png

    A step by step guide on installation and first package use with a paragraph on expected workflow would be really helpful.