Skip to content

Commit

Permalink
Merge pull request #180 from skrtheboss/feat/upgrade-dependencies
Browse files Browse the repository at this point in the history
Feat/upgrade dependencies
  • Loading branch information
skrtheboss committed Feb 26, 2021
2 parents f03063b + 8e8d087 commit 11ea73f
Show file tree
Hide file tree
Showing 19 changed files with 3,338 additions and 2,924 deletions.
112 changes: 55 additions & 57 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
aliases:
- &job-defaults
working_directory: ~/semaphore
docker:
- image: circleci/node:12.14
working_directory: ~/semaphore
docker:
- image: circleci/node:14.5.0

- &yarn-install
run:
name: Running Yarn install
command: yarn install --frozen-lockfile --non-interactive

run:
name: Running Yarn install
command: yarn install --frozen-lockfile --non-interactive

- &restore-cache
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
# Fallback in case checksum fails
- yarn-packages-{{ .Branch }}-
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
# Fallback in case checksum fails
- yarn-packages-{{ .Branch }}-

- &save-cache
name: Save Yarn Package Cache
paths: node_modules
key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}
name: Save Yarn Package Cache
paths: node_modules
key: yarn-packages-{{ .Branch }}-{{ checksum "yarn.lock" }}

- &release_branches_filter
branches:
only:
- master
- /rc-.*/
branches:
only:
- master
- /rc-.*/

- &attach-workspace
attach_workspace:
at: ~/
attach_workspace:
at: ~/

version: 2.1
jobs:
Expand All @@ -42,65 +41,65 @@ jobs:
- *yarn-install
- save_cache: *save-cache
- persist_to_workspace:
root: ~/
paths:
- ./semaphore
root: ~/
paths:
- ./semaphore

lint:
<<: *job-defaults
steps:
- *attach-workspace
- run:
name: Lint
command: yarn lint:ci
name: Lint
command: yarn lint:ci
- run:
name: Lint Commits
command: yarn commitlint-circle
name: Lint Commits
command: yarn commitlint-circle
- store_test_results:
path: reports
path: reports

test:
<<: *job-defaults
steps:
- *attach-workspace
- run:
command: yarn test:ci
command: yarn test:ci
- store_test_results:
path: reports
path: reports

check-dependencies:
<<: *job-defaults
steps:
- *attach-workspace
- run:
command: yarn check-dependencies
command: yarn check-dependencies

check-format:
<<: *job-defaults
steps:
- *attach-workspace
- run:
command: yarn check-formatting
command: yarn check-formatting

doc:
<<: *job-defaults
steps:
- *attach-workspace
- run:
command: yarn doc
command: yarn doc
- store_artifacts:
path: docs
path: docs

build:
<<: *job-defaults
steps:
- *attach-workspace
- run:
command: yarn build
command: yarn build
- persist_to_workspace:
root: ~/
paths:
- ./semaphore/dist
- ./semaphore/dist

release:
<<: *job-defaults
Expand All @@ -115,29 +114,28 @@ workflows:
jobs:
- setup
- lint:
requires:
- setup
requires:
- setup
- test:
requires:
- setup
requires:
- setup
- doc:
requires:
- setup
requires:
- setup
- build:
requires:
- setup
requires:
- setup
- check-format:
requires:
- setup
requires:
- setup
- check-dependencies:
requires:
- build
requires:
- build
- release:
filters:
*release_branches_filter
requires:
- lint
- test
- doc
- build
- check-dependencies
filters: *release_branches_filter
requires:
- lint
- test
- doc
- build
- check-dependencies
9 changes: 4 additions & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'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.
'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.
],
parserOptions: {
ecmaVersion: 2019, // Allows for the parsing of modern ECMAScript features
sourceType: 'module' // Allows for the use of imports
}
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
sourceType: 'module', // Allows for the use of imports
},
};
18 changes: 10 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

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

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
Expand All @@ -24,15 +24,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
Expand Down
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit $1
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn pretty-quick --staged
5 changes: 3 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"singleQuote": true,
"trailingComma": "none",
"printWidth": 120
"printWidth": 120,
"quoteProps": "consistent",
"arrowParens": "avoid"
}
26 changes: 13 additions & 13 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment
include:

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

Examples of unacceptable behavior by participants include:

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

## Our Responsibilities

Expand Down
35 changes: 15 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,55 +55,52 @@ Install the module via npm:
```typescript
// fairness false

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

semaphore.acquire(2).then(() => {
console.log('Hello');
console.log('Hello');
});

semaphore.acquire().then(() => {
console.log('World');
console.log('World');

semaphore.release(2);
semaphore.release(2);
});

setTimeout(function() {
semaphore.release();
setTimeout(function () {
semaphore.release();
}, 2000);

```

```typescript
// fairness true

import {Semaphore} from 'ts-async-semaphore';
import { Semaphore } from 'ts-async-semaphore';
const semaphore = new Semaphore(0, true);

semaphore.acquire(2).then(() => {
console.log('Hello');
console.log('Hello');
});

semaphore.acquire().then(() => {
console.log('World');
})
});

semaphore.release(1);

setTimeout(function() {
semaphore.release(2);
setTimeout(function () {
semaphore.release(2);
}, 2000);

```

```typescript
import {Semaphore} from 'ts-async-semaphore';
import { Semaphore } from 'ts-async-semaphore';
const semaphore = new Semaphore(0, true);

semaphore.tryAcquire(1 , 50).then(val => {
semaphore.tryAcquire(1, 50).then(val => {
console.log(`Acquire ${val ? 'success' : 'fail'}`);
})

});
```

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

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

Returns: `Promise<void>`
---
## Returns: `Promise<void>`

#### #getQueuedAcquirers()

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

Returns: `Boolean` Promise `true` if success, `false` false if fail

2 changes: 1 addition & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = {extends: ['@commitlint/config-conventional']};
module.exports = { extends: ['@commitlint/config-conventional'] };

0 comments on commit 11ea73f

Please sign in to comment.