Skip to content

Commit

Permalink
chore: move modules config to x-module files
Browse files Browse the repository at this point in the history
  • Loading branch information
lauramargar committed May 8, 2024
1 parent 7e84a53 commit 89d3a28
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 24 deletions.
28 changes: 4 additions & 24 deletions packages/_vue3-migration-test/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ import { XComponentsAdapter } from '@empathyco/x-types';
import { Component, configureCompat, createApp } from 'vue';
import { createStore } from 'vuex';
import { xPlugin } from '../../x-components/src/plugins/x-plugin';
import { getResultsStub } from '../../x-components/src/__stubs__/results-stubs.factory';
import { getBannersStub } from '../../x-components/src/__stubs__/banners-stubs.factory';
import { getPromotedsStub } from '../../x-components/src/__stubs__/promoteds-stubs.factory';
import { getNextQueriesStub } from '../../x-components/src/__stubs__/next-queries-stubs.factory';
import App from './App.vue';
import router from './router';
import { searchXModule } from './x-modules/search/x-module';
import { nextQueriesXModule } from './x-modules/next-queries/x-module';

// Warnings that cannot be solved in Vue 2 (a.k.a. breaking changes) are suppressed
const VUE_COMPAT_MODE = Number(import.meta.env.VITE_VUE_COMPAT_MODE);
Expand Down Expand Up @@ -38,26 +36,8 @@ createApp(App as Component)
adapter,
store,
__PRIVATE__xModules: {
search: {
storeModule: {
state: {
query: 'dress',
results: getResultsStub(10),
promoteds: getPromotedsStub(),
banners: getBannersStub(),
status: 'success'
}
}
},
nextQueries: {
storeModule: {
state: {
query: 'dress',
nextQueries: getNextQueriesStub(),
status: 'success'
}
}
}
search: searchXModule,
nextQueries: nextQueriesXModule
}
})
.mount('#app');
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './x-module';
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { getNextQueriesStub } from '../../../../x-components/src/__stubs__/next-queries-stubs.factory';
import { PrivateXModuleOptions } from '../../../../x-components/src/plugins';
import { NextQueriesXModule } from '../../../../x-components/src/x-modules/next-queries';

export const nextQueriesXModule = {
storeModule: {
state: {
query: 'dress',
nextQueries: getNextQueriesStub(),
status: 'success'
}
}
} as PrivateXModuleOptions<NextQueriesXModule>;
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './components';
export * from './x-module';
17 changes: 17 additions & 0 deletions packages/_vue3-migration-test/src/x-modules/search/x-module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { getResultsStub } from '../../../../x-components/src/__stubs__/results-stubs.factory';
import { getBannersStub } from '../../../../x-components/src/__stubs__/banners-stubs.factory';
import { getPromotedsStub } from '../../../../x-components/src/__stubs__/promoteds-stubs.factory';
import { PrivateXModuleOptions } from '../../../../x-components/src/plugins';
import { SearchXModule } from '../../../../x-components/src/x-modules/search';

export const searchXModule = {
storeModule: {
state: {
query: 'dress',
results: getResultsStub(10),
promoteds: getPromotedsStub(),
banners: getBannersStub(),
status: 'success'
}
}
} as PrivateXModuleOptions<SearchXModule>;

0 comments on commit 89d3a28

Please sign in to comment.