diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a4e6a29d..171c6ac2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,9 +14,9 @@ jobs: node-version: "16.x" - run: npm install - - name: get-npm-version - id: package-version - uses: martinbeentjes/npm-get-version-action@master + - name: get-package-details + id: package + uses: codex-team/action-nodejs-package-info@v1.1 - name: install npm packall run: npm install npm-pack-all @@ -45,6 +45,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./datasync-filesystem-sdk-${{ steps.package-version.outputs.current-version }}.tgz - asset_name: datasync-filesystem-sdk-${{ steps.package-version.outputs.current-version }}.tgz + asset_path: ./${{ steps.package.outputs.name }}-${{ steps.package.outputs.version }}.tgz + asset_name: ${{ steps.package.outputs.name }}-${{ steps.package.outputs.version }}.tgz asset_content_type: application/tgz \ No newline at end of file diff --git a/docs/scripts/prettify/lang-css.js b/docs/scripts/prettify/lang-css.js index 041e1f59..b5ed1407 100644 --- a/docs/scripts/prettify/lang-css.js +++ b/docs/scripts/prettify/lang-css.js @@ -1,2 +1,2 @@ PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", -/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); +/^(?:<\!--|(--\>|--\!>))/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/package-lock.json b/package-lock.json index b65713d0..23af300c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "datasync-filesystem-sdk", - "version": "1.0.6", + "version": "1.0.7", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "datasync-filesystem-sdk", - "version": "1.0.6", + "version": "1.0.7", "license": "MIT", "dependencies": { "json-mask": "0.3.8", diff --git a/package.json b/package.json index 465c4aaa..6fd2cbf8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasync-filesystem-sdk", - "version": "1.0.6", + "version": "1.0.8", "description": "JavaScript filesystem SDK to query data synced via @contentstack/datasync-content-store-filesystem", "main": "dist/index.js", "scripts": { diff --git a/src/fs.ts b/src/fs.ts index 2dd263b8..ce72dfd1 100644 --- a/src/fs.ts +++ b/src/fs.ts @@ -15,11 +15,11 @@ import { const promisifiedReadFile = promisify(rf) -export const readFile = async (path: string, type: string = 'utf-8') => { +export const readFile = async (path: string) => { if (existsSync(path)) { - const contents: string = await promisifiedReadFile(path, type) + const contents: Buffer = await promisifiedReadFile(path) - return JSON.parse(contents) + return JSON.parse(contents.toString()) } return [] diff --git a/src/stack.ts b/src/stack.ts index 4ecf40bb..591152dc 100755 --- a/src/stack.ts +++ b/src/stack.ts @@ -1279,7 +1279,7 @@ export class Stack { if (this.q.only) { const only = this.q.only.toString().replace(/\./g, '/') data = mask(data, only) - } else if (this.q.except) { + } else if (this.q.except.length) { const bukcet = this.q.except.toString().replace(/\./g, '/') const except = mask(data, bukcet) data = difference(data, except) @@ -1441,15 +1441,17 @@ export class Stack { for (let i = 0, j = currentInclude.length; i < j; i++) { const includePath = currentInclude[i] - // tslint:disable-next-line: forin for (const path in entryReferences) { - const subStrArr = includePath.split('.'); - if ((subStrArr.length && subStrArr[0] === path) || includePath === path) { + if (path.length > includePath.length) { + continue; + } + const subStr = includePath.slice(0, path.length); + if (subStr === path && (includePath[path.length] === '.' || includePath === subStr)) { let subPath // Its the complete path!! Hurrah! if (path.length !== includePath.length) { - subPath = subStrArr[0] + subPath = subStr pendingPath.push(includePath.slice(path.length + 1)) } else { subPath = includePath diff --git a/typings/fs.d.ts b/typings/fs.d.ts index 293f6e98..af3b108c 100644 --- a/typings/fs.d.ts +++ b/typings/fs.d.ts @@ -4,5 +4,5 @@ * Copyright (c) Contentstack LLC * MIT Licensed */ -export declare const readFile: (path: string, type?: string) => Promise; +export declare const readFile: (path: string) => Promise; export { existsSync, } from 'fs'; diff --git a/typings/utils.d.ts b/typings/utils.d.ts index 99c18520..f67aed4a 100644 --- a/typings/utils.d.ts +++ b/typings/utils.d.ts @@ -4,7 +4,7 @@ * Copyright (c) Contentstack LLC * MIT Licensed */ -export declare const difference: (obj: any, baseObj: any) => unknown[]; +export declare const difference: (obj: any, baseObj: any) => unknown; export declare const getBaseDir: ({ baseDir }: { baseDir: any; }) => {