fix(core): update
This commit is contained in:
parent
a640ab3d7b
commit
4e2321e1ee
@ -13,8 +13,13 @@ stages:
|
|||||||
- metadata
|
- metadata
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- npm install -g @shipzone/npmci
|
- pnpm install -g pnpm
|
||||||
|
- pnpm install -g @shipzone/pnpm
|
||||||
|
- npmci npm prepare
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# security stage
|
||||||
|
# ====================
|
||||||
# ====================
|
# ====================
|
||||||
# security stage
|
# security stage
|
||||||
# ====================
|
# ====================
|
||||||
@ -22,23 +27,20 @@ auditProductionDependencies:
|
|||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
- npmci command npm config set registry https://registry.npmjs.org
|
||||||
- npmci command npm install --production --ignore-scripts
|
- npmci command pnpm audit --audit-level=high --prod
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
|
||||||
tags:
|
tags:
|
||||||
|
- lossless
|
||||||
- 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
|
||||||
stage: security
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
- 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:
|
tags:
|
||||||
|
- lossless
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
allow_failure: true
|
||||||
|
|
||||||
@ -49,7 +51,6 @@ auditDevDependencies:
|
|||||||
testStable:
|
testStable:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci npm test
|
- npmci npm test
|
||||||
@ -60,7 +61,6 @@ testStable:
|
|||||||
testBuild:
|
testBuild:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci npm prepare
|
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command npm run build
|
- npmci command npm run build
|
||||||
@ -111,8 +111,7 @@ trigger:
|
|||||||
pages:
|
pages:
|
||||||
stage: metadata
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci node install stable
|
- npmci node install stable
|
||||||
- npmci npm prepare
|
|
||||||
- npmci npm install
|
- npmci npm install
|
||||||
- npmci command npm run buildDocs
|
- npmci command npm run buildDocs
|
||||||
tags:
|
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/smartdelay": "^2.0.13",
|
||||||
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
"@pushrocks/smartfile-interfaces": "^1.0.7",
|
||||||
"@pushrocks/smarthash": "^3.0.1",
|
"@pushrocks/smarthash": "^3.0.1",
|
||||||
"@pushrocks/smartjson": "^5.0.1",
|
"@pushrocks/smartjson": "^5.0.5",
|
||||||
"@pushrocks/smartmime": "^1.0.5",
|
"@pushrocks/smartmime": "^1.0.5",
|
||||||
"@pushrocks/smartpath": "^5.0.5",
|
"@pushrocks/smartpath": "^5.0.5",
|
||||||
"@pushrocks/smartpromise": "^3.1.6",
|
"@pushrocks/smartpromise": "^3.1.6",
|
||||||
"@pushrocks/smartrequest": "^2.0.11",
|
"@pushrocks/smartrequest": "^2.0.11",
|
||||||
"@pushrocks/smartstream": "^2.0.3",
|
"@pushrocks/smartstream": "^2.0.3",
|
||||||
"@pushrocks/streamfunction": "^4.0.4",
|
"@pushrocks/streamfunction": "^4.0.4",
|
||||||
"@types/fs-extra": "^9.0.13",
|
"@types/fs-extra": "^11.0.0",
|
||||||
"@types/glob": "^8.0.0",
|
"@types/glob": "^8.0.0",
|
||||||
"@types/js-yaml": "^4.0.5",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^11.1.0",
|
||||||
"glob": "^8.0.3",
|
"glob": "^8.0.3",
|
||||||
"js-yaml": "^4.1.0"
|
"js-yaml": "^4.1.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.65",
|
"@gitzone/tsbuild": "^2.1.65",
|
||||||
"@gitzone/tsrun": "^1.2.37",
|
"@gitzone/tsrun": "^1.2.39",
|
||||||
"@gitzone/tstest": "^1.0.73",
|
"@gitzone/tstest": "^1.0.74",
|
||||||
"@pushrocks/tapbundle": "^5.0.4",
|
"@pushrocks/tapbundle": "^5.0.4",
|
||||||
"@types/node": "^18.7.14",
|
"@types/node": "^18.11.18"
|
||||||
"gulp-function": "^2.2.14"
|
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
@ -67,4 +66,4 @@
|
|||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"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);
|
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 () => {
|
tap.test('should wait for file to be ready', async () => {
|
||||||
await smartfile.fs.waitForFileToBeReady('./test/testassets/mytest.json');
|
await smartfile.fs.waitForFileToBeReady('./test/testassets/mytest.json');
|
||||||
});
|
});
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/smartfile',
|
name: '@pushrocks/smartfile',
|
||||||
version: '10.0.5',
|
version: '10.0.6',
|
||||||
description: 'offers smart ways to work with files in nodejs'
|
description: 'offers smart ways to work with files in nodejs'
|
||||||
}
|
}
|
||||||
|
@ -237,6 +237,21 @@ export class Smartfile extends plugins.smartjson.Smartjson {
|
|||||||
return false;
|
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
|
// update things
|
||||||
public updateFileName(fileNameArg: string) {
|
public updateFileName(fileNameArg: string) {
|
||||||
const oldFileName = this.parsedPath.base;
|
const oldFileName = this.parsedPath.base;
|
||||||
|
@ -214,7 +214,7 @@ export const fileTreeToHash = async (dirPathArg: string, miniMatchFilter: string
|
|||||||
const fileTreeObject = await fileTreeToObject(dirPathArg, miniMatchFilter);
|
const fileTreeObject = await fileTreeToObject(dirPathArg, miniMatchFilter);
|
||||||
let combinedString = '';
|
let combinedString = '';
|
||||||
for (const smartfile of fileTreeObject) {
|
for (const smartfile of fileTreeObject) {
|
||||||
combinedString += smartfile.contentBuffer.toString();
|
combinedString += await smartfile.getHash();
|
||||||
}
|
}
|
||||||
const hash = await plugins.smarthash.sha256FromString(combinedString);
|
const hash = await plugins.smarthash.sha256FromString(combinedString);
|
||||||
return hash;
|
return hash;
|
||||||
|
Loading…
Reference in New Issue
Block a user