Skip to content

Commit 607f786

Browse files
authored
sync (#13)
1 parent 7125073 commit 607f786

10 files changed

+221
-8
lines changed

Diff for: .gitattributes

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto eol=lf

Diff for: .github/workflows/main.yml

+12-4
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,23 @@ jobs:
1212
build:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v2
15+
- name: Cancel previous runs
16+
uses: styfle/[email protected]
17+
with:
18+
access_token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: Checkout repository
21+
uses: actions/checkout@v2
1622

1723
- name: Install dependencies
18-
run: yarn install --frozen-lockfile
24+
uses: bahmutov/npm-install@v1
25+
with:
26+
useLockFile: false
1927

20-
- name: Building the library
28+
- name: Build the library
2129
run: yarn build
2230

23-
- name: Testing the library
31+
- name: Test the library
2432
run: yarn test:coverage
2533

2634
- name: Codecov

Diff for: .npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
package-lock=false

Diff for: CODE_OF_CONDUCT.md

+127
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official e-mail address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement. All complaints
63+
will be reviewed and investigated promptly and fairly.
64+
65+
All community leaders are obligated to respect the privacy and security of the
66+
reporter of any incident.
67+
68+
## Enforcement Guidelines
69+
70+
Community leaders will follow these Community Impact Guidelines in determining
71+
the consequences for any action they deem in violation of this Code of Conduct:
72+
73+
### 1. Correction
74+
75+
**Community Impact**: Use of inappropriate language or other behavior deemed
76+
unprofessional or unwelcome in the community.
77+
78+
**Consequence**: A private, written warning from community leaders, providing
79+
clarity around the nature of the violation and an explanation of why the
80+
behavior was inappropriate. A public apology may be requested.
81+
82+
### 2. Warning
83+
84+
**Community Impact**: A violation through a single incident or series of
85+
actions.
86+
87+
**Consequence**: A warning with consequences for continued behavior. No
88+
interaction with the people involved, including unsolicited interaction with
89+
those enforcing the Code of Conduct, for a specified period of time. This
90+
includes avoiding interactions in community spaces as well as external channels
91+
like social media. Violating these terms may lead to a temporary or permanent
92+
ban.
93+
94+
### 3. Temporary Ban
95+
96+
**Community Impact**: A serious violation of community standards, including
97+
sustained inappropriate behavior.
98+
99+
**Consequence**: A temporary ban from any sort of interaction or public
100+
communication with the community for a specified period of time. No public or
101+
private interaction with the people involved, including unsolicited interaction
102+
with those enforcing the Code of Conduct, is allowed during this period.
103+
Violating these terms may lead to a permanent ban.
104+
105+
### 4. Permanent Ban
106+
107+
**Community Impact**: Demonstrating a pattern of violation of community
108+
standards, including sustained inappropriate behavior, harassment of an
109+
individual, or aggression toward or disparagement of classes of individuals.
110+
111+
**Consequence**: A permanent ban from any sort of public interaction within the
112+
community.
113+
114+
## Attribution
115+
116+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
117+
version 2.0, available at
118+
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
119+
120+
Community Impact Guidelines were inspired by
121+
[Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
122+
123+
[homepage]: https://www.contributor-covenant.org
124+
125+
For answers to common questions about this code of conduct, see the FAQ at
126+
https://www.contributor-covenant.org/faq. Translations are available at
127+
https://www.contributor-covenant.org/translations.
File renamed without changes.

Diff for: LICENSE.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
The MIT License (MIT)
2+
Copyright (c) 2021 Artem Zakharchenko
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to deal
6+
in the Software without restriction, including without limitation the rights
7+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all
12+
copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
SOFTWARE.

Diff for: README.md

+2
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,5 @@ Also update `tsconfig.json` file with:
6161
// ...
6262
}
6363
```
64+
65+
Please read the [Contribution guidelines](CONTRIBUTING.md) to start with your awesome contributions!

Diff for: STANDARDS.ts

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
import * as fs from 'fs'
2+
import * as path from 'path'
3+
import * as packageJson from './package.json'
4+
5+
describe('Distribution', () => {
6+
it('Name and description', () => {
7+
expect(packageJson).toHaveProperty('name')
8+
expect(packageJson).toHaveProperty('description')
9+
})
10+
11+
it('Main entry point', () => {
12+
expect(fs.existsSync(packageJson.main)).toBe(true)
13+
})
14+
15+
it('Type definitions', () => {
16+
expect(fs.existsSync(packageJson.types)).toBe(true)
17+
})
18+
})
19+
20+
describe('Community', () => {
21+
it('README', () => {
22+
const filenames = ['README', 'README.md']
23+
expect(filenames.some(fs.existsSync)).toBe(true)
24+
})
25+
26+
it('Code of conduct', () => {
27+
const filenames = ['CODE_OF_CONDUCT', 'CODE_OF_CONDUCT.md']
28+
expect(filenames.some(fs.existsSync)).toBe(true)
29+
})
30+
31+
it('Contributing guidelines', () => {
32+
const filenames = ['CONTRIBUTING', 'CONTRIBUTING.md']
33+
const locations = ['.', '.github']
34+
35+
expect(
36+
filenames.some((filename) => {
37+
return locations.some((location) => {
38+
return fs.existsSync(path.resolve(location, filename))
39+
})
40+
})
41+
)
42+
})
43+
44+
it('License', () => {
45+
expect(packageJson).toHaveProperty('license')
46+
47+
const filenames = ['LICENSE', 'LICENSE.md']
48+
expect(filenames.some(fs.existsSync)).toBe(true)
49+
})
50+
})

Diff for: jest.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ import { compilerOptions } from './tsconfig.json'
44
export default {
55
preset: 'ts-jest',
66
moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths, {
7-
prefix: '<rootDir>/',
7+
prefix: '<rootDir>',
88
}),
99
}

Diff for: package.json

+7-3
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
"format": "prettier --write .",
2121
"hygen:file": "hygen file new",
2222
"lint": "eslint ./{src,test}/**/*.ts",
23-
"prepublishOnly": "yarn build && yarn test",
23+
"prepublishOnly": "yarn build && yarn test:lib && yarn test",
2424
"start": "rollup -c rollup.config.ts -w",
2525
"test": "jest",
2626
"test:coverage": "jest --collectCoverage",
27+
"test:lib": "jest STANDARDS.ts --testRegex=\"(STANDARDS\\.ts)\"",
2728
"test:silent": "jest --silent",
2829
"test:watch": "jest --watch",
2930
"preversion": "yarn build && yarn test",
@@ -38,8 +39,8 @@
3839
},
3940
"lint-staged": {
4041
"*.ts": [
41-
"eslint",
42-
"prettier"
42+
"prettier --write",
43+
"eslint --fix"
4344
]
4445
},
4546
"prettier": "@lukaspolak/prettier-config",
@@ -68,5 +69,8 @@
6869
"ts-jest": "^26.5.0",
6970
"ts-node": "^9.1.1",
7071
"typescript": "^4.1.3"
72+
},
73+
"engines": {
74+
"node": ">= 14.15.1"
7175
}
7276
}

0 commit comments

Comments
 (0)