Created
March 27, 2019 14:27
-
-
Save galvez/ecd961475981cb205ed6b82d4e1b42ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class ModuleUtils { | |
static mixin(target) { | |
for (const member of Object.getOwnPropertyNames(ModuleUtils.prototype)) { | |
target[member] = ModuleUtils.prototype[member].bind(target) | |
} | |
} | |
resolvePath(...args) { | |
return resolve(process.cwd(), ...args) | |
} | |
getManifestFiles() { | |
const manifestPath = this.resolvePath('core/manifest') | |
return readFileSync(manifestPath).toString().trim().split(/\r?\n/) | |
} | |
addPlugin2(path, options = {}) { | |
this.addPlugin({ | |
src: this.resolvePath('core/templates', ...path.split('/')), | |
fileName: join('core', ...path.split('/')), | |
options | |
}) | |
} | |
addTemplate2(path, options = {}) { | |
this.addTemplate({ | |
src: this.resolvePath('core/templates', ...path.split('/')), | |
fileName: join('core', ...path.split('/')), | |
options | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment