Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] Turn into an npm module + add CLI tool #76

Open
eadmaster opened this issue Aug 21, 2024 · 5 comments
Open

[Request] Turn into an npm module + add CLI tool #76

eadmaster opened this issue Aug 21, 2024 · 5 comments

Comments

@eadmaster
Copy link

followup

I'm mosty interested in this for easier cmdline use:

$ npm install -g RomPatcher  # a script `RomPatcher` is added in $PATH
$ RomPatcher patch "my_rom.bin" "my_patch.ips"
@marcrobledo marcrobledo pinned this issue Aug 21, 2024
@marcrobledo marcrobledo changed the title turn into an npm module [Request] Turn into an npm module Aug 21, 2024
@romh-acking
Copy link

+1

I'm interested in this because it makes it easier to include this package in codebases.

@marcrobledo
Copy link
Owner

Haven't tried it yet, but I've created my very first npm module: rom-patcher

Can anyone try it?

npm install -g rom-patcher
RomPatcher --help

@romh-acking
Copy link

I get this error when trying to import into my React project.

Failed to compile.

Module not found: Error: Can't resolve 'path' in '/home/xxxx/ui/node_modules/rom-patcher/rom-patcher-js/modules'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

ERROR in ./node_modules/rom-patcher/rom-patcher-js/modules/BinFile.js 308:13-28
Module not found: Error: Can't resolve 'path' in '/home/xxxx/ui/node_modules/rom-patcher/rom-patcher-js/modules'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

ERROR in ./node_modules/rom-patcher/rom-patcher-js/modules/BinFile.js 309:11-24
Module not found: Error: Can't resolve 'fs' in '/home/xxxx/ui/node_modules/rom-patcher/rom-patcher-js/modules'

ERROR in ./node_modules/rom-patcher/node_modules/commander/lib/command.js 2:21-45
Module not found: Error: Can't resolve 'child_process' in '/home/xxxx/ui/node_modules/rom-patcher/node_modules/commander/lib'

ERROR in ./node_modules/rom-patcher/node_modules/commander/lib/command.js 3:13-28
Module not found: Error: Can't resolve 'path' in '/home/xxxx/ui/node_modules/rom-patcher/node_modules/commander/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

ERROR in ./node_modules/rom-patcher/node_modules/commander/lib/command.js 4:11-24
Module not found: Error: Can't resolve 'fs' in '/home/xxxx/ui/node_modules/rom-patcher/node_modules/commander/lib'

@eadmaster eadmaster changed the title [Request] Turn into an npm module [Request] Turn into an npm module + add CLI tool Oct 9, 2024
@marcrobledo
Copy link
Owner

I get this error when trying to import into my React project.

Failed to compile.

Module not found: Error: Can't resolve 'path' in '/home/xxxx/ui/node_modules/rom-patcher/rom-patcher-js/modules'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

ERROR in ./node_modules/rom-patcher/rom-patcher-js/modules/BinFile.js 308:13-28
Module not found: Error: Can't resolve 'path' in '/home/xxxx/ui/node_modules/rom-patcher/rom-patcher-js/modules'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

ERROR in ./node_modules/rom-patcher/rom-patcher-js/modules/BinFile.js 309:11-24
Module not found: Error: Can't resolve 'fs' in '/home/xxxx/ui/node_modules/rom-patcher/rom-patcher-js/modules'

ERROR in ./node_modules/rom-patcher/node_modules/commander/lib/command.js 2:21-45
Module not found: Error: Can't resolve 'child_process' in '/home/xxxx/ui/node_modules/rom-patcher/node_modules/commander/lib'

ERROR in ./node_modules/rom-patcher/node_modules/commander/lib/command.js 3:13-28
Module not found: Error: Can't resolve 'path' in '/home/xxxx/ui/node_modules/rom-patcher/node_modules/commander/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

ERROR in ./node_modules/rom-patcher/node_modules/commander/lib/command.js 4:11-24
Module not found: Error: Can't resolve 'fs' in '/home/xxxx/ui/node_modules/rom-patcher/node_modules/commander/lib'

I've fixed a path that was wrong in package.json. Can you update your Rom Patcher JS npm package and try again?

@romh-acking
Copy link

This is the error I get. I can confirm in node modules I have version v20241102:

ERROR in ./node_modules/rom-patcher/rom-patcher-js/modules/BinFile.js 308:13-28
Module not found: Error: Can't resolve 'path' in '/home/xxx/ui/node_modules/rom-patcher/rom-patcher-js/modules'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

ERROR in ./node_modules/rom-patcher/rom-patcher-js/modules/BinFile.js 309:11-24
Module not found: Error: Can't resolve 'fs' in '/home/xxx/ui/node_modules/rom-patcher/rom-patcher-js/modules'

ERROR in ./node_modules/rom-patcher/node_modules/commander/lib/command.js 2:21-45
Module not found: Error: Can't resolve 'child_process' in '/home/xxx/ui/node_modules/rom-patcher/node_modules/commander/lib'

ERROR in ./node_modules/rom-patcher/node_modules/commander/lib/command.js 3:13-28
Module not found: Error: Can't resolve 'path' in '/home/xxx/ui/node_modules/rom-patcher/node_modules/commander/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "path": require.resolve("path-browserify") }'
        - install 'path-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "path": false }

ERROR in ./node_modules/rom-patcher/node_modules/commander/lib/command.js 4:11-24
Module not found: Error: Can't resolve 'fs' in '/home/xxx/ui/node_modules/rom-patcher/node_modules/commander/lib'

ERROR in ./node_modules/rom-patcher/node_modules/commander/lib/command.js 5:16-34
Module not found: Error: Can't resolve 'process' in '/home/xxx/ui/node_modules/rom-patcher/node_modules/commander/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "process": require.resolve("process/browser") }'
        - install 'process'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "process": false }

This is my React import:

import RomPatcher from "rom-patcher";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants