๐Ÿš€ Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more โ†’
Sign In

code-tracker

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

code-tracker - npm Package Compare versions

Comparing version
0.2.0
to
0.2.1
+1
-1
package.json
{
"name": "code-tracker",
"version": "0.2.0",
"version": "0.2.1",
"type": "module",

@@ -5,0 +5,0 @@ "files": [

+27
-77

@@ -1,17 +0,18 @@

# Focusing Library
# CodeTracker
Focus-Mode is a lightweight JavaScript library that helps track the amount of code developers write in a project. It allows you to monitor the lines of code in individual files and provides an overall count of lines of code for the entire project.
## Installation
CodeTracker is a TypeScript library that helps developers track, manage, and report lines of code across different files in a project. It offers utilities to track individual files, update file statistics, and retrieve code metrics.
You can install the Focusing library via NPM or Yarn:
## Features
```bash
npm install focusing-library --save
```
- ๐Ÿงพ **Track Individual Files**: Easily add and manage files and their lines of code.
- ๐Ÿ”„ **Update & Remove Files**: Convenient methods to update or remove tracked files.
- ๐Ÿ“Š **Retrieve Code Metrics**: Get total lines of code, file details, average lines per file, etc.
- โœจ **Utility Functions**: Batch operations, filtering, reporting, and more.
- ๐Ÿ’ช **Type Safety with TypeScript**: Written in TypeScript for enhanced development experience.
or
## Installation
```bash
yarn add focusing-library
npm install code-tracker
```

@@ -21,83 +22,32 @@

### Tracking Code Usage
Here's a simple example of how to use CodeTracker:
To track the lines of code in a file, you can use the `trackCodeUsage` function. For example:
```typescript
import codeTracker, { trackCodeUsage, getCodeMetrics } from 'code-tracker';
```javascript
import { trackCodeUsage } from 'focusing-library';
// Track a file
trackCodeUsage('example.ts', 200);
const file = 'example.js';
const linesOfCode = 50;
trackCodeUsage(file, linesOfCode);
// Get code metrics
const metrics = getCodeMetrics();
console.log(metrics.totalLinesOfCode); // Outputs: 200
```
### Updating Code Usage
See the [API Documentation]() for more detailed information on each method. **Coming soon!**
If you need to update the number of lines of code in a file, use the `updateCodeUsage` function:
## Contributing
```javascript
import { updateCodeUsage } from 'focusing-library';
We welcome contributions! Please see our [CONTRIBUTING.md]() file for details on how to get involved.
const file = 'example.js';
const newLinesOfCode = 75;
## Versioning & Backward Compatibility
updateCodeUsage(file, newLinesOfCode);
```
CodeTracker follows Semantic Versioning (SemVer) and strives to maintain backward compatibility. See our [versioning policy]() for more information.
### Removing Code Usage
## Support & Community
To stop tracking a file and remove it from the metrics, you can use the `removeCodeUsage` function:
Need help or have questions? Join our [community forum]() or open an issue on [GitHub]().
```javascript
import { removeCodeUsage } from 'focusing-library';
## License
const file = 'example.js';
removeCodeUsage(file);
CodeTracker is licensed under the MIT License - see the [LICENSE.md]() file for details.
```
### Getting Code Metrics
You can retrieve the overall lines of code and a dictionary of tracked files using the `getCodeMetrics` function:
```javascript
import { getCodeMetrics } from 'focusing-library';
const metrics = getCodeMetrics();
console.log(metrics.totalLinesOfCode); // Output: Total lines of code in the project
console.log(metrics.files); // Output: Dictionary of tracked files and their respective lines of code
```
## Example
Here's a basic example of how you might use the Focusing library in a project:
```javascript
import { trackCodeUsage, getCodeMetrics } from 'focusing-library';
const files = [
{ name: 'index.js', linesOfCode: 120 },
{ name: 'utils.js', linesOfCode: 50 },
// Add more files as needed
];
// Track code usage for each file
files.forEach(({ name, linesOfCode }) => {
trackCodeUsage(name, linesOfCode);
});
// Get code metrics
const metrics = getCodeMetrics();
console.log(metrics.totalLinesOfCode); // Output: Total lines of code in the project
console.log(metrics.files); // Output: Dictionary of tracked files and their respective lines of code
```
## License
This project is licensed under the [MIT License](LICENSE).
## Contributing
Contributions are welcome! If you find a bug or want to suggest an enhancement, please [create an issue](https://github.com/titan/focusing-library/issues) or submit a pull request.