Describe the bug
A clear and concise description of what the bug is.
When attempting to run the cli, it crashes instead.
Expected behavior
A clear and concise description of what you expected to happen.
The cli should be able to run.
To Reproduce
Steps to reproduce the behavior.
Clone this repo. Install dependencies using npm install
.
Try to run the cli using bin/cli
or node bin/cli
.
For completeness, here is my environment:
- node v12.19.0
- npm 6.14.9
- Ubuntu 20.10
Screenshots
If applicable, add screenshots to help explain your problem.
~/tmp/jspicl-cli$ bin/cli
(node:36493) ExperimentalWarning: The ESM module loader is experimental.
internal/process/esm_loader.js:90
internalBinding('errors').triggerUncaughtException(
^
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /home/joeja/tmp/jspicl-cli/bin/cli
at Loader.defaultGetFormat [as _getFormat] (internal/modules/esm/get_format.js:65:15)
at Loader.getFormat (internal/modules/esm/loader.js:116:42)
at Loader.getModuleJob (internal/modules/esm/loader.js:247:31)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Loader.import (internal/modules/esm/loader.js:181:17)
at async Object.loadESM (internal/process/esm_loader.js:84:5) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Additional context
Add any other context about the problem here.
I think this is because of "type": "module"
in package.json
. If I understand correctly, "type": "module"
allows you to use ES6 modules in node instead of CommonJS. However, bin/cli
appears to be a CommonJS module, not an ES6 module. Removing this line from package.json
causes the script to give an expected output:
~/tmp/jspicl-cli$ bin/cli
Options:
--input Path to entry point [required]
--output Path the generated PICO-8 cardridge [required]
--spritesheetImagePath Path to a spritesheet [required]
--cartridgePath Path to existing cardridge [required]
--includeBanner Include jspicl info in code
--jsOutput Path to JavaScript output
--luaOutput Path to LUA output
--showStats Display build stats
--pipeOutputToConsole Output console.log to terminal
--reloadOnSave Re-run cartridge when updated
--polyfillTransform Path to a module that exports a transformation method
--customPicoPath Path to PICO-8 executable
--prettify Format LUA code
--watch Reload cartridge on rebuilds
Missing required arguments: input, output, spritesheetImagePath, cartridgePath