Skip to content

Commit 03ae01b

Browse files
committed
chore: rebrand package from admin-bro to adminjs
1 parent f113c13 commit 03ae01b

File tree

15 files changed

+3089
-1865
lines changed

15 files changed

+3089
-1865
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ dist
159159
types
160160
build
161161
lib
162-
.adminbro
162+
.adminjs
163163

164164
example-app/.env
165165
*.log

README.md

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
## admin-bro-mikroorm
1+
## adminjs-mikroorm
22

3-
This is an *unofficial* [admin-bro](https://github.com/SoftwareBrothers/admin-bro) adapter which integrates [MikroORM](https://github.com/mikro-orm/mikro-orm) into admin-bro.
4-
5-
Note that this is a first release and it's currently tested using only the example setup found in this repository.
6-
7-
If you are having trouble integrating this adapter in your project, please open an issue and try to describe the problem with as many details as possible.
3+
This is an official [AdminJS](https://github.com/SoftwareBrothers/adminjs) adapter which integrates [MikroORM](https://github.com/mikro-orm/mikro-orm) into AdminJS.
84

95
### Installation
106

117
yarn
128
```bash
13-
$ yarn add admin-bro-mikroorm
9+
$ yarn add @adminjs/mikroorm
1410
```
1511

1612
npm
1713
```bash
18-
$ npm i admin-bro-mikroorm
14+
$ npm i @adminjs/mikroorm
1915
```
2016

2117
## Usage
2218

23-
The plugin can be registered using standard `AdminBro.registerAdapter` method.
19+
The plugin can be registered using standard `AdminJS.registerAdapter` method.
2420

2521
```typescript
26-
import { Database, Resource } from 'admin-bro-mikroorm';
27-
import AdminBro from 'admin-bro';
22+
import { Database, Resource } from '@adminjs/mikroorm';
23+
import AdminJS from 'adminjs';
2824
import { validate } from 'class-validator';
2925

30-
const setupAdminBro = async () => {
26+
const setupAdminJs = async () => {
3127
const orm = await MikroORM.init({
3228
entities: [User],
3329
dbName: process.env.DATABASE_NAME,
@@ -41,15 +37,15 @@ const setupAdminBro = async () => {
4137
Resource.setORM(orm);
4238
// If your entities use `class-validator` to validate data, you can inject it's validate method into the resource.
4339
Resource.validate = validate;
44-
AdminBro.registerAdapter({ Database, Resource });
40+
AdminJS.registerAdapter({ Database, Resource });
4541

46-
// You can instantiate AdminBro either by specifying all resources separately:
47-
const adminBro = new AdminBro({
42+
// You can instantiate AdminJS either by specifying all resources separately:
43+
const adminJs = new AdminJS({
4844
resources: [{ resource: User, options: {} }],
4945
});
5046

5147
// Or by passing your ORM instance into `databases` property.
52-
const adminBro = new AdminBro({
48+
const adminJs = new AdminJS({
5349
databases: [orm],
5450
});
5551
// You should choose to use either `resources` or `databases`
@@ -86,15 +82,15 @@ yarn link
8682

8783
4. Setup example app
8884

89-
Install all dependencies and use previously linked version of `admin-bro-mikroorm`.
85+
Install all dependencies and use previously linked version of `@adminjs/mikroorm`.
9086

9187
```
9288
cd example-app
9389
yarn install
94-
yarn link admin-bro-mikroorm
90+
yarn link "@adminjs/mikroorm"
9591
```
9692

97-
Optionally you might want to link your local version of `admin-bro` package
93+
Optionally you might want to link your local version of `adminjs` package
9894

9995
5. Make sure you have all the envs set (see `./example-app/example.env` and create an `.env` file based on that)
10096

example-app/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@
1919
"typescript": "^4.2.3"
2020
},
2121
"dependencies": {
22-
"@admin-bro/express": "^3.1.0",
22+
"@adminjs/express": "^4.0.0",
2323
"@mikro-orm/core": "^4.5.0",
2424
"@mikro-orm/postgresql": "^4.5.0",
25-
"admin-bro-mikroorm": "^1.0.0",
26-
"admin-bro": "^3.4.0-beta.9",
25+
"adminjs": "^5.2.2",
2726
"dotenv": "^8.2.0",
2827
"express": "^4.17.1",
2928
"express-formidable": "^1.2.0",

example-app/src/index.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import dotenv from 'dotenv';
55
dotenv.config({ path: path.join(__dirname, '../.env') });
66
/* eslint-disable import/first */
77
import express from 'express';
8-
import AdminBro from 'admin-bro';
9-
import AdminBroExpress from '@admin-bro/express';
10-
import { Database, Resource } from 'admin-bro-mikroorm';
8+
import AdminJS from 'adminjs';
9+
import AdminJSExpress from '@adminjs/express';
10+
import { Database, Resource } from '@adminjs/mikroorm';
1111
import { MikroORM } from '@mikro-orm/core';
1212

1313
import { User, Car, Seller } from './entities';
@@ -25,7 +25,7 @@ const run = async () => {
2525
});
2626

2727
Resource.setORM(orm as any);
28-
AdminBro.registerAdapter({ Database, Resource });
28+
AdminJS.registerAdapter({ Database, Resource });
2929

3030
const app = express();
3131

@@ -57,12 +57,12 @@ const run = async () => {
5757
Seller,
5858
];
5959

60-
const admin = new AdminBro({
60+
const admin = new AdminJS({
6161
// databases: [orm],
6262
resources,
6363
});
6464

65-
const router = AdminBroExpress.buildRouter(admin);
65+
const router = AdminJSExpress.buildRouter(admin);
6666

6767
app.use(admin.options.rootPath, router);
6868

example-app/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"sourceMap": true,
1818
"paths": {
1919
"react": ["node_modules/@types/react"],
20-
"admin-bro": ["node_modules/admin-bro"],
20+
"adminjs": ["node_modules/adminjs"],
2121
}
2222
},
2323
"include": [

0 commit comments

Comments
 (0)