update tsconfig
This commit is contained in:
parent
1b58055522
commit
5ad53a463e
@ -8,14 +8,24 @@
|
|||||||
"shortDescription": "a diffing lib for text",
|
"shortDescription": "a diffing lib for text",
|
||||||
"npmPackagename": "@push.rocks/smartdiff",
|
"npmPackagename": "@push.rocks/smartdiff",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "push.rocks"
|
"projectDomain": "push.rocks",
|
||||||
|
"description": "A library for performing text diffs.",
|
||||||
|
"keywords": [
|
||||||
|
"diff",
|
||||||
|
"text",
|
||||||
|
"patch",
|
||||||
|
"typescript",
|
||||||
|
"npm package",
|
||||||
|
"text comparison",
|
||||||
|
"text diff"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
},
|
},
|
||||||
"tsdocs": {
|
"tsdoc": {
|
||||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
11
package.json
11
package.json
@ -2,7 +2,7 @@
|
|||||||
"name": "@push.rocks/smartdiff",
|
"name": "@push.rocks/smartdiff",
|
||||||
"version": "1.0.3",
|
"version": "1.0.3",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a diffing lib for text",
|
"description": "A library for performing text diffs.",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
@ -37,5 +37,14 @@
|
|||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
|
],
|
||||||
|
"keywords": [
|
||||||
|
"diff",
|
||||||
|
"text",
|
||||||
|
"patch",
|
||||||
|
"typescript",
|
||||||
|
"npm package",
|
||||||
|
"text comparison",
|
||||||
|
"text diff"
|
||||||
]
|
]
|
||||||
}
|
}
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
96
readme.md
96
readme.md
@ -1,39 +1,81 @@
|
|||||||
# @pushrocks/smartdiff
|
# @push.rocks/smartdiff
|
||||||
a diffing lib for text
|
a diffing lib for text
|
||||||
|
|
||||||
## Availabililty and Links
|
## Install
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartdiff)
|
|
||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartdiff)
|
|
||||||
* [github.com (source mirror)](https://github.com/pushrocks/smartdiff)
|
|
||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/smartdiff/)
|
|
||||||
|
|
||||||
## Status for master
|
To install @push.rocks/smartdiff, you need to have Node.js and npm installed. Once you have those set up, you can install the library by running the following command in your project directory:
|
||||||
|
|
||||||
Status Category | Status Badge
|
```sh
|
||||||
-- | --
|
npm install @push.rocks/smartdiff --save
|
||||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartdiff/badges/master/pipeline.svg)](https://lossless.cloud)
|
```
|
||||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartdiff/badges/master/coverage.svg)](https://lossless.cloud)
|
|
||||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartdiff)](https://lossless.cloud)
|
|
||||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartdiff)](https://lossless.cloud)
|
|
||||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
|
||||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
|
||||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
|
||||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartdiff)](https://lossless.cloud)
|
|
||||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartdiff)](https://lossless.cloud)
|
|
||||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartdiff)](https://lossless.cloud)
|
|
||||||
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class intellisense
|
@push.rocks/smartdiff is a simple yet powerful library designed for creating and applying text diffs. It leverages the fast-diff library for efficient diffing operations. This usage guide will take you through the process of creating diffs between two pieces of text and applying those diffs to text using TypeScript with ESM syntax.
|
||||||
|
|
||||||
## Contribution
|
### Creating a Text Diff
|
||||||
|
|
||||||
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
|
The primary functionality of @push.rocks/smartdiff is to create a diff between two versions of text, which can then be used to update texts or synchronize changes. Here’s how you can create a diff:
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
```typescript
|
||||||
|
import { createDiff } from '@push.rocks/smartdiff';
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
const originalText = 'Hello World';
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
const revisedText = 'Hello smart World';
|
||||||
|
|
||||||
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
|
const diffString = createDiff(originalText, revisedText);
|
||||||
|
console.log(diffString);
|
||||||
|
// Output would be a JSON string representing the diff
|
||||||
|
```
|
||||||
|
|
||||||
|
This example demonstrates how to generate a diff. The `createDiff` function takes two arguments: the original text and the revised text. It returns a JSON string representing the changes required to go from the original text to the revised text.
|
||||||
|
|
||||||
|
### Applying a Text Diff
|
||||||
|
|
||||||
|
Once you have a diff, you might want to apply it to the original text to reconstruct the revised version (or vice versa). Here’s how you can apply a diff with smartdiff:
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { applyPatch } from '@push.rocks/smartdiff';
|
||||||
|
|
||||||
|
const originalText = 'Hello World';
|
||||||
|
const diffString = '[[-6,"smart "],[0," World"]]'; // An example diff string
|
||||||
|
|
||||||
|
const updatedText = applyPatch(originalText, diffString);
|
||||||
|
console.log(updatedText);
|
||||||
|
// Expected output: 'Hello smart World'
|
||||||
|
```
|
||||||
|
|
||||||
|
The `applyPatch` function takes the original text and a diff string as inputs and outputs the updated text after applying the diff.
|
||||||
|
|
||||||
|
### Handling Complex Diffs
|
||||||
|
|
||||||
|
@push.rocks/smartdiff is capable of handling more complex diffs, including multi-line changes, deletions, and insertions. When working with complex texts, the process remains the same: generate a diff using `createDiff` and apply it with `applyPatch`. This ensures that you can track and synchronize changes efficiently, no matter how extensive they are.
|
||||||
|
|
||||||
|
### Best Practices for Managing Diffs
|
||||||
|
|
||||||
|
- **Version Control**: Always keep track of your base and revised texts in some form of version control. This can help in diagnosing issues or conflicts in diffs.
|
||||||
|
- **Testing**: Ensure that you thoroughly test diffs, especially in applications where correctness is critical (e.g., legal documents or codebases).
|
||||||
|
- **Performance Considerations**: While `smartdiff` is optimized for performance, generating and applying diffs across extremely large documents may require additional considerations, such as chunking texts.
|
||||||
|
|
||||||
|
In conclusion, @push.rocks/smartdiff offers a streamlined interface for working with text diffs in TypeScript applications. Whether you are developing a collaborative editing tool, implementing version control for texts, or simply need to track changes in documents, `smartdiff` provides the necessary tools to get the job done with minimal overhead.
|
||||||
|
|
||||||
|
For any questions or contributions, please refer to the project's GitHub repository or contact the maintainers. Happy coding!
|
||||||
|
|
||||||
|
## License and Legal Information
|
||||||
|
|
||||||
|
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||||
|
|
||||||
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
### Trademarks
|
||||||
|
|
||||||
|
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||||
|
|
||||||
|
### Company Information
|
||||||
|
|
||||||
|
Task Venture Capital GmbH
|
||||||
|
Registered at District court Bremen HRB 35230 HB, Germany
|
||||||
|
|
||||||
|
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||||
|
|
||||||
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||||
|
Loading…
Reference in New Issue
Block a user