can use `this`, don't need `self`

This commit is contained in:
Michael Bradley, Jr 2018-08-16 16:38:50 -05:00
parent 963ecc0d92
commit 7291fd1187
1 changed files with 6 additions and 7 deletions

View File

@ -29,7 +29,6 @@ class WebpackProcess extends ProcessWrapper {
}
async webpackRun(assets, importsList, callback) {
const self = this;
try {
await writeFile(
fs.dappPath('.embark/embark-aliases.json'),
@ -64,18 +63,18 @@ class WebpackProcess extends ProcessWrapper {
// + array of named config objects
// + config object
if (typeof config === 'function') {
config = await config(self.webpackConfigName);
config = await config(this.webpackConfigName);
} else if (Array.isArray(config)) {
config = config.filter(cfg => cfg.name === self.webpackConfigName);
config = config.filter(cfg => cfg.name === this.webpackConfigName);
if (!config.length) {
const errMsg = `no webpack config has the name '${self.webpackConfigName}'`;
const errMsg = `no webpack config has the name '${this.webpackConfigName}'`;
console.error(errMsg);
return callback(errMsg);
// ?? should the message be wrapped in new Error()
}
if (config.length > 1) {
console.warn(
`detected ${config.length} webpack configs having the name '${self.webpackConfigName}', using the first one`
`detected ${config.length} webpack configs having the name '${this.webpackConfigName}', using the first one`
);
}
config = config[0];
@ -103,12 +102,12 @@ class WebpackProcess extends ProcessWrapper {
}
try {
if (config.stats && config.stats !== 'none') {
self._log('info', 'writing file '+ ('.embark/stats.report').bold.dim);
this._log('info', 'writing file '+ ('.embark/stats.report').bold.dim);
await writeFile(
fs.dappPath('.embark/stats.report'),
stats.toString(config.stats)
);
self._log('info','writing file '+ ('.embark/stats.json').bold.dim);
this._log('info','writing file '+ ('.embark/stats.json').bold.dim);
await writeFile(
fs.dappPath('.embark/stats.json'),
JSON.stringify(stats.toJson(config.stats))