Files
self/packages/mobile-sdk-alpha/scripts/validate-exports.mjs
Justin Hernandez b59dbe1b05 Chore: mobile sdk refinements (#858)
* Add sdk-alpha package with MRZ helper

* chore: add migration report script

* Add lint config and MRZ tests to sdk-alpha

* fix tests

* fixes. wip

* fixes

* fix bundler tests

* mrz improvements based on cr feedback

* prettier

* fix build errors

* Document browser shim (#859)

* Validate required adapters (#861)

* Use sdkError for web scanner shim (#862)

* Document new workspaces in AGENTS (#864)

* Add client tests (#860)

* Use deep merge for client config (#863)

* Add config merge helper

* format

* Add SDK alpha CI workflow (#865)

* rename

* rename file

* update workflow

* coderabbit feedback and fixes

* fix linter

* fix import paths

* wip fixes

* updates

* fix tests

* formatting

* update workflow

* remove console mocks

* rename folder and fixes

* fix tests

* save wip

* auto format on save for all sdk package files

* fixes

* cr feedback

* fix pipelines
2025-08-09 17:14:56 -07:00

23 lines
687 B
JavaScript

// Dev-only script to ensure named exports only and ESM shape (ok to use Node here)
import { readFile } from 'node:fs/promises';
import { readdir } from 'node:fs/promises';
import { join } from 'node:path';
const dist = new URL('../dist/', import.meta.url);
const files = await readdir(dist);
let hasDefault = false;
for (const f of files) {
if (!f.endsWith('.js')) continue;
const src = await readFile(join(dist.pathname, f), 'utf8');
if (/\bexport\s+default\b/.test(src)) {
console.error(`Default export found in dist/${f}`);
hasDefault = true;
}
}
if (hasDefault) {
process.exitCode = 1;
} else {
console.log('OK: no default exports, ESM build looks clean.');
}