Skip to content

Commit

Permalink
Added various watch npm commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiephan committed Dec 30, 2020
1 parent 356aa63 commit a654ebe
Show file tree
Hide file tree
Showing 8 changed files with 2,328 additions and 1,625 deletions.
8 changes: 7 additions & 1 deletion TOOLS.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ Altering `.env` variable: `TOOLS_MIMC_BEHAVIOR_XML_GENERATION_LOCATION`

**Command**: `npm run build:xml`

>Use `npm run watch:xml` for automatically run the command above when required files were changed
This tool will automatically generate the `GameData.XML` under `./(10)trymemode.stormmap/base.stormdata`, that will include all XML files in `./(10)trymemode.stormmap/base.stormdata/Mods`, which will scan through all its subdirectories.

>Note: It **will ignore** any files that does not end with `.xml` (case insensitive) and **does not** validate whether the XML file is valid (syntax error, etc). TODO: Also validate XML syntax.
Expand Down Expand Up @@ -226,6 +228,8 @@ Internal Command | Mimicked Command

**Command**: `npm run patch:libraries`

>Use `npm run watch:libraries` for automatically run the command above when required files were changed.
A command to automatically remove all `//_heroes_replace_//` string in the Modules folder. This allows for less human errors.

After exported and saved the galaxy file, run this command and enter Try mode to test it out.
Expand All @@ -239,4 +243,6 @@ This does not need to do a manual search/replace in Galaxy Editor.
## Build Usage Doc ([USAGE.md](USAGE.md))
**Command**: `npm run build:usagedoc`

A Command to build [USAGE.md](USAGE.md) document base on `doc.json` in `./(10)trymemode.stormmap/base.stormdata/Modules`
>Use `npm run watch:usagedoc` for automatically run the command above when required files were changed.
A Command to build [USAGE.md](USAGE.md) document base on `doc.json` in `./(10)trymemode.stormmap/base.stormdata/Modules`.
2 changes: 1 addition & 1 deletion USAGE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<a name="meta-top"></a>

# Usage
<sup>*(Generated from [doc.json](./(10)trymemode.stormmap/base.stormdata/Modules/doc.json) at Wed, 30 Dec 2020 09:36:04 GMT)*</sup>
<sup>*(Generated from [doc.json](./(10)trymemode.stormmap/base.stormdata/Modules/doc.json) at Wed, 30 Dec 2020 10:56:58 GMT)*</sup>

Generally, most of the functionalities are using chat commands. Simply type the commands in the chat box (like how you would normally chat with teammates).
>Note: Remember to either use allies or all chat channel when try to use the commands. Public chat channels and Private Messages (PM) does not work.
Expand Down
3,897 changes: 2,276 additions & 1,621 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
"main": "index.js",
"scripts": {
"build:xml": "bash -c -i \"node ./scripts/main/buildxml.js\"",
"watch:xml": "bash -c -i \"node ./scripts/watch/xml.js\"",
"build:mimiclib": "bash -c -i \"node ./scripts/main/buildmimiclib.js\"",
"build:mimicabilities": "bash -c -i \"node ./scripts/main/buildmimicabilities.js\"",
"build:mimicbehaviors": "bash -c -i \"node ./scripts/main/buildmimicbehaviors.js\"",
"build:usagedoc": "node ./scripts/main/buildusagedoc.js",
"build:usagedoc": "bash -c -i \"node ./scripts/main/buildusagedoc.js\"",
"watch:usagedoc": "bash -c -i \"node ./scripts/watch/usagedoc.js\"",
"patch:libraries": "bash -c -i \"node ./scripts/main/patchlibraries.js\"",
"watch:libraries": "bash -c -i \"node ./scripts/watch/libraries.js\"",
"extract:s2ma": "bash -c -i \"node ./scripts/main/extracts2ma.js\"",
"util:symlink": "node ./scripts/main/utilsymlink.js"
},
Expand All @@ -26,7 +29,7 @@
"dependencies": {
"app-root-path": "^3.0.0",
"dotenv": "^8.2.0",
"prompt": "^1.0.0",
"nodemon": "^2.0.6",
"rimraf": "^3.0.2",
"storm-extract": "^1.0.3",
"tmp": "^0.2.1",
Expand Down
18 changes: 18 additions & 0 deletions scripts/watch/helper/watch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require('../../main/helper/envValidator').check();

const nodemon = require('nodemon');

/**
* Runs a nodemon watcher
* @param {nodemon.Settings} config
*/
module.exports = (config) => {
nodemon({
verbose: true,
ext: '*',
exec: 'npm run build:xml',
legacyWatch: true,
...config,
});
nodemon.on('log', (l) => console.log(l.colour));
};
8 changes: 8 additions & 0 deletions scripts/watch/libraries.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const watch = require('./helper/watch');

watch({
watch: process.env.TOOLS_UPDATE_LIBRARY_LIBRARIES_LOCATION,
ext: 'galaxy',
exec: 'npm run patch:libraries',
delay: 3000,
});
6 changes: 6 additions & 0 deletions scripts/watch/usagedoc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const watch = require('./helper/watch');

watch({
watch: `${process.env.TOOLS_UPDATE_LIBRARY_LIBRARIES_LOCATION}/doc.json`,
exec: 'npm run build:usagedoc',
});
7 changes: 7 additions & 0 deletions scripts/watch/xml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const watch = require('./helper/watch');

watch({
watch: process.env.TOOLS_XML_MODS_DIR,
ext: 'xml',
exec: 'npm run build:xml',
});

0 comments on commit a654ebe

Please sign in to comment.