Skip to content

Instantly share code, notes, and snippets.

@galvez
Created March 27, 2019 14:27
Show Gist options
  • Save galvez/ecd961475981cb205ed6b82d4e1b42ad to your computer and use it in GitHub Desktop.
Save galvez/ecd961475981cb205ed6b82d4e1b42ad to your computer and use it in GitHub Desktop.
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