Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: adds auto-import support for the ui-library #119

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion assets/css/tailwind.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '@rotki/ui-library/dist/style.css';
@import '@rotki/ui-library/style.css';

@tailwind base;
@tailwind components;
Expand Down
1 change: 0 additions & 1 deletion components/NavigationMenu.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiIcon } from '@rotki/ui-library';
const { t } = useI18n();
</script>

Expand Down
1 change: 0 additions & 1 deletion components/account/home/AccountInformation.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import { useVuelidate } from '@vuelidate/core';
import { required } from '@vuelidate/validators';
import { get, set } from '@vueuse/core';
Expand Down
1 change: 0 additions & 1 deletion components/account/home/ApiKeys.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import { storeToRefs } from 'pinia';
import { useMainStore } from '~/store';

Expand Down
1 change: 0 additions & 1 deletion components/account/home/CancelSubscription.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import { type Subscription } from '~/types';
import { useMainStore } from '~/store';

Expand Down
1 change: 0 additions & 1 deletion components/account/home/ChangePassword.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import { useVuelidate } from '@vuelidate/core';
import { minLength, required, sameAs } from '@vuelidate/validators';
import { storeToRefs } from 'pinia';
Expand Down
1 change: 0 additions & 1 deletion components/account/home/DangerZone.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import { storeToRefs } from 'pinia';
import { useMainStore } from '~/store';
import { type ActionResult } from '~/types/common';
Expand Down
1 change: 0 additions & 1 deletion components/account/login/LoginForm.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import { useMainStore } from '~/store';

const props = withDefaults(defineProps<{ modal?: boolean }>(), {
Expand Down
1 change: 0 additions & 1 deletion components/account/password/PasswordForm.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import { useVuelidate } from '@vuelidate/core';
import { email, required } from '@vuelidate/validators';
import { FetchError } from 'ofetch';
Expand Down
1 change: 0 additions & 1 deletion components/account/password/PasswordReset.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import { useVuelidate } from '@vuelidate/core';
import { minLength, required, sameAs } from '@vuelidate/validators';
import { set } from '@vueuse/core';
Expand Down
1 change: 0 additions & 1 deletion components/account/signup/SignupForm.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import {
email,
helpers,
Expand Down
1 change: 0 additions & 1 deletion components/checkout/plan/ChangePlanDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import { get, set, toRefs } from '@vueuse/core';
import { storeToRefs } from 'pinia';
import { type ComputedRef } from 'vue';
Expand Down
2 changes: 0 additions & 2 deletions components/common/ButtonLink.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';

defineOptions({
inheritAttrs: false,
});
Expand Down
1 change: 0 additions & 1 deletion components/download/DownloadButton.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
const emit = defineEmits<{ (e: 'click'): void }>();

const { t } = useI18n();
Expand Down
2 changes: 0 additions & 2 deletions components/footer/FooterIconLinks.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { RuiIcon } from '@rotki/ui-library';

const menus = [
{
title: 'Github',
Expand Down
2 changes: 0 additions & 2 deletions components/footer/PageFooter.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { RuiButton, RuiLogo } from '@rotki/ui-library';

const { t } = useI18n();

const year = new Date().getFullYear().toString();
Expand Down
1 change: 0 additions & 1 deletion components/header/PageHeader.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton, RuiIcon, RuiLogo } from '@rotki/ui-library';
import { storeToRefs } from 'pinia';
import { useMainStore } from '~/store';
const { t } = useI18n();
Expand Down
1 change: 0 additions & 1 deletion components/plans/blocks/PlanBox.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';
import { get } from '@vueuse/core';

const props = defineProps<{
Expand Down
2 changes: 0 additions & 2 deletions components/plans/details/CustomPlan.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script setup lang="ts">
import { RuiButton } from '@rotki/ui-library';

const { t } = useI18n();
const css = useCssModule();
</script>
Expand Down
1 change: 0 additions & 1 deletion error.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<script lang="ts" setup>
import { RuiButton } from '@rotki/ui-library';
import { get } from '@vueuse/core';
import { commonAttrs, noIndex } from '~/utils/metadata';

Expand Down
42 changes: 42 additions & 0 deletions modules/ui-library/module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {
addComponent,
addImports,
addPlugin,
createResolver,
defineNuxtModule,
} from '@nuxt/kit';
import * as components from '@rotki/ui-library/components';
import * as composables from '@rotki/ui-library/composables';

// Module options TypeScript interface definition
export interface ModuleOptions {}

export default defineNuxtModule<ModuleOptions>({
meta: {
name: '@rotki/ui-library',
configKey: '@rotki/ui-library',
},
// Default configuration options of the Nuxt module
defaults: {},
async setup() {
const resolver = createResolver(import.meta.url);

addPlugin(resolver.resolve('./runtime/plugin'));

for (const component in components) {
await addComponent({
name: component,
export: component,
filePath: '@rotki/ui-library/components',
});
}

for (const composable in composables) {
addImports({
name: composable,
as: composable,
from: '@rotki/ui-library/composables',
});
}
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
RiTwitterLine,
RuiPlugin,
} from '@rotki/ui-library';
import { defineNuxtPlugin } from '#app';
import '@fontsource/roboto/latin.css';

export default defineNuxtPlugin((nuxtApp) => {
Expand Down
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default defineNuxtConfig({
['@pinia/nuxt', { disableVuex: true }],
'nuxt-simple-sitemap',
'nuxt-vitest',
'./modules/ui-library/module.ts',
],

i18n: {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@nuxt/devtools": "0.6.7",
"@nuxtjs/i18n": "8.0.0-beta.12",
"@rotki/eslint-config": "1.1.0",
"@rotki/ui-library": "0.1.2",
"@rotki/ui-library": "0.2.2",
"@types/braintree-web": "3.75.23",
"@types/paypal-checkout-components": "4.0.5",
"@types/qrcode": "1.5.1",
Expand Down
17 changes: 8 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.