@alexaegis/workspace-tools
Version:
Tools for working with javascript workspaces
22 lines • 1.09 kB
TypeScript
import { ObjectKeyOrder } from '@alexaegis/common';
import { CwdOption } from '@alexaegis/fs';
export interface SortingPreferenceJson {
schema?: string;
sort: ObjectKeyOrder;
}
/**
* Creates a function that can receive an optional objectKeyOrder and return it.
* It will also try to load a file from .config/${filename}.sort.json
* and treat it as the sorting preference if no custom preference is passed.
* That's why this function is async, but the normalizer itself is not.
*
* If the fileName passed is package.json it will also perform some adjustments
* to any order received to make sure the exports object will be valid.
*
* For package.json's only, when there's no keyorder is passed and there's no
* .config/package.sort.json is present, an opinionated order is returned
* specifically for package.json files.
*
*/
export declare const createJsonSortingPreferenceNormalizer: (fileName: string, rawOptions?: CwdOption) => Promise<(sortingPreference?: ObjectKeyOrder) => ObjectKeyOrder>;
//# sourceMappingURL=normalize-json-sorting-preference.function.d.ts.map