Skip to content

Commit a300265

Browse files
committed
lib.
1 parent 0fd543c commit a300265

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

configuration/webpack.config.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
const path = require('path');
2-
const PRODUCTION = 'production';
2+
const { isProduction, PRODUCTION} = require('../src/lib');
33

44
const root = path.resolve(__dirname, '..');
5-
const environment = process.env.NODE_ENV || PRODUCTION;
6-
const isProduction = environment === PRODUCTION;
75

86
module.exports = {
9-
mode: environment,
7+
mode: process.env.NODE_ENV || PRODUCTION,
108
devtool: 'source-map',
119
entry: path.join(root, 'index.js'),
1210
target: 'node',
@@ -30,7 +28,7 @@ module.exports = {
3028
minimize: false
3129
},
3230
performance: {
33-
hints: isProduction ? 'warning' : false
31+
hints: isProduction() ? 'warning' : false
3432
},
3533
resolve: {
3634
extensions: ['.js', '.json']

src/hooks/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1+
const { isUndefined } = require('../lib');
12
const { EXCLUDED_ASYNC_TYPES } = require('./constants');
23

3-
const isUndefined = (thing) => [null, undefined].includes(thing);
4-
54
/**
65
* Returns proper context ref for a given trigger id.
76
* @param {ExecutionContext} parentContext - The parent context triggered the init

src/lib/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/**
2+
* The production environment
3+
* @type {String}
4+
*/
5+
const PRODUCTION = 'production';
6+
7+
module.exports = {
8+
PRODUCTION,
9+
isProduction: () => process.env.NODE_ENV || PRODUCTION,
10+
isUndefined: (thing) => [null, undefined].includes(thing)
11+
};

0 commit comments

Comments
 (0)