Skip to content

Commit 30c029a

Browse files
authored
chore: update packages (#28)
* chore: update packages * chore: format files * chore: fix typo in README * chore: disable no explicit any rule * refactor: types * chore: update workflow * chore: update workflow * chore: update README * 0.2.0 * chore: update package-lock.json * chore: add release.yml * chore: add security badge
1 parent 85a8e69 commit 30c029a

12 files changed

+4070
-4199
lines changed

.eslintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
{ "code": 100, "tabWidth": 2, "ignoreComments": true, "ignoreTrailingComments": true }
1717
],
1818
"quotes": ["error", "single"],
19-
"expect-type/expect": ["error", { "disableExpectTypeSnapshotFix": false }]
19+
"expect-type/expect": ["error", { "disableExpectTypeSnapshotFix": false }],
20+
"@typescript-eslint/no-explicit-any": "off"
2021
}
2122
}

.github/workflows/main.yml

+12-19
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: main
33
on:
44
push:
55
branches:
6-
- 'main'
6+
- main
77
pull_request:
88
types:
99
- opened
@@ -14,37 +14,33 @@ jobs:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- name: Checkout Repo
17-
uses: actions/checkout@v2
17+
uses: actions/checkout@v4
1818

1919
- name: Install dependencies
20-
uses: bahmutov/npm-install@v1
21-
with:
22-
useLockFile: false
20+
run: npm ci
2321

2422
- name: Run ESLint
25-
run: npx eslint . --ext .ts
23+
run: npm run lint
2624

2725
test:
2826
strategy:
2927
fail-fast: false
3028
matrix:
3129
os: [ubuntu-latest, macos-latest, windows-latest]
32-
node: [10, 12, 14, 15]
30+
node: [16, 18, 20]
3331

3432
runs-on: ${{ matrix.os }}
3533
steps:
3634
- name: Checkout repo
37-
uses: actions/checkout@v2
35+
uses: actions/checkout@v4
3836

3937
- name: Setup node
40-
uses: actions/setup-node@v1
38+
uses: actions/setup-node@v3
4139
with:
4240
node-version: ${{ matrix.node }}
4341

4442
- name: Install dependencies
45-
uses: bahmutov/npm-install@v1
46-
with:
47-
useLockFile: false
43+
run: npm ci
4844

4945
- name: Run tests
5046
run: npm t
@@ -55,22 +51,19 @@ jobs:
5551
runs-on: ubuntu-latest
5652
steps:
5753
- name: Checkout repo
58-
uses: actions/checkout@v2
54+
uses: actions/checkout@v4
5955

6056
- name: Setup node
61-
uses: actions/setup-node@v1
57+
uses: actions/setup-node@v3
6258
with:
63-
node-version: 12
59+
node-version: 18
6460

6561
- name: Install dependencies
66-
uses: bahmutov/npm-install@v1
67-
with:
68-
useLockFile: false
62+
run: npm ci
6963

7064
- name: Codeclimate Test Coverage
7165
uses: paambaati/[email protected]
7266
env:
7367
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
7468
with:
7569
coverageCommand: npm run test:coverage
76-
debug: true

.github/workflows/release.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Publish Package to npmjs
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
11+
- uses: actions/setup-node@v3
12+
with:
13+
node-version: 18
14+
15+
- run: npm ci
16+
17+
- run: npm publish --access public
18+
env:
19+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.prettierignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.snap.json
2+
package-lock.json

README.md

+29-31
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# 🧠 🔒 Haf 🦺 ✏️
22

