encounterplus / module-packer

EncounterPlus Module Packer
Creative Commons Zero v1.0 Universal
49 stars 7 forks source link

CLI fails when there is no assets folder #4

Closed cffs closed 4 years ago

cffs commented 4 years ago

Trying to compile a module using pack.js fails with an error, while compiling the same module with the GUI (from npm start) succeeds and generate a valid Encounter+ module.

Minimal working example

my-module folder with one test.md:

# Test

Just a test page.

With CLI

$ ./pack.js /tmp/my-module -n 'My Module'
processing path: /tmp/my-module
module: My Module
/tmp/my-module/test.md
<h1 id="test">Test</h1>
<p>Just a test page.</p>

internal/validators.js:125
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
    at validateString (internal/validators.js:125:11)
    at Object.join (path.js:1147:7)
    at Markdown.process (/home/cffs/devel/module-packer/app/parsers/markdown.js:138:31)
    at Object.<anonymous> (/home/cffs/devel/module-packer/pack.js:27:8)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

With GUI

Using the GUI works as expected. Console output is as follows:

processing path: /tmp/my-module
module: My Module
/tmp/my-module/test.md
<h1 id="test">Test</h1>
<p>Just a test page.</p>

505 total bytes
FINISHED

Workaround

If I create an assets folder in the module, then it succeeds both ways.