Skip to content

Commit

Permalink
chore: add bal-doc-app to e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hirsch88 committed Dec 4, 2023
1 parent 11b5703 commit 6f4b0c7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/components/config/stencil.basic.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Config } from '@stencil/core'
import { sass } from '@stencil/sass'
import fg from 'fast-glob'
import { resolve } from 'path'
import { VueGenerator } from './stencil.bindings.vue'
import { VueTestGenerator } from './stencil.bindings.vue'

const IS_BAL_DS_RELEASE = process.env.BAL_DS_RELEASE === 'true'

Expand Down Expand Up @@ -32,7 +32,7 @@ export const StencilBaseConfig: Config = {
type: 'dist',
esmLoaderPath: '../loader',
},
VueGenerator('../', '../../test/generated/components/index.ts', []),
VueTestGenerator('../', '../../test/generated/components/index.ts'),
],
bundles: [
{ components: ['bal-accordion', 'bal-accordion-summary', 'bal-accordion-trigger', 'bal-accordion-details'] },
Expand Down
18 changes: 15 additions & 3 deletions packages/components/config/stencil.bindings.vue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { vueOutputTarget } from '@baloise/design-system-output-target-vue'
import { docComponents } from './doc.components'

export const vueComponentModels: any[] = [
{
Expand Down Expand Up @@ -29,14 +28,27 @@ export const vueComponentModels: any[] = [
export const VueGenerator = (
componentCorePackage = '@baloise/design-system-components',
proxiesFile = '../components-vue/src/generated/proxies.ts',
excludeComponents = docComponents,
): any =>
vueOutputTarget({
includeImportCustomElements: true,
includeDefineCustomElements: false,
includeInternalComponents: false,
proxiesFile,
componentCorePackage,
componentModels: vueComponentModels,
customElementsDir: 'dist/components',
})

export const VueTestGenerator = (
componentCorePackage = '@baloise/design-system-components',
proxiesFile = '../components-vue/src/generated/proxies.ts',
): any =>
vueOutputTarget({
includeImportCustomElements: true,
includeDefineCustomElements: false,
includeInternalComponents: true,
proxiesFile,
componentCorePackage,
componentModels: vueComponentModels,
excludeComponents,
customElementsDir: 'dist/components',
})
15 changes: 12 additions & 3 deletions packages/output-targets/vue/src/output-vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ export async function vueProxyOutput(
outputTarget: OutputTargetVue,
components: ComponentCompilerMeta[],
) {
const filteredComponents = getFilteredComponents(outputTarget.excludeComponents, components)
const filteredComponents = getFilteredComponents(
outputTarget.excludeComponents,
components,
outputTarget.includeInternalComponents,
)
const rootDir = config.rootDir as string
const pkgData = await readPackageJson(rootDir)

Expand All @@ -19,9 +23,14 @@ export async function vueProxyOutput(
await copyResources(config, outputTarget)
}

function getFilteredComponents(excludeComponents: string[] = [], cmps: ComponentCompilerMeta[]) {
function getFilteredComponents(
excludeComponents: string[] = [],
cmps: ComponentCompilerMeta[],
includeInternalComponents = false,
) {
return sortBy<ComponentCompilerMeta>(cmps, (cmp: ComponentCompilerMeta) => cmp.tagName).filter(
(c: ComponentCompilerMeta) => !excludeComponents.includes(c.tagName) && !c.internal,
(c: ComponentCompilerMeta) =>
!excludeComponents.includes(c.tagName) && includeInternalComponents ? true : !c.internal,
)
}

Expand Down
1 change: 1 addition & 0 deletions packages/output-targets/vue/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface OutputTargetVue {
loaderDir?: string
includeDefineCustomElements?: boolean
includeImportCustomElements?: boolean
includeInternalComponents?: boolean
customElementsDir?: string
}

Expand Down

0 comments on commit 6f4b0c7

Please sign in to comment.