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

Files in maker.options should allow relative paths #169

Closed
paustint opened this issue May 30, 2022 · 1 comment
Closed

Files in maker.options should allow relative paths #169

paustint opened this issue May 30, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@paustint
Copy link

Is your feature request related to a problem? Please describe.
When adding additional files to maker.options.json, an absolute file path is required for the files to be copied, but this is not transferrable between different computers or CI.

"files": [
  {
    "from": "/Users/foo/dev/node/bar/dist/apps/electron/worker",
    "to": "electron/worker",
    "filter": ["main.js", "assets"]
  },
  {
    "from": "/Users/foo/dev/node/bar/dist/apps/electron/preferences",
    "to": "electron/preferences",
    "filter": ["**/!(*.+(js|css).map)", "assets"]
  }
],

Describe the solution you'd like
I should be able to use a relative path, such as apps/electron/worker and this should be transformed into an absolute path during the packaging process when builder-effective-config.yaml is generated.

Describe alternatives you've considered
I have found two workarounds:

  1. use full filepaths (not transferrable between computers)
  2. Modify the filepath in a custom beforePack script and add in the path
// assume this is in the options
// "from": "${CWD}/dist/apps/electron/worker",

exports.default = async function (context) {
  context.targets.forEach((target) => {
    target?.packager?.info?._configuration?.files?.forEach((file) => {
      if (file.from) {
        file.from = file.from.replace('${CWD}', process.cwd());
      }
    });
  });
};

Additional context
If I am missing anything, please let me know - I have tried all sorts of different relative file paths and none have been successful so far.

@paustint paustint added the enhancement New feature or request label May 30, 2022
@bennymeg
Copy link
Owner

bennymeg commented Jun 1, 2022

Added in v13.2.1

Edit:
All the source paths are now resolved against <root>/dist/apps/

Example usage: (as per #155)

"files": [
    {
        "from": "<backend-project>/build",
        "to": "build",
        "filter": ["*.node"]
    }
],

@bennymeg bennymeg closed this as completed Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants