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

Allow to disable some config options in .amxxpack.json #3

Closed
rtxa opened this issue Apr 3, 2022 · 1 comment
Closed

Allow to disable some config options in .amxxpack.json #3

rtxa opened this issue Apr 3, 2022 · 1 comment

Comments

@rtxa
Copy link

rtxa commented Apr 3, 2022

When the project is not gonna use some of the config options (like assets), you probably will try to disable it by making the field empty or removing it. This currently is not possible and it will trigger an error with the parser in resolve.js

For example, you just want to build the .sma files only, then when everything is ready, you build the entire project with the assets included.

A possible fix for this problem would be to provide a default value for these options (to avoid triggering an error when the field isn't isn't defined), and to check that when it's empty, don't do any copying.

// --------------- Case 1 -------------------
"input": {
    "scripts": "./src/scripts",
    "include": "./src/include",
    "assets": "" // Leaving this empty will use the "node_modules" folder instead.
},
"output": {
    "scripts": "./dist/addons/amxmodx/scripting",
    "plugins": "./dist/addons/amxmodx/plugins",
    "include": "./dist/addons/amxmodx/scripting/include",
    "assets": "./dist"
},

// ------------ Case 2 -------------------
"input": {
    "scripts": "./src/scripts",
    "include": "./src/include",
    // Removing the field will trigger a parser error
    // "assets": ""
},
"output": {
    "scripts": "./dist/addons/amxmodx/scripting",
    "plugins": "./dist/addons/amxmodx/plugins",
    "include": "./dist/addons/amxmodx/scripting/include",
    // Removing the field will trigger a parser error
    // "assets": ""
},

This can be workarounded to input to some empty directory like "assets": "./empty", but still it would be good to be able to disable this.

Some options I found useful to disable by the moment are:

  • assets in both input/output: Sometimes you want to disable temporarily the copying of the assets
  • output.scripts: Sometimes you don't need to distribute the scripting files
@Hedgefog
Copy link
Owner

1c87137

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

2 participants