我在哪里可以找到解析 package.json 的电子伪造配置 js 文件? [英] Where can I find electron forge config js file where package.json is parsed?

查看:84
本文介绍了我在哪里可以找到解析 package.json 的电子伪造配置 js 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用环境变量来存储我的 Apple 用户凭据,但问题在于 Electron Forge 将其添加到不接受这些变量的 package.json 文件中.我正在寻找解析 package.json 文件的 .js 文件,以便我可以用 process.env 变量替换这些值.

我找到了 osxNotarize JS 文件,但它从另一个模块中获取参数,虽然我认为我可以将它们插入那里,但我不想破坏之前的任何逻辑或之后.我宁愿在解析 .json 文件的最早点并在那里插入我的变量.

非常感谢任何帮助!

解决方案

修改 Electron forge 源代码会很疯狂,您应该将electron forge 配置提取到单独的 JS 文件中:

I'm looking to use environment variables to store my apple user credentials, but the issue is with Electron Forge this is added to the package.json file which doesn't accept those variables. I'm looking for the .js file that parses the package.json file so I can replace the values with process.env variables.

I found the osxNotarize JS file but it takes the arguments from another module and while I THINK I could just insert them there, I don't want to break any of the logic that comes before or after that. I'd rather just get to the earliest point that the .json file is parsed and insert my variables there.

Any help is much appreciated!

解决方案

It would be crazy to modify the Electron forge source, you should rather extract the electron forge configuration in a separate JS file : ElectronForge configuration and load your environment variables using process.env.YOUR_VARIABLE_NAME

PS : I'm also trying to sign an Electron App for Mac, using electron forge too, but I have some configuration problems with the plist, if you know more, I'm really open to your help.

这篇关于我在哪里可以找到解析 package.json 的电子伪造配置 js 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