Skip to content

electron-builder-effective-config.yaml does not pass config validation #3058

Description

@adlk
  • Version: 20.18.0
  • Target: mac (dmg)

For a project I'm currently working on, I'm using electron-webpack and I want to configure it to copy specific files to another folder.
Without much extra configuration, it creates me the following electron-builder-effective-config.yaml

directories:
  output: ./release
  buildResources: build
extraMetadata:
  main: main.js
files:
  - from: .
    filter:
      - package.json
      - package.json
      - dist/main
      - dist/renderer
      - dist/renderer-dllfiles
      - src/renderer/images
  - from: dist/main
  - from: dist/renderer
  - from: dist/renderer-dll
extraResources:
  - from: static
    to: static
productName: Suzy
appId: io.adlk.suzy
asar: false
compression: maximum
mac:
  category: public.app-category.productivity
  icon: ./resources/icons/icon.icns
dmg:
  background: ./resources/installer/installer.png
  icon: ./resources/icons/icon.icns
  iconSize: 128
  contents:
    - x: 380
      'y': 240
      type: link
      path: /Applications
    - x: 122
      'y': 240
      type: file
extends: electron-webpack/electron-builder.yml
electronVersion: 2.0.3

However, if I use this file as the default config for electron builder (via electron-builder.yml or as a config set in package.json) I'm getting the error that my files configuration does not follow the form.

  • electron-builder version=20.18.0
  • loaded configuration file=/work/suzy/electron-builder.yaml
  • loaded parent configuration file=/work/suzy/node_modules/electron-webpack/electron-builder.yml
  • description is missed in the package.json appPackageFile=/work/suzy/package.json
  • author is missed in the package.json appPackageFile=/work/suzy/package.json
Error: Configuration is invalid.
 - configuration.files should be one of these:
   object { filter?, from?, to? } | [object { filter?, from?, to? } | string] | {
     "type": [
       "null",
       "string"
     ]
   }
   Details:
    * configuration.files should be an object.
    * configuration.files[0].filter[1] should be a string.
    * configuration.files[0].filter[2] should be a string.
    * configuration.files[0].filter[3] should be a string.
    * configuration.files[0].filter[4] should be a string.
    * configuration.files[0].filter should be a string.
    * configuration.files[0].filter should be one of these:
      [string] | string
      The [glob patterns](/file-patterns.md).

    * configuration.files[0] should be a string.
    * configuration.files[0] should be one of these:
      object { filter?, from?, to? } | string
    * configuration.files should be null,string:
      {
        "type": [
          "null",
          "string"
        ]
      }

How to fix:
1. Open https://electron.build/configuration/configuration
2. Search the option name on the page.
  * Not found? The option was deprecated or not exists (check spelling).
  * Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root.

    at validateConfig (/work/suzy/node_modules/read-config-file/src/main.ts:122:19)
    at <anonymous>
From previous event:
    at validateConfig (/work/suzy/node_modules/electron-builder-lib/out/util/config.js:235:18)
    at /work/suzy/node_modules/electron-builder-lib/src/packager.ts:301:11
    at Generator.next (<anonymous>)
From previous event:
    at Packager._build (/work/suzy/node_modules/electron-builder-lib/src/packager.ts:300:133)
    at /work/suzy/node_modules/electron-builder-lib/src/packager.ts:296:23
    at Generator.next (<anonymous>)
    at runCallback (timers.js:763:18)
    at tryOnImmediate (timers.js:734:5)
    at processImmediate (timers.js:716:5)
From previous event:
    at Packager.build (/work/suzy/node_modules/electron-builder-lib/src/packager.ts:254:14)
    at /work/suzy/node_modules/electron-builder-lib/src/index.ts:51:40
    at Generator.next (<anonymous>)
From previous event:
    at build (/work/suzy/node_modules/electron-builder-lib/out/index.js:220:17)
    at build (/work/suzy/node_modules/electron-builder/src/builder.ts:234:10)
    at then (/work/suzy/node_modules/electron-builder/src/cli/cli.ts:46:19)
    at <anonymous>

With this, I currently can't create my own file rules as they won't be recognized as a valid config

- from: foo
  to: bar
  filter: [...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions