Skip to content

Commit

Permalink
fix: bring back old admin-bro package
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtek-krysiak committed Aug 4, 2020
1 parent 695beef commit ad57957
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 120 deletions.
61 changes: 0 additions & 61 deletions CHANGELOG.md

This file was deleted.

2 changes: 1 addition & 1 deletion examples/auth.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const AdminBro = require('@admin-bro/core')
const AdminBro = require('admin-bro')
const express = require('express')
const mongoose = require('mongoose')

Expand Down
2 changes: 1 addition & 1 deletion examples/simple.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const AdminBro = require('@admin-bro/core')
const AdminBro = require('admin-bro')
const express = require('express')
const mongoose = require('mongoose')

Expand Down
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable max-len */
/**
* @module admin-bro-expressjs
* @module @admin-bro/express
*
* @description
* Plugin that allows you to add AdminBro to Express.js applications.
Expand All @@ -27,8 +27,8 @@
* It exposes 2 methods that create an Express Router, which can be attached
* to a given url in the API. Each method takes a pre-configured instance of {@link AdminBro}.
*
* - {@link module:admin-bro-expressjs.buildRouter AdminBroExpress.buildRouter(admin, [predefinedRouter])}
* - {@link module:admin-bro-expressjs.buildAuthenticatedRouter AdminBroExpress.buildAuthenticatedRouter(admin, auth, [predefinedRouter], sessionOptions)}
* - {@link module:@admin-bro/express.buildRouter AdminBroExpress.buildRouter(admin, [predefinedRouter])}
* - {@link module:@admin-bro/express.buildAuthenticatedRouter AdminBroExpress.buildAuthenticatedRouter(admin, auth, [predefinedRouter], sessionOptions)}
*
* If you want to use a router you have already created - not a problem. Just pass it
* as a `predefinedRouter` parameter.
Expand All @@ -39,7 +39,7 @@
* ## Example without an authentication
*
* ```
* const AdminBro = require('@admin-bro/core')
* const AdminBro = require('admin-bro')
* const AdminBroExpress = require('@admin-bro/express')
*
* const express = require('express')
Expand All @@ -58,7 +58,7 @@
* ## Using build in authentication
*
* To protect the routes with a session authentication, you can use predefined
* {@link module:admin-bro-expressjs.buildAuthenticatedRouter} method.
* {@link module:@admin-bro/express.buildAuthenticatedRouter} method.
*
* Note! To use authentication in production environment, there is a need to configure
* express-session for production build. It can be achieved by passing options to
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
},
"homepage": "https://github.com/SoftwareBrothers/admin-bro-expressjs#readme",
"peerDependencies": {
"@admin-bro/core": ">=3.0.0-beta.1",
"admin-bro": ">=3.0.0-beta.1",
"express": ">=4.16.4",
"express-formidable": "^1.2.0",
"express-session": ">=1.15.6"
Expand All @@ -39,7 +39,7 @@
"devDependencies": {
"@types/express": "^4.17.4",
"@types/mocha": "^7.0.2",
"@admin-bro/core": ">=3.0.0-beta.1",
"admin-bro": ">=3.0.0-beta.1",
"@admin-bro/mongoose": "^1.0.0-beta.1",
"chai": "^4.2.0",
"eslint": "^5.10.0",
Expand Down
14 changes: 7 additions & 7 deletions plugin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const express = require('express')
const AdminBro = require('@admin-bro/core')
const AdminBro = require('admin-bro')

const path = require('path')
const formidableMiddleware = require('express-formidable')
Expand All @@ -23,7 +23,7 @@ try {
* @return {express.Router} Express.js router
* @function
* @static
* @memberof module:admin-bro-expressjs
* @memberof module:@admin-bro/express
*/
const buildRouter = (admin, predefinedRouter, formidableOptions) => {
if (!admin || admin.constructor.name !== 'AdminBro') {
Expand Down Expand Up @@ -94,7 +94,7 @@ const buildRouter = (admin, predefinedRouter, formidableOptions) => {

/**
* @typedef {Function} Authenticate
* @memberof module:admin-bro-expressjs
* @memberof module:@admin-bro/express
* @description
* function taking 2 arguments email and password
* @param {string} [email] email given in the form
Expand All @@ -112,15 +112,15 @@ const buildRouter = (admin, predefinedRouter, formidableOptions) => {
*
* @param {AdminBro} admin instance of AdminBro
* @param {Object} auth authentication options
* @param {module:admin-bro-expressjs.Authenticate} auth.authenticate authenticate function
* @param {module:@admin-bro/express.Authenticate} auth.authenticate authenticate function
* @param {String} auth.cookiePassword secret used to encrypt cookies
* @param {String} auth.cookieName=adminbro cookie name
* @param {express.Router} [predefinedRouter] Express.js router
* @param {SessionOptions} [sessionOptions] Options that are passed to [express-session](https://github.com/expressjs/session)
* @param {ExpressFormidableOptions} [formidableOptions] Options that are passed to [express-session](https://github.com/expressjs/session)
* @return {express.Router} Express.js router
* @static
* @memberof module:admin-bro-expressjs
* @memberof module:@admin-bro/express
* @example
* const ADMIN = {
* email: '[email protected]',
Expand Down Expand Up @@ -249,13 +249,13 @@ module.exports = {
/**
* Version of the plugin
* @static
* @memberof module:admin-bro-expressjs
* @memberof module:@admin-bro/express
*/
version: pkg.version,
/**
* Plugin name
* @static
* @memberof module:admin-bro-expressjs
* @memberof module:@admin-bro/express
*/
name: 'AdminBroExpressjs',
}
2 changes: 1 addition & 1 deletion spec/plugin.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const express = require('express')
const AdminBro = require('@admin-bro/core')
const AdminBro = require('admin-bro')
const plugin = require('../plugin')

describe('plugin', function () {
Expand Down
84 changes: 42 additions & 42 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,6 @@
# yarn lockfile v1


"@admin-bro/core@>=3.0.0-beta.1":
version "3.0.0-beta.2"
resolved "https://registry.yarnpkg.com/@admin-bro/core/-/core-3.0.0-beta.2.tgz#1dd567a1ad63676319170a18d04ee7211510f7ec"
integrity sha512-mIez46h0GsXave0XJy6+4DDk3DYnKztYPzFn8vvg07jgvO/W3uFy85MCdgm0ZndyiSqQbklcdptpE+KvAb3DeA==
dependencies:
"@admin-bro/design-system" "^1.2.3"
"@babel/core" "^7.10.2"
"@babel/parser" "^7.10.2"
"@babel/plugin-transform-runtime" "^7.10.1"
"@babel/polyfill" "^7.10.1"
"@babel/preset-env" "^7.10.2"
"@babel/preset-react" "^7.10.1"
"@babel/preset-typescript" "^7.10.1"
"@babel/register" "^7.10.1"
"@types/react" "^16.9.16"
axios "^0.19.2"
commander "^5.1.0"
flat "^4.1.0"
i18next "^19.1.0"
lodash "^4.17.11"
ora "^4.0.2"
prop-types "^15.7.2"
react ">= 16.13.1"
react-dom ">= 16.13.1"
react-i18next "^11.3.1"
react-is "^16.13.1"
react-redux "^7.2.0"
react-router "^5.2.0"
react-router-dom "^5.2.0"
react-select "^2.4.2"
redux "^4.0.5"
rollup "^2.16.1"
rollup-plugin-babel "^4.4.0"
rollup-plugin-commonjs "^10.1.0"
rollup-plugin-json "^4.0.0"
rollup-plugin-node-resolve "^5.2.0"
rollup-plugin-replace "^2.2.0"
rollup-plugin-terser "^6.1.0"
slash "^3.0.0"
styled-components "^5.1.1"
styled-system "^5.1.5"

"@admin-bro/design-system@^1.2.3":
version "1.2.3"
resolved "https://registry.yarnpkg.com/@admin-bro/design-system/-/design-system-1.2.3.tgz#edb4ef06695923449de47f077654a2c986590d96"
Expand Down Expand Up @@ -1777,6 +1735,48 @@ acorn@^6.0.2:
version "6.0.4"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.0.4.tgz#77377e7353b72ec5104550aa2d2097a2fd40b754"

admin-bro@>=3.0.0-beta.1:
version "3.0.0-beta.1"
resolved "https://registry.yarnpkg.com/admin-bro/-/admin-bro-3.0.0-beta.1.tgz#1318cc1d736fd3927f1927eb04c1b5dda69355f9"
integrity sha512-gpwpfYUfUdvjF1gZgcj9tzEEqm+/4jbiZljnFJVnp9DIskgB32rQ7920xRDPg1jjr88sG69u/fYV1hEac8rtcA==
dependencies:
"@admin-bro/design-system" "^1.2.3"
"@babel/core" "^7.10.2"
"@babel/parser" "^7.10.2"
"@babel/plugin-transform-runtime" "^7.10.1"
"@babel/polyfill" "^7.10.1"
"@babel/preset-env" "^7.10.2"
"@babel/preset-react" "^7.10.1"
"@babel/preset-typescript" "^7.10.1"
"@babel/register" "^7.10.1"
"@types/react" "^16.9.16"
axios "^0.19.2"
commander "^5.1.0"
flat "^4.1.0"
i18next "^19.1.0"
lodash "^4.17.11"
ora "^4.0.2"
prop-types "^15.7.2"
react ">= 16.13.1"
react-dom ">= 16.13.1"
react-i18next "^11.3.1"
react-is "^16.13.1"
react-redux "^7.2.0"
react-router "^5.2.0"
react-router-dom "^5.2.0"
react-select "^2.4.2"
redux "^4.0.5"
rollup "^2.16.1"
rollup-plugin-babel "^4.4.0"
rollup-plugin-commonjs "^10.1.0"
rollup-plugin-json "^4.0.0"
rollup-plugin-node-resolve "^5.2.0"
rollup-plugin-replace "^2.2.0"
rollup-plugin-terser "^6.1.0"
slash "^3.0.0"
styled-components "^5.1.1"
styled-system "^5.1.5"

agent-base@4, agent-base@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee"
Expand Down

0 comments on commit ad57957

Please sign in to comment.