diff --git a/.spark-ui.cjs b/.spark-ui.cjs new file mode 100644 index 000000000..e69de29bb diff --git a/packages/utils/cli/src/index.doc.mdx b/packages/utils/cli/src/index.doc.mdx index b3bb996ee..e6b3cd7dc 100644 --- a/packages/utils/cli/src/index.doc.mdx +++ b/packages/utils/cli/src/index.doc.mdx @@ -77,7 +77,7 @@ spark scan adoption -c "./spark-ui.cjs" module.exports = { adoption: { details: true, - alpha: false, + sort: 'count', // 'count' or 'alphabetical' imports: ['@spark-ui'], extensions: ['.tsx', '.ts'], directory: './packages', @@ -86,7 +86,7 @@ module.exports = { /*** - `details` (boolean) - whether to show the details of the adoption or not. Default: false -- `alpha` (boolean) - packages are sorted alphabetically. Default: false means sorted by adoption number +- `sort` ('count' | 'alphabetical') - packages are sorted alphabetically. Default: false means sorted by adoption number - `imports` (array) - the imports to be scanned. - `extensions` (array) - the extensions to be scanned - `directory` (string) - the directory to be scanned. Default: '.' means the current directory diff --git a/packages/utils/cli/src/scan/index.mjs b/packages/utils/cli/src/scan/index.mjs index 4aef88078..db1d0a59c 100644 --- a/packages/utils/cli/src/scan/index.mjs +++ b/packages/utils/cli/src/scan/index.mjs @@ -10,7 +10,7 @@ import { scanDirectories } from './utils/scan-directories.mjs' const DEFAULT_CONFIG = { adoption: { details: false, - alpha: false, + sort: 'count', imports: ['@spark-ui'], extensions: ['.tsx', '.ts'], directory: '.', @@ -60,7 +60,7 @@ export async function adoption(options) { }) // Sort importsUsed by alphabet - if (config.adoption.alpha) { + if (config.adoption.sort === 'alphabetical') { importsUsed = Object.fromEntries( Object.entries(importsUsed) .sort(([pkgNameA], [pkgNameB]) => pkgNameA.localeCompare(pkgNameB)) @@ -79,7 +79,7 @@ export async function adoption(options) { ] }) ) - } else { + } else if (config.adoption.sort === 'count') { // Sort importsUsed by most used importsUsed = Object.fromEntries( Object.entries(importsUsed)