Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
JMSantos94 committed Nov 12, 2018
1 parent 0c69fc1 commit 60fe4df
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 91 deletions.
15 changes: 13 additions & 2 deletions README.md
@@ -1,3 +1,14 @@
# Coming soon
<img
src="https://github.com/jmsantos94/use-react/blob/master/misc/use-react.png"
alt="use-react logo"
/>

Collection of react utilities based on React hooks
# use-react
This package is intended to be a collection of react utilities based on React
Hooks. Everything here is currently experimental, until the hooks-api is
released.

## Table of Content
- [Installation](#installation)
- [Demo](#demo)
- [Documentation](#documentation)
Binary file added misc/use-react.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 3 additions & 89 deletions rollup.config.js
Expand Up @@ -8,7 +8,7 @@ const config = {
input: 'src/index.js',
output: {
name: 'use-react',
format: 'umd',
format: 'es',
sourcemap: true,
file: './dist/use-react.prod.js',
exports: 'named',
Expand All @@ -31,94 +31,8 @@ const config = {
exclude: 'node_modules/**',
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
uglify(),
],
};

if (process.env.NODE_ENV === 'production') {
config.plugins.push(uglify());
}


const buildUmd = ({ env }) => ({
plugins: [
resolve(),
replace({
exclude: 'node_modules/**',
'process.env.NODE_ENV': JSON.stringify(env),
}),
commonjs({
include: /node_modules/,
namedExports: {
'node_modules/prop-types/index.js': [
'object',
'oneOfType',
'string',
'node',
'func',
'bool',
'element',
],
},
}),
sourceMaps(),
env === 'production' && sizeSnapshot(),
env === 'production' &&
uglify({
output: { comments: false },
compress: {
keep_infinity: true,
pure_getters: true,
},
warnings: true,
toplevel: false,
}),
],
});

const buildCjs = ({ env }) => ({
input,
external: external.concat(Object.keys(pkg.dependencies)),
output: {
file: `./dist/${pkg.name}.cjs.${env}.js`,
format: 'cjs',
sourcemap: true,
},
plugins: [
resolve(),
replace({
exclude: 'node_modules/**',
'process.env.NODE_ENV': JSON.stringify(env),
}),
sourceMaps(),
sizeSnapshot(),
],
});

export default [
buildUmd({ env: 'production' }),
buildCjs({ env: 'production' }),
{
input,
external: external.concat(Object.keys(pkg.dependencies)),
output: [
{
file: pkg.module,
format: 'es',
sourcemap: true,
},
{
file: pkg.main,
format: 'cjs',
sourcemap: true,
},
],
plugins: [
resolve(),
babel({
plugins: ['babel-plugin-annotate-pure-calls'],
}),
sizeSnapshot(),
sourceMaps(),
],
},
];
export default config;

0 comments on commit 60fe4df

Please sign in to comment.