Replaced constants file with @tryghost/constants

- extracted constants file into a new package
- replaced all local requires of the file with new package
This commit is contained in:
Daniel Lockyer 2020-08-11 12:51:16 +01:00
parent d8880b8b97
commit 8799feb801
14 changed files with 17 additions and 25 deletions

View File

@ -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');

View File

@ -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');

View File

@ -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
};

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -1,4 +1,4 @@
const constants = require('../../../lib/constants');
const constants = require('@tryghost/constants');
module.exports = function updateUserLastSeenMiddleware(req, res, next) {
if (!req.user) {

View File

@ -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');

View File

@ -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');

View File

@ -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",

View File

@ -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 () {

View File

@ -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) {

View File

@ -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"