diff --git a/gulpfile.js b/gulpfile.js index ae9e94d..d4433a4 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -9,49 +9,52 @@ var pkg = require('./package.json'); var DIST = './dist'; var VERSION = process.env.VERSION || 'local-dev'; -gulp.task('qext', function () { - var qext = { - name: 'P&L pivot', - type: 'visualization', - description: pkg.description + '\nVersion: ' + VERSION, - version: VERSION, - icon: 'pivot-table', - preview: 'qlik-smart-pivot.png', - keywords: 'qlik-sense, visualization', - author: pkg.author, - homepage: pkg.homepage, - license: pkg.license, - repository: pkg.repository, - dependencies: { - 'qlik-sense': '>=5.5.x' - }, - __next: true - }; - if (pkg.contributors) { - qext.contributors = pkg.contributors; - } - var src = require('stream').Readable({ - objectMode: true - }); - src._read = function () { - this.push(new gutil.File({ - cwd: '', - base: '', - path: pkg.name + '.qext', - contents: Buffer.from(JSON.stringify(qext, null, 4)) - })); - this.push(null); - }; - return src.pipe(gulp.dest(DIST)); +gulp.task("qext", function () { + var qext = { + name: "P&L pivot", + type: "visualization", + description: pkg.description + "\nVersion: " + VERSION, + version: VERSION, + icon: "pivot-table", + preview: "qlik-smart-pivot.png", + keywords: "qlik-sense, visualization", + author: pkg.author, + homepage: pkg.homepage, + license: pkg.license, + repository: pkg.repository, + dependencies: { + "qlik-sense": ">=5.5.x", + }, + __next: true, + }; + if (pkg.contributors) { + qext.contributors = pkg.contributors; + } + var src = require("stream").Readable({ + objectMode: true, + }); + src._read = function () { + this.push( + new gutil.File({ + cwd: "", + base: "", + path: "qlik-smart-pivot.qext", + contents: Buffer.from(JSON.stringify(qext, null, 4)), + }) + ); + this.push(null); + }; + return src.pipe(gulp.dest(DIST)); }); -gulp.task('clean', function(){ +gulp.task("clean", function () { return del([DIST], { force: true }); }); -gulp.task('zip-build', function(){ - return gulp.src(DIST + '/**/*') - .pipe(zip(`${pkg.name}_${VERSION}.zip`)) +gulp.task("zip-build", function () { + return gulp + .src(DIST + "/**/*") + .pipe(zip(`qlik-smart-pivot_${VERSION}.zip`)) .pipe(gulp.dest(DIST)); }); diff --git a/package.json b/package.json index a54383f..eeaba6f 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "qlik-smart-pivot", + "name": "@qlik/qlik-smart-pivot", "version": "0.0.1", "description": "Profit & Loss reporting with color and font customizations.", "homepage": "", diff --git a/scripts/verify-files.sh b/scripts/verify-files.sh index fb30cd5..934489f 100644 --- a/scripts/verify-files.sh +++ b/scripts/verify-files.sh @@ -6,15 +6,8 @@ set -o errexit echo "Verifying built file count" -while read line; do - if [[ $line =~ ^\"name\": ]]; then - name=${line#*: \"} - name=${name%\"*} - fi -done < package.json - expected_file_count=$(($(find dist -type f | wc -l)-1)) -zip_file_count=$(zipinfo dist/${name}_${VERSION}.zip | grep ^- | wc -l) +zip_file_count=$(zipinfo dist/qlik-smart-pivot_${VERSION}.zip | grep ^- | wc -l) if [ "${expected_file_count}" -ne "${zip_file_count}" ]; then # File count is incorrect diff --git a/webpack.config.js b/webpack.config.js index 3b11542..424fb8b 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,70 +12,63 @@ console.log('Webpack mode:', MODE); // eslint-disable-line no-console const config = { devtool: DEVTOOL, - entry: ['./src/index.js'], + entry: ["./src/index.js"], externals: { jquery: { - amd: 'jquery', - commonjs: 'jquery', - commonjs2: 'jquery', - root: '_' + amd: "jquery", + commonjs: "jquery", + commonjs2: "jquery", + root: "_", }, qlik: { - amd: 'qlik', - commonjs: 'qlik', - commonjs2: 'qlik', - root: '_' - } + amd: "qlik", + commonjs: "qlik", + commonjs2: "qlik", + root: "_", + }, }, mode: MODE, module: { rules: [ { - enforce: 'pre', + enforce: "pre", exclude: /(node_modules|Library)/, - loader: 'eslint-loader', + loader: "eslint-loader", options: { - failOnError: true + failOnError: true, }, - test: /\.(js|jsx)$/ + test: /\.(js|jsx)$/, }, { exclude: /node_modules/, test: /\.(js|jsx)$/, use: { - loader: 'babel-loader', + loader: "babel-loader", options: { plugins: [ - '@babel/plugin-transform-async-to-generator', - '@babel/plugin-proposal-class-properties' + "@babel/plugin-transform-async-to-generator", + "@babel/plugin-proposal-class-properties", ], - presets: [ - '@babel/preset-env', - '@babel/preset-react' - ] - } - } + presets: ["@babel/preset-env", "@babel/preset-react"], + }, + }, }, { test: /.less$/, - use: [ - 'style-loader', - 'css-loader', - 'less-loader' - ] - } - ] + use: ["style-loader", "css-loader", "less-loader"], + }, + ], }, output: { - filename: `${packageJSON.name}.js`, - libraryTarget: 'amd', - path: DIST + filename: "qlik-smart-pivot.js", + libraryTarget: "amd", + path: DIST, }, plugins: [ new StyleLintPlugin({ - files: '**/*.less' - }) - ] + files: "**/*.less", + }), + ], }; module.exports = config;