Skip to content

Commit ab27843

Browse files
authored
Merge pull request #181 from skrtheboss/develop
Merge develop to master
2 parents adfed18 + 11ea73f commit ab27843

19 files changed

+3388
-2952
lines changed

.circleci/config.yml

+55-57
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,35 @@
11
aliases:
22
- &job-defaults
3-
working_directory: ~/semaphore
4-
docker:
5-
- image: circleci/node:12.13
3+
working_directory: ~/semaphore
4+
docker:
5+
- image: circleci/node:14.5.0
66

77
- &yarn-install
8-
run:
9-
name: Running Yarn install
10-
command: yarn install --frozen-lockfile --non-interactive
11-
8+
run:
9+
name: Running Yarn install
10+
command: yarn install --frozen-lockfile --non-interactive
1211

1312
- &restore-cache
14-
name: Restore Yarn Package Cache
15-
keys:
16-
- yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
17-
# Fallback in case checksum fails
18-
- yarn-packages-{{ .Branch }}-
13+
name: Restore Yarn Package Cache
14+
keys:
15+
- yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
16+
# Fallback in case checksum fails
17+
- yarn-packages-{{ .Branch }}-
1918

2019
- &save-cache
21-
name: Save Yarn Package Cache
22-
paths: node_modules
23-
key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
20+
name: Save Yarn Package Cache
21+
paths: node_modules
22+
key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
2423

2524
- &release_branches_filter
26-
branches:
27-
only:
28-
- master
29-
- /rc-.*/
25+
branches:
26+
only:
27+
- master
28+
- /rc-.*/
3029

3130
- &attach-workspace
32-
attach_workspace:
33-
at: ~/
31+
attach_workspace:
32+
at: ~/
3433

3534
version: 2.1
3635
jobs:
@@ -42,65 +41,65 @@ jobs:
4241
- *yarn-install
4342
- save_cache: *save-cache
4443
- persist_to_workspace:
45-
root: ~/
46-
paths:
47-
- ./semaphore
44+
root: ~/
45+
paths:
46+
- ./semaphore
4847

4948
lint:
5049
<<: *job-defaults
5150
steps:
5251
- *attach-workspace
5352
- run:
54-
name: Lint
55-
command: yarn lint:ci
53+
name: Lint
54+
command: yarn lint:ci
5655
- run:
57-
name: Lint Commits
58-
command: yarn commitlint-circle
56+
name: Lint Commits
57+
command: yarn commitlint-circle
5958
- store_test_results:
60-
path: reports
59+
path: reports
6160

6261
test:
6362
<<: *job-defaults
6463
steps:
6564
- *attach-workspace
6665
- run:
67-
command: yarn test:ci
66+
command: yarn test:ci
6867
- store_test_results:
69-
path: reports
68+
path: reports
7069

7170
check-dependencies:
7271
<<: *job-defaults
7372
steps:
7473
- *attach-workspace
7574
- run:
76-
command: yarn check-dependencies
75+
command: yarn check-dependencies
7776

7877
check-format:
7978
<<: *job-defaults
8079
steps:
8180
- *attach-workspace
8281
- run:
83-
command: yarn check-formatting
82+
command: yarn check-formatting
8483

8584
doc:
8685
<<: *job-defaults
8786
steps:
8887
- *attach-workspace
8988
- run:
90-
command: yarn doc
89+
command: yarn doc
9190
- store_artifacts:
92-
path: docs
91+
path: docs
9392

9493
build:
9594
<<: *job-defaults
9695
steps:
9796
- *attach-workspace
9897
- run:
99-
command: yarn build
98+
command: yarn build
10099
- persist_to_workspace:
101100
root: ~/
102101
paths:
103-
- ./semaphore/dist
102+
- ./semaphore/dist
104103

105104
release:
106105
<<: *job-defaults
@@ -115,29 +114,28 @@ workflows:
115114
jobs:
116115
- setup
117116
- lint:
118-
requires:
119-
- setup
117+
requires:
118+
- setup
120119
- test:
121-
requires:
122-
- setup
120+
requires:
121+
- setup
123122
- doc:
124-
requires:
125-
- setup
123+
requires:
124+
- setup
126125
- build:
127-
requires:
128-
- setup
126+
requires:
127+
- setup
129128
- check-format:
130-
requires:
131-
- setup
129+
requires:
130+
- setup
132131
- check-dependencies:
133-
requires:
134-
- build
132+
requires:
133+
- build
135134
- release:
136-
filters:
137-
*release_branches_filter
138-
requires:
139-
- lint
140-
- test
141-
- doc
142-
- build
143-
- check-dependencies
135+
filters: *release_branches_filter
136+
requires:
137+
- lint
138+
- test
139+
- doc
140+
- build
141+
- check-dependencies

.eslintrc.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ module.exports = {
22
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
33
extends: [
44
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
5-
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
6-
'plugin:prettier/recommended' // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
5+
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
76
],
87
parserOptions: {
9-
ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features
10-
sourceType: 'module' // Allows for the use of imports
11-
}
8+
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
9+
sourceType: 'module', // Allows for the use of imports
10+
},
1211
};

.github/ISSUE_TEMPLATE/bug_report.md

+10-8
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ about: Create a report to help us improve
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
98

109
**Describe the bug**
1110
A clear and concise description of what the bug is.
1211

