Skip to content

Commit 36094a6

Browse files
Merge pull request #1 from SoftwareBrothers/beta
Beta
2 parents 3b155c2 + 4bced6d commit 36094a6

26 files changed

+340
-405
lines changed

.eslintrc.json

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
"jest": true
77
},
88
"parser": "@typescript-eslint/parser",
9-
"parserOptions": {
10-
"project": "example-app/tsconfig.json",
11-
"sourceType": "module"
12-
},
139
"plugins": [
1410
"@typescript-eslint",
1511
"prefer-arrow",
@@ -21,7 +17,6 @@
2117
"eslint:recommended",
2218
"plugin:@typescript-eslint/eslint-recommended",
2319
"plugin:@typescript-eslint/recommended",
24-
"plugin:@typescript-eslint/recommended-requiring-type-checking",
2520
"plugin:jest/recommended"
2621
],
2722
"settings": {
@@ -174,7 +169,6 @@
174169
"error",
175170
"always-multiline"
176171
],
177-
"@typescript-eslint/prefer-readonly": "error",
178172
"prefer-arrow/prefer-arrow-functions": "error",
179173
"spaced-comment": [
180174
"error",
@@ -202,6 +196,22 @@
202196
"@typescript-eslint/unbound-method": "off",
203197
"@typescript-eslint/explicit-function-return-type": "off"
204198
}
199+
},
200+
{
201+
"files": [
202+
"**/*.js"
203+
],
204+
"rules": {
205+
"spaced-comment": "off"
206+
}
207+
},
208+
{
209+
"files": [
210+
"*/cypress/**/*.spec.ts"
211+
],
212+
"rules": {
213+
"jest/expect-expect": "off"
214+
}
205215
}
206216
]
207217
}

.github/workflows/push.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ jobs:
55
name: test
66
runs-on: ubuntu-latest
77
steps:
8-
- name: Dump GitHub context
9-
env:
10-
GITHUB_CONTEXT: ${{ toJson(github) }}
11-
run: echo "$GITHUB_CONTEXT"
128
- name: Checkout
139
uses: actions/checkout@v2
1410
- name: Setup

README.md

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,18 @@
1-
# AdminBro Addon template
1+
# NestJS plugin for AdminBro
22

