fix(config): migrate project config and harden SmartFile and StreamFile defaults for updated toolchain compatibility
This commit is contained in:
@@ -1,45 +1,34 @@
|
|||||||
{
|
{
|
||||||
"npmdocker": {},
|
"@git.zone/cli": {
|
||||||
"npmci": {
|
|
||||||
"npmGlobalTools": [],
|
|
||||||
"npmAccessLevel": "public"
|
|
||||||
},
|
|
||||||
"gitzone": {
|
|
||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "code.foss.global",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "push.rocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartfile",
|
"gitrepo": "smartfile",
|
||||||
"description": "Provides comprehensive tools for efficient file management in Node.js using TypeScript, including handling streams, virtual directories, and various file operations.",
|
"description": "High-level file representation classes (SmartFile, StreamFile, VirtualDirectory) for efficient in-memory file management in Node.js using TypeScript. Works seamlessly with @push.rocks/smartfs for filesystem operations.",
|
||||||
"npmPackagename": "@push.rocks/smartfile",
|
"npmPackagename": "@push.rocks/smartfile",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"keywords": [
|
"projectDomain": "push.rocks"
|
||||||
"file management",
|
},
|
||||||
"TypeScript",
|
"release": {
|
||||||
"Node.js",
|
"registries": [
|
||||||
"file operations",
|
"https://verdaccio.lossless.digital",
|
||||||
"file manipulation",
|
"https://registry.npmjs.org"
|
||||||
"file streaming",
|
],
|
||||||
"virtual directory",
|
"accessLevel": "public"
|
||||||
"filesystem utilities",
|
|
||||||
"memory-efficient file handling",
|
|
||||||
"custom file operations",
|
|
||||||
"write files",
|
|
||||||
"read files",
|
|
||||||
"copy files",
|
|
||||||
"delete files",
|
|
||||||
"list directories",
|
|
||||||
"handle large files",
|
|
||||||
"virtual filesystems",
|
|
||||||
"buffer operations"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tsdoc": {
|
"@git.zone/tsdoc": {
|
||||||
"classes": ["SmartFile", "StreamFile"],
|
"classes": [
|
||||||
|
"SmartFile",
|
||||||
|
"StreamFile"
|
||||||
|
],
|
||||||
"descriptions": [
|
"descriptions": [
|
||||||
"the purpose of the StreamFile class is to provide a hybrid interface between streaming files and simple handling when writing and reading those files multiple times."
|
"the purpose of the StreamFile class is to provide a hybrid interface between streaming files and simple handling when writing and reading those files multiple times."
|
||||||
],
|
],
|
||||||
"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"
|
||||||
|
},
|
||||||
|
"@ship.zone/szci": {
|
||||||
|
"npmGlobalTools": []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-04-30 - 13.1.3 - fix(config)
|
||||||
|
migrate project config and harden SmartFile and StreamFile defaults for updated toolchain compatibility
|
||||||
|
|
||||||
|
- replace npmextra.json with .smartconfig.json and update package metadata for the current release tooling
|
||||||
|
- simplify the build script and align tsconfig with the newer TypeScript toolchain by enabling noImplicitAny
|
||||||
|
- initialize SmartFile properties with safe defaults and remove empty-file constructor logging
|
||||||
|
- validate StreamFile response streams and require a relative file path before writing to a directory
|
||||||
|
- update runtime and development dependencies to current major and minor versions
|
||||||
|
|
||||||
## 2025-11-29 - 13.1.0 - feat(smartfs)
|
## 2025-11-29 - 13.1.0 - feat(smartfs)
|
||||||
Integrate @push.rocks/smartfs and wire SmartFileFactory.nodeFs to return a real SmartFs instance
|
Integrate @push.rocks/smartfs and wire SmartFileFactory.nodeFs to return a real SmartFs instance
|
||||||
|
|
||||||
|
|||||||
+15
-18
@@ -8,7 +8,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --verbose --logfile --timeout 120)",
|
"test": "(tstest test/ --verbose --logfile --timeout 120)",
|
||||||
"build": "(tsbuild --web --allowimplicitany)",
|
"build": "tsbuild",
|
||||||
"buildDocs": "tsdoc"
|
"buildDocs": "tsdoc"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@@ -31,33 +31,33 @@
|
|||||||
"buffer operations",
|
"buffer operations",
|
||||||
"file content manipulation"
|
"file content manipulation"
|
||||||
],
|
],
|
||||||
"author": "Lossless GmbH <hello@lossless.com> (https://lossless.com)",
|
"author": "Task Venture Capital GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://code.foss.global/push.rocks/smartfile/issues"
|
"url": "https://code.foss.global/push.rocks/smartfile/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://code.foss.global/push.rocks/smartfile#readme",
|
"homepage": "https://code.foss.global/push.rocks/smartfile#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@push.rocks/lik": "^6.2.2",
|
"@push.rocks/lik": "^6.4.0",
|
||||||
"@push.rocks/smartdelay": "^3.0.5",
|
"@push.rocks/smartdelay": "^3.0.5",
|
||||||
"@push.rocks/smartfile-interfaces": "^1.0.7",
|
"@push.rocks/smartfile-interfaces": "^1.0.7",
|
||||||
"@push.rocks/smarthash": "^3.2.3",
|
"@push.rocks/smarthash": "^3.2.7",
|
||||||
"@push.rocks/smartjson": "^5.0.20",
|
"@push.rocks/smartjson": "^6.0.1",
|
||||||
"@push.rocks/smartmime": "^2.0.4",
|
"@push.rocks/smartmime": "^2.0.4",
|
||||||
"@push.rocks/smartpath": "^6.0.0",
|
"@push.rocks/smartpath": "^6.0.0",
|
||||||
"@push.rocks/smartpromise": "^4.2.3",
|
"@push.rocks/smartpromise": "^4.2.3",
|
||||||
"@push.rocks/smartrequest": "^4.2.1",
|
"@push.rocks/smartrequest": "^5.0.1",
|
||||||
"@push.rocks/smartstream": "^3.2.5",
|
"@push.rocks/smartstream": "^3.4.0",
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"glob": "^11.0.3",
|
"glob": "^13.0.6",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"@push.rocks/smartfs": "^1.1.0"
|
"@push.rocks/smartfs": "^1.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@git.zone/tsbuild": "^2.6.4",
|
"@git.zone/tsbuild": "^4.4.0",
|
||||||
"@git.zone/tsrun": "^1.3.3",
|
"@git.zone/tsrun": "^2.0.2",
|
||||||
"@git.zone/tstest": "^2.3.4",
|
"@git.zone/tstest": "^3.6.3",
|
||||||
"@types/node": "^22.15.21"
|
"@types/node": "^25.6.0"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
@@ -68,14 +68,11 @@
|
|||||||
"dist_ts_web/**/*",
|
"dist_ts_web/**/*",
|
||||||
"assets/**/*",
|
"assets/**/*",
|
||||||
"cli.js",
|
"cli.js",
|
||||||
"npmextra.json",
|
".smartconfig.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
],
|
],
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
],
|
],
|
||||||
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39",
|
"packageManager": "pnpm@10.28.2"
|
||||||
"pnpm": {
|
|
||||||
"overrides": {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+2628
-3872
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@push.rocks/smartfile',
|
name: '@push.rocks/smartfile',
|
||||||
version: '13.1.0',
|
version: '13.1.3',
|
||||||
description: 'High-level file representation classes (SmartFile, StreamFile, VirtualDirectory) for efficient in-memory file management in Node.js using TypeScript. Works seamlessly with @push.rocks/smartfs for filesystem operations.'
|
description: 'High-level file representation classes (SmartFile, StreamFile, VirtualDirectory) for efficient in-memory file management in Node.js using TypeScript. Works seamlessly with @push.rocks/smartfs for filesystem operations.'
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-10
@@ -23,7 +23,7 @@ export class SmartFile extends plugins.smartjson.Smartjson {
|
|||||||
* the relative path of the file
|
* the relative path of the file
|
||||||
*/
|
*/
|
||||||
@plugins.smartjson.foldDec()
|
@plugins.smartjson.foldDec()
|
||||||
public path: string;
|
public accessor path: string = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* a parsed path
|
* a parsed path
|
||||||
@@ -43,20 +43,20 @@ export class SmartFile extends plugins.smartjson.Smartjson {
|
|||||||
* the content of the file as Buffer
|
* the content of the file as Buffer
|
||||||
*/
|
*/
|
||||||
@plugins.smartjson.foldDec()
|
@plugins.smartjson.foldDec()
|
||||||
public contentBuffer: Buffer;
|
public accessor contentBuffer: Buffer = Buffer.alloc(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current working directory of the file
|
* The current working directory of the file
|
||||||
* Note:this is similar to gulp and different from native node path base
|
* Note:this is similar to gulp and different from native node path base
|
||||||
*/
|
*/
|
||||||
@plugins.smartjson.foldDec()
|
@plugins.smartjson.foldDec()
|
||||||
public base: string;
|
public accessor base: string = process.cwd();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* sync the file with disk
|
* sync the file with disk
|
||||||
*/
|
*/
|
||||||
@plugins.smartjson.foldDec()
|
@plugins.smartjson.foldDec()
|
||||||
public sync: boolean;
|
public accessor sync: boolean = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the constructor of Smartfile
|
* the constructor of Smartfile
|
||||||
@@ -64,13 +64,16 @@ export class SmartFile extends plugins.smartjson.Smartjson {
|
|||||||
* @param smartFs optional SmartFs instance for filesystem operations
|
* @param smartFs optional SmartFs instance for filesystem operations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
constructor(optionsArg: ISmartfileConstructorOptions, smartFs?: any) {
|
constructor(
|
||||||
|
optionsArg: ISmartfileConstructorOptions = {
|
||||||
|
path: '',
|
||||||
|
contentBuffer: Buffer.alloc(0),
|
||||||
|
base: process.cwd(),
|
||||||
|
},
|
||||||
|
smartFs?: any,
|
||||||
|
) {
|
||||||
super();
|
super();
|
||||||
if (optionsArg.contentBuffer) {
|
this.contentBuffer = optionsArg.contentBuffer || Buffer.alloc(0);
|
||||||
this.contentBuffer = optionsArg.contentBuffer;
|
|
||||||
} else {
|
|
||||||
console.log('created empty Smartfile?');
|
|
||||||
}
|
|
||||||
this.path = optionsArg.path;
|
this.path = optionsArg.path;
|
||||||
this.base = optionsArg.base;
|
this.base = optionsArg.base;
|
||||||
this.smartFs = smartFs;
|
this.smartFs = smartFs;
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ export class StreamFile {
|
|||||||
const response = await plugins.smartrequest.SmartRequest.create()
|
const response = await plugins.smartrequest.SmartRequest.create()
|
||||||
.url(url)
|
.url(url)
|
||||||
.get();
|
.get();
|
||||||
return response.stream();
|
const responseStream = response.stream();
|
||||||
|
if (!responseStream) {
|
||||||
|
throw new Error(`No response stream available for ${url}`);
|
||||||
|
}
|
||||||
|
return responseStream;
|
||||||
};
|
};
|
||||||
const streamFile = new StreamFile(streamSource, undefined, smartFs);
|
const streamFile = new StreamFile(streamSource, undefined, smartFs);
|
||||||
streamFile.multiUse = true;
|
streamFile.multiUse = true;
|
||||||
@@ -117,9 +121,9 @@ export class StreamFile {
|
|||||||
|
|
||||||
// enable stream based multi use
|
// enable stream based multi use
|
||||||
private cachedStreamBuffer?: Buffer;
|
private cachedStreamBuffer?: Buffer;
|
||||||
public multiUse: boolean;
|
public multiUse: boolean = false;
|
||||||
public used: boolean = false;
|
public used: boolean = false;
|
||||||
public byteLengthComputeFunction: () => Promise<number>;
|
public byteLengthComputeFunction?: () => Promise<number>;
|
||||||
|
|
||||||
private constructor(streamSource: TStreamSource, relativeFilePath?: string, smartFs?: any) {
|
private constructor(streamSource: TStreamSource, relativeFilePath?: string, smartFs?: any) {
|
||||||
this.streamSource = streamSource;
|
this.streamSource = streamSource;
|
||||||
@@ -185,6 +189,10 @@ export class StreamFile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.checkMultiUse();
|
this.checkMultiUse();
|
||||||
|
if (!this.relativeFilePath) {
|
||||||
|
throw new Error('Cannot write stream to directory without a relative file path.');
|
||||||
|
}
|
||||||
|
|
||||||
const filePath = plugins.path.join(dirPathArg, this.relativeFilePath);
|
const filePath = plugins.path.join(dirPathArg, this.relativeFilePath);
|
||||||
const dirPath = plugins.path.parse(filePath).dir;
|
const dirPath = plugins.path.parse(filePath).dir;
|
||||||
await this.smartFs.directory(dirPath).recursive().create();
|
await this.smartFs.directory(dirPath).recursive().create();
|
||||||
@@ -213,7 +221,7 @@ export class StreamFile {
|
|||||||
/**
|
/**
|
||||||
* Returns the size of the file content in bytes.
|
* Returns the size of the file content in bytes.
|
||||||
*/
|
*/
|
||||||
public async getSize(): Promise<number> {
|
public async getSize(): Promise<number | null> {
|
||||||
if (this.byteLengthComputeFunction) {
|
if (this.byteLengthComputeFunction) {
|
||||||
return this.byteLengthComputeFunction();
|
return this.byteLengthComputeFunction();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+1
-4
@@ -1,14 +1,11 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"experimentalDecorators": true,
|
|
||||||
"useDefineForClassFields": false,
|
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "NodeNext",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "NodeNext",
|
"moduleResolution": "NodeNext",
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"verbatimModuleSyntax": true,
|
"verbatimModuleSyntax": true,
|
||||||
"baseUrl": ".",
|
"noImplicitAny": true
|
||||||
"paths": {}
|
|
||||||
},
|
},
|
||||||
"exclude": ["dist_*/**/*.d.ts"]
|
"exclude": ["dist_*/**/*.d.ts"]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user