Allow pass configuration to custom electron-publisher provider
See original GitHub issue- Electron-builder version: 20.28.1
- Electron-updater version: 3.1.1
- Target: Windows
Hi.
I try to make custom electron-publisher provider and i have two problems:
- I cannot pass any configuration to it by package.json ex:
"build": {
"appId": "appId",
"productName": "productName",
"publish": [
{
"provider": "generic",
"url": "http://hostname:port/${name}/${os}/${arch}/${channel}/${version}/"
},
{
"provider": "custom",
"url": "http://hostname:port/${name}/${os}/${arch}/${channel}/${version}/"
}
]
}
Will not pass configuration validation.
- I d`not know how to get installer meta info - os, channel, version etc. in doUpload function.
I have almost working solution but everything is hard coded into it:
node_modules/electron-publisher-custom/index.js
const {
getCiTag,
HttpPublisher,
PublishContext,
PublishOptions
} = require("electron-publish/out/publisher");
const { httpExecutor } = require("builder-util/out/nodeHttpExecutor");
const mime = require("mime");
const { configureRequestOptions } = require("builder-util-runtime");
class Publisher extends HttpPublisher {
async doUpload(fileName, arch, dataLength, requestProcessor, file) {
return await httpExecutor.doApiRequest(
configureRequestOptions({
hostname: "my.host.name", // TODO: from configuration
protocol: "http:", // TODO: from configuration
port: 8888, // TODO: from configuration
path: "/some/path", // TODO: from configuration mixed with file meta about name/os/channel etc
method: "POST",
headers: {
"X-File-Name": fileName,
"Content-Type": mime.getType(fileName) || "application/octet-stream",
"Content-Length": dataLength
}
}),
this.context.cancellationToken,
requestProcessor
);
}
}
module.exports = {
default: Publisher
};
package.json:
"build": {
"appId": "appId",
"productName": "productName",
"publish": [
{
"provider": "generic",
"url": "http://hostname:port/${name}/${os}/${arch}/${channel}/${version}/"
},
"custom"
]
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
electron-publisher-alioss - npm
Start using electron-publisher-alioss in your project by running `npm i ... Allow pass configuration to custom electron-publisher provider), ...
Read more >Publish - electron-builder
To force publishing to another providers, explicitly specify publish configuration for snap . You can publish to multiple providers. For example, to publish ......
Read more >electron-publisher-alioss - npm package - Snyk
Cause we can now only to pass the configuration to the publisher by using the "custom" provider(ISSUE#3261: Allow pass configuration to ...
Read more >Implement a custom configuration provider - .NET
You may need to implement a custom configuration provider when one of the available providers doesn't suit your application needs.
Read more >Option patterns with custom configuration provider in .NET
However, IOptionsMonitor<T> will have a feature to update the value. Let's experience the feature. Go back to the configuration of AddJsonFile() , you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@develar this could be better documented because this totally opaque as far a the current docs go. Can you explain better for custom publishers?
is allowed now (upcoming 20.31.1). Any property is allowed under publish configuration if
provider
is set tocustom
.In addition to this, now you can put
electron-publisher-${provider}
under build resources dir (seecustom provider
test for example).