Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Belphemur committed Jan 23, 2025
2 parents 122391d + e7ec3c3 commit 3503ac9
Show file tree
Hide file tree
Showing 14 changed files with 5,120 additions and 5,907 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@
"contributions": [
"code"
]
},
{
"login": "antonytrupe",
"name": "Tony Trupe",
"avatar_url": "https://avatars.githubusercontent.com/u/182436?v=4",
"profile": "http://www.antonytrupe.com",
"contributions": [
"test"
]
}
],
"contributorsPerLine": 7,
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -50,7 +50,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -64,4 +64,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
85 changes: 31 additions & 54 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,73 +19,56 @@ jobs:
node: ['lts/-1', 'lts/*', 'current' ]
steps:
- uses: actions/checkout@v4
- name: Set yarn cache
run: yarn config set cache-folder ${{env.YARN_CACHE}}
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: yarn
- name: Enable pnpm
run: corepack enable pnpm
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
path: ${{env.YARN_CACHE}}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Setup Node.js ${{ matrix.node }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
node-version: ${{ matrix.node }}
cache: 'pnpm'
- name: Install dependencies
run: yarn install --frozen-lockfile --ignore-engines
run: corepack pnpm install
- name: Run tests
run: yarn test
run: corepack pnpm run test
- name: Upload code coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true # optional (default = false)
ci-cd-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set yarn cache
run: yarn config set cache-folder ${{env.YARN_CACHE}}
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: yarn
with:
path: ${{env.YARN_CACHE}}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Enable pnpm
run: corepack enable pnpm
- name: Setup Node.js ${{env.NODEJS}}
uses: actions/setup-node@v3.8.1
uses: actions/setup-node@v4
with:
node-version: ${{env.NODEJS}}
cache: 'pnpm'
- name: Install dependencies
run: yarn install --frozen-lockfile
run: corepack pnpm install
- name: Run semantic-release
run: yarn semantic-release --dry-run
run: corepack pnpm semantic-release --dry-run
deploy-pages:
needs: build
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set yarn cache
run: yarn config set cache-folder ${{env.YARN_CACHE}}
- name: Setup Node.js
uses: actions/setup-node@v3.8.1
- name: Enable pnpm
run: corepack enable pnpm
- name: Use Node.js ${{env.NODEJS}}
uses: actions/setup-node@v4
with:
node-version: ${{env.NODEJS}}
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: yarn
with:
path: ${{env.YARN_CACHE}}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
cache: 'pnpm'
- name: Install semantic-release dependencies
run: yarn install --frozen-lockfile
run: corepack pnpm install
- name: Build package
run: yarn build:doc
run: corepack pnpm run build:doc
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action@v4.4.3
uses: JamesIves/github-pages-deploy-action@v4.7.2
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs # The folder the action should deploy.
Expand All @@ -96,23 +79,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set yarn cache
run: yarn config set cache-folder ${{env.YARN_CACHE}}
- name: Enable pnpm
run: corepack enable pnpm
- name: Setup Node.js
uses: actions/setup-node@v3.8.1
uses: actions/setup-node@v4
with:
node-version: ${{env.NODEJS}}
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: yarn
with:
path: ${{env.YARN_CACHE}}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
cache: 'pnpm'
- name: Install semantic-release dependencies
run: yarn install --frozen-lockfile
run: corepack pnpm install --frozen-lockfile
- name: Build package
run: yarn build
run: corepack pnpm run build
- name: Release
run: yarn semantic-release
run: corepack pnpm run semantic-release

39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ let numberOfElements = await db.count("/arraytest/list");
```javascript

// You can have the current index of an object
await db.push("/arraytest/myarray", {id: 65464646155, name: "test"}, true);
await db.push("/arraytest/myarray", [{id: 65464646155, name: "test"}], true);
await db.getIndex("/arraytest/myarray", 65464646155);
// The default property is 'id'
// You can add another property instead
Expand Down Expand Up @@ -278,6 +278,40 @@ await db.push("/arraytest/myarray",
await db.getData("/arraytest/myarray[0][0]");

```

#### Getting Item path in Array by id or Another key

```javascript

await db.push("/myarray",
[
{
id: '1',
obj: 'test'
},
{
id: '2',
obj: 'hello'
},
{
id: '3',
obj: 'hello',
children:[
{
id: '1',
desc: 'a sub item'
}
]
},
]
, true);

// You can easily get the path of any nested array and its child object by a property using the route style syntax, the default is the object's "id" property

const itemPath = db.fromPath("/myarray/3/children/1");

```

### Exception/Error
#### Type

Expand Down Expand Up @@ -326,6 +360,9 @@ await db.getData("/arraytest/myarray[0][0]");
<td align="center" valign="top" width="14.28%"><a href="https://github.com/michalfedyna"><img src="https://avatars.githubusercontent.com/u/84079005?v=4?s=100" width="100px;" alt="Michał Fedyna"/><br /><sub><b>Michał Fedyna</b></sub></a><br /><a href="https://github.com/Belphemur/node-json-db/commits?author=michalfedyna" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/alexsad"><img src="https://avatars.githubusercontent.com/u/2659613?v=4?s=100" width="100px;" alt="alex.query"/><br /><sub><b>alex.query</b></sub></a><br /><a href="https://github.com/Belphemur/node-json-db/commits?author=alexsad" title="Code">💻</a></td>
</tr>
<tr>
<td align="center" valign="top" width="14.28%"><a href="http://www.antonytrupe.com"><img src="https://avatars.githubusercontent.com/u/182436?v=4?s=100" width="100px;" alt="Tony Trupe"/><br /><sub><b>Tony Trupe</b></sub></a><br /><a href="https://github.com/Belphemur/node-json-db/commits?author=antonytrupe" title="Tests">⚠️</a></td>
</tr>
</tbody>
</table>

Expand Down
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
coverageProvider: "v8",
globals: {
"ts-jest": {
transform: {
'^.+\\.tsx?$': ['ts-jest', {
isolatedModules: true,
useESM: true
},
}],
},
};
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,23 @@
"@semantic-release/changelog": "^6.0.0",
"@semantic-release/git": "^10.0.0",
"@types/jest": "^29.5.0",
"@types/node": "^20.1.0",
"@types/node": "^22.0.0",
"@types/rwlock": "^5.0.3",
"@types/safe-regex": "^1.1.2",
"husky": "^8.0.0",
"husky": "^9.0.1",
"jest": "^29.5.0",
"last-release-git": "^0.0.3",
"safe-regex": "~2.1.1",
"semantic-release": "^22.0.0",
"semantic-release": "^24.0.0",
"ts-jest": "^29.1.0",
"typedoc": "^0.25.0",
"typedoc": "^0.27.0",
"typescript": "^5.0.4",
"validate-commit-msg": "^2.14.0"
},
"husky": {
"hooks": {
"commit-msg": "validate-commit-msg"
}
}
},
"packageManager": "[email protected]+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0"
}
Loading

0 comments on commit 3503ac9

Please sign in to comment.