feat: externalized tool configuration

This commit is contained in:
Corentin Thomasset 2021-05-28 19:44:27 +02:00
parent c3adfe30ec
commit 690bd099ef
No known key found for this signature in database
GPG key ID: DBD997E935996158
31 changed files with 387 additions and 300 deletions

View file

@ -1,16 +1,21 @@
<script lang="ts">
import {Component, Vue} from 'nuxt-property-decorator'
import {Component, mixins} from 'nuxt-property-decorator'
import ToolWrapper from '~/components/ToolWrapper.vue'
import type {ToolConfig} from '~/types/ToolConfig'
import {ToolConfigMixin} from '~/mixins/tool-config.mixin'
@Component({components: {ToolWrapper}})
export default class Tool extends Vue {
@Component({
components: {ToolWrapper}
})
export default class Tool extends mixins(ToolConfigMixin) {
config(): ToolConfig {
throw new Error('You need to specify a config() method your custom Tool.')
return {
title: 'ADD A <tool> TAG'
} as unknown as ToolConfig
};
public head() {
const {title, description, keywords} = this.config()
const {title, description, keywords} = this.$toolConfig
const uniqueKeywordsCleaned = [...new Set([...keywords, ...title.split(/\s+/)].map(s => s.trim().toLowerCase()))]