From 9108737d55300d8a4f822ba94335d8b53f04854d Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Sun, 7 Apr 2019 20:33:11 +0300 Subject: Webpack 4, ESLint with Vue, Node-sass, updated dependencies overall. New linting. --- build/utils.js | 75 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 36 deletions(-) (limited to 'build/utils.js') diff --git a/build/utils.js b/build/utils.js index 5b90db14..3beee774 100644 --- a/build/utils.js +++ b/build/utils.js @@ -1,61 +1,64 @@ var path = require('path') var config = require('../config') -var ExtractTextPlugin = require('extract-text-webpack-plugin') +var sass = require('sass') +var MiniCssExtractPlugin = require('mini-css-extract-plugin') exports.assetsPath = function (_path) { var assetsSubDirectory = process.env.NODE_ENV === 'production' - ? config.build.assetsSubDirectory - : config.dev.assetsSubDirectory + ? config.build.assetsSubDirectory + : config.dev.assetsSubDirectory return path.posix.join(assetsSubDirectory, _path) } exports.cssLoaders = function (options) { options = options || {} - // generate loader string to be used with extract text plugin - function generateLoaders (loaders) { - var sourceLoader = loaders.map(function (loader) { - var extraParamChar - if (/\?/.test(loader)) { - loader = loader.replace(/\?/, '-loader?') - extraParamChar = '&' - } else { - loader = loader + '-loader' - extraParamChar = '?' - } - return loader + (options.sourceMap ? extraParamChar + 'sourceMap' : '') - }).join('!') + function generateLoaders (loaders) { // Extract CSS when that option is specified // (which is the case during production build) if (options.extract) { - return ExtractTextPlugin.extract('vue-style-loader', sourceLoader) + return [MiniCssExtractPlugin.loader].concat(loaders) } else { - return ['vue-style-loader', sourceLoader].join('!') + return ['vue-style-loader'].concat(loaders) } } // http://vuejs.github.io/vue-loader/configurations/extract-css.html - return { - css: generateLoaders(['css']), - postcss: generateLoaders(['css']), - less: generateLoaders(['css', 'less']), - sass: generateLoaders(['css', 'sass?indentedSyntax']), - scss: generateLoaders(['css', 'sass']), - stylus: generateLoaders(['css', 'stylus']), - styl: generateLoaders(['css', 'stylus']) - } + return [ + { + test: /\.(post)?css$/, + use: generateLoaders(['css-loader']), + }, + { + test: /\.less$/, + use: generateLoaders(['css-loader', 'less-loader']), + }, + { + test: /\.sass$/, + use: generateLoaders([ + 'css-loader', + { + loader: 'sass-loader', + options: { + indentedSyntax: true + } + } + ]) + }, + { + test: /\.scss$/, + use: generateLoaders(['css-loader', 'sass-loader']) + }, + { + test: /\.styl(us)?$/, + use: generateLoaders(['css-loader', 'stylus-loader']), + }, + ] } // Generate loaders for standalone style files (outside of .vue) exports.styleLoaders = function (options) { - var output = [] - var loaders = exports.cssLoaders(options) - for (var extension in loaders) { - var loader = loaders[extension] - output.push({ - test: new RegExp('\\.' + extension + '$'), - loader: loader - }) - } + var output = exports.cssLoaders(options) + console.log(output) return output } -- cgit v1.2.3-70-g09d2 From 52475dbf23ee1ccee1c6cbc23cfd7b4af23dd8a9 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Tue, 21 May 2019 21:22:00 +0300 Subject: Fix pipelines and clean up console output --- build/utils.js | 4 +--- build/webpack.prod.conf.js | 2 -- test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js | 4 ++-- 3 files changed, 3 insertions(+), 7 deletions(-) (limited to 'build/utils.js') diff --git a/build/utils.js b/build/utils.js index 3beee774..b45ffc16 100644 --- a/build/utils.js +++ b/build/utils.js @@ -58,7 +58,5 @@ exports.cssLoaders = function (options) { // Generate loaders for standalone style files (outside of .vue) exports.styleLoaders = function (options) { - var output = exports.cssLoaders(options) - console.log(output) - return output + return exports.cssLoaders(options) } diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js index e7d25bfe..ed11ebad 100644 --- a/build/webpack.prod.conf.js +++ b/build/webpack.prod.conf.js @@ -14,8 +14,6 @@ let commitHash = require('child_process') .execSync('git rev-parse --short HEAD') .toString(); -console.log(commitHash) - var webpackConfig = merge(baseWebpackConfig, { mode: 'production', module: { diff --git a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js index bae890f8..3d34c5cc 100644 --- a/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js +++ b/test/unit/specs/services/entity_normalizer/entity_normalizer.spec.js @@ -322,9 +322,9 @@ describe('API Entities normalizer', () => { describe('MastoAPI emoji adder', () => { const emojis = makeMockEmojiMasto() - const imageHtml = 'image' + const imageHtml = 'image' .replace(/"/g, '\'') - const thinkHtml = 'thinking' + const thinkHtml = 'thinking' .replace(/"/g, '\'') it('correctly replaces shortcodes in supplied string', () => { -- cgit v1.2.3-70-g09d2