Skip to content

Commit 7459970

Browse files
committed
@atomic-layout/core: Handles global __PROD__ flag typing-wise
1 parent 5c9a772 commit 7459970

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Global flag that indicates production environment.
3+
*/
4+
declare const __PROD__: string
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Perform all unit tests in production environment
2+
global.__PROD__ = true

packages/atomic-layout-core/src/utils/templates/generateComponents/generateComponents.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ export default function generateComponents(
5858
return components[areaName]
5959
}
6060

61-
// @ts-ignore-line
6261
if (!__PROD__) {
62+
// tslint:disable-next-line
6363
console.warn(
6464
'Prevented render of the area "%s", which is not found in the template definition. Please render one of the existing areas ("%s"), or modify the template to include "%s".',
6565
areaName,

packages/atomic-layout-core/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
"baseUrl": ".",
1212
"types": ["node", "jest"]
1313
},
14-
"include": ["src/**/*"],
14+
"include": ["global.d.ts", "src/**/*"],
1515
"exclude": ["node_modules", "**/*.spec.ts"]
1616
}

0 commit comments

Comments
 (0)