diff --git a/core/frontend/apps/private-blogging/lib/middleware.js b/core/frontend/apps/private-blogging/lib/middleware.js index 09a4df313c..1e40a66fa1 100644 --- a/core/frontend/apps/private-blogging/lib/middleware.js +++ b/core/frontend/apps/private-blogging/lib/middleware.js @@ -5,7 +5,7 @@ const crypto = require('crypto'); const path = require('path'); const config = require('../../../../shared/config'); const urlUtils = require('../../../../shared/url-utils'); -const constants = require('../../../../server/lib/constants'); +const constants = require('@tryghost/constants'); const {i18n} = require('../../../../server/lib/common'); const errors = require('@tryghost/errors'); const settingsCache = require('../../../../server/services/settings/cache'); diff --git a/core/server/adapters/storage/LocalFileStorage.js b/core/server/adapters/storage/LocalFileStorage.js index a6797ac699..1dec2d1267 100644 --- a/core/server/adapters/storage/LocalFileStorage.js +++ b/core/server/adapters/storage/LocalFileStorage.js @@ -10,7 +10,7 @@ const config = require('../../../shared/config'); const {i18n} = require('../../lib/common'); const logging = require('../../../shared/logging'); const errors = require('@tryghost/errors'); -const constants = require('../../lib/constants'); +const constants = require('@tryghost/constants'); const urlUtils = require('../../../shared/url-utils'); const StorageBase = require('ghost-storage-base'); diff --git a/core/server/lib/constants.js b/core/server/lib/constants.js deleted file mode 100644 index 28a5912180..0000000000 --- a/core/server/lib/constants.js +++ /dev/null @@ -1,14 +0,0 @@ -module.exports = { - ONE_HOUR_S: 3600, - ONE_DAY_S: 86400, - ONE_MONTH_S: 2628000, - SIX_MONTH_S: 15768000, - ONE_YEAR_S: 31536000, - FIVE_MINUTES_MS: 300000, - ONE_HOUR_MS: 3600000, - ONE_DAY_MS: 86400000, - ONE_WEEK_MS: 604800000, - ONE_MONTH_MS: 2628000000, - SIX_MONTH_MS: 15768000000, - ONE_YEAR_MS: 31536000000 -}; diff --git a/core/server/models/invite.js b/core/server/models/invite.js index 31eb76fd29..9f235ae11b 100644 --- a/core/server/models/invite.js +++ b/core/server/models/invite.js @@ -2,7 +2,7 @@ const Promise = require('bluebird'); const _ = require('lodash'); const {i18n} = require('../lib/common'); const errors = require('@tryghost/errors'); -const constants = require('../lib/constants'); +const constants = require('@tryghost/constants'); const security = require('../lib/security'); const settingsCache = require('../services/settings/cache'); const ghostBookshelf = require('./base'); diff --git a/core/server/services/auth/passwordreset.js b/core/server/services/auth/passwordreset.js index 52d2b71bc9..e9d435343d 100644 --- a/core/server/services/auth/passwordreset.js +++ b/core/server/services/auth/passwordreset.js @@ -1,6 +1,6 @@ const _ = require('lodash'); const security = require('../../lib/security'); -const constants = require('../../lib/constants'); +const constants = require('@tryghost/constants'); const errors = require('@tryghost/errors'); const {i18n} = require('../../lib/common'); const models = require('../../models'); diff --git a/core/server/services/auth/session/express-session.js b/core/server/services/auth/session/express-session.js index ef570892de..36b8780951 100644 --- a/core/server/services/auth/session/express-session.js +++ b/core/server/services/auth/session/express-session.js @@ -1,5 +1,5 @@ const session = require('express-session'); -const constants = require('../../../lib/constants'); +const constants = require('@tryghost/constants'); const config = require('../../../../shared/config'); const settingsCache = require('../../settings/cache'); const models = require('../../../models'); diff --git a/core/server/web/admin/app.js b/core/server/web/admin/app.js index dfda36c41b..d1b07b4eb9 100644 --- a/core/server/web/admin/app.js +++ b/core/server/web/admin/app.js @@ -2,7 +2,7 @@ const debug = require('ghost-ignition').debug('web:admin:app'); const express = require('../../../shared/express'); const serveStatic = express.static; const config = require('../../../shared/config'); -const constants = require('../../lib/constants'); +const constants = require('@tryghost/constants'); const urlUtils = require('../../../shared/url-utils'); const shared = require('../shared'); const adminMiddleware = require('./middleware'); diff --git a/core/server/web/api/middleware/update-user-last-seen.js b/core/server/web/api/middleware/update-user-last-seen.js index 837b883d15..2ff867e5d0 100644 --- a/core/server/web/api/middleware/update-user-last-seen.js +++ b/core/server/web/api/middleware/update-user-last-seen.js @@ -1,4 +1,4 @@ -const constants = require('../../../lib/constants'); +const constants = require('@tryghost/constants'); module.exports = function updateUserLastSeenMiddleware(req, res, next) { if (!req.user) { diff --git a/core/server/web/site/app.js b/core/server/web/site/app.js index 43da6f1558..509e930747 100644 --- a/core/server/web/site/app.js +++ b/core/server/web/site/app.js @@ -7,7 +7,7 @@ const errors = require('@tryghost/errors'); // App requires const config = require('../../../shared/config'); -const constants = require('../../lib/constants'); +const constants = require('@tryghost/constants'); const storage = require('../../adapters/storage'); const urlService = require('../../../frontend/services/url'); const urlUtils = require('../../../shared/url-utils'); diff --git a/core/server/web/site/middleware/static-theme.js b/core/server/web/site/middleware/static-theme.js index e9ea41e1f2..f7de8ef0d9 100644 --- a/core/server/web/site/middleware/static-theme.js +++ b/core/server/web/site/middleware/static-theme.js @@ -1,6 +1,6 @@ const path = require('path'); const config = require('../../../../shared/config'); -const constants = require('../../../lib/constants'); +const constants = require('@tryghost/constants'); const themeUtils = require('../../../../frontend/services/themes'); const express = require('../../../../shared/express'); diff --git a/package.json b/package.json index 8dd77f78c5..f46fee5bf5 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "@sentry/node": "5.20.1", "@tryghost/adapter-manager": "0.1.9", "@tryghost/bootstrap-socket": "0.2.0", + "@tryghost/constants": "0.1.0", "@tryghost/errors": "0.2.2", "@tryghost/helpers": "1.1.29", "@tryghost/image-transform": "1.0.2", diff --git a/test/unit/web/api/middleware/update-user-last-seen_spec.js b/test/unit/web/api/middleware/update-user-last-seen_spec.js index 7abd3dc993..d67d8eae14 100644 --- a/test/unit/web/api/middleware/update-user-last-seen_spec.js +++ b/test/unit/web/api/middleware/update-user-last-seen_spec.js @@ -1,6 +1,6 @@ const should = require('should'); const sinon = require('sinon'); -const constants = require('../../../../../core/server/lib/constants'); +const constants = require('@tryghost/constants'); const updateUserLastSeenMiddleware = require('../../../../../core/server/web/api/middleware/update-user-last-seen'); describe('updateUserLastSeenMiddleware', function () { diff --git a/test/utils/fixtures/data-generator.js b/test/utils/fixtures/data-generator.js index 4c8a1c1ad8..5c8f7da3ec 100644 --- a/test/utils/fixtures/data-generator.js +++ b/test/utils/fixtures/data-generator.js @@ -2,7 +2,7 @@ const _ = require('lodash'); const uuid = require('uuid'); const ObjectId = require('bson-objectid'); const moment = require('moment'); -const constants = require('../../../core/server/lib/constants'); +const constants = require('@tryghost/constants'); const DataGenerator = {}; DataGenerator.markdownToMobiledoc = function markdownToMobiledoc(content) { diff --git a/yarn.lock b/yarn.lock index 72e48e5d29..3ebe3697a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -302,6 +302,11 @@ resolved "https://registry.yarnpkg.com/@tryghost/bootstrap-socket/-/bootstrap-socket-0.2.0.tgz#efc7291b346b633117d8d5e0fca7e52c6913a9f2" integrity sha512-Ao9REMMiorIdEtVDkS0xdCnnvwQU9zd3bsz7521RCeDBT3pi5AbrFrV9LwG+XnCgw9NvbmTv0aidxpiEQV1aSQ== +"@tryghost/constants@0.1.0": + version "0.1.0" + resolved "https://registry.yarnpkg.com/@tryghost/constants/-/constants-0.1.0.tgz#a92b0d7f9f82d6a5fb44efb41b03d7f57b37309b" + integrity sha512-QFRiCW9cgrYEtQXaLdhKwylg/WoeVy3ZPFfCIQv0R7i5f6ycyW+2N1t4ZsnEFiuCw9Fvphwodr2QgHrQaiOCpg== + "@tryghost/errors@0.2.2", "@tryghost/errors@^0.2.2": version "0.2.2" resolved "https://registry.yarnpkg.com/@tryghost/errors/-/errors-0.2.2.tgz#ff70a5f895c84b84c47d71b9a16cba55c52f89ff"