@mx51/spi-client-js
Advanced tools
Comparing version 2.9.4 to 2.9.6
module.exports = function (config) { | ||
'use strict'; | ||
function getWebackConfig({ exclude, plugins } = {}) { | ||
return { | ||
test: /\.m?js$/, | ||
exclude, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['@babel/preset-env'], | ||
plugins: [ | ||
[ | ||
'@babel/transform-runtime', | ||
{ | ||
'regenerator': true, | ||
} | ||
], | ||
...(Array.isArray(plugins) ? plugins : []), | ||
] | ||
} | ||
}, | ||
}; | ||
} | ||
config.set({ | ||
// base path that will be used to resolve all patterns (eg. files, exclude) | ||
basePath: './', | ||
// frameworks to use | ||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter | ||
frameworks: ['jasmine'], | ||
// list of files / patterns to load in the browser | ||
files: [ | ||
// Our code | ||
// './src/**/*.js', | ||
{ pattern: 'test-context.js', watched: false }, | ||
// Include the unit tests | ||
// './tests/**/*.spec.js', | ||
// Mock fixtures | ||
'./tests/fixtures/**/*.json' | ||
basePath: '', | ||
frameworks: ["jasmine", "karma-typescript"], | ||
files: ['src/**/*.ts', | ||
'tests/utils/*', | ||
'tests/services/*', | ||
'tests/*.spec.ts' | ||
], | ||
// plugins: [ | ||
// 'karma-json-fixtures-preprocessor' | ||
// ], | ||
// list of files to exclude | ||
exclude: [ | ||
], | ||
// preprocess matching files before serving them to the browser | ||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor | ||
preprocessors: { | ||
'src/**/*.js': ['coverage'], | ||
'./tests/fixtures/**/*.json': ['json_fixtures'], | ||
'test-context.js': ['webpack', 'sourcemap'], | ||
"tests/**/*.ts": ["karma-typescript"], | ||
"src/**/*.ts": ["karma-typescript"], | ||
}, | ||
webpack: { | ||
devtool: 'inline-source-map', | ||
mode: 'development', | ||
module: { | ||
rules: [ | ||
// two seperate rules are required so that spec files are not instrumented | ||
// and included in coverage reporting | ||
getWebackConfig({ exclude: [/(bower_components|node_modules|tests)/], plugins: [ 'istanbul' ] }), | ||
getWebackConfig({ exclude: [/(bower_components|node_modules)/] }), | ||
] | ||
}, | ||
watch: true | ||
karmaTypescriptConfig : { | ||
tsconfig: './tsconfig.test.json', | ||
}, | ||
webpackServer: { | ||
noInfo: true | ||
}, | ||
jsonFixturesPreprocessor: { | ||
// strip this from the file path \ fixture name | ||
stripPrefix: 'tests/fixtures/' | ||
}, | ||
junitReporter: { | ||
@@ -92,10 +23,6 @@ outputDir: 'test/junit', | ||
useBrowserName: false | ||
}, | ||
// test results reporter to use | ||
// possible values: 'dots', 'progress' | ||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter | ||
reporters: ['progress', 'coverage', 'junit'], | ||
}, | ||
// code coverage reporter | ||
reporters: ["progress", "karma-typescript", 'junit'], | ||
coverageReporter: { | ||
@@ -108,3 +35,3 @@ dir: 'coverage', | ||
{ type: 'text' }, | ||
] | ||
] | ||
}, | ||
@@ -115,23 +42,19 @@ | ||
// enable / disable colors in the output (reporters and logs) | ||
colors: true, | ||
// level of logging | ||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG | ||
logLevel: config.LOG_ERROR, | ||
logLevel: config.LOG_INFO, | ||
// enable / disable watching file and executing tests whenever any file changes | ||
autoWatch: true, | ||
// start these browsers | ||
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher | ||
browsers: ['ChromeHeadlessNoSandbox'], | ||
browsers: ['ChromeHeadlessNoSandbox'], | ||
customLaunchers: { | ||
ChromeHeadlessNoSandbox: { | ||
base: 'ChromeHeadless', | ||
flags: ['--no-sandbox'] | ||
base: 'ChromeHeadless', | ||
flags: ['--no-sandbox'] | ||
} | ||
@@ -142,5 +65,6 @@ }, | ||
// if true, Karma captures browsers, runs the tests and exits | ||
singleRun: true | ||
singleRun: true, | ||
concurrency: Infinity | ||
}); | ||
}; | ||
{ | ||
"name": "@mx51/spi-client-js", | ||
"version": "2.9.4", | ||
"version": "2.9.6", | ||
"description": "JavaScript Client Library for mx51's In-Store Integration.", | ||
"main": "dist/spi-client-js.js", | ||
"typings": "dist/index.d.ts", | ||
"scripts": { | ||
"start": "webpack-dev-server --open --colors --public localhost:3000", | ||
"build": "webpack -p", | ||
"build:dev": "webpack", | ||
"build": "webpack --mode=production", | ||
"build:dev": "webpack --mode=development", | ||
"test": "karma start", | ||
"transpile": "babel src --out-file ./dist/spi-client-js.js", | ||
"prepare": "npm run snyk-protect", | ||
"prepare": "npm run snyk-protect && husky install", | ||
"snyk-auth": "snyk auth", | ||
"snyk-monitor": "snyk monitor", | ||
"snyk-protect": "snyk protect" | ||
"snyk-protect": "snyk protect", | ||
"lint": "eslint \"src/**/*.ts\" --ext .ts", | ||
"validate": "echo \"Validating Typescript. No files will be emitted. Please wait...\" && tsc --noEmit --pretty --diagnostics && echo \"Validation Completed. Exiting\"" | ||
}, | ||
@@ -36,2 +39,6 @@ "repository": { | ||
"@babel/preset-env": "^7.15.0", | ||
"@types/jasmine": "^4.3.1", | ||
"@types/node": "^18.11.18", | ||
"@typescript-eslint/eslint-plugin": "^5.45.1", | ||
"@typescript-eslint/parser": "^5.45.1", | ||
"babel-loader": "^8.2.2", | ||
@@ -41,15 +48,24 @@ "babel-plugin-istanbul": "^6.0.0", | ||
"core-js": "^3.16.1", | ||
"eslint": "^8.29.0", | ||
"husky": "^8.0.2", | ||
"jasmine": "^3.8.0", | ||
"karma": "^6.3.4", | ||
"karma": "^6.4.1", | ||
"karma-chrome-launcher": "^3.1.0", | ||
"karma-coverage": "^2.0.3", | ||
"karma-cli": "^2.0.0", | ||
"karma-coverage": "^2.2.0", | ||
"karma-jasmine": "^4.0.1", | ||
"karma-json-fixtures-preprocessor": "0.0.6", | ||
"karma-junit-reporter": "2.0.1", | ||
"karma-sourcemap-loader": "^0.3.8", | ||
"karma-webpack": "^4.0.2", | ||
"snyk": "^1.679.0", | ||
"webpack": "^4.46.0", | ||
"webpack-cli": "^3.3.12", | ||
"webpack-dev-server": "^3.11.2", | ||
"karma-spec-reporter": "0.0.32", | ||
"karma-typescript": "^5.5.3", | ||
"karma-webpack": "5.0.0", | ||
"npm-dts-webpack-plugin": "^1.3.12", | ||
"snyk": "^1.1071.0", | ||
"ts-loader": "^8.3.0", | ||
"ts-node": "^10.8.2", | ||
"ts-node-dev": "^2.0.0", | ||
"typescript": "^4.6.4", | ||
"webpack": "^5.75.0", | ||
"webpack-cli": "^5.0.1", | ||
"webpack-dev-server": "^4.11.1", | ||
"webpack-visualizer-plugin": "^0.1.11" | ||
@@ -56,0 +72,0 @@ }, |
@@ -73,3 +73,4 @@ { | ||
"terminal_id": "100000000000", | ||
"transaction_range": "000000-000000" | ||
"transaction_range": "000000-000000", | ||
"pos_ref_id": "nicePos" | ||
}, | ||
@@ -76,0 +77,0 @@ "datetime": "2000-01-01T00:00:00.000", |
@@ -85,3 +85,4 @@ { | ||
"terminal_id": "100000000000", | ||
"transaction_range": "000000-000000" | ||
"transaction_range": "000000-000000", | ||
"pos_ref_id": "pos_id" | ||
}, | ||
@@ -88,0 +89,0 @@ "datetime": "2000-01-01T00:00:00.000", |
@@ -1,73 +0,56 @@ | ||
const path = require('path'); | ||
const fs = require("fs"); | ||
const webpack = require('webpack'); | ||
const apiMocker = require('connect-api-mocker'); | ||
const Visualizer = require('webpack-visualizer-plugin'); | ||
/* | ||
* Copyright 2019 Nazmul Idris. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
const path = require('path'); | ||
const NpmDtsPlugin = require('npm-dts-webpack-plugin') | ||
const isProd = process.argv.indexOf("-p") !== -1; | ||
const sourcePath = path.resolve(__dirname,'src'); | ||
const outputPath = path.resolve(__dirname,'dist'); | ||
const isProd = process.argv.indexOf("-p") !== -1; | ||
const pkg = JSON.parse(fs.readFileSync('./package.json')); | ||
const config = { | ||
mode: isProd ? "production" : "development", | ||
entry: './index.js', | ||
output: { | ||
filename: 'spi-client-js.js', | ||
path: outputPath, | ||
libraryTarget: 'umd', | ||
}, | ||
devServer: { | ||
historyApiFallback: true, | ||
noInfo: true, | ||
contentBase: outputPath, | ||
compress: true, | ||
hot: true, | ||
port: 3000, | ||
host: 'localhost', | ||
disableHostCheck: true, | ||
before: function(app) { | ||
app.use('/api', apiMocker('/mocks/api')); | ||
} | ||
}, | ||
resolve: { | ||
extensions: ['.js'] | ||
}, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.m?js$/, | ||
exclude: /(node_modules|bower_components)/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['@babel/preset-env'] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
plugins: [ | ||
new Visualizer({ | ||
filename: '../coverage/statistics.html' | ||
}), | ||
] | ||
module.exports = { | ||
entry: './src/index.ts', | ||
devtool: isProd ? 'source-map' : 'inline-source-map', | ||
mode: isProd ? "production" : "development", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
use: 'ts-loader', | ||
exclude: /node_modules/ | ||
} | ||
], | ||
}, | ||
resolve: { | ||
extensions: ['.ts', '.js'], | ||
}, | ||
output: { | ||
filename: 'spi-client-js.js', | ||
path: path.resolve(__dirname, './dist'), | ||
libraryTarget: 'umd', | ||
globalObject: 'this', | ||
}, | ||
devServer: { | ||
contentBase: path.join(__dirname, './dist'), | ||
compress: true, | ||
hot: true, | ||
}, | ||
plugins: [ | ||
new NpmDtsPlugin({ | ||
output: 'dist/index.d.ts' | ||
}) | ||
// new TypescriptDeclarationPlugin({ | ||
// removeComments: false, | ||
// }), | ||
], | ||
}; | ||
if(isProd) { | ||
config.devtool = "source-map"; | ||
} else { | ||
config.plugins.push(new webpack.HotModuleReplacementPlugin()); | ||
config.devtool = "inline-source-map"; | ||
} | ||
module.exports = config; | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
1591306
106
12215
0
1
35