Compare commits

...

21 Commits

Author SHA1 Message Date
Purwa Shrivastava
090a47cffd Merge pull request #96 from qlik-oss/atq/fixDeploy
fix: Environment Setup not needed for deploy
2022-11-14 14:03:28 +01:00
Purwa Shrivastava
43fa4cd380 fix: Environment Setup not needed for deploy 2022-11-11 14:48:15 +01:00
Purwa Shrivastava
233f2a5c7c Merge pull request #95 from qlik-oss/fix/QB-14863
fix: QB-14863-duplicateKeys
2022-11-11 14:28:12 +01:00
Purwa Shrivastava
ca6893296a fix: permission issue 2022-11-10 14:53:53 +01:00
Purwa Shrivastava
f13312c288 fix: yml file 2022-11-10 14:45:37 +01:00
Purwa Shrivastava
6fc73c4cc8 fix: update docker image 2022-11-10 14:34:46 +01:00
Purwa Shrivastava
9424e847c9 fix: use node v16 instead of v17 2022-11-10 14:09:53 +01:00
Purwa Shrivastava
b86a3ae9c6 fix: generated unique keys for data columns and removed blackduck scan 2022-11-10 10:53:19 +01:00
Jingjing Xie
ed50a8f3d3 Merge pull request #93 from qlik-oss/fix/QB-5202-option-in-QCS
fix: Export as XLS in QCS
2021-07-07 16:42:47 +02:00
Jingjing Xie
cca315efbb fix: check for desktop 2021-07-07 14:15:24 +02:00
Jingjing Xie
c888dd9fe4 fix: Export as XLS in QCS 2021-07-06 10:24:00 +02:00
Jingjing Xie
467948a46c Merge pull request #92 from qlik-oss/fcy/QB-5202
fix: enable Export as XLS option on qcs
2021-06-23 15:56:45 +02:00
Jingjing Xie
315191ccfa fix: comment 2021-06-23 12:29:23 +02:00
Jingjing Xie
80a9fdf2a9 fix: enable Export as XLS option on qcs 2021-06-23 10:26:36 +02:00
Tobias Åström
092b89d69f Merge pull request #91 from qlik-oss/tsm/qb-2727
fix: remove infinite loop
2021-01-14 16:51:40 +01:00
caele
f934fa929d chore: add comment 2021-01-14 10:23:22 +01:00
caele
acf6eb7b26 fix: remove infinite loop 2021-01-13 16:09:38 +01:00
Tobias Åström
d6ae86220e Merge pull request #90 from qlik-oss/tsm/increase-style-rows
Tsm/increase style rows
2021-01-05 09:29:18 +01:00
caele
3397bd419d fix: set style rows to 5000 2021-01-05 09:13:46 +01:00
caele
2dd11ad24c fix: set style rows to 5000 2021-01-05 09:10:39 +01:00
Tobias Åström
1099be87fa chore: add comment to explain export in QCS 2020-09-24 13:29:39 +02:00
10 changed files with 191 additions and 148 deletions

View File

@@ -3,7 +3,7 @@ version: 2
defaults: &defaults
working_directory: ~/qlik-smart-pivot
docker:
- image: circleci/node:stretch
- image: circleci/node:16.13.0
environment:
GITHUB_ORG: "qlik-oss"
GITHUB_REPO: "PLSmartPivot"
@@ -12,20 +12,12 @@ defaults: &defaults
jobs:
test:
docker:
- image: circleci/node:stretch-browsers
- image: circleci/node:16.13.0-browsers
steps:
- checkout
- run:
name: Install dependencies
command: npm install
- run:
name: BlackDuck scan
command: curl -s https://detect.synopsys.com/detect.sh | bash -s -- \
--blackduck.url="https://qliktech.blackducksoftware.com" \
--blackduck.trust.cert=true \
--blackduck.username="svc-blackduck" \
--blackduck.password=${svc_blackduck} \
--detect.project.name="viz-bundle-qlik-smart-pivot"
bump-version:
<<: *defaults
@@ -43,6 +35,10 @@ jobs:
<<: *defaults
steps:
- checkout
- run:
name: Setup environment
command: |
sudo chmod +x ./.circleci/upgrade-node.sh
- attach_workspace:
at: ~/qlik-smart-pivot
- run:

