如何将package.json转换为适用于Firefox加载项的install.rdf?

时间:2022-06-28 20:07:42

I've got a working add-on for Firefox, which was built using the cfx tool. The tool is being depracated in favor of jpm from Firefox 38 onwards. I followed the instructions to make the switch, but while running, I get the term undefined often, even though the add-on works just fine.

我有一个适用于Firefox的附加组件,它是使用cfx工具构建的。从Firefox 38开始,该工具正在被剥离以支持jpm。我按照说明进行切换,但在运行时,我经常得到术语undefined,即使附加组件工作得很好。

JPM undefined Starting jpm run on Magnetz
Creating XPI
JPM undefined XPI created at C:\Temp\example@add-on-1.0.0.xpi (133ms)
Created XPI at C:\Temp\example@add-on-1.0.0.xpi
JPM undefined Creating a new profile

Someone in the forums suggested that the undefined comes from an install.rdf file, which I don't have. I only have a package.json, which is what the cfx-based process requires.

论坛中有人建议undefined来自install.rdf文件,我没有。我只有一个package.json,这是基于cfx的进程所需要的。

Looking at the contents of typical install.rdf files, it seems to contain more or less the same data as a package.json. Is there any way to convert the package.json to install.rdf?

查看典型install.rdf文件的内容,它似乎包含与package.json大致相同的数据。有没有办法将package.json转换为install.rdf?

I've actually not been able to find a recently updated install.rdf for add-ons, with most links talking about the older XUL-based add-ons.

我实际上无法找到最近更新的install.rdf for add-ons,大多数链接都在谈论旧的基于XUL的附加组件。

I'm also confused about why a Python-based tool (cfx) favors a JavaScript-based package.json file, whereas the newer JavaScript-based tool (jpm) favors an arguably deprecated XML-based install.rdf.

我也很困惑为什么一个基于Python的工具(cfx)偏爱基于JavaScript的package.json文件,而较新的基于JavaScript的工具(jpm)倾向于一个可论证的已弃用的基于XML的install.rdf。

1 个解决方案

#1


0  

There is a guide for transitioning to jpm from cfx here. In short, you do not have to create your own install.rdf file, both cfx and jpm create one for you. Install.rdf is an old crufty xml file, but it is necessary for the extension to work at all in Firefox.

这里有一个从cfx过渡到jpm的指南。简而言之,您不必创建自己的install.rdf文件,cfx和jpm都会为您创建一个。 Install.rdf是一个古老的简洁的xml文件,但扩展在Firefox中必须工作。

The package.json file has a field 'Title' that you can add in order to provide a 'display name' for your add-on - this replaces the older 'fullName' field.

package.json文件有一个“Title”字段,您可以添加该字段以便为您的插件提供“显示名称” - 这将取代旧的“fullName”字段。

As for the 'JPM undefined' message you see - I think that's actually a bug in JPM.

至于你看到的'JPM undefined'消息 - 我认为这实际上是JPM中的一个错误。

#1


0  

There is a guide for transitioning to jpm from cfx here. In short, you do not have to create your own install.rdf file, both cfx and jpm create one for you. Install.rdf is an old crufty xml file, but it is necessary for the extension to work at all in Firefox.

这里有一个从cfx过渡到jpm的指南。简而言之,您不必创建自己的install.rdf文件,cfx和jpm都会为您创建一个。 Install.rdf是一个古老的简洁的xml文件,但扩展在Firefox中必须工作。

The package.json file has a field 'Title' that you can add in order to provide a 'display name' for your add-on - this replaces the older 'fullName' field.

package.json文件有一个“Title”字段,您可以添加该字段以便为您的插件提供“显示名称” - 这将取代旧的“fullName”字段。

As for the 'JPM undefined' message you see - I think that's actually a bug in JPM.

至于你看到的'JPM undefined'消息 - 我认为这实际上是JPM中的一个错误。