-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Convert Version Package to JS #6494
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll finish the review after the function to class conversion.
@@ -0,0 +1,76 @@ | |||
//let Future, VersionCompiler, async, exec, os; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this?
//let Future, VersionCompiler, async, exec, os; | ||
|
||
let VersionCompiler = undefined; | ||
const exec = Npm.require('child_process').exec; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you can improve with const {exec} = Npm.require('child_process');
const exec = Npm.require('child_process').exec; | ||
const os = Npm.require('os'); | ||
const Future = Npm.require('fibers/future'); | ||
const async = Npm.require('async'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably can use imports here:
import {exec} from 'child_process';
import os from 'os';
import Future from 'fibers/future';
import async from 'async');
Can you test this?
VersionCompiler = (function() { | ||
function VersionCompiler() {} | ||
|
||
VersionCompiler.prototype.processFilesForTarget = function(files) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change this to the ES6 class format?
import Future from 'fibers/future'; | ||
import async from 'async'; | ||
|
||
Plugin.registerCompiler({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to after the class declaration
return new VersionCompiler(); | ||
}); | ||
|
||
VersionCompiler = (class { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use class VersionCompiler {
}); | ||
|
||
VersionCompiler = (class { | ||
constructor() {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this non used constructor
@RocketChat/core