fix(core): update
This commit is contained in:
parent
a640ab3d7b
commit
4e2321e1ee
@ -13,8 +13,13 @@ stages:
|
||||
- metadata
|
||||
|
||||
before_script:
|
||||
- npm install -g @shipzone/npmci
|
||||
- pnpm install -g pnpm
|
||||
- pnpm install -g @shipzone/pnpm
|
||||
- npmci npm prepare
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
@ -22,23 +27,20 @@ auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --production --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=prod --production
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command pnpm audit --audit-level=high --prod
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high --only=dev
|
||||
- npmci command pnpm audit --audit-level=high --dev
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
@ -49,7 +51,6 @@ auditDevDependencies:
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
@ -60,7 +61,6 @@ testStable:
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
@ -111,8 +111,7 @@ trigger:
|
||||
pages:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run buildDocs
|
||||
tags:
|
||||
|
14590
package-lock.json
generated
14590
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
15
package.json
15
package.json
@ -30,27 +30,26 @@
|
||||
"@pushrocks/smartdelay": "^2.0.13",
|
||||
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
||||
"@pushrocks/smarthash": "^3.0.1",
|
||||
"@pushrocks/smartjson": "^5.0.1",
|
||||
"@pushrocks/smartjson": "^5.0.5",
|
||||
"@pushrocks/smartmime": "^1.0.5",
|
||||
"@pushrocks/smartpath": "^5.0.5",
|
||||
"@pushrocks/smartpromise": "^3.1.6",
|
||||
"@pushrocks/smartrequest": "^2.0.11",
|
||||
"@pushrocks/smartstream": "^2.0.3",
|
||||
"@pushrocks/streamfunction": "^4.0.4",
|
||||
"@types/fs-extra": "^9.0.13",
|
||||
"@types/fs-extra": "^11.0.0",
|
||||
"@types/glob": "^8.0.0",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"fs-extra": "^10.1.0",
|
||||
"fs-extra": "^11.1.0",
|
||||
"glob": "^8.0.3",
|
||||
"js-yaml": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.65",
|
||||
"@gitzone/tsrun": "^1.2.37",
|
||||
"@gitzone/tstest": "^1.0.73",
|
||||
"@gitzone/tsrun": "^1.2.39",
|
||||
"@gitzone/tstest": "^1.0.74",
|
||||
"@pushrocks/tapbundle": "^5.0.4",
|
||||
"@types/node": "^18.7.14",
|
||||
"gulp-function": "^2.2.14"
|
||||
"@types/node": "^18.11.18"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
@ -67,4 +66,4 @@
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
]
|
||||
}
|
||||
}
|
4396
pnpm-lock.yaml
generated
Normal file
4396
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -209,6 +209,14 @@ tap.test('should create, store and retrieve valid smartfiles', async () => {
|
||||
expect(retrievedString).toEqual(fileString);
|
||||
});
|
||||
|
||||
tap.test('should get a hash', async () => {
|
||||
const fileString = 'hi there';
|
||||
const filePath = './test/testassets/utf8.txt';
|
||||
const smartfileInstance = await smartfile.Smartfile.fromString(filePath, fileString, 'utf8');
|
||||
const hash = await smartfileInstance.getHash();
|
||||
console.log(hash);
|
||||
});
|
||||
|
||||
tap.test('should wait for file to be ready', async () => {
|
||||
await smartfile.fs.waitForFileToBeReady('./test/testassets/mytest.json');
|
||||
});
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartfile',
|
||||
version: '10.0.5',
|
||||
version: '10.0.6',
|
||||
description: 'offers smart ways to work with files in nodejs'
|
||||
}
|
||||
|
@ -237,6 +237,21 @@ export class Smartfile extends plugins.smartjson.Smartjson {
|
||||
return false;
|
||||
}
|
||||
|
||||
public async getHash(typeArg: 'path' | 'content' | 'all' = 'all') {
|
||||
const pathHash = await plugins.smarthash.sha256FromString(this.path);
|
||||
const contentHash = await plugins.smarthash.sha256FromBuffer(this.contentBuffer);
|
||||
const combinedHash = await plugins.smarthash.sha256FromString(pathHash + contentHash);
|
||||
switch(typeArg) {
|
||||
case 'path':
|
||||
return pathHash;
|
||||
case 'content':
|
||||
return contentHash;
|
||||
case 'all':
|
||||
default:
|
||||
return combinedHash;
|
||||
}
|
||||
}
|
||||
|
||||
// update things
|
||||
public updateFileName(fileNameArg: string) {
|
||||
const oldFileName = this.parsedPath.base;
|
||||
|
@ -214,7 +214,7 @@ export const fileTreeToHash = async (dirPathArg: string, miniMatchFilter: string
|
||||
const fileTreeObject = await fileTreeToObject(dirPathArg, miniMatchFilter);
|
||||
let combinedString = '';
|
||||
for (const smartfile of fileTreeObject) {
|
||||
combinedString += smartfile.contentBuffer.toString();
|
||||
combinedString += await smartfile.getHash();
|
||||
}
|
||||
const hash = await plugins.smarthash.sha256FromString(combinedString);
|
||||
return hash;
|
||||
|
Loading…
Reference in New Issue
Block a user