electron / forge

:electron: A complete tool for building and publishing Electron applications
https://electronforge.io
MIT License
6.5k stars 520 forks source link

You can not override the dir #934

Closed rynz closed 5 years ago

rynz commented 5 years ago

I read that "you can not override the dir" of electron-packager. Currently, my build system creates a dist folder with the appropriate package.json, main.js and renderer.js files generated from typescript files, etc.

Is it not possible to have electron-forge configured to the appropriate path of the built project?

MarshallOfSound commented 5 years ago

@rynz Electron Forge is supposed to control all those things, how are you building your main.js and renderer.js? Sounds like you want to be using the Webpack Plugin if you've got build steps

MarshallOfSound commented 5 years ago

(Closing as not a bug nor valid feature request, happy to continue discussion though)

malept commented 5 years ago

As far as I can tell from the --help, one of the arguments for most subcommands is the app directory (although it should be named appPath and not cwd).

rynz commented 5 years ago

@MarshallOfSound no worries about closing, keen to keep discussing too.

I'm using vue-cli to build the project and vue-cli-plugin-electron to build electron - They both use webpack-chain rather than webpack directly, but the end result is a dist folder with built typescript, static assets, package.json etc.

Should I instead use electron-packager directly and the appropriate electron-installer-*?

malept commented 5 years ago

Does electron-forge package dist work?

rynz commented 5 years ago

Nope :( It's okay I'll use electron-packager directly.

prodigy7 commented 5 years ago

Same problem here too!

My package.json:

{
  "name": "project",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "vue-cli-service serve",
    "build": "vue-cli-service build",
    "lint": "vue-cli-service lint",
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make"
  },
  "dependencies": {
    "axios": "^0.19.0",
    "core-js": "^2.6.5",
    "electron-compile": "^6.4.4",
    "electron-squirrel-startup": "^1.0.0",
    "vue": "^2.6.10",
    "vue-router": "^3.1.1",
    "vuex": "^3.1.1"
  },
  "devDependencies": {
    "@dongido/vue-viaudio": "^0.3.2",
    "@vue/cli-plugin-babel": "^3.10.0",
    "@vue/cli-plugin-eslint": "^3.10.0",
    "@vue/cli-service": "^3.10.0",
    "babel-eslint": "^10.0.1",
    "babel-plugin-transform-async-to-generator": "^6.24.1",
    "babel-preset-env": "^1.7.0",
    "babel-preset-react": "^6.24.1",
    "compass-mixins": "^0.12.10",
    "electron-forge": "^5.2.4",
    "electron-prebuilt-compile": "4.0.0",
    "eslint": "^5.16.0",
    "eslint-plugin-vue": "^5.0.0",
    "lodash": "^4.17.15",
    "node-sass": "^4.12.0",
    "sass-loader": "^7.1.0",
    "vue-template-compiler": "^2.6.10"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "rules": {},
    "parserOptions": {
      "parser": "babel-eslint"
    }
  },
  "postcss": {
    "plugins": {
      "autoprefixer": {}
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions"
  ],
  "main": "./dist/electron.js",
  "config": {
    "forge": "./forge.config.js"
  }
}

My forge.config.js:

module.exports = {
  "make_targets": {
    "win32": [
      "squirrel"
    ],
    "darwin": [
      "zip"
    ],
    "linux": [
      "deb",
      "rpm"
    ]
  },
  "electronPackagerConfig": {
    "asar": false,
    "dir": "./dist",
    "packageManager": "yarn",
    "ignore": ["^/src", "^/public"]
  },
  "electronWinstallerConfig": {
    "name": "project"
  },
  "electronInstallerDebian": {},
  "electronInstallerRedhat": {},
  "github_repository": {
    "owner": "",
    "name": ""
  },
  "windowsStoreConfig": {
    "packageName": "",
    "name": "project"
  }
}

"dir" as root for generate package isn't taken, only "ignore" is working. I want that ./dist is the root for the generated package. electron-packager directly is working but should not be the solution in my opinion. Next problem is, that asar file is generated everytime - i dont want it. Also tried rename section electronPackagerConfig to packagerConfig but does not change anything, only that every key/value is ignored.

Electron Forge version used: 5.2.4

zkeyoung commented 1 year ago

Same problem here too! "packagerConfig.dir" does not override the "dir" used during actual "electron-package" execution.

nofacer commented 1 year ago

same here with v6.1.1