Skip to content

Commit 520a4a0

Browse files
authored
Merge pull request #4 from softnetics/v2
feat: v2
2 parents 08ca659 + 1d0e73e commit 520a4a0

32 files changed

Lines changed: 1218 additions & 1543 deletions

.changeset/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.2/schema.json",
33
"changelog": ["@changesets/changelog-github", { "repo": "softnetics/rbac" }],
44
"commit": false,
55
"fixed": [],

.changeset/lucky-humans-tap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@softnetics/rbac": major
3+
---
4+
5+
Support dynamic fine grain premission

.gitattributes

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ jobs:
2424
release:
2525
uses: softnetics/workflows/.github/workflows/release-packages.yaml@main
2626
with:
27-
before-publish: yarn build
27+
before-publish: bun
28+
release-mode: tag
2829
secrets:
2930
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
1-
.yarn/*
2-
release.sh
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# Dependencies
4+
node_modules
5+
.pnp
6+
.pnp.js
7+
8+
# Local env files
9+
.env
10+
.env.local
11+
.env.development.local
12+
.env.test.local
13+
.env.production.local
14+
15+
# Testing
16+
coverage
17+
18+
# Turbo
19+
.turbo
20+
21+
# Vercel
22+
.vercel
23+
24+
# Build Outputs
25+
.next/
26+
out/
27+
build
328
dist
429

5-
node_modules
30+
31+
# Debug
32+
npm-debug.log*
33+
yarn-debug.log*
34+
yarn-error.log*
35+
36+
# Misc
37+
.DS_Store
38+
*.pem

.npmrc

Whitespace-only changes.

.prettierignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
pnpm-lock.yaml
2+
.changeset/**.md
3+
4+
5+
packages/bff-client/src/openapi.yaml
6+
# Dependencies
7+
node_modules
8+
.pnp
9+
.pnp.js
10+
11+
# Local env files
12+
.env
13+
.env.local
14+
.env.development.local
15+
.env.test.local
16+
.env.production.local
17+
18+
# Testing
19+
coverage
20+
21+
# Turbo
22+
.turbo
23+
.linear
24+
25+
# Vercel
26+
.vercel
27+
28+
# Build Outputs
29+
.next/
30+
out/
31+
build
32+
dist
33+
tmp
34+
.goreload
35+
36+
37+
# Debug
38+
npm-debug.log*
39+
yarn-debug.log*
40+
yarn-error.log*
41+
42+
# Misc
43+
.DS_Store
44+
*.pem

.prettierrc.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import config from '@softnetics/project-config/prettier/base.js'
2+
export default config

README.md

Lines changed: 65 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,81 @@
1-
# rbac
1+
# Turborepo starter
22

3-
O(1) type safe role based access control
3+
This is an official starter Turborepo.
44

5-
## Usage
5+
## Using this example
66

7-
create a policy
7+
Run the following command:
88

9-
```ts
10-
const policy = createPolicy({
11-
name: 'todo',
12-
permissions: {
13-
todo: ['create', 'read', 'update', 'delete'],
14-
comment: ['create', 'read', 'update'],
15-
},
16-
roles: {
17-
viewer: ['todo.read', 'comment.read'],
18-
editor: ['todo.create', 'todo.update', 'comment.create', 'comment.update'],
19-
},
20-
})
9+
```sh
10+
npx create-turbo@latest
2111
```
2212

23-
permissions are defined as a map of resource to actions
24-
roles are defined as a map of role to permissions
13+
## What's inside?
2514

26-
you also can use * to match all resources and actions
15+
This Turborepo includes the following packages/apps:
2716

28-
```ts
29-
createPolicy({
30-
name: 'todo',
31-
permissions: {
32-
todo: ['create', 'read', 'update', 'delete'],
33-
comment: ['create', 'read', 'delete'],
34-
},
35-
roles: {
36-
viewer: ['todo.read', 'comment.read'],
37-
editor: ['todo.*', 'comment.delete'],
38-
admin: '*',
39-
},
40-
})
17+
### Apps and Packages
18+
19+
- `docs`: a [Next.js](https://nextjs.org/) app
20+
- `web`: another [Next.js](https://nextjs.org/) app
21+
- `@repo/ui`: a stub React component library shared by both `web` and `docs` applications
22+
- `@repo/eslint-config`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
23+
- `@repo/typescript-config`: `tsconfig.json`s used throughout the monorepo
24+
25+
Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).
26+
27+
### Utilities
28+
29+
This Turborepo has some additional tools already setup for you:
30+
31+
- [TypeScript](https://www.typescriptlang.org/) for static type checking
32+
- [ESLint](https://eslint.org/) for code linting
33+
- [Prettier](https://prettier.io) for code formatting
34+
35+
### Build
36+
37+
To build all apps and packages, run the following command:
38+
39+
```
40+
cd my-turborepo
41+
pnpm build
4142
```
4243

43-
create a identity
44+
### Develop
4445

45-
```ts
46-
const identity = createIdentity({
47-
policies: [policy],
48-
identities: {
49-
student: ['todo.viewer'],
50-
teacher: ['todo.editor', 'todo.viewer'],
51-
},
52-
})
46+
To develop all apps and packages, run the following command:
47+
48+
```
49+
cd my-turborepo
50+
pnpm dev
5351
```
5452

55-
identities are defined as a map of identity to roles
53+
### Remote Caching
5654

57-
enforce a permission
55+
Turborepo can use a technique known as [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
5856

59-
```ts
60-
identity.enforce('student', ['todo.todo.read']) // true
61-
identity.enforce('student', ['todo.todo.create']) // false
57+
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup), then enter the following commands:
58+
59+
```
60+
cd my-turborepo
61+
npx turbo login
62+
```
63+
64+
This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).
65+
66+
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:
67+
68+
```
69+
npx turbo link
6270
```
71+
72+
## Useful Links
73+
74+
Learn more about the power of Turborepo:
75+
76+
- [Tasks](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks)
77+
- [Caching](https://turbo.build/repo/docs/core-concepts/caching)
78+
- [Remote Caching](https://turbo.build/repo/docs/core-concepts/remote-caching)
79+
- [Filtering](https://turbo.build/repo/docs/core-concepts/monorepos/filtering)
80+
- [Configuration Options](https://turbo.build/repo/docs/reference/configuration)
81+
- [CLI Usage](https://turbo.build/repo/docs/reference/command-line-reference)

bun.lockb

203 KB
Binary file not shown.

0 commit comments

Comments
 (0)