Skip to content

Commit

Permalink
Cascade useDefaultSettings to other plugins, do not reload expresser-…
Browse files Browse the repository at this point in the history
…legacy from node_modules.
  • Loading branch information
igoramadas committed Aug 2, 2019
1 parent 8a0e54e commit e896ba9
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 47 deletions.
5 changes: 5 additions & 0 deletions plugins/legacy/History.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog for expresser-legacy

3.6.2
=====
* Cascade useDefaultSettings to all plugins.
* Do not reload expresser-legacy from node_modules.

3.6.1
=====
* Fixes for using Connect Assets with coffeescript.
Expand Down
80 changes: 40 additions & 40 deletions plugins/legacy/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions plugins/legacy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "expresser-legacy",
"version": "3.6.1",
"version": "3.6.2",
"description": "Legacy adapter to make Expresser v3 apps work with v4.",
"keywords": [
"adapter",
Expand Down Expand Up @@ -28,20 +28,20 @@
"coffeescript": "^2.4.1",
"compression": "^1.7.4",
"cookie-parser": "^1.4.4",
"connect-assets": "^6.0.0",
"connect-assets": "^6.0.1",
"express-session": "^1.16.2",
"memorystore": "^1.6.1",
"pug": "^2.0.4",
"stylus": "^0.54.5"
},
"devDependencies": {
"expresser": "^4.0.3",
"expresser": "^4.0.4",
"expresser-aws": "^3.2.7",
"expresser-cron": "^3.1.1",
"expresser-mailer": "^3.1.1",
"expresser-swagger": "^1.1.0"
},
"peerDependencies": {
"expresser": "^4.0.3"
"expresser": "^4.0.4"
}
}
5 changes: 3 additions & 2 deletions plugins/legacy/src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ isTest = process.env.NODE_ENV is "test"
###
class ExpresserLegacy
init: (expresser, useDefaultSettings) =>
useDefaultSettings = false if not useDefaultSettings?
expresser = require("expresser") if not expresser?
expresser.expresser = expresser

Expand Down Expand Up @@ -55,7 +56,7 @@ class ExpresserLegacy
for p in plugins
pluginId = p.substring(p.lastIndexOf("/") + 1)

if pluginId.substring(0, 10) is "expresser-"
if pluginId isnt "expresser-legacy" and pluginId.substring(0, 10) is "expresser-"
pluginName = pluginId.replace "expresser-", ""

# Check if plugin was already attached.
Expand All @@ -64,7 +65,7 @@ class ExpresserLegacy

# Check if there are default settings to be loaded for the plugin.
if fs.existsSync pluginSettingsPath
setmeup.load pluginSettingsPath
setmeup.load pluginSettingsPath, {overwrite: useDefaultSettings}

# Get options accordingly to plugin name.
pluginArr = pluginName.split "-"
Expand Down
2 changes: 1 addition & 1 deletion test/test-z-legacy.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe("App Legacy Tests", function() {
cron = expresser.plugins.cron

cron.load("test/testcron.json", {
basePath: "../../../lib/",
basePath: "../../../../lib/",
autoStart: false
})

Expand Down

0 comments on commit e896ba9

Please sign in to comment.