diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 86ef64a..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,61 +0,0 @@ -# Changelog -All notable changes to this project will be documented in this file. - -The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), -and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - -Started from version 0.3.0 - -## Version v2.0.5 - 29.04.2020 - -### Changed - -* switch travis to github actions - -### Added - -* error message when body-parser has been used - -## 2.0.4 - 12.04.2020 - -### Fixed - -* fix JSDoc type auto-suggestion - -## 2.0.2,2.0.3 - 08.04.2020 - -### Added - -* add formidable options - -### Fixed - -* login handler waits until session is stored: fixes automatic redirects to login page when user has been logged in - -## 2.0.1 - 02.04.2020 - -### Changed - -* move to the next middleware instead of hanging when errors are thrown - -## 2.0.0 - 04.03.2020 - -### Added - -* support for admin v2 - -## 1.4.0 - 2019-12-17 - -### Changed - -* change body-parser to formidable - -## 1.3.0 - 2019-11-04 - -### Added - -* Added session options to authenticatedRouter - -### Removed - -* removed cookie-parser dependency diff --git a/examples/auth.js b/examples/auth.js index 5b196c0..280412c 100644 --- a/examples/auth.js +++ b/examples/auth.js @@ -1,4 +1,4 @@ -const AdminBro = require('@admin-bro/core') +const AdminBro = require('admin-bro') const express = require('express') const mongoose = require('mongoose') diff --git a/examples/simple.js b/examples/simple.js index 3b3e22f..3f549da 100644 --- a/examples/simple.js +++ b/examples/simple.js @@ -1,4 +1,4 @@ -const AdminBro = require('@admin-bro/core') +const AdminBro = require('admin-bro') const express = require('express') const mongoose = require('mongoose') diff --git a/index.js b/index.js index 56b8a5d..b58af2a 100644 --- a/index.js +++ b/index.js @@ -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. @@ -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. @@ -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') @@ -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 diff --git a/package.json b/package.json index 1aa76b0..ba8ab78 100644 --- a/package.json +++ b/package.json @@ -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" @@ -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", diff --git a/plugin.js b/plugin.js index e1494a3..01ba871 100644 --- a/plugin.js +++ b/plugin.js @@ -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') @@ -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') { @@ -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 @@ -112,7 +112,7 @@ 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 @@ -120,7 +120,7 @@ const buildRouter = (admin, predefinedRouter, formidableOptions) => { * @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: 'test@example.com', @@ -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', } diff --git a/spec/plugin.spec.js b/spec/plugin.spec.js index 7e9696b..1e50135 100644 --- a/spec/plugin.spec.js +++ b/spec/plugin.spec.js @@ -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 () { diff --git a/yarn.lock b/yarn.lock index 02d76b9..5edfab1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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"