@@ -9,6 +9,10 @@ export interface OpenComponentsConfig {
99 registries ?: string [ ] ;
1010 /** Development-specific configuration settings */
1111 development ?: {
12+ /** Importmap to add to the preview HTML's <head> section. */
13+ importmap ?: {
14+ imports ?: Record < string , string > ;
15+ } ;
1216 /** Additional Express routes to mount on the registry application */
1317 routes ?: Array < {
1418 route : string ;
@@ -48,9 +52,13 @@ export interface OpenComponentsConfig {
4852}
4953
5054type ParsedConfig = {
55+ $schema ?: string | null ;
5156 sourcePath ?: string ;
5257 registries : string [ ] ;
5358 development : {
59+ importmap ?: {
60+ imports ?: Record < string , string > ;
61+ } ;
5462 routes ?: Array < {
5563 route : string ;
5664 method : string ;
@@ -100,6 +108,7 @@ function parseConfig(config: OpenComponentsConfig): ParsedConfig {
100108 ...config ,
101109 registries : config . registries || [ ] ,
102110 development : {
111+ importmap : config . development ?. importmap ,
103112 preload : config . development ?. preload ,
104113 plugins,
105114 fallback : config . development ?. fallback ,
@@ -131,6 +140,10 @@ export function getOcConfig(folder?: string): ParsedConfig {
131140
132141export function setOcConfig ( config : ParsedConfig , path ?: string ) {
133142 const { sourcePath, ...rest } = config ;
143+ if ( ! rest . $schema ) {
144+ rest . $schema = 'https://opencomponents.github.io/schema.json' ;
145+ }
146+
134147 fs . writeFileSync (
135148 path || sourcePath || settings . configFile . src ,
136149 JSON . stringify ( rest , null , 2 )
0 commit comments