-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow customization of sendDeployData #8
Allow customization of sendDeployData #8
Conversation
Allow customization of sendDeployData
Thanks a lot @mydea for the addition! |
I will publish a new release shortly. |
@mydea thanks, If you have a bit more time would mind providing a bit more detail on what you are doing the Cheers Again thanks heaps for this PR! ENV['asset-sizes'] = {
sendDeployData(assets, options) {
// Manually do something with the assets
// 'assets' is an array of objects with 'name', 'size' and 'gzipSize'
}
} |
Ah damn @kiwiupover, I had already merged. Sorry about that. Haven't published a release though. I will wait until we're all happy with the changes to do that. |
@YoranBrondsema no worries It will only be a readme update I would think. Please cut a release. |
In our company, we have a custom proxy for keen. So basically, instead of sending data to keen directly, we send it to an internal endpoint which modifies the data and then posts it to keen. So basically, my function looks something like this: const https = require('https');
const RSVP = require('rsvp');
sendDeployData(keenData, configOptions) {
let postData = JSON.stringify({ 'deploy-file-sizes': [keenData] });
let hostname = configOptions.KEEN_PROJECT_ID;
let options = {
hostname,
path: '/api/internal-endpoint',
method: 'POST',
port: 443,
headers: {
'Content-Type': 'application/json',
'Content-Length': postData.length
}
};
return new RSVP.Promise(function(resolve, reject) {
// If no hostname is configured, resolve without doing anything
if (!hostname) {
console.log('No hostname was specified for asset-sizes, skipping tracking...');
return resolve();
}
let req = https.request(options, (res) => {
res.setEncoding('utf8');
console.log(`File size data was tracked to keen for ${hostname} with status code ${res.statusCode}`);
resolve();
});
req.on('error', (e) => {
reject(e);
});
req.write(postData);
req.end();
});
}
} |
Thanks heaps @mydea |
I found out that the tests probably don't run anywhere but on @mydea's computer because of the absolute paths in https://github.com/kiwiupover/ember-cli-deploy-asset-sizes/pull/8/files#diff-f47a110ab50cb6481739372ca5a08789R203 (see the Travis build too). Just a heads up that I think those should be fixed before we push out a new release. By the way @kiwiupover, do you have any idea why the build status does not appear next to the commit? Normally it shows the result of the build (green tick or red cross) next to the commit message in the screenshot below. |
Huh, oops. Not sure how that sneaked in :O. sorry about that. I also wondered why my PR was not being picked up by travis. |
This PR makes it possible to specify a custom
sendDeployData
method in the deploy config.This can be used to do some custom tracking, e.g. if you don't want to track to keen.io but to another service.