diff --git a/npmextra.json b/npmextra.json index 37c8506..e5b5a2e 100644 --- a/npmextra.json +++ b/npmextra.json @@ -9,12 +9,22 @@ "githost": "code.foss.global", "gitscope": "push.rocks", "gitrepo": "smartevent", - "description": "lightweight gulp replacement", + "description": "A lightweight replacement for gulp, featuring smart stream handling and file manipulation.", "npmPackagename": "@push.rocks/smartgulp", - "license": "MIT" + "license": "MIT", + "keywords": [ + "build tool", + "gulp replacement", + "stream manipulation", + "file manipulation", + "typescript", + "task runner", + "pipeline", + "development tool" + ] } }, - "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" } } \ No newline at end of file diff --git a/package.json b/package.json index 49d5b06..993fd4e 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@push.rocks/smartgulp", "version": "3.0.4", "private": false, - "description": "lightweight gulp replacement", + "description": "A lightweight replacement for gulp, featuring smart stream handling and file manipulation.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "scripts": { @@ -15,7 +15,14 @@ "url": "git+https://gitlab.com/push.rocks/smartevent.git" }, "keywords": [ - "gulp" + "build tool", + "gulp replacement", + "stream manipulation", + "file manipulation", + "typescript", + "task runner", + "pipeline", + "development tool" ], "author": "Lossless GmbH", "license": "MIT", @@ -55,4 +62,4 @@ "npmextra.json", "readme.md" ] -} +} \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/readme.hints.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.md b/readme.md index 8989439..e7b7b44 100644 --- a/readme.md +++ b/readme.md @@ -1,38 +1,103 @@ -# @push.rocks/smartevent +# @push.rocks/smartgulp lightweight gulp replacement -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartgulp) -* [gitlab.com (source)](https://gitlab.com/pushrocks/smartevent) -* [github.com (source mirror)](https://github.com/pushrocks/smartevent) -* [docs (typedoc)](https://pushrocks.gitlab.io/smartevent/) +## Install +To install `@push.rocks/smartgulp`, use the following command in your terminal: -## Status for master +```bash +npm install @push.rocks/smartgulp --save-dev +``` -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartevent/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartevent/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartgulp)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartevent)](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/@push.rocks/smartgulp)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartgulp)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartgulp)](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) +This will add `smartgulp` to your project's `devDependencies`. `smartgulp` is designed to be a lightweight replacement for `gulp`, thus assuming its role in development processes rather than in production environments. ## Usage +In this section, we'll dive into how to effectively utilize `@push.rocks/smartgulp` within your project. `smartgulp` aims to present a simplified interface for handling file streams and processing, similar to traditional `gulp` but with a modernized API and reduced complexity. -## Contribution +### Basic Stream Creation and File Manipulation -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). :) +First, let's demonstrate how to create a stream from source files and then manipulate these files, ultimately saving the transformed files to a desired directory. -For further information read the linked docs at the top of this readme. +```typescript +// Import smartgulp methods +import { src, dest } from '@push.rocks/smartgulp'; -> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +// Create a stream from source files using the `src` function +src(['src/**/*.ts']) // Specify the glob pattern + .pipe( + // Example transformation: Convert TypeScript to JavaScript + // Use your desired transformer here + ts() // Assuming `ts()` is a function returning a Transform stream + ) + .pipe( + // Save the transformed files to the 'dist' directory + dest('dist') + ); +``` -[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) +In the example above, `src(['src/**/*.ts'])` creates a stream that reads all TypeScript files in the `src` directory. Each file is then transformed (for instance, compiled from TypeScript to JavaScript, though the actual transformation function `ts()` is illustrative) and finally written to the `dist` directory via `dest('dist')`. + +### Advanced Usage: Custom Transformations + +`smartgulp` can be extended with custom transformations, allowing you to perform virtually any file manipulation task. Here’s how you can create and use custom transform streams: + +```typescript +import { src, dest } from '@push.rocks/smartgulp'; +import { Transform } from 'stream'; + +// Creating a custom transform to prefix file contents +const prefixTransform = new Transform({ + objectMode: true, + transform(file, encoding, callback) { + const prefix = '/* Prefixed content */\n'; + file.contents = Buffer.from(prefix + file.contents.toString()); + callback(null, file); // Pass the modified file along the stream + } +}); + +// Usage in a pipeline +src(['src/**/*.js']) // Adjust glob pattern as needed + .pipe(prefixTransform) // Apply custom prefixing + .pipe(dest('dist')); // Output to 'dist' directory +``` + +In this scenario, `prefixTransform` is a custom transformation that prepends a comment to the contents of each `.js` file fetched through `src(['src/**/*.js'])`. After transformation, the files are written to the `dist` directory. + +### Combining with Other Libraries + +`@push.rocks/smartgulp` can be seamlessly integrated with other libraries, making it easy to enhance your build pipeline with additional functionality like linting, minification, and more. + +```typescript +import { src, dest } from '@push.rocks/smartgulp'; +import someOtherLib from 'some-other-lib'; + +src(['src/**/*.css']) // Example with CSS files + .pipe( + // Assuming `someOtherLib` provides a method for CSS minification + someOtherLib.minifyCSS() + ) + .pipe(dest('dist')); +``` + +### Conclusion + +`@push.rocks/smartgulp` offers a simplified, promise-based approach to stream processing and file manipulation. By leveraging its functionality along with custom and third-party transforms, you can create powerful and efficient build pipelines tailored to your project's needs. Whether you're compiling, bundling, minifying, or simply copying files, `smartgulp` provides a lightweight, flexible foundation for your automated workflows. + +## 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.