Skip to content

Commit

Permalink
Compile rn version too
Browse files Browse the repository at this point in the history
  • Loading branch information
sonaye committed Jul 8, 2018
1 parent 0988d63 commit 4b5f8b6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Unreleased
# 0.0.4

- Support theming.
- Fixed a bug where `withComponent()` was showing the original component name.
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"license": "MIT",
"name": "shakl",
"description": "A utility to create styled components in React Native.",
"version": "0.0.3",
"version": "0.0.4",
"main": "lib/index.js",
"react-native": "src/index.js",
"react-native": "lib/rn.js",
"repository": {
"type": "git",
"url": "git+https://github.com/sonaye/shakl.git"
Expand Down Expand Up @@ -47,7 +47,7 @@
"benchmark": "jest /benchmark",
"postbenchmark": "open -a Chrome benchmark/chart/index.html",
"prebuild": "rm -rf lib",
"build": "rollup -c"
"build": "rollup -c && rollup -c --environment TARGET:react-native"
},
"jest": {
"collectCoverageFrom": [
Expand All @@ -60,7 +60,6 @@
]
},
"files": [
"src",
"lib"
]
}
12 changes: 9 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import babel from 'rollup-plugin-babel';

const rn = process.env.TARGET === 'react-native';

const external = ['react', rn && 'react-native'];
const input = rn ? 'src/index.js' : 'src/styled.js';
const file = rn ? 'lib/rn.js' : 'lib/index.js';

export default {
external: ['react'],
input: 'src/styled.js',
output: { file: 'lib/index.js', format: 'cjs' },
external,
input,
output: { file, format: 'cjs', exports: 'named' },
plugins: [
babel({
presets: [['es2015', { modules: false }], 'react', 'stage-0'],
Expand Down

0 comments on commit 4b5f8b6

Please sign in to comment.