You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a wrapper around the invocation of attw, some may find it helpful:
asyncfunctionlintPublishedTypes({ cwd }){letmanifest=awaitpackageJson.read(cwd);letname=manifest.name;letentrypoints=[];for(let[entryGlob,mapping]ofObject.entries(manifest['exports'])){if(!entryGlob.includes('*')){letentry=path.join(name,entryGlob);entrypoints.push(entry);continue;}constfiles=globbySync(mapping.types.replace('*','**/*'),{cwd});// Map the files to full module pathsconstmappedFiles=files.map(file=>{// Now that we found files, we need to map them _back_ to entrypoints.// Based on the entryGlob, we need to remove the path leading up until the '*',lettoRemove=mapping.types.split('*')[0];letmoduleName=file.split(toRemove)[1];// we need to chop off the extension IFF the mapping.types includes itif(mapping.types.endsWith('.d.ts')){moduleName=moduleName.replace('.d.ts','');}returnmoduleName;});entrypoints.push(...mappedFiles);}entrypoints=entrypoints// Remove stuff we are going to exclude.filter(entry=>!entry.endsWith('*')).filter(entry=>!entry.endsWith('addon-main'))// Remove index files.filter(entry=>!entry.endsWith('index'));letargs=['attw','--pack',// This does not provide types'--exclude-entrypoints','addon-main',// We turn this one off because we don't care about CJS consumers'--ignore-rules','cjs-resolves-to-esm',// Wildcard is not official supported'--ignore-rules','wildcard',// publint will handle resolving'--ignore-rules','internal-resolution-error','--include-entrypoints', ...entrypoints];console.info(chalk.blueBright('Running:\n',args.join(' ')));awaitexeca('pnpm',args,{
cwd,stdio: 'inherit',});}
I wrote a wrapper around the invocation of attw, some may find it helpful:
This takes my exports:
and invokes this command:
it's not perfect -- but it's progress
The text was updated successfully, but these errors were encountered: