refactor: employ prettier

This commit is contained in:
Michael Vines
2018-11-04 11:41:21 -08:00
parent 9a043344d5
commit 1d6abb17cf
35 changed files with 1498 additions and 856 deletions

View File

@@ -1,11 +1,11 @@
import babel from 'rollup-plugin-babel';
import builtins from 'rollup-plugin-node-builtins';
import commonjs from 'rollup-plugin-commonjs';
import globals from 'rollup-plugin-node-globals';
import json from 'rollup-plugin-json';
import babel from 'rollup-plugin-babel';
import builtins from 'rollup-plugin-node-builtins';
import commonjs from 'rollup-plugin-commonjs';
import globals from 'rollup-plugin-node-globals';
import json from 'rollup-plugin-json';
import nodeResolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import uglify from 'rollup-plugin-uglify';
import replace from 'rollup-plugin-replace';
import uglify from 'rollup-plugin-uglify';
const env = process.env.NODE_ENV;
@@ -39,72 +39,71 @@ function generateConfig(configType) {
}
switch (configType) {
case 'browser':
config.output = [
{
file: 'lib/index.iife.js',
format: 'iife',
name: 'solanaWeb3',
},
];
config.plugins.push(builtins());
config.plugins.push(globals());
config.plugins.push(nodeResolve({
browser: true,
}));
break;
case 'node':
config.output = [
{
file: 'lib/index.cjs.js',
format: 'cjs',
},
{
file: 'lib/index.esm.js',
format: 'es',
},
];
case 'browser':
config.output = [
{
file: 'lib/index.iife.js',
format: 'iife',
name: 'solanaWeb3',
},
];
config.plugins.push(builtins());
config.plugins.push(globals());
config.plugins.push(
nodeResolve({
browser: true,
}),
);
break;
case 'node':
config.output = [
{
file: 'lib/index.cjs.js',
format: 'cjs',
},
{
file: 'lib/index.esm.js',
format: 'es',
},
];
// Quash 'Unresolved dependencies' complaints for modules listed in the
// package.json "dependencies" section. Unfortunately this list is manually
// maintained.
config.external = [
'assert',
'babel-runtime/core-js/get-iterator',
'babel-runtime/core-js/json/stringify',
'babel-runtime/core-js/object/assign',
'babel-runtime/core-js/object/get-prototype-of',
'babel-runtime/core-js/object/keys',
'babel-runtime/core-js/promise',
'babel-runtime/helpers/asyncToGenerator',
'babel-runtime/helpers/classCallCheck',
'babel-runtime/helpers/createClass',
'babel-runtime/helpers/get',
'babel-runtime/helpers/inherits',
'babel-runtime/helpers/possibleConstructorReturn',
'babel-runtime/helpers/toConsumableArray',
'babel-runtime/helpers/typeof',
'babel-runtime/regenerator',
'bn.js',
'bs58',
'buffer-layout',
'elfy',
'jayson/lib/client/browser',
'node-fetch',
'rpc-websockets',
'superstruct',
'tweetnacl',
'url',
];
break;
default:
throw new Error(`Unknown configType: ${configType}`);
// Quash 'Unresolved dependencies' complaints for modules listed in the
// package.json "dependencies" section. Unfortunately this list is manually
// maintained.
config.external = [
'assert',
'babel-runtime/core-js/get-iterator',
'babel-runtime/core-js/json/stringify',
'babel-runtime/core-js/object/assign',
'babel-runtime/core-js/object/get-prototype-of',
'babel-runtime/core-js/object/keys',
'babel-runtime/core-js/promise',
'babel-runtime/helpers/asyncToGenerator',
'babel-runtime/helpers/classCallCheck',
'babel-runtime/helpers/createClass',
'babel-runtime/helpers/get',
'babel-runtime/helpers/inherits',
'babel-runtime/helpers/possibleConstructorReturn',
'babel-runtime/helpers/toConsumableArray',
'babel-runtime/helpers/typeof',
'babel-runtime/regenerator',
'bn.js',
'bs58',
'buffer-layout',
'elfy',
'jayson/lib/client/browser',
'node-fetch',
'rpc-websockets',
'superstruct',
'tweetnacl',
'url',
];
break;
default:
throw new Error(`Unknown configType: ${configType}`);
}
return config;
}
export default [
generateConfig('node'),
generateConfig('browser'),
];
export default [generateConfig('node'), generateConfig('browser')];