7 Commits

Author SHA1 Message Date
jkunz b226871859 v3.1.0 2026-05-01 22:17:09 +00:00
jkunz 63c5e20391 feat(smartgulp): modernize file glob handling and refresh package metadata 2026-05-01 22:17:09 +00:00
philkunz fa76cec8b4 update description 2024-05-29 14:13:27 +02:00
philkunz a2406be478 update tsconfig 2024-04-14 17:39:50 +02:00
philkunz 816ab19cb3 update npmextra.json: githost 2024-04-01 21:35:17 +02:00
philkunz 46b7d69b10 update npmextra.json: githost 2024-04-01 19:58:22 +02:00
philkunz 5926276c16 update npmextra.json: githost 2024-03-30 21:47:20 +01:00
23 changed files with 7881 additions and 5125 deletions
+38
View File
@@ -0,0 +1,38 @@
{
"@ship.zone/szci": {
"npmGlobalTools": [],
"npmRegistryUrl": "registry.npmjs.org"
},
"@git.zone/cli": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartgulp",
"shortDescription": "Gulp-style stream utilities",
"description": "A lightweight replacement for gulp, featuring smart stream handling and file manipulation.",
"npmPackagename": "@push.rocks/smartgulp",
"license": "MIT",
"keywords": [
"build tool",
"gulp replacement",
"stream manipulation",
"file manipulation",
"typescript",
"task runner",
"pipeline",
"development tool"
]
},
"release": {
"registries": [
"https://verdaccio.lossless.digital",
"https://registry.npmjs.org"
],
"accessLevel": "public"
}
},
"@git.zone/tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.\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 or third parties, and are not included within the scope of the MIT license granted herein.\n\nUse of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District Court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or 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"
}
}
+106
View File
@@ -0,0 +1,106 @@
# Changelog
## 2026-05-01 - 3.1.0 - feat(smartgulp)
modernize file glob handling and refresh package metadata
- reworks src() to resolve glob base directories and match files with minimatch, including dotfiles
- simplifies dest() by writing SmartFile objects directly with writeToDir() and keeps replace() based on SmartFile.write()
- adds an exports entry, updates build/test tooling and dependencies, and replaces the legacy test suite with NodeNext-compatible tests and improved documentation
## 2024-03-10 - 3.0.4 - maintenance
Release 3.0.4 with project metadata and configuration updates.
- Updated TypeScript configuration
- Updated npmextra.json githost settings
- Refined project description
- Summarizes trivial maintenance commits across 2024-03-30 to 2024-05-29
## 2023-11-25 - 3.0.3 - core
Patch release with a core update.
- Fixed and updated core behavior
## 2023-11-25 - 3.0.2 - core
Patch release with a core update.
- Fixed and updated core behavior
## 2023-11-25 - 3.0.1 - core
Patch release with a core update.
- Fixed and updated core behavior
## 2022-06-09 - 3.0.0 - breaking
Major release introducing a new organization scheme and core breaking changes.
- Switched to a new organization scheme
- Introduced a breaking core update
- Summarizes related changes through 2023-07-10
## 2019-02-20 - 2.0.2 - core
Release with a breaking core update.
- Introduced a breaking change in core
## 2018-09-02 - 2.0.1 - core
Patch release with a core fix.
- Fixed and updated core behavior
## 2018-09-02 - 2.0.0 - dependencies
Major release focused on dependency updates.
- Updated dependencies to latest versions
## 2018-02-16 - 1.0.11 - breaking
Release with scope and system-level changes.
- Introduced a breaking scope update
- Applied a system change
## 2018-02-16 - 1.0.10 - fix
Patch release with a replace fix.
- Fixed replace behavior
## 2018-02-16 - 1.0.9 - maintenance
Patch release with internal maintenance updates.
- Updated smartfile support
## 2018-02-16 - 1.0.8 - fix
Patch release with npm metadata fixes.
- Fixed npmextra.json configuration
## 2018-02-15 - 1.0.7 - maintenance
Patch release with lockfile maintenance.
- Updated yarn.lock
## 2017-05-27 - 1.0.6 - feature
Release adding replace functionality.
- Added replace()
## 2017-05-01 - 1.0.3-1.0.5 - dependencies
Maintenance releases focused on dependency updates.
- Updated dependencies across versions 1.0.3 to 1.0.5
## 2017-04-29 - 1.0.2 - dependencies
Patch release with dependency maintenance.
- Updated dependencies
## 2017-04-29 - 1.0.1 - src
Patch release improving source handling.
- .src is now fully working
## 2017-04-28 - 1.0.0 - core
Initial release establishing expected read and runtime behavior.
- Added initial implementation
- Corrected reading behavior
- Brought functionality to expected working state
-1
View File
@@ -1 +0,0 @@
export * from './smartgulp.gulpapi';
-7
View File
@@ -1,7 +0,0 @@
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(require("./smartgulp.gulpapi"));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLHlDQUFtQyJ9
-10
View File
@@ -1,10 +0,0 @@
/// <reference types="node" />
import { Smartfile } from 'smartfile';
import { Transform } from 'stream';
export declare class GulpStream {
stream: Transform;
/**
* allows you to pipe a SmartfileArray into the stream
*/
pipeSmartfileArray(smartfileArray: Smartfile[]): Promise<void>;
}
-43
View File
@@ -1,43 +0,0 @@
"use strict";
// this file contains the code to generate and handle the stream
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartgulp.plugins");
const stream_1 = require("stream");
class GulpStream {
constructor() {
this.stream = new stream_1.Transform({ objectMode: true });
}
/**
* allows you to pipe a SmartfileArray into the stream
*/
pipeSmartfileArray(smartfileArray) {
return __awaiter(this, void 0, void 0, function* () {
// ensure what we get is an array
if (!Array.isArray(smartfileArray)) {
throw new Error('fileArg has unknown format');
}
for (let smartfile of smartfileArray) {
let hasWritten = this.stream.push(smartfile);
if (!hasWritten) {
yield plugins.smartevent.once(this.stream, 'drain');
}
else {
// iterate
}
}
;
// signal end of stream;
this.stream.push(null);
});
}
}
exports.GulpStream = GulpStream;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRndWxwLmNsYXNzZXMuZ3VscHN0cmVhbS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0Z3VscC5jbGFzc2VzLmd1bHBzdHJlYW0udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLGdFQUFnRTs7Ozs7Ozs7OztBQUVoRSwrQ0FBOEM7QUFHOUMsbUNBQWtDO0FBRWxDO0lBQUE7UUFDRSxXQUFNLEdBQUcsSUFBSSxrQkFBUyxDQUFDLEVBQUUsVUFBVSxFQUFFLElBQUksRUFBRSxDQUFDLENBQUE7SUFxQjlDLENBQUM7SUFuQkM7O09BRUc7SUFDRyxrQkFBa0IsQ0FBQyxjQUEyQjs7WUFDbEQsaUNBQWlDO1lBQ2pDLEVBQUUsQ0FBQyxDQUFDLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxjQUFjLENBQUMsQ0FBQyxDQUFDLENBQUM7Z0JBQ25DLE1BQU0sSUFBSSxLQUFLLENBQUMsNEJBQTRCLENBQUMsQ0FBQTtZQUMvQyxDQUFDO1lBQ0QsR0FBRyxDQUFDLENBQUMsSUFBSSxTQUFTLElBQUksY0FBYyxDQUFDLENBQUMsQ0FBQztnQkFDckMsSUFBSSxVQUFVLEdBQUcsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7Z0JBQzVDLEVBQUUsQ0FBQyxDQUFDLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQztvQkFDaEIsTUFBTSxPQUFPLENBQUMsVUFBVSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxDQUFBO2dCQUNyRCxDQUFDO2dCQUFDLElBQUksQ0FBQyxDQUFDO29CQUNOLFVBQVU7Z0JBQ1osQ0FBQztZQUNILENBQUM7WUFBQSxDQUFDO1lBQ0Ysd0JBQXdCO1lBQ3hCLElBQUksQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFBO1FBQ3hCLENBQUM7S0FBQTtDQUNGO0FBdEJELGdDQXNCQyJ9
-5
View File
@@ -1,5 +0,0 @@
/// <reference types="node" />
import { Transform } from 'stream';
export declare let src: (minimatchPathArrayArg: string[]) => Transform;
export declare let dest: (dirArg: string) => void;
export declare let replace: () => Transform;
-39
View File
@@ -1,39 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
// this file contains the implementation of the standard gulp api
const plugins = require("./smartgulp.plugins");
const smartgulp_classes_gulpstream_1 = require("./smartgulp.classes.gulpstream");
exports.src = (minimatchPathArrayArg) => {
let gulpStream = new smartgulp_classes_gulpstream_1.GulpStream();
let handleFiles = () => __awaiter(this, void 0, void 0, function* () {
let smartfileArray = [];
for (let minimatchPath of minimatchPathArrayArg) {
let localSmartfileArray = yield plugins.smartfile.fs.fileTreeToObject(process.cwd(), minimatchPath);
smartfileArray = plugins.lodash.concat(smartfileArray, localSmartfileArray);
}
gulpStream.pipeSmartfileArray(smartfileArray);
});
handleFiles().catch(err => {
console.log(err);
});
return gulpStream.stream;
};
exports.dest = (dirArg) => {
};
exports.replace = () => {
return plugins.through2.obj((file, enc, cb) => __awaiter(this, void 0, void 0, function* () {
yield file.write();
cb(null, file);
}), (cb) => {
cb();
});
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRndWxwLmd1bHBhcGkuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGd1bHAuZ3VscGFwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsaUVBQWlFO0FBQ2pFLCtDQUE4QztBQUM5QyxpRkFBMkQ7QUFLaEQsUUFBQSxHQUFHLEdBQUcsQ0FBQyxxQkFBK0IsRUFBYSxFQUFFO0lBQzlELElBQUksVUFBVSxHQUFHLElBQUkseUNBQVUsRUFBRSxDQUFBO0lBQ2pDLElBQUksV0FBVyxHQUFHLEdBQVMsRUFBRTtRQUMzQixJQUFJLGNBQWMsR0FBZ0IsRUFBRSxDQUFBO1FBQ3BDLEdBQUcsQ0FBQyxDQUFDLElBQUksYUFBYSxJQUFJLHFCQUFxQixDQUFDLENBQUMsQ0FBQztZQUNoRCxJQUFJLG1CQUFtQixHQUFHLE1BQU0sT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsZ0JBQWdCLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxFQUFFLGFBQWEsQ0FBQyxDQUFBO1lBQ25HLGNBQWMsR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxjQUFjLEVBQUUsbUJBQW1CLENBQUMsQ0FBQTtRQUM3RSxDQUFDO1FBQ0QsVUFBVSxDQUFDLGtCQUFrQixDQUFDLGNBQWMsQ0FBQyxDQUFBO0lBQy9DLENBQUMsQ0FBQSxDQUFBO0lBQ0QsV0FBVyxFQUFFLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxFQUFFO1FBQ3hCLE9BQU8sQ0FBQyxHQUFHLENBQUMsR0FBRyxDQUFDLENBQUE7SUFDbEIsQ0FBQyxDQUFDLENBQUE7SUFDRixNQUFNLENBQUMsVUFBVSxDQUFDLE1BQU0sQ0FBQTtBQUMxQixDQUFDLENBQUE7QUFFVSxRQUFBLElBQUksR0FBRyxDQUFDLE1BQWMsRUFBRSxFQUFFO0FBRXJDLENBQUMsQ0FBQTtBQUVVLFFBQUEsT0FBTyxHQUFHLEdBQUcsRUFBRTtJQUN4QixNQUFNLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxHQUFHLENBQUMsQ0FBTyxJQUFlLEVBQUUsR0FBRyxFQUFFLEVBQUUsRUFBRSxFQUFFO1FBQzdELE1BQU0sSUFBSSxDQUFDLEtBQUssRUFBRSxDQUFBO1FBQ2xCLEVBQUUsQ0FBQyxJQUFJLEVBQUUsSUFBSSxDQUFDLENBQUE7SUFDaEIsQ0FBQyxDQUFBLEVBQUUsQ0FBQyxFQUFFLEVBQUUsRUFBRTtRQUNSLEVBQUUsRUFBRSxDQUFBO0lBQ04sQ0FBQyxDQUFDLENBQUE7QUFDSixDQUFDLENBQUEifQ==
-6
View File
@@ -1,6 +0,0 @@
import * as smartevent from 'smartevent';
import * as smartfile from 'smartfile';
import * as smartstream from 'smartstream';
import * as lodash from 'lodash';
import * as through2 from 'through2';
export { lodash, smartevent, smartfile, smartstream, through2 };
-13
View File
@@ -1,13 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const smartevent = require("smartevent");
exports.smartevent = smartevent;
const smartfile = require("smartfile");
exports.smartfile = smartfile;
const smartstream = require("smartstream");
exports.smartstream = smartstream;
const lodash = require("lodash");
exports.lodash = lodash;
const through2 = require("through2");
exports.through2 = through2;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRndWxwLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGd1bHAucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHlDQUF3QztBQVF0QyxnQ0FBVTtBQVBaLHVDQUFzQztBQVFwQyw4QkFBUztBQVBYLDJDQUEwQztBQVF4QyxrQ0FBVztBQVBiLGlDQUFnQztBQUk5Qix3QkFBTTtBQUhSLHFDQUFvQztBQU9sQyw0QkFBUSJ9
+19
View File
@@ -0,0 +1,19 @@
Copyright (c) 2026 Task Venture Capital GmbH <hello@task.vc>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+28 -7
View File
@@ -1,17 +1,38 @@
{
"npmci": {
"@ship.zone/szci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
"npmRegistryUrl": "registry.npmjs.org"
},
"gitzone": {
"@git.zone/cli": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartevent",
"description": "lightweight gulp replacement",
"gitrepo": "smartgulp",
"shortDescription": "Gulp-style stream utilities",
"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"
]
},
"release": {
"registries": [
"https://verdaccio.lossless.digital",
"https://registry.npmjs.org"
],
"accessLevel": "public"
}
},
"@git.zone/tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.\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 or third parties, and are not included within the scope of the MIT license granted herein.\n\nUse of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District Court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or 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"
}
}
+30 -20
View File
@@ -1,43 +1,51 @@
{
"name": "@push.rocks/smartgulp",
"version": "3.0.4",
"version": "3.1.0",
"private": false,
"description": "lightweight gulp replacement",
"description": "A lightweight replacement for gulp, featuring smart stream handling and file manipulation.",
"exports": {
".": "./dist_ts/index.js"
},
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild --web --allowimplicitany)",
"test": "tstest test/",
"build": "tsbuild",
"buildDocs": "tsdoc"
},
"repository": {
"type": "git",
"url": "git+https://gitlab.com/push.rocks/smartevent.git"
"url": "https://code.foss.global/push.rocks/smartgulp.git"
},
"keywords": [
"gulp"
"build tool",
"gulp replacement",
"stream manipulation",
"file manipulation",
"typescript",
"task runner",
"pipeline",
"development tool"
],
"author": "Lossless GmbH",
"author": "Task Venture Capital GmbH <hello@task.vc>",
"license": "MIT",
"bugs": {
"url": "https://gitlab.com/push.rocks/smartevent/issues"
"url": "https://code.foss.global/push.rocks/smartgulp/issues"
},
"homepage": "https://gitlab.com/push.rocks/smartevent#readme",
"homepage": "https://code.foss.global/push.rocks/smartgulp",
"devDependencies": {
"@git.zone/tsbuild": "^2.1.72",
"@git.zone/tsrun": "^1.2.44",
"@git.zone/tstest": "^1.0.88",
"@push.rocks/tapbundle": "^5.0.8",
"@types/node": "^20.11.25",
"@push.rocks/gulp-function": "^2.2.14"
"@git.zone/tsbuild": "^4.4.0",
"@git.zone/tsdoc": "^2.0.3",
"@git.zone/tstest": "^3.6.3",
"@push.rocks/gulp-function": "^3.0.7",
"@types/node": "^25.6.0"
},
"dependencies": {
"@push.rocks/smartevent": "^2.0.5",
"@push.rocks/smartfile": "^11.0.4",
"@push.rocks/smartpromise": "^4.0.2",
"@push.rocks/smartstream": "^3.0.33",
"@types/through2": "^2.0.41",
"through2": "^4.0.2"
"@push.rocks/smartfile": "^13.1.3",
"@push.rocks/smartpromise": "^4.2.4",
"@push.rocks/smartstream": "^3.4.2",
"minimatch": "^10.2.5"
},
"type": "module",
"browserslist": [
@@ -52,6 +60,8 @@
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
".smartconfig.json",
"license",
"npmextra.json",
"readme.md"
]
+7441 -4925
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
+155 -28
View File
@@ -1,38 +1,165 @@
# @push.rocks/smartevent
lightweight gulp replacement
# @push.rocks/smartgulp
## 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/)
`@push.rocks/smartgulp` is a tiny, modern Gulp-style file pipeline for TypeScript and Node.js projects. It gives you the familiar `src(...).pipe(...).pipe(dest(...))` workflow without pulling in the full Gulp task runner: read files by glob, process them as `SmartFile` objects, write them somewhere else, or replace them in place.
## Status for master
Use it when you want stream-based build steps that stay small, explicit, and easy to compose with regular Node streams.
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)
## Issue Reporting and Security
## Usage
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
## Installation
## Contribution
Install it as a development dependency:
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). :)
```bash
pnpm add -D @push.rocks/smartgulp
```
For further information read the linked docs at the top of this readme.
## What It Provides
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
`@push.rocks/smartgulp` exports three pipeline primitives:
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
| API | Purpose |
| --- | --- |
| `src(patterns)` | Reads matching files from disk and emits `SmartFile` objects into an object-mode stream. |
| `dest(directory)` | Writes incoming `SmartFile` objects to a target directory. |
| `replace()` | Writes incoming `SmartFile` objects back to their original location. |
The files flowing through a `smartgulp` pipeline are `SmartFile` instances from [`@push.rocks/smartfile`](https://www.npmjs.com/package/@push.rocks/smartfile). That means transforms can inspect paths, read or mutate contents, and then pass each file along to the next stream.
## Quick Start
Copy Markdown files from one directory to another:
```ts
import { src, dest } from '@push.rocks/smartgulp';
src(['./docs/**/*.md']).pipe(dest('./dist/docs'));
```
`src()` accepts an array of glob patterns. Each matching file is emitted as a `SmartFile`, and `dest()` writes every received file to the target directory.
## Transform Files
Because `smartgulp` uses object-mode streams, you can use any transform that accepts and emits `SmartFile` objects. The companion package [`@push.rocks/gulp-function`](https://www.npmjs.com/package/@push.rocks/gulp-function) is a convenient fit:
```ts
import { src, dest } from '@push.rocks/smartgulp';
import * as gulpFunction from '@push.rocks/gulp-function';
import type { SmartFile } from '@push.rocks/smartfile';
src(['./src/**/*.txt'])
.pipe(
gulpFunction.forEach(async (fileArg: SmartFile) => {
const currentContent = fileArg.contents.toString();
fileArg.contents = Buffer.from(`Processed by smartgulp\n\n${currentContent}`);
})
)
.pipe(dest('./dist'));
```
This pattern keeps transformations focused: read files with `src()`, mutate or inspect each `SmartFile`, then write the result with `dest()`.
## Replace Files In Place
Use `replace()` when a transform should update the original files instead of writing to a new output directory:
```ts
import { src, replace } from '@push.rocks/smartgulp';
import * as gulpFunction from '@push.rocks/gulp-function';
import type { SmartFile } from '@push.rocks/smartfile';
src(['./content/**/*.md'])
.pipe(
gulpFunction.forEach(async (fileArg: SmartFile) => {
fileArg.contents = Buffer.from(
fileArg.contents.toString().replaceAll('http://', 'https://')
);
})
)
.pipe(replace());
```
`replace()` calls `write()` on each incoming `SmartFile`, so it persists the modified contents back to the file's known path.
## Wait For A Pipeline To Finish
Node streams are asynchronous. If your script needs to wait for the final file before exiting or starting the next step, add an end-of-stream transform:
```ts
import { src, dest } from '@push.rocks/smartgulp';
import * as gulpFunction from '@push.rocks/gulp-function';
import * as smartpromise from '@push.rocks/smartpromise';
const done = smartpromise.defer<void>();
src(['./test/testfiles/**/*.md'])
.pipe(dest('./dist/testfiles'))
.pipe(
gulpFunction.atEnd(async () => {
done.resolve();
})
);
await done.promise;
```
This is useful in tests, build scripts, and one-off automation where the surrounding code needs a promise.
## Glob Behavior
`src()` resolves each provided pattern from the current working directory. It derives the static base directory before the first glob segment, loads that directory, and filters files with `minimatch`.
Examples:
| Pattern | Base directory | Matched portion |
| --- | --- | --- |
| `./src/**/*.ts` | `./src` | `**/*.ts` |
| `./docs/*.md` | `./docs` | `*.md` |
| `./package.json` | `.` | `package.json` |
Dotfiles are included in matching, so patterns can pick up files such as `.config.json` when the glob allows them.
## Typical Use Cases
- Copy assets into build directories.
- Run text or metadata transformations across many files.
- Update generated files in place.
- Build small project-specific pipelines without a full task runner.
- Compose `SmartFile`-aware transforms with regular Node stream flow.
## API Reference
### `src(patterns: string[])`
Creates an object-mode `Transform` stream and asynchronously pushes every matching `SmartFile` into it. The stream ends after all matched files have been pushed.
### `dest(directory: string)`
Creates an object-mode writable stream. Each incoming `SmartFile` is written to `directory` through `SmartFile.writeToDir()`.
### `replace()`
Creates an object-mode writable stream. Each incoming `SmartFile` is persisted through `SmartFile.write()`.
## License and Legal Information
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
**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 or third parties, 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 or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
### Company Information
Task Venture Capital GmbH
Registered at District Court Bremen HRB 35230 HB, Germany
For any legal inquiries or 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.
+47
View File
@@ -0,0 +1,47 @@
import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as smartgulp from '../ts/index.js';
import * as gulpFunction from '@push.rocks/gulp-function';
import * as smartpromise from '@push.rocks/smartpromise';
import { SmartFile } from '@push.rocks/smartfile';
tap.test('smartgulp.src should read a directory', async () => {
const done = smartpromise.defer<void>();
const filePaths: string[] = [];
smartgulp
.src(['./test/testfiles/**/*.md'])
.pipe(
gulpFunction.forEach(async (fileArg: SmartFile) => {
filePaths.push(fileArg.path);
})
)
.pipe(
gulpFunction.atEnd(async () => {
done.resolve();
})
);
await done.promise;
expect(filePaths.some((filePathArg) => filePathArg.endsWith('.md'))).toBeTrue();
});
tap.test('smartgulp should replace files', async () => {
const done = smartpromise.defer<void>();
const filePaths: string[] = [];
smartgulp
.src(['./test/testfiles/**/*.md'])
.pipe(
gulpFunction.forEach(async (fileArg: SmartFile) => {
filePaths.push(fileArg.path);
})
)
.pipe(
gulpFunction.atEnd(async () => {
done.resolve();
})
)
.pipe(smartgulp.replace());
await done.promise;
expect(filePaths.some((filePathArg) => filePathArg.endsWith('.md'))).toBeTrue();
});
export default tap.start();
-43
View File
@@ -1,43 +0,0 @@
import { expect, tap } from '@push.rocks/tapbundle';
import * as smartgulp from '../ts/index.js';
import * as smartstream from '@push.rocks/smartstream';
import * as gulpFunction from 'gulp-function';
import * as smartpromise from '@push.rocks/smartpromise';
tap.test('smartgulp.src -> should read a directoy', async (tools) => {
let done = smartpromise.defer();
smartgulp
.src(['./test/testfiles/**/*.md'])
.pipe(
gulpFunction.forEach(async (fileArg) => {
console.log(fileArg.path);
})
)
.pipe(
gulpFunction.atEnd(async () => {
done.resolve();
})
);
await done.promise;
});
tap.test('smartgulp shoould replace files', async () => {
let done = smartpromise.defer();
smartgulp
.src(['./test/testfiles/**/*.md'])
.pipe(
gulpFunction.forEach(async (fileArg) => {
console.log(fileArg.path);
})
)
.pipe(
gulpFunction.atEnd(async () => {
done.resolve();
})
)
.pipe(smartgulp.replace());
await done.promise;
});
await tap.start();
+3 -3
View File
@@ -1,8 +1,8 @@
/**
* autocreated commitinfo by @pushrocks/commitinfo
* autocreated commitinfo by @push.rocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/smartgulp',
version: '3.0.4',
description: 'lightweight gulp replacement'
version: '3.1.0',
description: 'A lightweight replacement for gulp, featuring smart stream handling and file manipulation.'
}
+4 -4
View File
@@ -3,7 +3,7 @@
import * as plugins from './smartgulp.plugins.js';
import { SmartFile } from '@push.rocks/smartfile';
import { Transform } from 'stream';
import { Transform } from 'node:stream';
export class GulpStream {
stream = new Transform({ objectMode: true });
@@ -11,13 +11,13 @@ export class GulpStream {
/**
* allows you to pipe a SmartfileArray into the stream
*/
async pipeSmartfileArray(smartfileArray: SmartFile[]) {
async pipeSmartfileArray(smartfileArray: SmartFile[]): Promise<void> {
// ensure what we get is an array
if (!Array.isArray(smartfileArray)) {
throw new Error('fileArg has unknown format');
}
for (let smartfile of smartfileArray) {
let hasWritten = this.stream.push(smartfile);
for (const smartfile of smartfileArray) {
const hasWritten = this.stream.push(smartfile);
if (!hasWritten) {
await plugins.smartevent.once(this.stream, 'drain');
}
+36 -14
View File
@@ -1,22 +1,47 @@
// this file contains the implementation of the standard gulp api
import * as plugins from './smartgulp.plugins.js';
import { GulpStream } from './smartgulp.classes.gulpstream.js';
import { Transform } from 'stream';
import { Transform } from 'node:stream';
import { SmartFile } from '@push.rocks/smartfile';
const smartFileFactory = plugins.smartfile.SmartFileFactory.nodeFs();
const toPosixPath = (pathArg: string): string => pathArg.split(plugins.path.sep).join('/');
const getGlobBaseAndPattern = (globPatternArg: string): { baseDir: string; matchPattern: string } => {
const normalizedPattern = toPosixPath(globPatternArg);
const pathParts = normalizedPattern.split('/');
const firstGlobIndex = pathParts.findIndex((pathPartArg) => /[*?[\]{}]/.test(pathPartArg));
if (firstGlobIndex === -1) {
return {
baseDir: plugins.path.dirname(globPatternArg),
matchPattern: plugins.path.basename(globPatternArg),
};
}
return {
baseDir: pathParts.slice(0, firstGlobIndex).join('/') || '.',
matchPattern: pathParts.slice(firstGlobIndex).join('/'),
};
};
export let src = (minimatchPathArrayArg: string[]): Transform => {
let gulpStream = new GulpStream();
let handleFiles = async () => {
const gulpStream = new GulpStream();
const handleFiles = async (): Promise<void> => {
let smartfileArray: SmartFile[] = [];
for (let minimatchPath of minimatchPathArrayArg) {
let localSmartfileArray = await plugins.smartfile.fs.fileTreeToObject(
process.cwd(),
minimatchPath
for (const minimatchPath of minimatchPathArrayArg) {
const { baseDir, matchPattern } = getGlobBaseAndPattern(minimatchPath);
const virtualDirectory = await smartFileFactory.virtualDirectoryFromPath(
plugins.path.resolve(process.cwd(), baseDir)
);
const localSmartfileArray = virtualDirectory
.listFiles()
.filter((fileArg) => plugins.minimatch(toPosixPath(fileArg.relative), matchPattern, { dot: true }));
smartfileArray = [...smartfileArray, ...localSmartfileArray];
}
gulpStream.pipeSmartfileArray(smartfileArray);
await gulpStream.pipeSmartfileArray(smartfileArray);
};
handleFiles().catch((err) => {
console.log(err);
@@ -28,11 +53,8 @@ export let dest = (dirArg: string) => {
const stream = new plugins.smartstream.SmartDuplex({
objectMode: true,
writeFunction: async (fileArg: SmartFile) => {
const filePath = plugins.path.join(dirArg, fileArg.relative);
const dirPath = plugins.path.dirname(filePath);
await plugins.smartfile.fs.ensureDir(dirPath);
await plugins.smartfile.memory.toFs(fileArg.contentBuffer, filePath);
}
await fileArg.writeToDir(dirArg);
},
});
return stream;
};
@@ -42,7 +64,7 @@ export let replace = () => {
objectMode: true,
writeFunction: async (fileArg: SmartFile) => {
await fileArg.write();
}
},
});
return stream;
};
+3 -3
View File
@@ -1,5 +1,5 @@
// node native scope
import * as path from 'path';
import * as path from 'node:path';
export {
path
@@ -9,6 +9,6 @@ export {
import * as smartevent from '@push.rocks/smartevent';
import * as smartfile from '@push.rocks/smartfile';
import * as smartstream from '@push.rocks/smartstream';
import * as through2 from 'through2';
import { minimatch } from 'minimatch';
export { smartevent, smartfile, smartstream, through2 };
export { smartevent, smartfile, smartstream, minimatch };
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noImplicitAny": true,
"esModuleInterop": true,
"verbatimModuleSyntax": true,
"types": ["node"]
},
"exclude": [
"dist_*/**/*.d.ts"
]
}