Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
at main 1.1 kB view raw
1#!/usr/bin/env node 2 3import fs from 'node:fs'; 4import path from 'node:path'; 5 6import { getPackageManifest, listPackages } from '../actions/lib/packages.mjs'; 7 8const getExports = exports => { 9 const exportNames = Object.keys(exports); 10 const eventualExports = {}; 11 for (const exportName of exportNames) { 12 if (exportName.includes('package.json')) continue; 13 const exp = exports[exportName]; 14 eventualExports[exportName] = exp.source; 15 } 16 return eventualExports; 17}; 18 19export const updateJsr = async () => { 20 (await listPackages()).forEach(dir => { 21 const manifest = getPackageManifest(dir); 22 const jsrManifest = { 23 name: manifest.name, 24 version: manifest.version, 25 exports: manifest.exports 26 ? getExports(manifest.exports) 27 : manifest.source, 28 exclude: [ 29 'node_modules', 30 'cypress', 31 '**/*.test.*', 32 '**/*.spec.*', 33 '**/*.test.*.snap', 34 '**/*.spec.*.snap', 35 ], 36 }; 37 38 fs.writeFileSync( 39 path.resolve(dir, 'jsr.json'), 40 JSON.stringify(jsrManifest, undefined, 2) 41 ); 42 }); 43};