1
0
Fork 0

add rollup-plugin-url to support importing images

This commit is contained in:
Travis Fischer 2018-03-09 17:45:42 -05:00 committed by Joost De Cock
parent c19fb7efe0
commit ab9c25a789
6 changed files with 2910 additions and 12 deletions

View file

@ -1,6 +1,6 @@
# create-react-library # create-react-library
> CLI for easily publishing modern React modules with Rollup and example usage via create-react-app. > CLI for easily publishing modern React libraries with Rollup and example usage via create-react-app.
[![NPM](https://img.shields.io/npm/v/create-react-library.svg)](https://www.npmjs.com/package/create-react-library) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![NPM](https://img.shields.io/npm/v/create-react-library.svg)](https://www.npmjs.com/package/create-react-library) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
@ -13,19 +13,19 @@
</p> </p>
The CLI is based on this [boilerplate](https://github.com/transitive-bullshit/react-modern-library-boilerplate), which you can optionally read in-depth about [here](https://hackernoon.com/publishing-baller-react-modules-2b039d84bce7). The CLI is based on this [boilerplate](https://github.com/transitive-bullshit/react-modern-library-boilerplate), which you can optionally read about [here](https://hackernoon.com/publishing-baller-react-modules-2b039d84bce7).
## Features ## Features
- Support all modern JS language features for component development out of the box - Supports all modern JS language features for component development out of the box
- Build process to convert source to `umd` and `es` module formats for publishing to npm - Build process to convert source to `umd` and `es` module formats for publishing to npm
- Comes with an `example` app using a standard [create-react-app](https://github.com/facebookincubator/create-react-app), serving 2 purposes - Comes with an `example` app using a standard [create-react-app](https://github.com/facebookincubator/create-react-app), serving 2 purposes
- Local, hot-reload server for developing your module - Local, hot-reload server for developing your module
- Easily publishable to github pages so users can quickly play with your module - Easily publishable to github pages so users can quickly play with your module
- Use [Rollup](https://rollupjs.org/) for build process and [Babel](https://babeljs.io/) for transpilation - Uses [Rollup](https://rollupjs.org/) for build process and [Babel](https://babeljs.io/) for transpilation
- See the [blog post](https://hackernoon.com/publishing-baller-react-modules-2b039d84bce7) for an explanation of Rollup vs Webpack - See the [blog post](https://hackernoon.com/publishing-baller-react-modules-2b039d84bce7) for an explanation of Rollup vs Webpack
- Allow the use of `npm` modules within your library, either as dependencies or peer-dependencies - Allows the use of `npm` modules within your library, either as dependencies or peer-dependencies
- Support importing CSS in your components (with css modules enabled by default) - Supports importing CSS in your components (with css modules enabled by default)
- Note that CSS support will be a noop if you're using css-in-js - Note that CSS support will be a noop if you're using css-in-js
- Testing with [Jest](https://facebook.github.io/jest/), using `react-scripts` from `create-react-app` - Testing with [Jest](https://facebook.github.io/jest/), using `react-scripts` from `create-react-app`
- Sourcemap creation enabled by default - Sourcemap creation enabled by default

File diff suppressed because it is too large Load diff

View file

@ -1,17 +1,32 @@
{ {
"name": "create-react-library", "name": "create-react-library",
"version": "2.1.0", "version": "2.1.1",
"description": "CLI for easily bootstrapping modern react libraries", "description": "CLI for easily bootstrapping modern react libraries",
"repository": "transitive-bullshit/create-react-library", "repository": "transitive-bullshit/create-react-library",
"author": "Travis Fischer <travis@automagical.ai>",
"main": "index.js", "main": "index.js",
"license": "MIT", "license": "MIT",
"bin": { "bin": {
"create-react-library": "index.js" "create-react-library": "index.js"
}, },
"keywords": [
"react",
"preact",
"library",
"create-react-app",
"cli",
"component",
"rollup",
"babel",
"preact",
"publish"
],
"dependencies": { "dependencies": {
"asciicast2gif": "^0.1.4",
"consolidate": "^0.15.0", "consolidate": "^0.15.0",
"cp-file": "^5.0.0", "cp-file": "^5.0.0",
"execa": "^0.9.0", "execa": "^0.9.0",
"gifsicle": "^3.0.4",
"git-config-path": "^1.0.1", "git-config-path": "^1.0.1",
"github-username": "^4.1.0", "github-username": "^4.1.0",
"globby": "^8.0.1", "globby": "^8.0.1",

View file

@ -28,4 +28,4 @@ class Example extends Component {
## License ## License
{{license}} © [{{author}}](https://github.com/{{repo}}) {{license}} © [{{author}}](https://github.com/{{author}})

View file

@ -9,7 +9,7 @@
"module": "dist/index.es.js", "module": "dist/index.es.js",
"jsnext:main": "dist/index.es.js", "jsnext:main": "dist/index.es.js",
"scripts": { "scripts": {
"test": "react-scripts test --env=jsdom", "test": "CI=1 react-scripts test --env=jsdom",
"build": "rollup -c", "build": "rollup -c",
"start": "rollup -c -w", "start": "rollup -c -w",
"prepare": "{{manager}} run build", "prepare": "{{manager}} run build",
@ -30,12 +30,16 @@
"babel-preset-react": "^6.24.1", "babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1", "babel-preset-stage-0": "^6.24.1",
"gh-pages": "^1.1.0", "gh-pages": "^1.1.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-scripts": "^1.1.1",
"rollup": "^0.54.0", "rollup": "^0.54.0",
"rollup-plugin-babel": "^3.0.3", "rollup-plugin-babel": "^3.0.3",
"rollup-plugin-commonjs": "^8.2.1", "rollup-plugin-commonjs": "^8.2.1",
"rollup-plugin-node-resolve": "^3.0.2", "rollup-plugin-node-resolve": "^3.0.2",
"rollup-plugin-peer-deps-external": "^2.0.0", "rollup-plugin-peer-deps-external": "^2.0.0",
"rollup-plugin-postcss": "^1.1.0" "rollup-plugin-postcss": "^1.1.0",
"rollup-plugin-url": "^1.3.0"
}, },
"files": [ "files": [
"dist" "dist"

View file

@ -3,6 +3,7 @@ import commonjs from 'rollup-plugin-commonjs'
import external from 'rollup-plugin-peer-deps-external' import external from 'rollup-plugin-peer-deps-external'
import postcss from 'rollup-plugin-postcss' import postcss from 'rollup-plugin-postcss'
import resolve from 'rollup-plugin-node-resolve' import resolve from 'rollup-plugin-node-resolve'
import url from 'rollup-plugin-url'
import pkg from './package.json' import pkg from './package.json'
@ -23,6 +24,7 @@ export default {
postcss({ postcss({
modules: true modules: true
}), }),
url(),
babel({ babel({
exclude: 'node_modules/**' exclude: 'node_modules/**'
}), }),