From a4a14016cae376edc66a244087d436e0d93086e8 Mon Sep 17 00:00:00 2001 From: "Breno A." Date: Sun, 13 Oct 2024 02:33:06 +0000 Subject: [PATCH 1/4] fix: use `pathArg` as default to keep as default or use a custom path. --- src/cli.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index b82f72f3..7f423391 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -23,7 +23,7 @@ const showHelpAndExit = (yargsInstance: any) => { let pathArg = './src' const analyzeIndex = process.argv.indexOf('analyze') -if (analyzeIndex !== -1 && !process.argv[analyzeIndex + 1].startsWith('--')) { +if (analyzeIndex !== -1 && process.argv[analyzeIndex + 1] && !process.argv[analyzeIndex + 1].startsWith('-')) { pathArg = process.argv[analyzeIndex + 1] } @@ -41,7 +41,7 @@ getProjectRoot(pathArg).then(async (projectRoot) => { builder: yargs => yargs .positional('path', { describe: 'path to the Vue files', - default: './src', + default: pathArg, }) .option('apply', { alias: 'a', From dccb8d3a81c1c5d82acbd706508c5d4242489b84 Mon Sep 17 00:00:00 2001 From: "Breno A." Date: Sun, 13 Oct 2024 02:52:11 +0000 Subject: [PATCH 2/4] fix: Config must be `undefined` by default --- src/helpers/getConfig.ts | 2 +- src/types/Config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/helpers/getConfig.ts b/src/helpers/getConfig.ts index 0b549898..ede17ec0 100644 --- a/src/helpers/getConfig.ts +++ b/src/helpers/getConfig.ts @@ -17,7 +17,7 @@ const getConfigFileContent = async (filePath: string) => { export const getConfig = async (projectRoot: string): Promise => { const defaultConfig: Config = { - path: './src', + path: undefined, apply: Object.values(RULESETS).join(','), ignore: '', exclude: '', diff --git a/src/types/Config.ts b/src/types/Config.ts index 6becb1ed..ec1545c6 100644 --- a/src/types/Config.ts +++ b/src/types/Config.ts @@ -1,7 +1,7 @@ import type { OverrideConfig } from './Override' export interface Config { - path: string + path?: string apply: string ignore: string exclude: string From 461c73213b92a2ce5164691a09415331268dcb32 Mon Sep 17 00:00:00 2001 From: "Breno A." Date: Sun, 13 Oct 2024 02:54:26 +0000 Subject: [PATCH 3/4] fix: update default config --- src/helpers/getConfig.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/helpers/getConfig.ts b/src/helpers/getConfig.ts index ede17ec0..5c021124 100644 --- a/src/helpers/getConfig.ts +++ b/src/helpers/getConfig.ts @@ -17,7 +17,6 @@ const getConfigFileContent = async (filePath: string) => { export const getConfig = async (projectRoot: string): Promise => { const defaultConfig: Config = { - path: undefined, apply: Object.values(RULESETS).join(','), ignore: '', exclude: '', From 35be52acf40e5077b4901d05cf854f6b50529dbe Mon Sep 17 00:00:00 2001 From: "Breno A." Date: Sun, 13 Oct 2024 02:58:27 +0000 Subject: [PATCH 4/4] ci: use default path for vue analysis --- .github/workflows/integration-tests.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 06f71384..2c817242 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -97,23 +97,23 @@ jobs: yes "my-package" | head -n 1 | pnpm create vue@latest . --default --typescript pnpm add file:${{ github.workspace }}/package/ -D pnpm install - pnpm vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json + pnpm vue-mess-detector analyze --output=json --file-output=vmd-output.json elif [ "${{ matrix.package-manager }}" == "yarn" ]; then yes "my-package" | head -n 1 | yarn --cwd . create vue . --default --typescript touch ./yarn.lock yarn add vue-mess-detector@file:${{ github.workspace }}/package/ -D yarn install - yarn vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json + yarn vue-mess-detector analyze --output=json --file-output=vmd-output.json elif [ "${{ matrix.package-manager }}" == "bun" ]; then yes "my-package" | head -n 1 | bun create vue . --default --typescript --cwd=. --ignore-scripts bun add file:${{ github.workspace }}/package/ --dev bun install --ignore-scripts - bun run vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json + bun run vue-mess-detector analyze --output=json --file-output=vmd-output.json else yes "my-package" | head -n 1 | npm create vue@latest -- . --default --typescript npm install file:${{ github.workspace }}/package/ --save-dev npm install - npx vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json + npx vue-mess-detector analyze --output=json --file-output=vmd-output.json fi node -e "const fs = require('fs'); try { const data = JSON.parse(fs.readFileSync('vmd-output.json', 'utf8')); console.log(JSON.stringify(data, null, 2)); } catch (e) { throw new Error('Something went wrong'); }" @@ -125,23 +125,23 @@ jobs: echo "my-package" | pnpm create vue@latest . --default --typescript pnpm add file:${{ github.workspace }}/package/ -D pnpm install - pnpm vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json + pnpm vue-mess-detector analyze --output=json --file-output=vmd-output.json } elseif ($Env:matrix_package_manager -eq 'yarn') { echo "my-package" | yarn create vue . --default --typescript touch ./yarn.lock yarn add vue-mess-detector@file:${{ github.workspace }}/package/ -D yarn install - yarn vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json + yarn vue-mess-detector analyze --output=json --file-output=vmd-output.json } elseif ($Env:matrix_package_manager -eq 'bun') { echo "my-package" | bun create vue . --default --typescript --ignore-scripts bun add file:${{ github.workspace }}/package/ --d bun install --ignore-scripts - bun run vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json + bun run vue-mess-detector analyze --output=json --file-output=vmd-output.json } else { echo "my-package" | npm create vue@latest -- . --default --typescript npm install file:${{ github.workspace }}/package/ --save-dev npm install - npx vue-mess-detector analyze ./ --output=json --file-output=vmd-output.json + npx vue-mess-detector analyze --output=json --file-output=vmd-output.json } node -e "const fs = require('fs'); try { const data = JSON.parse(fs.readFileSync('vmd-output.json', 'utf8')); console.log(JSON.stringify(data, null, 2)); } catch (e) { throw new Error('Something went wrong'); }"