Skip to content

Commit b332436

Browse files
committed
Use relative imports in CTAValidator integration files for astro sync, path aliases not available in files imported to astro.config.ts
1 parent 8b547e6 commit b332436

2 files changed

Lines changed: 5 additions & 7 deletions

File tree

‎src/integrations/CtaValidator/componentDiscovery.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
* Component discovery for CallToAction validator
33
* Discovers all CallToAction components in the specified directory
44
*/
5-
65
import { readdir, readFile } from 'fs/promises'
76
import { join, resolve } from 'path'
8-
import { ClientScriptError } from '@components/scripts/errors/ClientScriptError'
7+
import { BuildError } from '../../lib/errors'
98
import type { CallToActionComponent } from './@types'
109
import { generateImportPatterns } from './parsers'
1110

@@ -66,7 +65,7 @@ export async function discoverCallToActionComponents(
6665
}
6766
}
6867
} catch (error) {
69-
throw new ClientScriptError({
68+
throw new BuildError({
7069
message: `Failed to read CallToAction components directory '${fullComponentPath}': ${error}`
7170
})
7271
}

‎src/integrations/CtaValidator/index.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@
2727
* })
2828
* ```
2929
*/
30-
3130
import type { AstroIntegration, AstroConfig } from 'astro'
3231
import { fileURLToPath } from 'url'
33-
import { ClientScriptError } from '@components/scripts/errors/ClientScriptError'
32+
import { BuildError } from '../../lib/errors'
3433
import type { CallToActionValidatorOptions, CallToActionComponent } from './@types'
3534
import { discoverCallToActionComponents } from './componentDiscovery'
3635
import { validateAllPages, validateCtaRequirements } from './validation'
@@ -156,7 +155,7 @@ export function callToActionValidator(
156155
)
157156
logger.error('')
158157

159-
throw new ClientScriptError({
158+
throw new BuildError({
160159
message: `CallToAction validation failed: Found multiple component instances on ${pagesWithErrors.length} page(s). Each CallToAction component should only appear once per page.`
161160
})
162161
}
@@ -171,7 +170,7 @@ export function callToActionValidator(
171170
throw error
172171
}
173172
logger.error(`CallToAction Validator: Validation error: ${error}`)
174-
throw new ClientScriptError({
173+
throw new BuildError({
175174
message: `CallToAction validation failed: ${error}`
176175
})
177176
}

0 commit comments

Comments
 (0)