From 81d9ed1c1d890eccab0d89866fc5e87ca066c302 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2024 17:30:42 +0300 Subject: [PATCH] refactor: remove index file (#88) Co-authored-by: Almanov Nikita <131481562+nikkeyl@users.noreply.github.com> --- .github/workflows/codeql.yaml | 4 ++-- lint-staged.config.js | 2 +- package.json | 2 +- rollup.config.ts | 13 +++++++------ specs/define-config.spec.ts | 2 +- src/{index.ts => app.ts} | 0 6 files changed, 12 insertions(+), 11 deletions(-) rename src/{index.ts => app.ts} (100%) diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 281abe4..4f42671 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -5,12 +5,12 @@ on: branches: - main paths: - - src/index.ts + - src/**/*.ts push: branches: - main paths: - - src/index.ts + - src/**/*.ts permissions: actions: read diff --git a/lint-staged.config.js b/lint-staged.config.js index 3d66b65..a2063fc 100644 --- a/lint-staged.config.js +++ b/lint-staged.config.js @@ -1,4 +1,4 @@ export default { '*': 'prettier --write', - 'src/index.ts': 'eslint --fix', + 'src/**/*.ts': 'eslint --fix', }; diff --git a/package.json b/package.json index 76d93f9..54b56d0 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "type": "module", "types": "index.d.ts", "imports": { - "#src": "./src/index.ts" + "#app": "./src/app.ts" }, "exports": { ".": "./index.js" diff --git a/rollup.config.ts b/rollup.config.ts index 5704230..7e75a2f 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -8,16 +8,17 @@ import typescript from '@rollup/plugin-typescript'; const sourceFolder = 'src'; const fileFormat = 'es'; -const fileName = 'index'; +const entryFileName = 'app'; +const outputFileName = 'index'; -const declarationFile = `${fileName}.d.ts`; -const indexFile = `${fileName}.ts`; -const outputFile = `${fileName}.js`; +const declarationFile = `${outputFileName}.d.ts`; +const entryFile = `${entryFileName}.ts`; +const outputFile = `${outputFileName}.js`; export default defineConfig([ { plugins: [typescript(), minify()], - input: `${sourceFolder}/${indexFile}`, + input: `${sourceFolder}/${entryFile}`, output: { file: outputFile, format: fileFormat, @@ -25,7 +26,7 @@ export default defineConfig([ }, { plugins: [dts()], - input: `${sourceFolder}/${indexFile}`, + input: `${sourceFolder}/${entryFile}`, output: { file: declarationFile, format: fileFormat, diff --git a/specs/define-config.spec.ts b/specs/define-config.spec.ts index a469a8a..97b3dd9 100644 --- a/specs/define-config.spec.ts +++ b/specs/define-config.spec.ts @@ -2,7 +2,7 @@ import { describe, expectTypeOf, test as spec } from 'vitest'; import type { UserConfig } from '@commitlint/types'; -import { defineConfig } from '#src'; +import { defineConfig } from '#app'; describe('Commitlint Config', () => { spec('empty config', async () => { diff --git a/src/index.ts b/src/app.ts similarity index 100% rename from src/index.ts rename to src/app.ts