3-
This an AdminBro addon template repository. You may use it if you want to create
3+
This is an official [AdminBro](https://github.com/SoftwareBrothers/admin-bro) plugin which integrates it to [nestjs](https://nestjs.com) framework.
44

5-
* AdminBro plugin
6-
* AdminBro adapter
7-
* AdminBro feature
5+
## AdminBro
86

9-
## What is inside
7+
AdminBro is an automatic admin interface which can be plugged into your application. You, as a developer, provide database models (like posts, comments, stores, products or whatever else your application uses), and AdminBro generates UI which allows you (or other trusted users) to manage content.
108

11-
It is a typescript repository with:
9+
Check out the example application with mongo and postgres models here: https://admin-bro-example-app-staging.herokuapp.com/admin
1210

13-
* TypeScript
14-
* linter with semantic commits (ensures the same style across AdminBro packages)
15-
* semantic-release
16-
* github actions
17-
* example application with cypress
11+
Or visit [AdminBro](https://github.com/SoftwareBrothers/admin-bro) github page.
1812

19-
What is missing:
20-
* cypress run in the CI which is an optional. You can take a look at admin-bro/core repository to see how to build it.
13+
## Usage
2114

22-
## How to use it
23-
24-
In order to start working on an AdminBro feature/plugin/adapter follow this steps:
25-
26-
1. fork this repository
27-
2. Make sure it uses the latest versions of the packages
28-
2. rename package in package.json
29-
3. add env variables github settings:
30-
- SLACK_WEBHOOK
31-
- NPM_TOKEN
32-
4. in the root folder:
33-
- `yarn install`
34-
- `yarn link` (registers package in `linked packages` repository)
35-
5. cd example-app
36-
- `yarn install`
37-
- `yarn add NAME_OF_YOUR_PACKAGE`
38-
- `yarn link NAME_OF_YOUR_PACKAGE`
39-
6. then in one terminal in the root folder run:
40-
- `yarn build --watch`
41-
7. in the second terminal in example app:
42-
- `yarn dev`
43-
44-
You can read more about package linking in [yarn link documentation](https://classic.yarnpkg.com/en/docs/cli/link/)
45-
46-
## Publishing to NPM
47-
48-
package has semantic-release configured, but it don't upload build to NPM because of `private: true` set in package.json. In order to trigger automatic releases simply remove this line.
15+
To see example usage see the [example-app](https://github.com/SoftwareBrothers/admin-bro-nestjs/tree/master/example-app) or visit the [Nestjs section under AdminBro project page](https://softwarebrothers.github.io/admin-bro-dev/module-admin-bro-nest.html)
4916

5017
## License
5118

@@ -58,4 +25,4 @@ AdminBro is Copyright © 2020 SoftwareBrothers.co. It is free software, and may
5825
We’re an open, friendly team that helps clients from all over the world to transform their businesses and create astonishing products.
5926

6027
* We are available for [hire](https://softwarebrothers.co/contact).
61-
* If you want to work for us - checkout the [career page](https://softwarebrothers.co/career).
28+
* If you want to work for us - checkout the [career page](https://softwarebrothers.co/career).

example-app/README.md

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

example-app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"dependencies": {
2121
"@admin-bro/express": "^3.0.0-beta.3",
2222
"@admin-bro/mongoose": "^1.0.0-beta.3",
23+
"@admin-bro/nestjs": "^1.0.0-beta.2",
2324
"@nestjs/common": "^6.7.2",
2425
"@nestjs/core": "^6.7.2",
2526
"@nestjs/mongoose": "^7.0.2",
@@ -38,7 +39,7 @@
3839
"@nestjs/schematics": "^6.6.6",
3940
"@nestjs/testing": "^6.7.1",
4041
"@types/express": "^4.17.1",
41-
"@types/jest": "^24.0.18",
42+
"@types/jest": "^26.0.9",
4243
"@types/mongoose": "^5.7.36",
4344
"@types/node": "^12.7.5",
4445
"@types/supertest": "^2.0.8",

example-app/src/app.controller.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export class AppController {
88
constructor(private readonly appService: AppService) {}
99

1010
@Get()
11-
getHello(): string {
11+
public getHello(): string {
1212
return this.appService.getHello();
1313
}
1414
}

example-app/src/app.module.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Module } from '@nestjs/common';
22
import { MongooseModule, getModelToken } from '@nestjs/mongoose';
3-
import mongoose, { Model } from 'mongoose';
3+
import { Model } from 'mongoose';
44

5-
import { AdminModule } from '../../src/index';
5+
import { AdminModule } from '../../src'; // lib
66

77
import { AppController } from './app.controller';
88
import { AppService } from './app.service';
@@ -12,7 +12,7 @@ import { MongooseSchemasModule } from './mongoose/mongoose.module';
1212
@Module({
1313
imports: [
1414
MongooseModule.forRoot('mongodb://localhost:27017/nest'),
15-
AdminModule.createAdminModule({
15+
AdminModule.createAdminAsync({
1616
imports: [
1717
MongooseSchemasModule,
1818
],
@@ -27,7 +27,7 @@ import { MongooseSchemasModule } from './mongoose/mongoose.module';
2727
],
2828
},
2929
auth: {
30-
authenticate: async (email, password) => Promise.resolve({ test: 'test' }),
30+
authenticate: async (email, password) => Promise.resolve({ email: 'test' }),
3131
cookieName: 'test',
3232
cookiePassword: 'testPass',
3333
},

example-app/src/app.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
22

33
@Injectable()
44
export class AppService {
5-
getHello(): string {
5+
public getHello(): string {
66
return 'Hello World!';
77
}
88
}

example-app/src/index.js

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

example-app/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AppModule } from './app.module';
66

77
AdminBro.registerAdapter(AdminBroMongoose);
88

9-
async function bootstrap() {
9+
const bootstrap = async () => {
1010
const app = await NestFactory.create(AppModule);
1111
await app.listen(3000);
1212
}

example-app/src/mongoose/article-model.js

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

example-app/src/mongoose/blog-post-model.js

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

example-app/src/mongoose/category-model.js

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

example-app/src/mongoose/comment-model.js

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

0 commit comments

Comments
 (0)