3+
[![npm version](https://img.shields.io/npm/v/@batuhanw/haf.svg)](https://www.npmjs.com/package/@batuhanw/haf)
34
![CI](https://github.com/BatuhanW/haf/workflows/main/badge.svg)
5+
[![Known Vulnerabilities](https://snyk.io/test/github/BatuhanW/haf/badge.svg?targetFile=package.json)](https://snyk.io/test/github/BatuhanW/haf?targetFile=package.json)
46
[![Maintainability](https://api.codeclimate.com/v1/badges/4315aa36678fe4181b77/maintainability)](https://codeclimate.com/github/BatuhanW/haf/maintainability)
57
[![Test Coverage](https://api.codeclimate.com/v1/badges/4315aa36678fe4181b77/test_coverage)](https://codeclimate.com/github/BatuhanW/haf/test_coverage)
6-
[![Dependencies](https://status.david-dm.org/gh/batuhanw/haf.svg)](https://status.david-dm.org/gh/batuhanw/haf)
7-
[![Dev Dependencies](https://status.david-dm.org/gh/batuhanw/haf.svg?type=dev)](https://status.david-dm.org/gh/batuhanw/haf)
88

99
Haf is a fully typed 🔒, cross-platform, persistent 💾 config ⚙️ solution for your NodeJS projects with a great developer experience!
1010

@@ -50,32 +50,30 @@ interface DogSchema {
5050
### 2. Initiate Haf
5151

5252
```typescript
53-
import Haf from '@batuhanw/haf'
54-
55-
const haf = new Haf<DogSchema>(
56-
{
57-
name: 'myDog',
58-
defaultSchema: {
59-
name: 'Pop',
60-
age: 2,
61-
toys: ['socks', 'toilet paper'],
62-
vaccines: [
63-
{ name: 'rabbies', date: '2020-01-01' },
64-
{ name: 'parasite', date: '2020-01-01', next: '2020-01-03' },
65-
],
66-
appearance: {
67-
eyeColor: 'brown',
68-
hairColor: {
69-
primary: 'white',
70-
secondary: undefined,
71-
otherColors: ['black'],
72-
},
53+
import Haf from '@batuhanw/haf';
54+
55+
const haf = new Haf<DogSchema>({
56+
name: 'myDog',
57+
defaultSchema: {
58+
name: 'Pop',
59+
age: 2,
60+
toys: ['socks', 'toilet paper'],
61+
vaccines: [
62+
{ name: 'rabbies', date: '2020-01-01' },
63+
{ name: 'parasite', date: '2020-01-01', nextDate: '2020-01-03' },
64+
],
65+
appearance: {
66+
eyeColor: 'brown',
67+
hairColor: {
68+
primary: 'white',
69+
secondary: undefined,
70+
otherColors: ['black'],
7371
},
74-
sterilizedAt: undefined,
75-
hasPuppies: false,
76-
}
77-
}
78-
)
72+
},
73+
sterilizedAt: undefined,
74+
hasPuppies: false,
75+
},
76+
});
7977
```
8078

8179
### 3. Enjoy
@@ -100,7 +98,7 @@ haf.set('name', 'Pop');
10098
haf.set('appearance.hairColor', { primary: 'white' });
10199
haf.set('appearance.hairColor.secondary', 'brown');
102100
haf.set('appearance.hairColor.secondary', undefined);
103-
haf.set('appearance.hairColor.otherColors', ['black']) // This will overwrite existing array
101+
haf.set('appearance.hairColor.otherColors', ['black']); // This will overwrite existing array
104102

105103
haf.set('name', 1); // type error
106104
haf.set('toys', [1, 2]); // type error
@@ -114,11 +112,11 @@ haf.set('appearance.haircolor', { notExist: 'white' }); //type error
114112
Appends given values to the existing array
115113

116114
```typescript
117-
haf.get('toys') // ['socks', 'toilet paper']
115+
haf.get('toys'); // ['socks', 'toilet paper']
118116

119-
haf.append('toys', 'human hand', 'bone')
117+
haf.append('toys', 'human hand', 'bone');
120118

121-
haf.get('toys') // ['socks', 'toilet paper', 'human hand', 'bone']
119+
haf.get('toys'); // ['socks', 'toilet paper', 'human hand', 'bone']
122120
```
123121

124122
#### Delete

jest.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
module.exports = {
55
preset: 'ts-jest',
66
testEnvironment: 'node',
7-
testPathIgnorePatterns: ["spec/types.spec.ts"]
7+
testPathIgnorePatterns: ['spec/types.spec.ts'],
88
};

0 commit comments

Comments
 (0)