Skip to content

Commit

Permalink
Minimize formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Sep 22, 2023
1 parent 4fc2934 commit d9bc072
Show file tree
Hide file tree
Showing 4 changed files with 274 additions and 262 deletions.
26 changes: 13 additions & 13 deletions config/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
const webpackConfig = require("./webpack.config.browser.js");
const webpackConfig = require('./webpack.config.browser.js');

delete webpackConfig.output;
delete webpackConfig.entry; // karma fills these in
webpackConfig.plugins.shift(); // drop eslinter plugin

module.exports = function (config) {
config.set({
frameworks: ["mocha", "sinon-chai"],
browsers: ["FirefoxHeadless", "ChromeHeadless"],
frameworks: ['mocha', 'sinon-chai'],
browsers: ['FirefoxHeadless', 'ChromeHeadless'],

files: [
"../dist/stellar-sdk.js", // webpack should build this first
"../test/test-browser.js",
"../test/unit/**/*.js",
'../dist/stellar-sdk.js', // webpack should build this first
'../test/test-browser.js',
'../test/unit/**/*.js'
],

preprocessors: {
"../test/**/*.js": ["webpack"],
'../test/**/*.js': ['webpack']
},

webpack: webpackConfig,
webpackMiddleware: {
noInfo: true,
noInfo: true
},

colors: true,
singleRun: true,

reporters: ["dots", "coverage"],
reporters: ['dots', 'coverage'],
coverageReporter: {
type: "text-summary",
type: 'text-summary',
instrumenterOptions: {
istanbul: { noCompact: true },
},
},
istanbul: { noCompact: true }
}
}
});
};
12 changes: 6 additions & 6 deletions config/prettier.config.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {
arrowParens: "always",
arrowParens: 'always',
bracketSpacing: true,
bracketSameLine: false,
printWidth: 80,
proseWrap: "always",
proseWrap: 'always',
semi: true,
singleQuote: false,
singleQuote: true,
tabWidth: 2,
parser: "babel",
trailingComma: "all",
useTabs: false,
parser: 'babel',
trailingComma: 'none',
useTabs: false
};
70 changes: 35 additions & 35 deletions config/webpack.config.browser.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
var path = require("path");
var webpack = require("webpack");
var path = require('path');
var webpack = require('webpack');

var ESLintPlugin = require("eslint-webpack-plugin");
var TerserPlugin = require("terser-webpack-plugin");
var NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
var ESLintPlugin = require('eslint-webpack-plugin');
var TerserPlugin = require('terser-webpack-plugin');
var NodePolyfillPlugin = require('node-polyfill-webpack-plugin');

const config = {
target: "web",
target: 'web',
// https://stackoverflow.com/a/34018909
entry: {
"stellar-sdk": path.resolve(__dirname, "../src/browser.ts"),
"stellar-sdk.min": path.resolve(__dirname, "../src/browser.ts"),
'stellar-sdk': path.resolve(__dirname, '../src/browser.ts'),
'stellar-sdk.min': path.resolve(__dirname, '../src/browser.ts')
},
resolve: {
fallback: {
crypto: require.resolve("crypto-browserify"),
stream: require.resolve("stream-browserify"),
buffer: require.resolve("buffer"),
crypto: require.resolve('crypto-browserify'),
stream: require.resolve('stream-browserify'),
buffer: require.resolve('buffer')
},
extensions: [".ts", ".js"],
extensions: ['.ts', '.js']
},
output: {
clean: true,
library: {
name: "StellarSdk",
type: "umd",
umdNamedDefine: true,
name: 'StellarSdk',
type: 'umd',
umdNamedDefine: true
},
path: path.resolve(__dirname, "../dist"),
path: path.resolve(__dirname, '../dist')
},
mode: process.env.NODE_ENV ?? "development",
devtool: process.env.NODE_ENV === "production" ? false : "inline-source-map",
mode: process.env.NODE_ENV ?? 'development',
devtool: process.env.NODE_ENV === 'production' ? false : 'inline-source-map',
module: {
rules: [
{
test: /\.m?(ts|js)$/,
exclude: /node_modules\/(?!(stellar-base|js-xdr))/,
use: {
loader: "babel-loader",
loader: 'babel-loader',
options: {
cacheDirectory: true,
},
},
},
],
cacheDirectory: true
}
}
}
]
},
optimization: {
minimize: true,
Expand All @@ -52,29 +52,29 @@ const config = {
include: /\.min\.js$/,
terserOptions: {
format: {
ascii_only: true,
},
},
}),
],
ascii_only: true
}
}
})
]
},
plugins: [
// this must be first for karma to work (see line 5 of karma.conf.js)
new ESLintPlugin({
overrideConfigFile: path.resolve(__dirname, "../.eslintrc.js"),
overrideConfigFile: path.resolve(__dirname, '../.eslintrc.js')
}),
// Ignore native modules (sodium-native)
new webpack.IgnorePlugin({ resourceRegExp: /sodium-native/ }),
new NodePolyfillPlugin({
includeAliases: ["http", "https"], // others aren't needed
includeAliases: ['http', 'https'] // others aren't needed
}),
new webpack.ProvidePlugin({
Buffer: ["buffer", "Buffer"],
}),
Buffer: ['buffer', 'Buffer']
})
],
watchOptions: {
ignored: /(node_modules|coverage|lib|dist)/,
},
ignored: /(node_modules|coverage|lib|dist)/
}
};

module.exports = config;
Loading

0 comments on commit d9bc072

Please sign in to comment.