11/**
22 * This script is used to generate the `registry.json` file.
33 */
4+ import path from 'node:path'
45import fs from 'fs-extra'
56import axios from 'axios'
67import crypto from 'crypto'
@@ -114,6 +115,7 @@ const buildRegistryEntry = async (
114115 version : cacheEntry ?. version || '' ,
115116 source : cacheEntry ?. source || '' ,
116117 integrity : cacheEntry ?. integrity || '' ,
118+ options_schema : cacheEntry ?. options_schema || '' ,
117119 updated_at : cacheEntry ?. updated_at || '' ,
118120 min_artalk_version : cacheEntry ?. min_artalk_version || '' ,
119121 }
@@ -133,7 +135,9 @@ const buildRegistryEntry = async (
133135 )
134136 return null
135137 }
136- const source = `https://cdn.jsdelivr.net/npm/${ srcEntry . npm_package } @${ version } /${ mainFile } `
138+
139+ const cdnBase = `https://cdn.jsdelivr.net/npm/${ srcEntry . npm_package } @${ version } `
140+ const source = `${ cdnBase } /${ mainFile } `
137141 const integrity = await generateSRIFromURL ( source )
138142 if ( ! integrity ) return null
139143
@@ -144,6 +148,7 @@ const buildRegistryEntry = async (
144148 integrity,
145149 updated_at : npmInfo [ 'time' ] [ version ] ,
146150 min_artalk_version : extractMinArtalkClientVersion ( npmPkgData ) ,
151+ options_schema : `${ cdnBase } /${ path . dirname ( mainFile ) } /artalk-plugin-options.schema.json` ,
147152 }
148153 }
149154
0 commit comments