@cloudcommerce/config
Advanced tools
Comparing version
import Deepmerge from '@fastify/deepmerge'; | ||
import { | ||
DEFAULT_LANG, DEFAULT_CURRENCY, DEFAULT_CURRENCY_SYMBOL, DEFAULT_COUNTRY_CODE, DEV_FALLBACK_STORE_ID, | ||
DEFAULT_LANG, DEFAULT_CURRENCY, DEFAULT_CURRENCY_SYMBOL, DEFAULT_COUNTRY_CODE, | ||
} from './defaults.js'; | ||
@@ -19,7 +19,6 @@ | ||
_env.ECOM_COUNTRY_CODE = _env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE; | ||
let isNoStoreWarned = false; | ||
export default { | ||
get() { | ||
const config = { | ||
return { | ||
lang: _env.ECOM_LANG, | ||
@@ -32,12 +31,2 @@ currency: _env.ECOM_CURRENCY, | ||
}; | ||
if (!config.storeId && _env.DEV === true) { | ||
config.storeId = DEV_FALLBACK_STORE_ID; | ||
if (!isNoStoreWarned) { | ||
// eslint-disable-next-line no-console | ||
console.warn('[@cloudcommerce/config] `storeId` is not set, ' | ||
+ `using dev-only fallback ${DEV_FALLBACK_STORE_ID}`); | ||
isNoStoreWarned = true; | ||
} | ||
} | ||
return config; | ||
}, | ||
@@ -44,0 +33,0 @@ set(config) { |
@@ -5,2 +5,1 @@ export declare const DEFAULT_LANG = "pt_br"; | ||
export declare const DEFAULT_COUNTRY_CODE = "BR"; | ||
export declare const DEV_FALLBACK_STORE_ID = 1011; |
@@ -8,4 +8,2 @@ export const DEFAULT_LANG = 'pt_br'; | ||
export const DEFAULT_COUNTRY_CODE = 'BR'; | ||
export const DEV_FALLBACK_STORE_ID = 1011; | ||
// # sourceMappingURL=defaults.js.map |
{ | ||
"name": "@cloudcommerce/config", | ||
"type": "module", | ||
"version": "0.9.1", | ||
"version": "0.10.0", | ||
"description": "E-Com Plus Cloud Commerce base config", | ||
@@ -25,6 +25,6 @@ "main": "lib/config.js", | ||
"@fastify/deepmerge": "^1.3.0", | ||
"@cloudcommerce/api": "0.9.1" | ||
"@cloudcommerce/api": "0.10.0" | ||
}, | ||
"devDependencies": { | ||
"@cloudcommerce/types": "0.9.1" | ||
"@cloudcommerce/types": "0.10.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "scripts": { |
@@ -8,3 +8,2 @@ import type { CmsSettings } from '@cloudcommerce/types'; | ||
DEFAULT_COUNTRY_CODE, | ||
DEV_FALLBACK_STORE_ID, | ||
} from './defaults'; | ||
@@ -36,7 +35,6 @@ | ||
_env.ECOM_COUNTRY_CODE = _env.ECOM_COUNTRY_CODE || DEFAULT_COUNTRY_CODE; | ||
let isNoStoreWarned = false; | ||
export default { | ||
get(): BaseConfig { | ||
const config = { | ||
return { | ||
lang: _env.ECOM_LANG, | ||
@@ -49,12 +47,2 @@ currency: _env.ECOM_CURRENCY, | ||
}; | ||
if (!config.storeId && _env.DEV === true) { | ||
config.storeId = DEV_FALLBACK_STORE_ID; | ||
if (!isNoStoreWarned) { | ||
// eslint-disable-next-line no-console | ||
console.warn('[@cloudcommerce/config] `storeId` is not set, ' | ||
+ `using dev-only fallback ${DEV_FALLBACK_STORE_ID}`); | ||
isNoStoreWarned = true; | ||
} | ||
} | ||
return config; | ||
}, | ||
@@ -61,0 +49,0 @@ set(config: Partial<BaseConfig>) { |
@@ -8,3 +8,1 @@ export const DEFAULT_LANG = 'pt_br'; | ||
export const DEFAULT_COUNTRY_CODE = 'BR'; | ||
export const DEV_FALLBACK_STORE_ID = 1011; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23512
-5.54%226
-10.32%+ Added
- Removed
Updated