|
@@ -4,25 +4,48 @@ const config = require('./lib.config.js')
|
|
|
|
|
|
module.exports = {
|
|
|
helpers: {
|
|
|
- componentLibrary: (libraryName, path = true) => {
|
|
|
- if (libraryName === 'Desktop') return path ? 'apps/desktop' : 'desktop'
|
|
|
- if (libraryName === 'Mobile') return path ? 'apps/mobile' : 'mobile'
|
|
|
- if (libraryName === 'Shared') return 'shared'
|
|
|
- },
|
|
|
- composableName: (name, h) => {
|
|
|
- return h.changeCase.camel(`use${name}`)
|
|
|
+ componentLibrary: (directoryScope, path = true) => {
|
|
|
+ if (directoryScope === 'Desktop') return path ? 'apps/desktop' : 'desktop'
|
|
|
+ if (directoryScope === 'Mobile') return path ? 'apps/mobile' : 'mobile'
|
|
|
+ if (directoryScope === 'Shared') return 'shared'
|
|
|
+
|
|
|
+ throw new Error('Directory scope not found')
|
|
|
},
|
|
|
- componentGenericWitPrefix: (name, h) => {
|
|
|
- const nameWithGenericPrefix = name.replace(
|
|
|
- new RegExp(`${config.generic.prefix}`, 'i'),
|
|
|
- '',
|
|
|
- )
|
|
|
- return h.changeCase.pascal(
|
|
|
- `${config.generic.prefix}${h.changeCase.pascal(nameWithGenericPrefix)}`,
|
|
|
- )
|
|
|
+ getPath(type, options) {
|
|
|
+ switch (type) {
|
|
|
+ case 'genericComponent':
|
|
|
+ return `../../app/frontend/${this.componentLibrary(options.directoryScope)}/components/${options.suffix}`
|
|
|
+ case 'composable':
|
|
|
+ return `../../app/frontend/${this.componentLibrary(options.directoryScope)}/composables/${options.suffix}`
|
|
|
+ case 'store':
|
|
|
+ return `../../app/frontend/${this.componentLibrary(options.directoryScope)}/stores/${options.suffix}`
|
|
|
+ default:
|
|
|
+ return type
|
|
|
+ }
|
|
|
},
|
|
|
zammadCopyright: () => {
|
|
|
return `Copyright (C) 2012-${new Date().getFullYear()} Zammad Foundation, https://zammad-foundation.org/`
|
|
|
},
|
|
|
+ usePrefix(name, type = 'use') {
|
|
|
+ if (type === 'use') {
|
|
|
+ const nameWithGenericPrefix = name.replace(
|
|
|
+ new RegExp(`${config.convention.vue.use}`, 'i'),
|
|
|
+ '',
|
|
|
+ )
|
|
|
+ return this.changeCase.camel(
|
|
|
+ `${config.convention.vue.use}${this.changeCase.pascal(nameWithGenericPrefix)}`,
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ if (type === 'generic') {
|
|
|
+ const nameWithGenericPrefix = name.replace(
|
|
|
+ new RegExp(`${config.generic.prefix}`, 'i'),
|
|
|
+ '',
|
|
|
+ )
|
|
|
+ return this.changeCase.pascal(
|
|
|
+ `${config.generic.prefix}${this.changeCase.pascal(nameWithGenericPrefix)}`,
|
|
|
+ )
|
|
|
+ }
|
|
|
+ },
|
|
|
},
|
|
|
}
|