Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
403a0f4fae | |||
91ade8a4d4 | |||
1a571bba90 | |||
bcb66b2ccf | |||
0000984e4b | |||
b391e54083 |
@ -12,6 +12,9 @@ stages:
|
|||||||
- release
|
- release
|
||||||
- metadata
|
- metadata
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
- npm install -g @shipzone/npmci
|
||||||
|
|
||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
# ====================
|
# ====================
|
||||||
@ -36,6 +39,7 @@ auditProductionDependencies:
|
|||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
- npmci command npm audit --audit-level=high --only=prod --production
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
auditDevDependencies:
|
auditDevDependencies:
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@ -2,28 +2,10 @@
|
|||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
{
|
{
|
||||||
"name": "current file",
|
"command": "npm test",
|
||||||
"type": "node",
|
"name": "Run npm test",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": [
|
"type": "node-terminal"
|
||||||
"${relativeFile}"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "test.ts",
|
|
||||||
"type": "node",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [
|
|
||||||
"test/test.ts"
|
|
||||||
],
|
|
||||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
|
||||||
"cwd": "${workspaceRoot}",
|
|
||||||
"protocol": "inspector",
|
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
"githost": "gitlab.com",
|
"githost": "gitlab.com",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "pushrocks",
|
||||||
"gitrepo": "smartfile",
|
"gitrepo": "smartfile",
|
||||||
"shortDescription": "smart ways to work with files in nodejs",
|
"description": "smart ways to work with files in nodejs",
|
||||||
"npmPackagename": "@pushrocks/smartfile",
|
"npmPackagename": "@pushrocks/smartfile",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
}
|
}
|
||||||
|
5
package-lock.json
generated
5
package-lock.json
generated
@ -1,15 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartfile",
|
"name": "@pushrocks/smartfile",
|
||||||
"version": "9.0.3",
|
"version": "9.0.6",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@pushrocks/smartfile",
|
"name": "@pushrocks/smartfile",
|
||||||
"version": "9.0.3",
|
"version": "9.0.6",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^5.0.0",
|
"@pushrocks/lik": "^5.0.0",
|
||||||
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
||||||
"@pushrocks/smarthash": "^2.1.10",
|
"@pushrocks/smarthash": "^2.1.10",
|
||||||
"@pushrocks/smartjson": "^4.0.6",
|
"@pushrocks/smartjson": "^4.0.6",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartfile",
|
"name": "@pushrocks/smartfile",
|
||||||
"private": false,
|
"private": false,
|
||||||
"version": "9.0.3",
|
"version": "9.0.6",
|
||||||
"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",
|
||||||
@ -25,6 +25,7 @@
|
|||||||
"homepage": "https://gitlab.com/pushrocks/smartfile",
|
"homepage": "https://gitlab.com/pushrocks/smartfile",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/lik": "^5.0.0",
|
"@pushrocks/lik": "^5.0.0",
|
||||||
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
||||||
"@pushrocks/smarthash": "^2.1.10",
|
"@pushrocks/smarthash": "^2.1.10",
|
||||||
"@pushrocks/smartjson": "^4.0.6",
|
"@pushrocks/smartjson": "^4.0.6",
|
||||||
|
@ -213,4 +213,8 @@ tap.test('should create, store and retrieve valid smartfiles', async () => {
|
|||||||
expect(retrievedString).to.equal(fileString);
|
expect(retrievedString).to.equal(fileString);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should wait for file to be ready', async () => {
|
||||||
|
await smartfile.fs.waitForFileToBeReady('./test/testassets/mytest.json');
|
||||||
|
});
|
||||||
|
|
||||||
tap.start();
|
tap.start();
|
||||||
|
@ -6,7 +6,6 @@ import * as memoryMod from './smartfile.memory';
|
|||||||
export { Smartfile, ISmartfileConstructorOptions } from './smartfile.classes.smartfile';
|
export { Smartfile, ISmartfileConstructorOptions } from './smartfile.classes.smartfile';
|
||||||
export { VirtualDirectory } from './smartfile.classes.virtualdirectory';
|
export { VirtualDirectory } from './smartfile.classes.virtualdirectory';
|
||||||
|
|
||||||
|
|
||||||
export let fs = fsMod;
|
export let fs = fsMod;
|
||||||
export let interpreter = interpreterMod;
|
export let interpreter = interpreterMod;
|
||||||
export let memory = memoryMod;
|
export let memory = memoryMod;
|
||||||
|
@ -77,10 +77,10 @@ export class Smartfile extends plugins.smartjson.Smartjson {
|
|||||||
/**
|
/**
|
||||||
* a parsed path
|
* a parsed path
|
||||||
*/
|
*/
|
||||||
public get parsedPath (): plugins.path.ParsedPath {
|
public get parsedPath(): plugins.path.ParsedPath {
|
||||||
return plugins.path.parse(this.path);
|
return plugins.path.parse(this.path);
|
||||||
};
|
}
|
||||||
public get absolutePath () {
|
public get absolutePath() {
|
||||||
return plugins.path.join(this.base, this.path);
|
return plugins.path.join(this.base, this.path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ export class VirtualDirectory {
|
|||||||
|
|
||||||
public async toVirtualDirTransferableObject(): Promise<plugins.smartfileInterfaces.VirtualDirTransferableObject> {
|
public async toVirtualDirTransferableObject(): Promise<plugins.smartfileInterfaces.VirtualDirTransferableObject> {
|
||||||
return {
|
return {
|
||||||
files: this.smartfileArray.map(smartfileArg => smartfileArg.foldToJson())
|
files: this.smartfileArray.map((smartfileArg) => smartfileArg.foldToJson()),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,11 +377,25 @@ export const listFileTree = async (
|
|||||||
/**
|
/**
|
||||||
* checks wether a file is ready for processing
|
* checks wether a file is ready for processing
|
||||||
*/
|
*/
|
||||||
export const waitForFileToBeReady = async (filePathArg: string) => {
|
export const waitForFileToBeReady = async (filePathArg: string): Promise<void> => {
|
||||||
const limitedArray = new plugins.lik.LimitedArray<string>(3);
|
if (!plugins.path.isAbsolute(filePathArg)) {
|
||||||
if(!plugins.path.isAbsolute(filePathArg)) {
|
|
||||||
filePathArg = plugins.path.resolve(filePathArg);
|
filePathArg = plugins.path.resolve(filePathArg);
|
||||||
};
|
}
|
||||||
|
const limitedArray = new plugins.lik.LimitedArray<number>(3);
|
||||||
|
let fileReady = false;
|
||||||
|
while (!fileReady) {
|
||||||
const stats = await plugins.fsExtra.stat(filePathArg);
|
const stats = await plugins.fsExtra.stat(filePathArg);
|
||||||
stats.size
|
limitedArray.addOne(stats.size);
|
||||||
}
|
if (
|
||||||
|
limitedArray.array.length < 3 ||
|
||||||
|
!(
|
||||||
|
limitedArray.array[0] === limitedArray.array[1] &&
|
||||||
|
limitedArray.array[1] === limitedArray.array[2]
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
await plugins.smartdelay.delayFor(5000);
|
||||||
|
} else {
|
||||||
|
fileReady = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
@ -7,6 +7,7 @@ export { fs, path };
|
|||||||
// @pushrocks scope
|
// @pushrocks scope
|
||||||
import * as lik from '@pushrocks/lik';
|
import * as lik from '@pushrocks/lik';
|
||||||
import * as smartfileInterfaces from '@pushrocks/smartfile-interfaces';
|
import * as smartfileInterfaces from '@pushrocks/smartfile-interfaces';
|
||||||
|
import * as smartdelay from '@pushrocks/smartdelay';
|
||||||
import * as smarthash from '@pushrocks/smarthash';
|
import * as smarthash from '@pushrocks/smarthash';
|
||||||
import * as smartjson from '@pushrocks/smartjson';
|
import * as smartjson from '@pushrocks/smartjson';
|
||||||
import * as smartmime from '@pushrocks/smartmime';
|
import * as smartmime from '@pushrocks/smartmime';
|
||||||
@ -14,7 +15,17 @@ import * as smartpath from '@pushrocks/smartpath';
|
|||||||
import * as smartpromise from '@pushrocks/smartpromise';
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
import * as smartrequest from '@pushrocks/smartrequest';
|
import * as smartrequest from '@pushrocks/smartrequest';
|
||||||
|
|
||||||
export { lik, smartfileInterfaces, smarthash, smartjson, smartmime, smartpath, smartpromise, smartrequest };
|
export {
|
||||||
|
lik,
|
||||||
|
smartfileInterfaces,
|
||||||
|
smartdelay,
|
||||||
|
smarthash,
|
||||||
|
smartjson,
|
||||||
|
smartmime,
|
||||||
|
smartpath,
|
||||||
|
smartpromise,
|
||||||
|
smartrequest,
|
||||||
|
};
|
||||||
|
|
||||||
// third party scope
|
// third party scope
|
||||||
import * as fsExtra from 'fs-extra';
|
import * as fsExtra from 'fs-extra';
|
||||||
|
Reference in New Issue
Block a user