From 7f516b70fdb91c0a6973628543980a8b32b8c05c Mon Sep 17 00:00:00 2001 From: soykje Date: Tue, 25 Jun 2024 15:16:25 +0200 Subject: [PATCH] refactor(cli-utils): harmonize config format --- packages/utils/cli/src/scan/config.mjs | 18 +++++++++++------- packages/utils/cli/src/scan/index.mjs | 4 +++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/utils/cli/src/scan/config.mjs b/packages/utils/cli/src/scan/config.mjs index f2508a1b5..f9a1eea5b 100644 --- a/packages/utils/cli/src/scan/config.mjs +++ b/packages/utils/cli/src/scan/config.mjs @@ -1,7 +1,11 @@ -export const details = false -export const sort = 'count' -export const imports = ['@spark-ui'] -export const extensions = ['.tsx', '.ts'] -export const directory = '.' -export const verbose = false -export const output = null +module.exports = { + adoption: { + details: false, + sort: 'count', + imports: ['@spark-ui'], + extensions: ['.tsx', '.ts'], + directory: '.', + verbose: false, + output: null, + }, +} diff --git a/packages/utils/cli/src/scan/index.mjs b/packages/utils/cli/src/scan/index.mjs index 1caf606a1..9a653be20 100644 --- a/packages/utils/cli/src/scan/index.mjs +++ b/packages/utils/cli/src/scan/index.mjs @@ -1,3 +1,5 @@ +/* eslint-disable complexity */ +/* eslint-disable max-lines-per-function */ import * as process from 'node:process' import { existsSync, mkdirSync, writeFileSync } from 'fs' @@ -10,7 +12,7 @@ import { loadConfig } from './loadConfig.mjs' import { scanCallback } from './scanCallback.mjs' import { scanDirectories } from './utils/index.mjs' -export async function adoption(options) { +export async function adoption(options = {}) { const { configuration, ...optionsConfig } = options const configFileRoute = path.join(process.cwd(), configuration || '.spark-ui.cjs')