1312
**To Reproduce**
1413
Steps to reproduce the behavior:
14+
1515
1. Go to '...'
1616
2. Click on '....'
1717
3. Scroll down to '....'
@@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
2424
If applicable, add screenshots to help explain your problem.
2525

2626
**Desktop (please complete the following information):**
27-
- OS: [e.g. iOS]
28-
- Browser [e.g. chrome, safari]
29-
- Version [e.g. 22]
27+
28+
- OS: [e.g. iOS]
29+
- Browser [e.g. chrome, safari]
30+
- Version [e.g. 22]
3031

3132
**Smartphone (please complete the following information):**
32-
- Device: [e.g. iPhone6]
33-
- OS: [e.g. iOS8.1]
34-
- Browser [e.g. stock browser, safari]
35-
- Version [e.g. 22]
33+
34+
- Device: [e.g. iPhone6]
35+
- OS: [e.g. iOS8.1]
36+
- Browser [e.g. stock browser, safari]
37+
- Version [e.g. 22]
3638

3739
**Additional context**
3840
Add any other context about the problem here.

.github/ISSUE_TEMPLATE/feature_request.md

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ about: Suggest an idea for this project
44
title: ''
55
labels: ''
66
assignees: ''
7-
87
---
98

109
**Is your feature request related to a problem? Please describe.**

.husky/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
_

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn commitlint --edit $1

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
. "$(dirname "$0")/_/husky.sh"
3+
4+
yarn pretty-quick --staged

.prettierrc

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"singleQuote": true,
3-
"trailingComma": "none",
4-
"printWidth": 120
3+
"printWidth": 120,
4+
"quoteProps": "consistent",
5+
"arrowParens": "avoid"
56
}

CODE_OF_CONDUCT.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
1414
Examples of behavior that contributes to creating a positive environment
1515
include:
1616

17-
* Using welcoming and inclusive language
18-
* Being respectful of differing viewpoints and experiences
19-
* Gracefully accepting constructive criticism
20-
* Focusing on what is best for the community
21-
* Showing empathy towards other community members
17+
- Using welcoming and inclusive language
18+
- Being respectful of differing viewpoints and experiences
19+
- Gracefully accepting constructive criticism
20+
- Focusing on what is best for the community
21+
- Showing empathy towards other community members
2222

2323
Examples of unacceptable behavior by participants include:
2424

25-
* The use of sexualized language or imagery and unwelcome sexual attention or
26-
advances
27-
* Trolling, insulting/derogatory comments, and personal or political attacks
28-
* Public or private harassment
29-
* Publishing others' private information, such as a physical or electronic
30-
address, without explicit permission
31-
* Other conduct which could reasonably be considered inappropriate in a
32-
professional setting
25+
- The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
- Trolling, insulting/derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
- Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
3333

3434
## Our Responsibilities
3535

README.md

+15-20
Original file line numberDiff line numberDiff line change
@@ -55,55 +55,52 @@ Install the module via npm:
5555
```typescript
5656
// fairness false
5757

58-
import {Semaphore} from 'ts-async-semaphore';
58+
import { Semaphore } from 'ts-async-semaphore';
5959
const semaphore = new Semaphore(0);
6060

6161
semaphore.acquire(2).then(() => {
62-
console.log('Hello');
62+
console.log('Hello');
6363
});
6464

6565
semaphore.acquire().then(() => {
66-
console.log('World');
66+
console.log('World');
6767

68-
semaphore.release(2);
68+
semaphore.release(2);
6969
});
7070

71-
setTimeout(function() {
72-
semaphore.release();
71+
setTimeout(function () {
72+
semaphore.release();
7373
}, 2000);
74-
7574
```
7675

7776
```typescript
7877
// fairness true
7978

80-
import {Semaphore} from 'ts-async-semaphore';
79+
import { Semaphore } from 'ts-async-semaphore';
8180
const semaphore = new Semaphore(0, true);
8281

8382
semaphore.acquire(2).then(() => {
84-
console.log('Hello');
83+
console.log('Hello');
8584
});
8685

8786
semaphore.acquire().then(() => {
8887
console.log('World');
89-
})
88+
});
9089

9190
semaphore.release(1);
9291

93-
setTimeout(function() {
94-
semaphore.release(2);
92+
setTimeout(function () {
93+
semaphore.release(2);
9594
}, 2000);
96-
9795
```
9896

9997
```typescript
100-
import {Semaphore} from 'ts-async-semaphore';
98+
import { Semaphore } from 'ts-async-semaphore';
10199
const semaphore = new Semaphore(0, true);
102100

103-
semaphore.tryAcquire(1 , 50).then(val => {
101+
semaphore.tryAcquire(1, 50).then(val => {
104102
console.log(`Acquire ${val ? 'success' : 'fail'}`);
105-
})
106-
103+
});
107104
```
108105

109106
## Documentation
@@ -130,8 +127,7 @@ Acquires the given number of permits from this semaphore.
130127

131128
`permits: number` The number of permits to acquire. `Default: 0`.
132129

133-
Returns: `Promise<void>`
134-
---
130+
## Returns: `Promise<void>`
135131

136132
#### #getQueuedAcquirers()
137133

@@ -181,4 +177,3 @@ Acquires the given number of permits from this semaphore.
181177
`timeoutMs: number` The timeout after which the acquire will fail
182178

183179
Returns: `Boolean` Promise `true` if success, `false` false if fail
184-

commitlint.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = {extends: ['@commitlint/config-conventional']};
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

0 commit comments

Comments
 (0)