Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/code.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ on:
- "master"
paths:
- ".github/workflows/code.yaml"
- ".github/workflows/publish.yaml"
- "package.json"
- "lib/**"
- "README.md"
- "src/**"
- "test/*"
- "tsconfig.json"
- "tslint.json"
pull_request:
paths:
- ".github/workflows/code.yaml"
- ".github/workflows/publish.yaml"
- "package.json"
- "lib/**"
- "README.md"
- "src/**"
- "test/*"
- "tsconfig.json"
Expand All @@ -28,7 +32,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout git repository
uses: actions/checkout@v1.2.0
uses: actions/checkout@v2.3.2
- name: Install yarn dependencies
run: yarn install --frozen-lockfile
- name: Lint code
Expand All @@ -43,11 +47,16 @@ jobs:
needs: test
steps:
- name: Checkout git repository
uses: actions/checkout@v1.2.0
uses: actions/checkout@v2.3.2
- name: Clean old release drafts
run: hub release -f "%T (%S) %n" --include-drafts | grep " (draft)" | awk '{print $1}' | xargs --no-run-if-empty -t -n1 hub release delete
env:
GITHUB_USER: minddocbot
GITHUB_TOKEN: ${{ secrets.MINDDOCBOT_TOKEN }}
- name: Create release
uses: minddocdev/mou-release-action@master
with:
draft: true
prerelease: false
templatePath: RELEASE_DRAFT/default.md
token: ${{ github.token }}
token: ${{ secrets.MINDDOCBOT_TOKEN }}
48 changes: 35 additions & 13 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,46 @@ on:
release:
types: [published]
jobs:
build:
publish-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v2.3.2
- name: Set release version
id: vars
run: echo ::set-output name=tag::$(echo ${{ github.event.release.tag_name }} | cut -d "v" -f 2)
- uses: actions/setup-node@v2
with:
always-auth: true
node-version: "13.x"
registry-url: "https://registry.npmjs.org"
scope: "@minddoc"
- name: Publish the package
run: |
npm --no-git-tag-version version $RELEASE_VERSION
npm config set registry https://registry.npmjs.org
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
publish-github:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.3.2
- name: Set release version
id: vars
run: echo ::set-output name=tag::$(echo ${{ github.event.release.tag_name }} | cut -d "v" -f 2)
- uses: actions/setup-node@v2
with:
node-version: "13.x"
registry-url: "https://npm.pkg.github.com"
scope: "@minddocdev"
- name: Install yarn dependencies
run: yarn install --frozen-lockfile
- name: Lint code
run: yarn lint
- name: Test code
run: yarn test
- name: Build code
run: yarn build
- name: Publish the package
run: yarn publish
run: |
npm --no-git-tag-version version $RELEASE_VERSION
npm config set registry https://npm.pkg.github.com
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ github.token }}
NODE_AUTH_TOKEN: ${{ secrets.MINDDOCBOT_TOKEN }}
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
23 changes: 1 addition & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,13 @@ Many Role Based Access Control (RBAC) implementations differ, but the basics is
- No **silent** errors.
- **Fast**. (Grants are stored in memory, no database queries.)

## Getting Started

```bash
yarn install
```

```bash
yarn build
```

```bash
yarn test
```

## Installation

```bash
yarn add @minddocdev/accesscontrol
```

## Publishing

To publish a new version of the package, firstly bump the version in the `package.json` file,
then cut a new release on [Github](https://github.com/minddocdev/accesscontrol/releases). This
will automatically initiate the `publish` Github Action workflow and publish a new version to
[Github Packages](https://github.com/minddocdev/accesscontrol/packages)

## Guide
## Usage

```typescript
import { AccessControl } from 'accesscontrol';
Expand Down
1 change: 1 addition & 0 deletions lib/src/access/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/src/access/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/error/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/src/error/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/src/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/permission/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/src/permission/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/src/query/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/src/query/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 10 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@minddocdev/accesscontrol",
"version": "0.1.2",
"version": "0.0.0",
"description": "Role and Attribute based Access Control",
"author": "MindDoc Health GmbH",
"license": "MIT",
Expand All @@ -18,9 +18,6 @@
"type": "git",
"url": "https://github.com/minddocdev/accesscontrol.git"
},
"publishConfig": {
"registry": "https://npm.pkg.github.com/"
},
"keywords": [
"accesscontrol",
"node",
Expand All @@ -30,20 +27,18 @@
"scripts": {
"build": "tsc -b -v",
"test": "yarn build && jest --coverage --verbose --no-cache",
"lint": "tslint --project .",
"ncu:u": "ncu -u"
"lint": "tslint --project ."
},
"devDependencies": {
"@types/jest": "^26.0.3",
"@types/node": "^14.0.14",
"husky": "^4.2.5",
"jest": "^26.1.0",
"npm-check-updates": "^7.0.1",
"prettier": "^2.0.5",
"ts-jest": "^26.1.1",
"tslint": "^6.1.2",
"@types/jest": "^26.0.20",
"@types/node": "^14.14.20",
"husky": "^4.3.7",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"ts-jest": "^26.4.4",
"tslint": "^6.1.3",
"tslint-config-airbnb": "^5.11.2",
"typescript": "^3.9.6"
"typescript": "^4.1.3"
},
"dependencies": {},
"husky": {
Expand Down
Loading