Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
7b3194cc13 | |||
e1e821efec | |||
6b613d1b8a | |||
70f1c58a82 | |||
5df76ca94b | |||
32cfda3c90 | |||
dd521398ea | |||
038e6cc33d | |||
2fc37d6892 | |||
3c1eb1ab70 | |||
5296e8859b |
@ -101,17 +101,10 @@ jobs:
|
|||||||
- name: Trigger
|
- name: Trigger
|
||||||
run: npmci trigger
|
run: npmci trigger
|
||||||
|
|
||||||
- name: Build docs and upload artifacts
|
- name: Build docs
|
||||||
run: |
|
run: |
|
||||||
npmci node install stable
|
npmci node install stable
|
||||||
npmci npm install
|
npmci npm install
|
||||||
pnpm install -g @gitzone/tsdoc
|
pnpm install -g @gitzone/tsdoc
|
||||||
npmci command tsdoc
|
npmci command tsdoc
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
|
||||||
- name: Upload artifacts
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: public
|
|
||||||
path: public
|
|
||||||
retention-days: 7
|
|
||||||
|
@ -8,10 +8,10 @@
|
|||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "smartfile",
|
"gitrepo": "smartfile",
|
||||||
"description": "smart ways to work with files in nodejs",
|
"description": "smart ways to work with files in nodejs",
|
||||||
"npmPackagename": "@pushrocks/smartfile",
|
"npmPackagename": "@push.rocks/smartfile",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
29
package.json
29
package.json
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartfile",
|
"name": "@push.rocks/smartfile",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "10.0.24",
|
"version": "10.0.29",
|
||||||
"description": "offers smart ways to work with files in nodejs",
|
"description": "offers smart ways to work with files in nodejs",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
@ -26,22 +26,21 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartfile",
|
"homepage": "https://gitlab.com/pushrocks/smartfile",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^6.0.2",
|
"@push.rocks/lik": "^6.0.2",
|
||||||
"@pushrocks/smartdelay": "^3.0.1",
|
"@push.rocks/smartdelay": "^3.0.1",
|
||||||
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
"@push.rocks/smartfile-interfaces": "^1.0.7",
|
||||||
"@pushrocks/smarthash": "^3.0.2",
|
"@push.rocks/smarthash": "^3.0.2",
|
||||||
"@pushrocks/smartjson": "^5.0.6",
|
"@push.rocks/smartjson": "^5.0.6",
|
||||||
"@pushrocks/smartmime": "^1.0.5",
|
"@push.rocks/smartmime": "^1.0.5",
|
||||||
"@pushrocks/smartpath": "^5.0.5",
|
"@push.rocks/smartpath": "^5.0.5",
|
||||||
"@pushrocks/smartpromise": "^4.0.2",
|
"@push.rocks/smartpromise": "^4.0.2",
|
||||||
"@pushrocks/smartrequest": "^2.0.15",
|
"@push.rocks/smartrequest": "^2.0.15",
|
||||||
"@pushrocks/smartstream": "^2.0.3",
|
"@push.rocks/smartstream": "^2.0.3",
|
||||||
"@pushrocks/streamfunction": "^4.0.4",
|
|
||||||
"@types/fs-extra": "^11.0.1",
|
"@types/fs-extra": "^11.0.1",
|
||||||
"@types/glob": "^8.1.0",
|
"@types/glob": "^8.1.0",
|
||||||
"@types/js-yaml": "^4.0.5",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"fs-extra": "^11.1.1",
|
"fs-extra": "^11.1.1",
|
||||||
"glob": "^10.3.0",
|
"glob": "^10.3.3",
|
||||||
"js-yaml": "^4.1.0"
|
"js-yaml": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -49,7 +48,7 @@
|
|||||||
"@gitzone/tsrun": "^1.2.42",
|
"@gitzone/tsrun": "^1.2.42",
|
||||||
"@gitzone/tstest": "^1.0.74",
|
"@gitzone/tstest": "^1.0.74",
|
||||||
"@pushrocks/tapbundle": "^5.0.8",
|
"@pushrocks/tapbundle": "^5.0.8",
|
||||||
"@types/node": "^20.3.1"
|
"@types/node": "^20.4.1"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
547
pnpm-lock.yaml
generated
547
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -2,7 +2,7 @@
|
|||||||
* autocreated commitinfo by @pushrocks/commitinfo
|
* autocreated commitinfo by @pushrocks/commitinfo
|
||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/smartfile',
|
name: '@push.rocks/smartfile',
|
||||||
version: '10.0.24',
|
version: '10.0.29',
|
||||||
description: 'offers smart ways to work with files in nodejs'
|
description: 'offers smart ways to work with files in nodejs'
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ export class VirtualDirectory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async saveToDisk(dirArg: string) {
|
public async saveToDisk(dirArg: string) {
|
||||||
console.log(`writing VirtualDirectory with ${this.smartfileArray.length} to directory:
|
console.log(`writing VirtualDirectory with ${this.smartfileArray.length} files to directory:
|
||||||
--> ${dirArg}`);
|
--> ${dirArg}`);
|
||||||
for (const smartfileArg of this.smartfileArray) {
|
for (const smartfileArg of this.smartfileArray) {
|
||||||
const filePath = await smartfileArg.writeToDir(dirArg);
|
const filePath = await smartfileArg.writeToDir(dirArg);
|
||||||
@ -56,6 +56,22 @@ export class VirtualDirectory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO implement root shifting to get subdirectories as new virtual directories
|
public async shiftToSubdirectory(subDir: string): Promise<VirtualDirectory> {
|
||||||
// TODO implement root shifting to combine VirtualDirecotries in a parent virtual directory
|
const newVirtualDir = new VirtualDirectory();
|
||||||
|
for (const file of this.smartfileArray) {
|
||||||
|
if (file.path.startsWith(subDir)) {
|
||||||
|
const adjustedFilePath = plugins.path.relative(subDir, file.path);
|
||||||
|
file.path = adjustedFilePath;
|
||||||
|
newVirtualDir.addSmartfiles([file]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newVirtualDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async addVirtualDirectory(virtualDir: VirtualDirectory, newRoot: string): Promise<void> {
|
||||||
|
for (const file of virtualDir.smartfileArray) {
|
||||||
|
file.path = plugins.path.join(newRoot, file.path);
|
||||||
|
}
|
||||||
|
this.addSmartfiles(virtualDir.smartfileArray);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,4 +11,29 @@ export const createWriteStream = (pathArg: string) => {
|
|||||||
return plugins.fs.createWriteStream(pathArg);
|
return plugins.fs.createWriteStream(pathArg);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const streamDirectory = async (dirPathArg: string) => {};
|
export const processFile = async (
|
||||||
|
filePath: string,
|
||||||
|
asyncFunc: (fileStream: plugins.stream.Readable) => Promise<void>
|
||||||
|
): Promise<void> => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const fileStream = createReadStream(filePath);
|
||||||
|
asyncFunc(fileStream).then(resolve).catch(reject);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export const processDirectory = async (
|
||||||
|
directoryPath: string,
|
||||||
|
asyncFunc: (fileStream: plugins.stream.Readable) => Promise<void>
|
||||||
|
): Promise<void> => {
|
||||||
|
const files = plugins.fs.readdirSync(directoryPath, { withFileTypes: true });
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
const fullPath = plugins.path.join(directoryPath, file.name);
|
||||||
|
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
await processDirectory(fullPath, asyncFunc); // Recursively call processDirectory for directories
|
||||||
|
} else if (file.isFile()) {
|
||||||
|
await processFile(fullPath, asyncFunc); // Call async function with the file stream and wait for it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
// node native scope
|
// node native scope
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
import * as stream from 'stream';
|
||||||
|
|
||||||
export { fs, path };
|
export { fs, path, stream };
|
||||||
|
|
||||||
// @pushrocks scope
|
// @pushrocks scope
|
||||||
import * as lik from '@pushrocks/lik';
|
import * as lik from '@push.rocks/lik';
|
||||||
import * as smartfileInterfaces from '@pushrocks/smartfile-interfaces';
|
import * as smartfileInterfaces from '@push.rocks/smartfile-interfaces';
|
||||||
import * as smartdelay from '@pushrocks/smartdelay';
|
import * as smartdelay from '@push.rocks/smartdelay';
|
||||||
import * as smarthash from '@pushrocks/smarthash';
|
import * as smarthash from '@push.rocks/smarthash';
|
||||||
import * as smartjson from '@pushrocks/smartjson';
|
import * as smartjson from '@push.rocks/smartjson';
|
||||||
import * as smartmime from '@pushrocks/smartmime';
|
import * as smartmime from '@push.rocks/smartmime';
|
||||||
import * as smartpath from '@pushrocks/smartpath';
|
import * as smartpath from '@push.rocks/smartpath';
|
||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@push.rocks/smartpromise';
|
||||||
import * as smartrequest from '@pushrocks/smartrequest';
|
import * as smartrequest from '@push.rocks/smartrequest';
|
||||||
import * as smartstream from '@pushrocks/smartstream';
|
import * as smartstream from '@push.rocks/smartstream';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
lik,
|
lik,
|
||||||
|
Reference in New Issue
Block a user