Skip to content

Commit cbfeb47

Browse files
authored
chore: Prepare Tailwind 2.0 - Part 2 (#82)
* add tests * rename default to DEFAULT
1 parent 1a51113 commit cbfeb47

File tree

7 files changed

+3955
-48
lines changed

7 files changed

+3955
-48
lines changed

Diff for: .github/workflows/nodejs.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [master]
9+
pull_request:
10+
branches: [master]
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [12.x, 14.x]
19+
20+
steps:
21+
- uses: actions/[email protected]
22+
- name: Use Node.js ${{ matrix.node-version }}
23+
uses: actions/[email protected]
24+
with:
25+
node-version: ${{ matrix.node-version }}
26+
- name: Use cached node_modules
27+
id: cache
28+
uses: actions/[email protected]
29+
with:
30+
path: node_modules
31+
key: nodeModules-${{ hashFiles('**/yarn.lock') }}-${{ matrix.node-version }}
32+
restore-keys: |
33+
nodeModules-
34+
- name: Install dependencies
35+
if: steps.cache.outputs.cache-hit != 'true'
36+
run: npm install
37+
env:
38+
CI: true
39+
- run: npm run prepublishOnly
40+
- run: npm test
41+
env:
42+
CI: true

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
node_modules
33
package-lock.json
44
/demo/out
5+
coverage/

Diff for: package.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"trailingComma": "es5"
1616
},
1717
"scripts": {
18+
"test": "jest",
1819
"dev": "next dev demo",
1920
"build": "next build demo",
2021
"export": "next export demo",
@@ -34,10 +35,13 @@
3435
"cssnano": "^4.1.10",
3536
"dedent": "^0.7.0",
3637
"highlight.js": "^9.15.6",
38+
"jest": "^26.6.1",
3739
"next": "^9.4.4",
3840
"postcss": "^7.0.17",
39-
"react": "^16.8.6",
41+
"prettier": "^2.1.2",
4042
"react-dom": "^16.8.6",
43+
"react": "^16.8.6",
44+
"snapshot-diff": "^0.8.1",
4145
"tailwindcss": "^2.0.0-alpha.1"
4246
}
4347
}

Diff for: src/index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const computed = {
1010

1111
function configToCss(config) {
1212
return merge(
13+
{},
1314
...Object.keys(config)
1415
.filter((key) => computed[key])
1516
.map((key) => computed[key](config[key])),
@@ -26,18 +27,20 @@ module.exports = plugin.withOptions(
2627
[
2728
{
2829
[`.${className}`]: merge(
29-
...castArray(styles.default.css),
30-
configToCss(config.default || {})
30+
{},
31+
...castArray(styles.DEFAULT.css),
32+
configToCss(config.DEFAULT || {})
3133
),
3234
},
3335
...modifiers.map((modifier) => ({
3436
[`.${className}-${modifier}`]: merge(
37+
{},
3538
...castArray(styles[modifier].css),
3639
configToCss(config[modifier] || {})
3740
),
3841
})),
3942
...Object.keys(config)
40-
.filter((key) => !['default', ...modifiers].includes(key))
43+
.filter((key) => !['DEFAULT', ...modifiers].includes(key))
4144
.map((modifier) => ({
4245
[`.${className}-${modifier}`]: configToCss(config[modifier]),
4346
})),

0 commit comments

Comments
 (0)