-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
47 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,27 +9,22 @@ | |
"email": "[email protected]", | ||
"url": "https://akameco.github.io" | ||
}, | ||
"main": "lib/index.js", | ||
"jsnext:main": "dist/styled-spinkit.es.js", | ||
"module": "dist/styled-spinkit.es.js", | ||
"main": "dist/index.js", | ||
"jsnext:main": "dist/styled-spinkit.esm.js", | ||
"module": "dist/styled-spinkit.esm.js", | ||
"typings": "dist/index.d.ts", | ||
"keywords": [ | ||
"react", | ||
"styled-components", | ||
"components", | ||
"flow", | ||
"flowtype", | ||
"Spinner", | ||
"Loading", | ||
"components" | ||
], | ||
"scripts": { | ||
"add-contributors": "all-contributors add", | ||
"prebuild:lib": "rimraf lib/*", | ||
"build": "npm run build:lib && npm run build:dist && npm run build:flow", | ||
"build:lib": "babel src/ -d lib/ --ignore '**/*.test.js'", | ||
"prebuild:dist": "rimraf dist/*", | ||
"build:dist": "rollup -c", | ||
"build:flow": "flow-copy-source -v -i '{**/tests/*.js,**/*.test.js}' src lib", | ||
"build": "tsc && rollup -c", | ||
"prebuild": "rimraf dist/*", | ||
"fmt": "prettier --write '**/*.{js,json,md}'", | ||
"storybook": "start-storybook -p 9009", | ||
"build-storybook": "build-storybook", | ||
|
@@ -47,10 +42,7 @@ | |
] | ||
}, | ||
"files": [ | ||
"flow-typed", | ||
"lib", | ||
"dist", | ||
"src" | ||
"dist" | ||
], | ||
"dependencies": { | ||
"prop-types": "^15.6.2", | ||
|
@@ -94,9 +86,8 @@ | |
"rimraf": "2.6.3", | ||
"rollup": "1.1.2", | ||
"rollup-plugin-babel": "4.3.2", | ||
"rollup-plugin-commonjs": "9.2.0", | ||
"rollup-plugin-flow": "1.1.1", | ||
"rollup-plugin-node-resolve": "4.0.0", | ||
"rollup-plugin-terser": "^4.0.4", | ||
"storyshots": "3.2.2", | ||
"styled-components": "4.1.3", | ||
"stylelint": "9.10.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,43 @@ | ||
import nodeResolve from 'rollup-plugin-node-resolve' | ||
import commonjs from 'rollup-plugin-commonjs' | ||
import babel from 'rollup-plugin-babel' | ||
import flow from 'rollup-plugin-flow' | ||
import resolve from 'rollup-plugin-node-resolve' | ||
import { terser } from 'rollup-plugin-terser' | ||
import pkg from './package.json' | ||
|
||
const plugins = [ | ||
flow(), | ||
nodeResolve(), | ||
babel({ | ||
babelrc: false, | ||
presets: [ | ||
['@babel/preset-env', { loose: true, modules: false }], | ||
'@babel/preset-react', | ||
], | ||
plugins: [ | ||
'flow-react-proptypes', | ||
'@babel/plugin-transform-flow-strip-types', | ||
['@babel/plugin-proposal-class-properties', { loose: true }], | ||
[ | ||
'styled-components', | ||
{ | ||
displayName: false, | ||
}, | ||
], | ||
].filter(Boolean), | ||
ignore: ['*.test.js'], | ||
}), | ||
commonjs({ ignoreGlobal: true }), | ||
] | ||
const input = './compiled/index.js' | ||
|
||
const external = id => !id.startsWith('.') && !id.startsWith('/') | ||
|
||
export default { | ||
plugins, | ||
external: ['react', 'styled-components'], | ||
input: 'src/index.js', | ||
const buildCjs = () => ({ | ||
input, | ||
external, | ||
output: { | ||
file: 'dist/styled-spinkit.es.js', | ||
format: 'es', | ||
exports: 'named', | ||
globals: { react: 'React' }, | ||
file: pkg.main, | ||
format: 'cjs', | ||
sourcemap: true, | ||
}, | ||
} | ||
plugins: [ | ||
resolve(), | ||
terser({ | ||
sourcemap: true, | ||
output: { comments: false }, | ||
warnings: true, | ||
ecma: 5, | ||
// Compress and/or mangle variables in top level scope. | ||
// @see https://github.com/terser-js/terser | ||
toplevel: true, | ||
}), | ||
], | ||
}) | ||
|
||
export default [ | ||
buildCjs(), | ||
{ | ||
input, | ||
external, | ||
output: { | ||
file: pkg.module, | ||
format: 'esm', | ||
sourcemap: true, | ||
}, | ||
plugins: [resolve()], | ||
}, | ||
] |