Skip to content

Commit 4592e1a

Browse files
author
andrianka
committed
chore: rebrand AdminBro to AdminJS
This commit is a part of AdminBro to AdminJS rebranding process. BREAKING CHANGE: AdminBro has been rebranded to AdminJS. All package and repository names had been updated. 1. Update your dependencies to use new `adminjs` packages. - `admin-bro` -> `adminjs` for the core package - `@admin-bro/<package name>` -> `@adminjs/<package name>` for other modules 2. Update your custom CSS classes: - `.admin-bro_<component name>` -> `.adminjs_<component name>` (example: `.adminjs_Box`) 3. Search your project for `admin-bro` occurrences - most likely they will have to be updated to `adminjs`
1 parent 24ed03f commit 4592e1a

13 files changed

+84
-84
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,6 @@ dist
158158

159159
types
160160
build
161-
.adminbro
161+
.adminjs
162162

163163
example-app/cypress/videos

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# NestJS plugin for AdminBro
1+
# NestJS plugin for AdminJS
22

3-
This is an official [AdminBro](https://github.com/SoftwareBrothers/admin-bro) plugin which integrates it to [nestjs](https://nestjs.com) framework.
3+
This is an official [AdminJS](https://github.com/SoftwareBrothers/adminjs) plugin which integrates it to [nestjs](https://nestjs.com) framework.
44

5-
## AdminBro
5+
## AdminJS
66

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.
7+
AdminJS 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 AdminJS generates UI which allows you (or other trusted users) to manage content.
88

99
Check out the example application with mongo and postgres models here: https://admin-bro-example-app-staging.herokuapp.com/admin
1010

11-
Or visit [AdminBro](https://github.com/SoftwareBrothers/admin-bro) github page.
11+
Or visit [AdminJS](https://github.com/SoftwareBrothers/adminjs) github page.
1212

1313
## Usage
1414

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)
15+
To see example usage see the [example-app](https://github.com/SoftwareBrothers/adminjs-nestjs/tree/master/example-app) or visit the [Nestjs section under AdminJS project page](https://softwarebrothers.github.io/adminjs-dev/module-adminjs-nest.html)
1616

1717
## License
1818

19-
AdminBro is Copyright © 2020 SoftwareBrothers.co. It is free software, and may be redistributed under the terms specified in the [LICENSE](LICENSE.md) file.
19+
AdminJS is Copyright © 2020 SoftwareBrothers.co. It is free software, and may be redistributed under the terms specified in the [LICENSE](LICENSE.md) file.
2020

2121
## About SoftwareBrothers.co
2222

example-app/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
"test:e2e": "NODE_ENV=test jest --config ./test/jest-e2e.json"
1919
},
2020
"dependencies": {
21-
"@admin-bro/express": "^3.0.1",
22-
"@admin-bro/mongoose": "^1.1.0",
21+
"@adminjs/express": "^3.0.1",
22+
"@adminjs/mongoose": "^1.1.0",
2323
"@nestjs/common": "^7.4.2",
2424
"@nestjs/core": "7.4.2",
2525
"@nestjs/mongoose": "^7.0.2",
2626
"@nestjs/platform-express": "^6.7.2",
27-
"admin-bro": "^3.3.1",
27+
"adminjs": "^3.3.1",
2828
"class-transformer": "^0.3.1",
2929
"class-validator": "^0.12.2",
3030
"express": "^4.17.1",

example-app/src/app.module.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Module } from '@nestjs/common';
22
import { MongooseModule, getModelToken } from '@nestjs/mongoose';
3-
import AdminBro from 'admin-bro';
4-
import AdminBroMongoose from '@admin-bro/mongoose';
3+
import AdminJS from 'adminjs';
4+
import AdminJSMongoose from '@adminjs/mongoose';
55
import { Model } from 'mongoose';
66

77
import { AdminModule } from '../../src'; // lib
@@ -12,7 +12,7 @@ import { ExpressCustomLoader } from './express-custom.loader';
1212
import { Admin } from './mongoose/admin-model';
1313
import { MongooseSchemasModule } from './mongoose/mongoose.module';
1414

15-
AdminBro.registerAdapter(AdminBroMongoose);
15+
AdminJS.registerAdapter(AdminJSMongoose);
1616

1717
@Module({
1818
imports: [
@@ -25,7 +25,7 @@ AdminBro.registerAdapter(AdminBroMongoose);
2525
getModelToken('Admin'),
2626
],
2727
useFactory: (adminModel: Model<Admin>) => ({
28-
adminBroOptions: {
28+
adminJsOptions: {
2929
rootPath: '/admin',
3030
resources: [
3131
{ resource: adminModel },

example-app/src/express-custom.loader.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* eslint-disable no-underscore-dangle */
2-
import AdminBro from 'admin-bro';
2+
import AdminJS from 'adminjs';
33
import { Injectable } from '@nestjs/common';
44
import { AbstractHttpAdapter } from '@nestjs/core';
55

@@ -10,7 +10,7 @@ import { ExpressLoader } from '../../src/loaders/express.loader';
1010
@Injectable()
1111
export class ExpressCustomLoader extends AbstractLoader {
1212
public register(
13-
admin: AdminBro,
13+
admin: AdminJS,
1414
httpAdapter: AbstractHttpAdapter,
1515
options: AdminModuleOptions,
1616
) {

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"name": "@admin-bro/nestjs",
2+
"name": "@adminjs/nestjs",
33
"version": "1.1.0",
44
"main": "build/index.js",
55
"types": "types/index.d.ts",
66
"private": false,
7-
"repository": "git@github.com:SoftwareBrothers/admin-bro-nestjs.git",
7+
"repository": "git@github.com:SoftwareBrothers/adminjs-nestjs.git",
88
"license": "MIT",
99
"scripts": {
1010
"release": "semantic-release",
@@ -18,15 +18,15 @@
1818
}
1919
},
2020
"peerDependencies": {
21-
"admin-bro": ">=3.0.0"
21+
"adminjs": ">=3.0.0"
2222
},
2323
"devDependencies": {
2424
"@commitlint/cli": "^8.3.5",
2525
"@commitlint/config-conventional": "^8.3.4",
2626
"@semantic-release/git": "^9.0.0",
2727
"@typescript-eslint/eslint-plugin": "^3.7.0",
2828
"@typescript-eslint/parser": "^3.7.0",
29-
"admin-bro": "^3.3.1",
29+
"adminjs": "^3.3.1",
3030
"eslint": "^7.5.0",
3131
"eslint-config-airbnb": "^18.2.0",
3232
"eslint-plugin-import": "^2.22.0",

src/admin.module.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import AdminBro from 'admin-bro'
1+
import AdminJS from 'adminjs'
22
import { Module, DynamicModule, OnModuleInit, Inject } from '@nestjs/common'
33
import { HttpAdapterHost } from '@nestjs/core'
44

@@ -10,14 +10,14 @@ import { AdminModuleFactory } from './interfaces/admin-module-factory.interface'
1010
import { CustomLoader } from './interfaces/custom-loader.interface'
1111

1212
/**
13-
* Nest module which is responsible for an AdminBro integration
13+
* Nest module which is responsible for an AdminJS integration
1414
*
1515
* @summary Nest Module
1616
*
1717
* @class
18-
* @name module:@admin-bro/nestjs~AdminModule
18+
* @name module:@adminjs/nestjs~AdminModule
1919
* @alias AdminModule
20-
* @memberof module:@admin-bro/nestjs
20+
* @memberof module:@adminjs/nestjs
2121
*/
2222
// This is needed by JSDoc which cannot parse this statement
2323
@Module({})
@@ -33,12 +33,12 @@ export class AdminModule implements OnModuleInit {
3333
* Creates admin in a synchronous way
3434
*
3535
* @param {AdminModuleOptions} options
36-
* @memberof module:@admin-bro/nestjs~AdminModule
36+
* @memberof module:@adminjs/nestjs~AdminModule
3737
* @method
3838
* @name createAdmin
3939
* @example
4040
* import { Module } from '@nestjs/common';
41-
* import { AdminModule } from '@admin-bro/nestjs';
41+
* import { AdminModule } from '@adminjs/nestjs';
4242
*
4343
* \@Module({
4444
* imports: [
@@ -72,7 +72,7 @@ export class AdminModule implements OnModuleInit {
7272
* Creates admin in an asynchronous way
7373
*
7474
* @param {AdminModuleFactory} options
75-
* @memberof module:@admin-bro/nestjs~AdminModule
75+
* @memberof module:@adminjs/nestjs~AdminModule
7676
* @method
7777
* @name createAdminAsync
7878
* @example
@@ -87,7 +87,7 @@ export class AdminModule implements OnModuleInit {
8787
* getModelToken('Admin'), // using mongoose function to inject dependency
8888
* ],
8989
* useFactory: (adminModel: Model<Admin>) => ({ // injected dependecy will appear as an argument
90-
* adminBroOptions: {
90+
* adminJsOptions: {
9191
* rootPath: '/admin',
9292
* resources: [
9393
* { resource: adminModel },
@@ -119,19 +119,19 @@ export class AdminModule implements OnModuleInit {
119119
}
120120

121121
/**
122-
* Applies given options to AdminBro and initializes it
122+
* Applies given options to AdminJS and initializes it
123123
*/
124124
public onModuleInit() {
125125
if ('shouldBeInitialized' in this.adminModuleOptions && !this.adminModuleOptions.shouldBeInitialized) {
126126
return;
127127
}
128128

129-
const admin = new AdminBro(this.adminModuleOptions.adminBroOptions);
129+
const admin = new AdminJS(this.adminModuleOptions.adminJsOptions);
130130

131131
const { httpAdapter } = this.httpAdapterHost;
132132
this.loader.register(admin, httpAdapter, {
133133
...this.adminModuleOptions,
134-
adminBroOptions: admin.options,
134+
adminJsOptions: admin.options,
135135
});
136136
}
137137
}

src/index.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
/**
2-
* @module @admin-bro/nestjs
2+
* @module @adminjs/nestjs
33
* @subcategory Plugins
44
* @section modules
55
*
66
* @classdesc
7-
* This is an official plugin which allows you to render AdminBro in [NestJS
7+
* This is an official plugin which allows you to render AdminJS in [NestJS
88
* framework](https://nestjs.com/)
99
*
1010
* ## Installation
1111
*
12-
* 1. First of all, install the AdminBro along with the module:
12+
* 1. First of all, install the AdminJS along with the module:
1313
*
1414
* ```
15-
* yarn add admin-bro @admin-bro/nestjs
15+
* yarn add adminjs @adminjs/nestjs
1616
* ```
1717
*
1818
* ### Express:
19-
* You have to additionally add admin-bro express plugin along with packages it's using, express and express formidable:
19+
* You have to additionally add adminjs express plugin along with packages it's using, express and express formidable:
2020
*
2121
* ```
22-
* yarn add express @admin-bro/express express-formidable
22+
* yarn add express @adminjs/express express-formidable
2323
* ```
2424
*
2525
* If you are passing `authenticate` object you have to also add express-session:
@@ -36,12 +36,12 @@
3636
*
3737
* ```
3838
* import { Module } from '@nestjs/common';
39-
* import { AdminModule } from '@admin-bro/nestjs';
39+
* import { AdminModule } from '@adminjs/nestjs';
4040
*
4141
* \@Module({
4242
* imports: [
4343
* AdminModule.createAdmin({
44-
* adminBroOptions: {
44+
* adminJsOptions: {
4545
* rootPath: '/admin',
4646
* resources: [],
4747
* }),
@@ -51,25 +51,25 @@
5151
* export class AppModule {}
5252
* ```
5353
*
54-
* Then enter `/admin` path in your browser and you should see the AdminBro.
54+
* Then enter `/admin` path in your browser and you should see the AdminJS.
5555
*
5656
* 3. Passing resources
5757
*
5858
* Let say you use @nestjs/typeorm module, and you have users module.
5959
*
60-
* - you have to install @admin-bro/typeorm adapter
61-
* - you have to register it in AdminBro (as stated in the docs)
60+
* - you have to install @adminjs/typeorm adapter
61+
* - you have to register it in AdminJS (as stated in the docs)
6262
* - and you have to pass it to your options
6363
*
6464
* ```
65-
* import AdminBro from 'admin-bro';
65+
* import AdminJS from 'adminjs';
6666
* import { Module } from '@nestjs/common';
67-
* import { AdminModule } from '@admin-bro/nestjs';
68-
* import { Database, Resource } from '@admin-bro/typeorm'
67+
* import { AdminModule } from '@adminjs/nestjs';
68+
* import { Database, Resource } from '@adminjs/typeorm'
6969
* import { TypeOrmModule } from '@nestjs/typeorm';
7070
* import { UsersModule } from './users/users.module';
7171
*
72-
* AdminBro.registerAdapter({ Database, Resource })
72+
* AdminJS.registerAdapter({ Database, Resource })
7373
*
7474
* \@Module({
7575
* imports: [
@@ -85,7 +85,7 @@
8585
* synchronize: true,
8686
* }),
8787
* AdminModule.createAdmin({
88-
* adminBroOptions: {
88+
* adminJsOptions: {
8989
* rootPath: '/admin',
9090
* resources: [User],
9191
* }
@@ -97,7 +97,7 @@
9797
*
9898
* ## Authentication
9999
*
100-
* Apart from the `adminBroOptions` you can define `auth` settings.
100+
* Apart from the `adminJsOptions` you can define `auth` settings.
101101
*
102102
* This is an example which always logs users in, since authenticate method
103103
* always returns a Promise resolving to {@link CurrentAdmin}. You may
@@ -106,7 +106,7 @@
106106
*
107107
* ```
108108
* AdminModule.createAdmin({
109-
* adminBroOptions: {
109+
* adminJsOptions: {
110110
* rootPath: '/admin',
111111
* resources: [User],
112112
* },
@@ -138,7 +138,7 @@
138138
* })
139139
* export class MongooseSchemasModule {}
140140
* ```
141-
* - we want to use Admin model in admin-bro panel, to be displayed as the resource
141+
* - we want to use Admin model in adminjs panel, to be displayed as the resource
142142
* ```
143143
* \@Module({
144144
* imports: [
@@ -151,7 +151,7 @@
151151
* getModelToken('Admin'), // using mongoose function to inject dependency
152152
* ],
153153
* useFactory: (adminModel: Model<Admin>) => ({ // injected dependecy will appear as an argument
154-
* adminBroOptions: {
154+
* adminJsOptions: {
155155
* rootPath: '/admin',
156156
* resources: [
157157
* { resource: adminModel },
@@ -166,9 +166,9 @@
166166
* ```
167167
*
168168
* ## Custom loader
169-
* In most cases default plugins for admin-bro are enough for functionality we need, but in rare ocasions
169+
* In most cases default plugins for adminjs are enough for functionality we need, but in rare ocasions
170170
* we want to customize routing, or achieve different logic after login and this cases can be achieved only
171-
* by providing own plugin implementation. Because @admin-bro/nestjs under the hood uses plugin for express (@admin-bro/express)
171+
* by providing own plugin implementation. Because @adminjs/nestjs under the hood uses plugin for express (@adminjs/express)
172172
* it would require basically copying whole nestjs plugin and express plugin to own project to put any changes.
173173
* Instead there is optional parameter to put your custom loader if you don't want to use official one for any reason.
174174
* Your custom loader must extend AbstractLoader.
@@ -177,7 +177,7 @@
177177
* \@Injectable()
178178
* export class CustomLoader extends AbstractLoader {
179179
* public register(
180-
* admin: AdminBro,
180+
* admin: AdminJS,
181181
* httpAdapter: AbstractHttpAdapter,
182182
* options: AdminModuleOptions,
183183
* ) {}
@@ -188,7 +188,7 @@
188188
*
189189
* ```
190190
* AdminModule.createAdmin({
191-
* adminBroOptions: {
191+
* adminJsOptions: {
192192
* //...
193193
* },
194194
* auth: {
@@ -208,7 +208,7 @@
208208
* ```
209209
*
210210
* ## Example
211-
* There is a working example [here](https://github.com/SoftwareBrothers/admin-bro-nestjs/tree/master/example-app)
211+
* There is a working example [here](https://github.com/SoftwareBrothers/adminjs-nestjs/tree/master/example-app)
212212
*/
213213
import * as NestJSPlugin from './admin.module'
214214

0 commit comments

Comments
 (0)