Skip to content

Commit df22577

Browse files
Kent C. DoddsKent C. Dodds
Kent C. Dodds
authored and
Kent C. Dodds
committed
fix(build): update kcd-scripts and change core a bit
1 parent 60d0a0f commit df22577

21 files changed

+192
-160
lines changed

.all-contributorsrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@
4848
"code",
4949
"test"
5050
]
51+
},
52+
{
53+
"login": "TxHawks",
54+
"name": "Jonathan Pollak",
55+
"avatar_url": "https://avatars2.githubusercontent.com/u/5658514?v=4",
56+
"profile": "https://github.com/TxHawks",
57+
"contributions": [
58+
"code",
59+
"test"
60+
]
5161
}
5262
]
5363
}

README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RTL conversion for CSS in JS objects
99
[![downloads][downloads-badge]][npm-stat]
1010
[![MIT License][license-badge]][LICENSE]
1111

12-
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors)
12+
[![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors)
1313
[![PRs Welcome][prs-badge]][prs]
1414
[![Donate][donate-badge]][donate]
1515
[![Code of Conduct][coc-badge]][coc]
@@ -59,7 +59,7 @@ console.log(styles) // logs {paddingRight: 23}
5959
You can also just include a script tag in your browser and use the `rtlCSSJS` variable:
6060

6161
```html
62-
<script src="https://unpkg.com/rtl-css-js@1.0.0-beta.1"></script>
62+
<script src="https://unpkg.com/rtl-css-js"></script>
6363
<script>
6464
const styles = rtlCSSJS({paddingRight: 23})
6565
console.log(styles) // logs {paddingLeft: 23}
@@ -74,6 +74,17 @@ const styles = rtlCSSJS({paddingLeft: '20px /* @noflip */'})
7474
console.log(styles) // logs {paddingLeft: '20px /* @noflip */' }
7575
```
7676

77+
### core
78+
79+
`rtl-css-js` also exposes its internal helpers and utilities so you can deal
80+
with [certain scenarios](https://github.com/kentcdodds/rtl-css-js/pull/22)
81+
yourself. To use these you can use the `rtlCSSJSCore` global with the UMD build,
82+
`require('rtl-css-js/core')`, or use
83+
`import {propertyValueConverters, arrayToObject} from 'rtl-css-js/core.esm'`.
84+
85+
You can import anything that's exported from `src/core`. Please see the code
86+
comments for documentation on how to use these.
87+
7788
## Caveats
7889

7990
### `background`
@@ -96,8 +107,8 @@ I'm not aware of any, if you are please [make a pull request](http://makeapullre
96107
Thanks goes to these people ([emoji key][emojis]):
97108

98109
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
99-
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=kentcdodds "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=kentcdodds "Tests") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars.githubusercontent.com/u/63876?v=3" width="100px;"/><br /><sub>Ahmed El Gabri</sub>](https://gabri.me)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Code") [📖](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Documentation") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1383861?v=4" width="100px;"/><br /><sub>Maja Wichrowska</sub>](https://github.com/majapw)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=majapw "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=majapw "Tests") | [<img src="https://avatars2.githubusercontent.com/u/6600720?v=4" width="100px;"/><br /><sub>Yaniv</sub>](https://github.com/yzimet)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=yzimet "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=yzimet "Tests") |
100-
| :---: | :---: | :---: | :---: |
110+
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub>Kent C. Dodds</sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=kentcdodds "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=kentcdodds "Tests") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") | [<img src="https://avatars.githubusercontent.com/u/63876?v=3" width="100px;"/><br /><sub>Ahmed El Gabri</sub>](https://gabri.me)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Code") [📖](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Documentation") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=ahmedelgabri "Tests") | [<img src="https://avatars1.githubusercontent.com/u/1383861?v=4" width="100px;"/><br /><sub>Maja Wichrowska</sub>](https://github.com/majapw)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=majapw "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=majapw "Tests") | [<img src="https://avatars2.githubusercontent.com/u/6600720?v=4" width="100px;"/><br /><sub>Yaniv</sub>](https://github.com/yzimet)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=yzimet "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=yzimet "Tests") | [<img src="https://avatars2.githubusercontent.com/u/5658514?v=4" width="100px;"/><br /><sub>Jonathan Pollak</sub>](https://github.com/TxHawks)<br />[💻](https://github.com/kentcdodds/rtl-css-js/commits?author=TxHawks "Code") [⚠️](https://github.com/kentcdodds/rtl-css-js/commits?author=TxHawks "Tests") |
111+
| :---: | :---: | :---: | :---: | :---: |
101112
<!-- ALL-CONTRIBUTORS-LIST:END -->
102113

103114
This project follows the [all-contributors][all-contributors] specification. Contributions of any kind welcome!

core.esm.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* eslint import/no-unresolved:0 */
2+
// this file just makes it easier to import dist/core
3+
export * from './dist/rtl-css-js.core.esm'

core.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/* eslint import/no-unresolved:0 */
2+
// this file just makes it easier to require dist/core
3+
module.exports = require('./dist/rtl-css-js.core.cjs')

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,25 @@
77
"module": "dist/rtl-css-js.es.js",
88
"scripts": {
99
"add-contributor": "kcd-scripts contributors add",
10-
"build": "kcd-scripts build --browser --environment BUILD_NAME:rtlCSSJS",
10+
"build": "rimraf dist && npm-run-all build:*",
11+
"build:main":
12+
"kcd-scripts build --bundle --environment BUILD_NAME:rtlCSSJS --no-clean",
13+
"build:core":
14+
"kcd-scripts build --bundle --environment BUILD_NAME:rtlCSSJSCore,BUILD_FILENAME_SUFFIX:\".core\",BUILD_INPUT:src/core/index.js --no-clean",
1115
"lint": "kcd-scripts lint",
1216
"test": "kcd-scripts test",
1317
"test:update": "npm run test -s -- --coverage --updateSnapshot",
1418
"validate": "kcd-scripts validate",
1519
"precommit": "kcd-scripts precommit"
1620
},
17-
"files": ["dist"],
21+
"files": ["dist", "core", "core.esm"],
1822
"keywords": ["css-in-js", "ltr", "rtl", "cssjanus"],
1923
"author": "Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)",
2024
"license": "MIT",
2125
"devDependencies": {
22-
"kcd-scripts": "^0.6.0"
26+
"kcd-scripts": "^0.16.0",
27+
"npm-run-all": "^4.1.1",
28+
"rimraf": "^2.6.2"
2329
},
2430
"eslintConfig": {
2531
"extends": "./node_modules/kcd-scripts/eslint.js"

src/core/arrayToObject.js

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/core/calculateNewBackgroundPosition.js

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/core/calculateNewTranslate.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/core/flipSign.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/core/getValuesAsList.js

Lines changed: 0 additions & 30 deletions
This file was deleted.

src/core/handleQuartetValues.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/core/includes.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/core/index.js

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,4 @@
1-
import arrayToObject from './arrayToObject'
2-
import calculateNewBackgroundPosition from './calculateNewBackgroundPosition'
3-
import calculateNewTranslate from './calculateNewTranslate'
4-
import flipSign from './flipSign'
5-
import getValuesAsList from './getValuesAsList'
6-
import handleQuartetValues from './handleQuartetValues'
7-
import includes from './includes'
8-
import isNullOrUndefined from './isNullOrUndefined'
9-
import isNumber from './isNumber'
10-
import isObject from './isObject'
11-
import isString from './isString'
12-
import propertyValueConverters from './propertyValueConverters'
1+
import propertyValueConverters from './property-value-converters'
132

14-
export {
15-
arrayToObject,
16-
calculateNewBackgroundPosition,
17-
calculateNewTranslate,
18-
flipSign,
19-
handleQuartetValues,
20-
includes,
21-
isNullOrUndefined,
22-
isNumber,
23-
isObject,
24-
isString,
25-
getValuesAsList,
26-
propertyValueConverters,
27-
}
3+
export * from './utils'
4+
export {propertyValueConverters}

src/core/isNullOrUndefined.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/core/isNumber.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/core/isObject.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/core/isString.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/core/propertyValueConverters.js renamed to src/core/property-value-converters.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import includes from './includes'
2-
import isNumber from './isNumber'
3-
import calculateNewBackgroundPosition from './calculateNewBackgroundPosition'
4-
import calculateNewTranslate from './calculateNewTranslate'
5-
import handleQuartetValues from './handleQuartetValues'
6-
import getValuesAsList from './getValuesAsList'
1+
import {
2+
includes,
3+
isNumber,
4+
calculateNewBackgroundPosition,
5+
calculateNewTranslate,
6+
handleQuartetValues,
7+
getValuesAsList,
8+
} from './utils'
79

810
// some values require a little fudging, that fudging goes here.
911
const propertyValueConverters = {

0 commit comments

Comments
 (0)