Can't package all files of package output dir when making squirrel.windows distribution.
- Dominant language
- TypeScript
- Stars
- 7.1k
- Forks
- 641
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 30
Description
### Pre-flight checklist
- [X] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.
### Electron Forge version
6.0.4
### Electron version
21.3.3
### Operating system
Windows 11 (22H2 22621.819)
### Last known working Electron Forge version
6.0.4
### Expected behavior
Run electron-forge make, copy files into package step's output dir, like ....../out/appname-win32-x64/ in postPackage hook. Then continue to run making. Finally the squirrel.windows distribution should include all the copy of files in package output dir.
### Actual behavior
The squirrel.windows distribution and application folder after install don't contain the new added files in package output dir. Files included when making zip distribution. It seems to be the problem from electron/windows-installer.
### Steps to reproduce
Run electron-forge make, copy files into package step's output dir, like ....../out/appname-win32-x64/ in postPackage hook. Then continue to run making.
### Additional information
package script runned: "make":"electron-forge make --arch=x64"
console result: normal
content of forge.config.js:
```
const { MakerSquirrel } = require("@electron-forge/maker-squirrel");
const { MakerZIP } = require("@electron-forge/maker-zip");
const { MakerDeb } = require("@electron-forge/maker-deb");
const { MakerRpm } = require("@electron-forge/maker-rpm");
const { WebpackPlugin } = require("@electron-forge/plugin-webpack");
const { promises: fsPromise } = require("fs");
const mainConfig = require("./config/forge/webpack.main.config");
const rendererConfig = require("./config/forge/webpack.renderer.config");
const path = require("path");
module.exports = {
packagerConfig: {},
rebuildConfig: {},
makers: [
// create a windows installer using Squirrel
new MakerSquirrel({}),
// create a windows MSI file。making need to install electron-wix-msi on computer first
// new MakerWix(),
// create zip containing packaged appllication, there are no platform specific and it will run on any platform
new MakerZIP(),
],
plugins: [
new WebpackPlugin({
// devServer: {
// stats: "verbose",
// },
// devContentSecurityPolicy: `default-src 'self' 'unsafe-inline' data:; script-src 'self' 'unsafe-eval' 'unsafe-inline' data:`,
mainConfig,
renderer: {
config: rendererConfig,
entryPoints: [
{
name: "main_window",
html: "./public/index.html",
js: "./src/renderer.tsx",
preload: {
js: "./src/preload.js",
},
nodeIntegration: false,
},
],
},
packageSourceMaps: true,
}),
],
hooks: {
generateAssets: async (forgeConfig, platform, arch) => {
console.log("running generateAssets hook...");
process.env.NODE_ENV = "development";
return;
},
prePackage: async (forgeConfig, platform, arch) => {
console.log("running prePackage hook...");
process.env.NODE_ENV = "production";
return;
},
postPackage: async (forgeConfig, packageResult) => {
console.log("running postPackage hook...");
const { platform, arch, outputPaths } = packageResult;
// copy files to package output folder
const configPath = "./config.json";
const configOutputPath = path.resolve(outputPaths[0], "./config.json");
await fsPromise.copyFile(configPath, configOutputPath);
return;
},
},
};
```
Contributor guide
Assessment
This issue has not been assessed yet.