diff --git a/README.md b/README.md index 5fd0bc0..07104d3 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ - 🎯 AST-based symbol searching for TypeScript/JavaScript - 📝 Interactive fix mode with colored diffs - 🎨 Beautiful diff display -- 🚫 .docsignore support for excluding files +- 🚫 Ignore file support for excluding files ## Installation @@ -171,7 +171,7 @@ Create `.coderefrc.json` in your project root: { "projectRoot": ".", "docsDir": "docs", - "ignoreFile": ".docsignore" + "ignoreFile": ".gitignore" } ``` diff --git a/docs/user-guide/configuration.md b/docs/user-guide/configuration.md index b8e29fb..825e4bf 100644 --- a/docs/user-guide/configuration.md +++ b/docs/user-guide/configuration.md @@ -8,7 +8,7 @@ Create `.coderefrc.json` in your project root: { "projectRoot": ".", "docsDir": "docs", - "ignoreFile": ".docsignore", + "ignoreFile": ".gitignore", "ignorePatterns": ["**/*.draft.md"], "verbose": false } @@ -55,15 +55,18 @@ The tool loads configuration from multiple sources with the following precedence #### `ignoreFile` - **Type**: `string` (optional) -- **Default**: `".docsignore"` +- **Default**: `undefined` - **Description**: Path to ignore file relative to `projectRoot`. The file follows `.gitignore` syntax. ```json { - "ignoreFile": ".docsignore" + "ignoreFile": ".gitignore" } ``` +> **Note**: Prior to version 0.2.0, the default value was `.docsignore`. +> If you want to continue using `.docsignore`, explicitly set `ignoreFile: '.docsignore'` in your configuration. + #### `ignorePatterns` - **Type**: `string[]` (optional) @@ -161,7 +164,7 @@ Configuration with custom ignore patterns and verbose output: { "projectRoot": ".", "docsDir": "documentation", - "ignoreFile": ".docsignore", + "ignoreFile": ".gitignore", "ignorePatterns": ["**/*.draft.md", "**/archive/**", "**/_*.md"], "verbose": true } @@ -175,7 +178,7 @@ Configuration for a monorepo with multiple documentation directories: { "projectRoot": "packages/my-package", "docsDir": "docs", - "ignoreFile": "../../.docsignore" + "ignoreFile": "../../.gitignore" } ``` @@ -217,9 +220,9 @@ Alternatively, you can define configuration in `package.json`: ## Ignore Files -### .docsignore Syntax +### Ignore File Syntax -The `.docsignore` file follows the same syntax as `.gitignore`: +The ignore file follows the same syntax as `.gitignore`: ``` # Ignore draft files diff --git a/src/cli/validate.ts b/src/cli/validate.ts index 755a5f0..235e7ad 100644 --- a/src/cli/validate.ts +++ b/src/cli/validate.ts @@ -103,14 +103,14 @@ export async function main(args: string[] = process.argv.slice(2)): Promise { const relativePath = path.relative(config.projectRoot, file); return !isIgnored(relativePath, ignorePatterns); @@ -118,7 +118,7 @@ export async function main(args: string[] = process.argv.slice(2)): Promise markdownFiles.length) { console.log( - `📋 ${allMarkdownFiles.length - markdownFiles.length} files excluded by .docsignore\n` + `📋 ${allMarkdownFiles.length - markdownFiles.length} files excluded by ignore patterns\n` ); } diff --git a/src/config.test.ts b/src/config.test.ts index 47d4c7e..ba0ded8 100644 --- a/src/config.test.ts +++ b/src/config.test.ts @@ -39,7 +39,6 @@ describe('Config System', () => { expect(config).toEqual({ projectRoot: testDir, docsDir: 'docs', - ignoreFile: '.docsignore', verbose: false, }); }); @@ -219,7 +218,7 @@ describe('Config System', () => { expect(config.docsDir).toBe('custom-docs'); expect(config.projectRoot).toBe(testDir); - expect(config.ignoreFile).toBe('.docsignore'); + expect(config.ignoreFile).toBeUndefined(); }); }); @@ -320,8 +319,9 @@ describe('Config System', () => { describe('getIgnoreFilePath', () => { it('should return absolute path to ignore file when configured', () => { - const ignorePath = getIgnoreFilePath(config); - expect(ignorePath).toBe(path.join(testDir, '.docsignore')); + const customConfig = loadConfig({ ignoreFile: '.gitignore' }); + const ignorePath = getIgnoreFilePath(customConfig); + expect(ignorePath).toBe(path.join(testDir, '.gitignore')); }); it('should return null when ignoreFile is not configured', () => { @@ -343,13 +343,12 @@ describe('Config System', () => { const docsDir = path.join(testDir, 'docs'); fs.mkdirSync(docsDir); fs.writeFileSync(path.join(docsDir, 'README.md'), '# Documentation'); - fs.writeFileSync(path.join(testDir, '.docsignore'), '*.tmp.md'); const config = loadConfig(); expect(config.projectRoot).toBe(testDir); expect(getDocsPath(config)).toBe(docsDir); - expect(getIgnoreFilePath(config)).toBe(path.join(testDir, '.docsignore')); + expect(getIgnoreFilePath(config)).toBeNull(); }); it('should handle monorepo structure with custom docsDir', () => { diff --git a/src/config.ts b/src/config.ts index 01acfeb..148ea49 100644 --- a/src/config.ts +++ b/src/config.ts @@ -26,7 +26,7 @@ export interface CodeRefConfig { docsDir: string; /** - * Path to ignore file relative to projectRoot (default: ".docsignore") + * Path to ignore file relative to projectRoot */ ignoreFile?: string; @@ -80,7 +80,6 @@ function getDefaultConfig(): CodeRefConfig { return { projectRoot: process.cwd(), docsDir: 'docs', - ignoreFile: '.docsignore', verbose: false, }; } diff --git a/src/core/validate.test.ts b/src/core/validate.test.ts index 7674149..3bff612 100644 --- a/src/core/validate.test.ts +++ b/src/core/validate.test.ts @@ -14,7 +14,6 @@ const mockProjectRoot = '/project'; const mockConfig: CodeRefConfig = { projectRoot: mockProjectRoot, docsDir: 'docs', - ignoreFile: '.docsignore', verbose: false, }; diff --git a/src/utils/fix.test.ts b/src/utils/fix.test.ts index b6d4583..722d509 100644 --- a/src/utils/fix.test.ts +++ b/src/utils/fix.test.ts @@ -50,7 +50,6 @@ const mockPrompt = prompt as jest.Mocked; const mockConfig: CodeRefConfig = { projectRoot: path.resolve(__dirname, '../../..'), docsDir: 'docs', - ignoreFile: '.docsignore', verbose: false, };