17
.circleci/upgrade-node.sh Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -eo pipefail
NVM_DIR="/opt/circleci/.nvm"
NODE_VERSION="v16"
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
echo "Installing Node $NODE_VERSION"
nvm install $NODE_VERSION
nvm alias default $NODE_VERSION
# Each step uses the same `$BASH_ENV`, so need to modify it
echo 'export NVM_DIR="/opt/circleci/.nvm"' >> $BASH_ENV
echo "[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"" >> $BASH_ENV

View File

@@ -3,15 +3,15 @@ module.exports = {
ecmaVersion: 6,
ecmaFeatures: {
jsx: true,
modules: true
modules: true,
},
sourceType: "module"
sourceType: "module",
},
parser: "babel-eslint",
env: {
browser: true,
es6: true,
node: true
node: true,
},
globals: {
angular: false,
@@ -21,49 +21,63 @@ module.exports = {
document: false,
expect: false,
it: false,
require: false
require: false,
},
rules: {
"indent": ["error", 2, { "SwitchCase": 1 }],
indent: ["warn", 2, { SwitchCase: 1 }],
"linebreak-style": ["error", "unix"],
"object-curly-spacing": ["error", "always"],
"max-lines": ["warn", 300],
"max-len": ["warn", { "code": 120, "ignoreComments": true, "ignoreTrailingComments": false }],
"max-len": [
"warn",
{ code: 120, ignoreComments: true, ignoreTrailingComments: false },
],
"no-console": ["warn"],
"no-mixed-operators": ["warn", {
"groups": [
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"]
],
"allowSamePrecedence": true
}],
"no-mixed-operators": [
"warn",
{
groups: [
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
["&&", "||"],
["in", "instanceof"],
],
allowSamePrecedence: true,
},
],
"comma-dangle": ["off"],
"space-before-function-paren": ["off"],
"no-multi-spaces": ["error"],
"no-cond-assign": ["warn"],
"no-fallthrough": ["warn"],
"no-undef": ["error"],
"no-unused-vars": ["error"],
"no-use-before-define": ["error", { "functions": false, "classes": false, "variables": false }],
"no-use-before-define": [
"error",
{ functions: false, classes: false, variables: false },
],
"no-useless-escape": ["warn"],
"no-useless-return": ["warn"],
"no-underscore-dangle": ["warn", { "allow": ["_id"] }],
"no-underscore-dangle": ["warn", { allow: ["_id"] }],
"no-redeclare": ["error"],
"no-restricted-syntax": ["warn"],
"operator-linebreak": ["warn", "before"],
"prefer-promise-reject-errors": ["warn"],
"padded-blocks": ["warn", { "blocks": "never", "switches": "never", "classes": "never" }],
"semi": ["error", "always"],
"padded-blocks": [
"warn",
{ blocks: "never", switches: "never", classes: "never" },
],
semi: ["error", "always"],
"valid-typeof": ["warn"],
"no-eval": ["error"],
"no-implied-eval": ["error"],
"no-debugger": ["warn"],
"no-unreachable": ["warn"],
"quotes": ["warn", "single", { "avoidEscape": true }],
quotes: ["warn", "single", { avoidEscape: true }],
"sort-imports": ["off"],
"max-lines-per-function": ["off"], // marks the entire functions, a bit too noisy
"complexity": ["warn"],
"camelcase": ["warn"],
"max-statements": ["off"], // marks the entire functions, a bit too noisy
complexity: ["warn"],
camelcase: ["warn"],
"max-statements": ["off"], // marks the entire functions, a bit too noisy
"sort-vars": ["off"], // not much value for the work
"init-declarations": ["off"],
"capitalized-comments": ["off"],
@@ -99,13 +113,13 @@ module.exports = {
"array-bracket-newline": ["warn"],
"array-element-newline": ["warn"],
"object-shorthand": ["warn"],
"eqeqeq": ["warn"],
eqeqeq: ["warn"],
"no-empty-function": ["off"],
"function-paren-newline": ["warn"],
"no-invalid-this": ["warn"],
"newline-per-chained-call": ["warn"],
"no-unused-expressions": ["warn"],
"strict": ["warn"],
strict: ["warn"],
"no-ternary": ["off"],
"multiline-ternary": ["off"],
"no-param-reassign": ["error"],
@@ -115,9 +129,9 @@ module.exports = {
"default-case": ["warn"],
"no-alert": ["warn"],
"max-params": ["warn"],
"brace-style": ["warn", "1tbs", { "allowSingleLine": true }],
"brace-style": ["warn", "1tbs", { allowSingleLine: true }],
"prefer-const": ["warn"],
"class-methods-use-this":["warn"],
"class-methods-use-this": ["warn"],
// plugin:react
"react/jsx-indent": ["warn", 2],
"react/jsx-indent-props": ["warn", 2],
@@ -131,10 +145,7 @@ module.exports = {
"react/jsx-max-depth": ["off"], // rule throws exception in single-dimension-measure
"react/jsx-filename-extension": ["warn"],
"react/prefer-stateless-function": ["warn"],
"react/no-set-state": ["warn"]
"react/no-set-state": ["warn"],
},
extends: [
"eslint:all",
"plugin:react/all"
]
}
extends: ["eslint:all", "plugin:react/all"],
};

View File

@@ -24,7 +24,8 @@ gulp.task('qext', function () {
repository: pkg.repository,
dependencies: {
'qlik-sense': '>=5.5.x'
}
},
__next: true
};
if (pkg.contributors) {
qext.contributors = pkg.contributors;

View File

@@ -143,15 +143,13 @@ class DataTable extends React.PureComponent {
}
// eslint-disable-next-line no-shadow
const { dimension1: dimension1Info, dimension2, measurement } = measurementData.parents;
const id = `${dimension1Info.elementNumber}-${dimension2 && dimension2.elementNumber}-${measurement.header}-${measurement.index}`;
return (
<DataCell
cellWidth={cellWidth}
component={component}
data={data}
general={general}
key={`${dimensionEntry.displayValue}-${id}`}
key={`${Math.random()}-${new Date().getTime()}`}
measurement={measurementData}
styleBuilder={styleBuilder}
styling={styling}

View File

@@ -86,6 +86,6 @@ export function initializeDesignList (component, layout) {
resolve(data);
};
stylingField.OnData.bind(listener);
stylingField.getData();
stylingField.getData({ rows: 5000 });
});
}

View File

@@ -2,7 +2,6 @@ import definition from "./definition";
import { exportXLS } from "./excel-export";
import { initializeDataCube, initializeDesignList } from "./dataset";
import initializeStore from "./store";
import qlik from "qlik";
import React from "react";
import ReactDOM from "react-dom";
import Root from "./root.jsx";
@@ -13,7 +12,7 @@ if (!window._babelPolyfill) {
require("@babel/polyfill"); // eslint-disable-line global-require
}
export default {
export default ({ flags }) => ({
design: {
dimensions: {
max: 1,
@@ -106,16 +105,21 @@ export default {
return snapshotLayout;
},
async getContextMenu (obj, menu) {
const app = qlik.currApp(this);
const isPersonalResult = await app.global.isPersonalMode();
if (
!this.$scope.layout.allowexportxls ||
(isPersonalResult && isPersonalResult.qReturn)
) {
if (!this.$scope.layout.allowexportxls) {
return menu;
}
if (this.backendApi.model.layout.qMeta.privileges.indexOf('exportdata') !== -1) {
const app = this.backendApi.model.app;
const isPersonalResult = await app.global.isPersonalMode();
// Export as XLS option is removed from desktop because the desktop wrapper blocks downloads.
// Enabled for windows and QCS
// isPersonalMode returns true for both desktop and QCS
// By checking both if has download dialog and if is QCS can enable Export as XLS option on QCS
if (
(this.backendApi.model.layout.qMeta.privileges.includes('exportdata') && !isPersonalResult) ||
(flags.isEnabled('DOWNLOAD_USE_REPORTING') && isPersonalResult)
) {
menu.addItem({
translation: 'Export as XLS',
tid: 'export-excel',
@@ -133,4 +137,4 @@ export default {
return menu;
},
version: 1.0
};
});

View File

@@ -1,50 +1,55 @@
import { distinctArray } from './utilities';
import { distinctArray } from "./utilities";
export const HEADER_FONT_SIZE = {
SMALL: -1,
MEDIUM: 1
MEDIUM: 1,
};
function getAlignment (option) {
function getAlignment(option) {
const alignmentOptions = {
1: 'left',
2: 'center',
3: 'right'
1: "left",
2: "center",
3: "right",
};
return alignmentOptions[option] || 'left';
return alignmentOptions[option] || "left";
}
function getFontSizeAdjustment (option) {
function getFontSizeAdjustment(option) {
const fontSizeAdjustmentOptions = {
1: HEADER_FONT_SIZE.SMALL,
2: HEADER_FONT_SIZE.MEDIUM
2: HEADER_FONT_SIZE.MEDIUM,
};
return fontSizeAdjustmentOptions[option] || 0;
}
function generateMeasurements (information) {
return information.map(measurement => {
function generateMeasurements(information) {
return information.map((measurement) => {
const transformedMeasurement = {
format: measurement.qNumFormat.qFmt || '#.##0',
name: measurement.qFallbackTitle
format: measurement.qNumFormat.qFmt || "#.##0",
name: measurement.qFallbackTitle,
};
return transformedMeasurement;
});
}
function generateDimensionEntry (information, data) {
function generateDimensionEntry(information, data) {
return {
displayValue: data.qText || data.qNum,
elementNumber: data.qElemNumber,
name: information.qFallbackTitle,
value: data.qNum
value: data.qNum,
};
}
function generateMatrixCell ({ cell, dimension1Information, dimension2Information, measurementInformation }) {
function generateMatrixCell({
cell,
dimension1Information,
dimension2Information,
measurementInformation,
}) {
const matrixCell = {
displayValue: cell.qText,
format: measurementInformation.format,
@@ -52,28 +57,32 @@ function generateMatrixCell ({ cell, dimension1Information, dimension2Informatio
parents: {
dimension1: {
elementNumber: dimension1Information.qElemNumber,
header: dimension1Information.qText
header: dimension1Information.qText,
},
measurement: {
header: measurementInformation.name,
index: measurementInformation.index
}
index: measurementInformation.index,
},
},
value: cell.qNum
value: cell.qNum,
};
if (dimension2Information) {
matrixCell.parents.dimension2 = {
elementNumber: dimension2Information.qElemNumber,
header: dimension2Information.qText
header: dimension2Information.qText,
};
}
return matrixCell;
}
function generateDataSet (component, dimensionsInformation, measurementsInformation, dataCube) {
function generateDataSet(
component,
dimensionsInformation,
measurementsInformation,
dataCube
) {
const measurements = generateMeasurements(measurementsInformation);
let dimension1 = [];
let dimension2 = [];
@@ -83,13 +92,19 @@ function generateDataSet (component, dimensionsInformation, measurementsInformat
// eslint-disable-next-line no-undefined
for (let index = 0; dataCube[index] !== undefined; index++) {
// eslint-disable-next-line no-loop-func
dataCube[index].forEach(row => {
const dimension1Entry = generateDimensionEntry(dimensionsInformation[0], row[0]);
dataCube[index].forEach((row) => {
const dimension1Entry = generateDimensionEntry(
dimensionsInformation[0],
row[0]
);
dimension1.push(dimension1Entry);
let dimension2Entry;
let firstDataCell = 1;
if (hasSecondDimension) {
dimension2Entry = generateDimensionEntry(dimensionsInformation[1], row[1]);
dimension2Entry = generateDimensionEntry(
dimensionsInformation[1],
row[1]
);
dimension2.push(dimension2Entry);
firstDataCell = 2;
}
@@ -104,16 +119,19 @@ function generateDataSet (component, dimensionsInformation, measurementsInformat
cell,
dimension1Information,
dimension2Information,
measurementInformation
measurementInformation,
});
return generatedCell;
});
let appendToRowIndex = matrix.length;
if (hasSecondDimension) {
// See if there already is a row for the current dim1
// See if there already is a row for the current dim1
for (let i = 0; i < matrix.length; i++) {
if (matrix[i][0].parents.dimension1.header === matrixRow[0].parents.dimension1.header) {
if (
matrix[i][0].parents.dimension1.header ===
matrixRow[0].parents.dimension1.header
) {
appendToRowIndex = i;
matrixRow = matrix[i].concat(matrixRow);
}
@@ -131,34 +149,44 @@ function generateDataSet (component, dimensionsInformation, measurementsInformat
dimension1: dimension1,
dimension2: dimension2,
matrix,
measurements
measurements,
};
}
function initializeTransformed ({ component, dataCube, designList, layout }) {
function initializeTransformed({
$element,
component,
dataCube,
designList,
layout,
}) {
const dimensionsInformation = component.backendApi.getDimensionInfos();
const measurementsInformation = component.backendApi.getMeasureInfos();
const dimensionCount = layout.qHyperCube.qDimensionInfo.length;
const {
dimension1,
dimension2,
measurements,
matrix
} = generateDataSet(component, dimensionsInformation, measurementsInformation, dataCube);
const { dimension1, dimension2, measurements, matrix } = generateDataSet(
component,
dimensionsInformation,
measurementsInformation,
dataCube
);
const customSchemaBasic = [];
const customSchemaFull = [];
let customHeadersCount = 0;
if (designList && designList.length > 0) {
const headers = designList[0].split(';');
const headers = designList[0].split(";");
customHeadersCount = headers.length;
for (let lineNumber = 0; lineNumber < designList.length; lineNumber += 1) {
customSchemaFull[lineNumber] = new Array(headers.length);
const data = designList[lineNumber].split(';');
const data = designList[lineNumber].split(";");
if (data.length === headers.length) {
for (let headerIndex = 0; headerIndex < headers.length; headerIndex += 1) {
for (
let headerIndex = 0;
headerIndex < headers.length;
headerIndex += 1
) {
[customSchemaBasic[lineNumber]] = data;
customSchemaFull[lineNumber][headerIndex] = data[headerIndex];
}
@@ -172,25 +200,28 @@ function initializeTransformed ({ component, dataCube, designList, layout }) {
// the widths as percentages of the available width. However, this often results in random
// columns getting 1px wider than the others because of rounding necessary to fill the width.
// This 1px causes missalignment between the data- and header tables.
cellWidth = '';
cellWidth = "";
} else {
// If using the previous solution just set 60px
cellWidth = `${layout.columnwidthslider > 10 ? layout.columnwidthslider : 60}px`;
cellWidth = `${
layout.columnwidthslider > 10 ? layout.columnwidthslider : 60
}px`;
}
// top level properties could be reducers and then components connect to grab what they want,
// possibly with reselect for some presentational transforms (moving some of the presentational logic like formatting and such)
const transformedProperties = {
element: $element[0],
data: {
headers: {
dimension1, // column headers
dimension2, // parent row headers if exists
measurements // row headers, looped for each dimension2 if exists
measurements, // row headers, looped for each dimension2 if exists
},
matrix, // 2d array of all rows/cells to render in body of datatable
meta: {
dimensionCount: dimensionsInformation.length
}
dimensionCount: dimensionsInformation.length,
},
},
general: {
allowExcelExport: layout.allowexportxls,
@@ -200,23 +231,25 @@ function initializeTransformed ({ component, dataCube, designList, layout }) {
footnote: layout.footnote,
subtitle: layout.subtitle,
title: layout.title,
useColumnSeparator: layout.separatorcols && dimensionCount > 1
useColumnSeparator: layout.separatorcols && dimensionCount > 1,
},
selection: {
dimensionSelectionCounts: dimensionsInformation.map(dimensionInfo => dimensionInfo.qStateCounts.qSelected)
dimensionSelectionCounts: dimensionsInformation.map(
(dimensionInfo) => dimensionInfo.qStateCounts.qSelected
),
},
styling: {
customCSV: {
basic: customSchemaBasic,
count: customHeadersCount,
full: customSchemaFull
full: customSchemaFull,
},
hasCustomFileStyle: Boolean(designList),
headerOptions: {
alignment: getAlignment(layout.HeaderAlign),
colorSchema: layout.HeaderColorSchema.color,
fontSizeAdjustment: getFontSizeAdjustment(layout.lettersizeheader),
textColor: layout.HeaderTextColorSchema.color
textColor: layout.HeaderTextColorSchema.color,
},
options: {
backgroundColor: layout.rowEvenBGColor,
@@ -224,38 +257,42 @@ function initializeTransformed ({ component, dataCube, designList, layout }) {
color: layout.BodyTextColorSchema,
fontFamily: layout.FontFamily,
fontSizeAdjustment: getFontSizeAdjustment(layout.lettersize),
textAlignment: layout.cellTextAlignment
textAlignment: layout.cellTextAlignment,
},
conditionalColoring: {
enabled: layout.conditionalcoloring.enabled,
colorAllRows: layout.conditionalcoloring.colorall,
rows: layout.conditionalcoloring.rows.map(row => row.rowname),
colorAllMeasures: typeof layout.conditionalcoloring.colorallmeasures === 'undefined'
|| layout.conditionalcoloring.colorallmeasures,
rows: layout.conditionalcoloring.rows.map((row) => row.rowname),
colorAllMeasures:
typeof layout.conditionalcoloring.colorallmeasures === "undefined" ||
layout.conditionalcoloring.colorallmeasures,
measures: !layout.conditionalcoloring.measures
? [] : layout.conditionalcoloring.measures.split(',').map(index => Number(index)),
? []
: layout.conditionalcoloring.measures
.split(",")
.map((index) => Number(index)),
threshold: {
poor: layout.conditionalcoloring.threshold_poor,
fair: layout.conditionalcoloring.threshold_fair
fair: layout.conditionalcoloring.threshold_fair,
},
colors: {
poor: {
color: layout.conditionalcoloring.color_poor,
textColor: layout.conditionalcoloring.textcolor_poor
textColor: layout.conditionalcoloring.textcolor_poor,
},
fair: {
color: layout.conditionalcoloring.color_fair,
textColor: layout.conditionalcoloring.textcolor_fair
textColor: layout.conditionalcoloring.textcolor_fair,
},
good: {
color: layout.conditionalcoloring.color_good,
textColor: layout.conditionalcoloring.textcolor_good
}
}
textColor: layout.conditionalcoloring.textcolor_good,
},
},
},
symbolForNulls: layout.symbolfornulls,
usePadding: layout.indentbool
}
usePadding: layout.indentbool,
},
};
return transformedProperties;

View File

@@ -5,37 +5,15 @@ import DataTable from "./data-table/index.jsx";
import { LinkedScrollWrapper, LinkedScrollSection } from "./linked-scroll";
class Root extends React.PureComponent {
constructor (props) {
super(props);
this.onDataTableRefSet = this.onDataTableRefSet.bind(this);
this.renderedTableWidth = 0;
}
componentDidUpdate () {
let tableWidth;
if (this.dataTableRef) {
tableWidth = this.dataTableRef.getBoundingClientRect().width;
if (this.renderedTableWidth !== tableWidth) {
this.forceUpdate();
}
}
}
onDataTableRefSet (element) {
this.dataTableRef = element;
this.forceUpdate();
}
render () {
const { editmodeClass, component, state } = this.props;
const { data, general, styling, error } = state;
const { data, general, styling, error, element } = state;
// Determine cell- and column separator width
let cellWidth = '0px';
let columnSeparatorWidth = '';
if (this.dataTableRef && !error) {
const tableWidth = this.dataTableRef.getBoundingClientRect().width;
this.renderedTableWidth = tableWidth;
if (!error && element) {
const tableWidth = element.getBoundingClientRect().width;
if (general.cellWidth) {
cellWidth = general.cellWidth;
@@ -43,7 +21,8 @@ class Root extends React.PureComponent {
columnSeparatorWidth = '8px';
}
} else {
const headerMarginRight = 8;
// 230 is the left "header", rest is magic margins
const headerMarginRight = 8 + 230 + 20;
const borderWidth = 1;
const rowCellCount = data.matrix[0].length;
@@ -99,7 +78,6 @@ class Root extends React.PureComponent {
<div
className={`data-table ${editmodeClass}`}
style={{ width: general.cellWidth ? 'auto' : '100%' }}
ref={this.onDataTableRefSet}
>
<LinkedScrollSection linkHorizontal>
<HeadersTable

View File

@@ -3,9 +3,10 @@ const packageJSON = require('./package.json');
const path = require('path');
const DIST = path.resolve("./dist");
// eslint-disable-next-line no-process-env
const MODE = process.env.NODE_ENV || 'development';
const SOURCE_MAP = 'sourec-map';
const DEVTOOL = (process.env.NODE_ENV === 'development') ? SOURCE_MAP : false;
const SOURCE_MAP = 'source-map';
const DEVTOOL = MODE === 'development' ? SOURCE_MAP : false;
console.log('Webpack mode:', MODE); // eslint-disable-line no-console