Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve init command #96

Merged
merged 4 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ npm install -g repopack
# Or using yarn
yarn global add repopack

# Or using Homebrew (macOS)
brew install repopack

# Then run in any project directory
repopack
```
Expand Down
133 changes: 133 additions & 0 deletions repopack-instruction.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,136 @@
# Generate Comprehensive Output
- Include all content without abbreviation, unless specified otherwise
- Optimize for handling large codebases while maintaining output quality

# GitHub Release Note Guidelines
Here are some examples of release notes that follow the guidelines:

v0.1.40
````md
This release introduces improvements to file handling and output formatting, enhancing Repopack's functionality and user experience.

## Improvements

### Enhanced Markdown Support (#86, #95)

- Improved code block formatting in Markdown output:
- Added language identifiers to code blocks for better syntax highlighting
- Extended support for various file extensions to improve language detection
- Dynamic output file extension:
- The extension of the output file now changes based on the selected style (e.g., `.md` for Markdown, `.xml` for XML)
- This behavior only applies when no specific output file path is provided by the user

### Enhanced Exclusion of Package Manager Lock Files (#90, #94)

- Improved exclusion of common package manager lock files:
- npm: `package-lock.json`
- Yarn: `yarn.lock`
- pnpm: `pnpm-lock.yaml`
- These files are now automatically excluded from the packed output, including those in subdirectories

## How to Update

To update to the latest version, run:

```bash
npm update -g repopack
```

---

We value your feedback and contributions in making Repopack better! If you encounter any issues or have suggestions, please share them through our GitHub issues.
````

v0.1.38
````md
This release introduces a new Markdown output style, providing users with an additional option for formatting their repository content.

## What's New

### Markdown Output Style (#86, #87)

- Added new 'markdown' output style option
- Users can now generate output in Markdown format, alongside existing plain text and XML options

## How to Use

To use the new Markdown output style, use the `--style markdown` option:

```bash
repopack --style markdown
```

Or update your `repopack.config.json`:

```json
{
"output": {
"style": "markdown"
}
}
```

---

To update, simply run:
```bash
npm update -g repopack
```

As always, we appreciate your feedback and contributions to make Repopack even better! If you encounter any issues or have suggestions regarding this new feature, please let us know through our GitHub issues.
````

v0.1.36
````md
This release introduces a new configuration option that allows users to control the security check feature, providing more flexibility in how Repopack handles sensitive information detection.

## What's New

### Configurable Security Check (#74, #75)

- Added new configuration option `security.enableSecurityCheck` (default: `true`)
- Users can now disable the security check when needed, such as when working with cryptographic libraries or known false positives

## How to Use

To **disable** the security check, add the following to your `repopack.config.json`:

```json
{
"security": {
"enableSecurityCheck": false
}
}
```

**Note:** Disabling the security check may expose sensitive information. Use this option with caution and only when necessary.

---

To update, simply run:
```bash
npm update -g repopack
```

As always, we appreciate your feedback and contributions to make Repopack even better! If you encounter any issues or have suggestions regarding this new feature, please let us know through our GitHub issues.
````

v0.1.32
````md
This release focuses on improving performance and user experience, particularly when processing large repositories.

## Bug Fixes
### Fixed an issue where the application appeared to hang (#63, #65)

- Fixed an issue where the application appeared to hang during the security check process on large repositories.
- Reduced the impact on the event loop to prevent hanging when processing a large number of files.
- Implemented more frequent console updates during file processing and security checks.

---
To update, simply run:
```
npm update -g repopack
```

As always, we appreciate your feedback and contributions to make Repopack even better!
````
24 changes: 14 additions & 10 deletions src/cli/actions/initActionRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import path from 'node:path';
import * as prompts from '@clack/prompts';
import pc from 'picocolors';
import type { RepopackConfigFile, RepopackOutputStyle } from '../../config/configTypes.js';
import { defaultConfig } from '../../config/defaultConfig.js';
import { defaultConfig, defaultFilePathMap } from '../../config/defaultConfig.js';
import { getGlobalDirectory } from '../../config/globalDirectory.js';
import { logger } from '../../shared/logger.js';

Expand Down Expand Up @@ -77,27 +77,31 @@ export async function createConfigFile(rootDir: string, isGlobal: boolean): Prom

const options = await prompts.group(
{
outputFilePath: () => {
outputStyle: () => {
if (isCancelled) {
return;
}
return prompts.text({
message: 'Output file path:',
initialValue: defaultConfig.output.filePath,
validate: (value) => (value.length === 0 ? 'Output file path is required' : undefined),
});
},

outputStyle: () => {
return prompts.select({
message: 'Output style:',
options: [
{ value: 'plain', label: 'Plain', hint: 'Simple text format' },
{ value: 'xml', label: 'XML', hint: 'Structured XML format' },
{ value: 'markdown', label: 'Markdown', hint: 'Markdown format' },
],
initialValue: defaultConfig.output.style,
});
},
outputFilePath: ({ results }) => {
if (isCancelled) {
return;
}
const defaultFilePath = defaultFilePathMap[results.outputStyle as RepopackOutputStyle];
return prompts.text({
message: 'Output file path:',
initialValue: defaultFilePath,
validate: (value) => (value.length === 0 ? 'Output file path is required' : undefined),
});
},
},
{
onCancel: onCancelOperation,
Expand Down
10 changes: 5 additions & 5 deletions src/core/security/securityCheckRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ export const runSecurityCheck = async (
async (rawFile, index) => {
const secretLintResult = await runSecretLint(rawFile.path, rawFile.content, secretLintConfig);

progressCallback(`Running security check... (${index + 1}/${rawFiles.length}) ${pc.dim(rawFile.path)}`);

// Sleep for a short time to prevent blocking the event loop
await sleep(1);

if (secretLintResult.messages.length > 0) {
return {
filePath: rawFile.path,
messages: secretLintResult.messages.map((message) => message.message),
};
}

progressCallback(`Running security check... (${index + 1}/${rawFiles.length}) ${pc.dim(rawFile.path)}`);

// Sleep for a short time to prevent blocking the event loop
await sleep(1);

return null;
},
{
Expand Down
Loading