Skip to content
This repository was archived by the owner on Apr 9, 2024. It is now read-only.

Commit fe950bc

Browse files
authored
Refactor repo to current monorepo standards (#153)
1 parent 28bc098 commit fe950bc

File tree

125 files changed

+7849
-9230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+7849
-9230
lines changed

.changeset/config.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "seek-oss/treat" }
6+
],
7+
"commit": false,
8+
"linked": [],
9+
"access": "public",
10+
"baseBranch": "master",
11+
"updateInternalDependencies": "patch",
12+
"ignore": ["gatsby-plugin-treat-example", "next-treat-example", "treat-test-helpers", "treat-docs-site"]
13+
}

.changeset/warm-starfishes-allow.md

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'treat': major
3+
---
4+
5+
`treat/webpack-plugin` is now an ES module.
6+
7+
BREAKING CHANGE:
8+
When importing `treat/webpack-plugin` in a commonjs file you must now use the named export `TreatPlugin`.
9+
10+
```js
11+
const { TreatPlugin } = require('treat/webpack-plugin');
12+
```

.github/workflows/release.yml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
name: Publish & Deploy
11+
runs-on: ubuntu-latest
12+
env:
13+
CI: true
14+
steps:
15+
- name: Check out repo
16+
uses: actions/checkout@main
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Set up Node.js 14.x
21+
uses: actions/setup-node@main
22+
with:
23+
node-version: 14.x
24+
25+
- name: Install dependencies
26+
run: yarn install --frozen-lockfile
27+
28+
- name: Create Release Pull Request or Publish to npm
29+
uses: changesets/action@b3300fad33b6ab794313da28d27424c0e2f78991
30+
with:
31+
publish: yarn release
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
NPM_TOKEN: ${{ secrets.SEEK_OSS_CI_NPM_TOKEN }}

.github/workflows/validate.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Validate
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
jobs:
8+
validate:
9+
name: Lint & Test
10+
runs-on: ubuntu-latest
11+
env:
12+
CI: true
13+
steps:
14+
- name: Check out repo
15+
uses: actions/checkout@main
16+
17+
- name: Set up Node.js 14.x
18+
uses: actions/setup-node@main
19+
with:
20+
node-version: 14.x
21+
22+
- name: Install dependencies
23+
run: yarn install --frozen-lockfile
24+
25+
- name: Make docs manifest
26+
run: yarn make-docs-manifest
27+
28+
- name: Build
29+
run: yarn build
30+
31+
- name: Lint
32+
run: yarn lint
33+
34+
- name: Test
35+
run: yarn test

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
node_modules
22
dist
33
lib
4-
docs-manifest.json
4+
docs-manifest.json
5+
yarn-error.log
6+
tsconfig.tsbuildinfo

.prettierignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.idea/
2+
.vscode/
3+
node_modules*/
4+
dist
5+
lib
6+
docs-manifest.json
7+
**/.next/*
8+
**/.cache/*
9+
**/public/*
10+
/.changeset/*
11+
CHANGELOG.md

.prettierrc

-14
This file was deleted.

.travis.yml

-39
This file was deleted.

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
<br />
1313
</div>
1414

15-
1615
Write your styles in JavaScript/TypeScript within **treat files** (e.g. `Button.treat.js`) that get executed at build time.
1716

1817
All CSS rules are created ahead of time, so the runtime is _very_ lightweight—only needing to swap out pre-existing classes. In fact, if your application doesn’t use theming, you don’t even need the runtime at all.
@@ -87,7 +86,7 @@ export const Button = ({ text }) => `
8786

8887
## Themed usage
8988

90-
>This themed usage example makes use of [react-treat](https://seek-oss.github.io/treat/react-api) to keep things simple. React is [not required](https://seek-oss.github.io/treat/runtime-api) to use treat.
89+
> This themed usage example makes use of [react-treat](https://seek-oss.github.io/treat/react-api) to keep things simple. React is [not required](https://seek-oss.github.io/treat/runtime-api) to use treat.
9190
9291
First, install react-treat.
9392

@@ -129,7 +128,7 @@ Now that you’ve configured the theming system, define and export [themed style
129128
// ** THIS CODE WON'T END UP IN YOUR BUNDLE EITHER! **
130129
import { style } from 'treat';
131130

132-
export const button = style(theme => ({
131+
export const button = style((theme) => ({
133132
backgroundColor: theme.brandColor,
134133
height: theme.grid * 11
135134
}));
@@ -145,7 +144,7 @@ import React from 'react';
145144
import { useStyles } from 'react-treat';
146145
import * as styleRefs from './Button.treat.js';
147146

148-
export const Button = props => {
147+
export const Button = (props) => {
149148
const styles = useStyles(styleRefs);
150149

151150
return <button {...props} className={styles.button} />;

babel.config.js

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
module.exports = {
22
presets: [
33
'@babel/preset-typescript',
4-
[
5-
'@babel/preset-env',
6-
{
7-
targets: {
8-
node: 'current',
9-
},
10-
},
11-
],
124
'@babel/preset-react',
5+
['@babel/preset-env', { targets: { node: 10 } }],
136
],
147
};

docs/data-types.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ Type: `function`
115115
Accepts a [`Theme`](#theme) and returns a [`Styles` object.](#styles)
116116

117117
```js
118-
theme => ({
118+
(theme) => ({
119119
color: theme.brandColor
120120
});
121121
```

docs/how-it-works.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ Then, let's assume you've written the following treat file:
5454
// text.treat.js
5555
import { style } from 'treat';
5656

57-
export const text = style(theme => ({ color: theme.text }));
57+
export const text = style((theme) => ({
58+
color: theme.text
59+
}));
5860
```
5961

6062
This will generate the following CSS:
@@ -77,7 +79,7 @@ In order to ensure consistent specificity across different themes, **themed styl
7779
For example, let's assume you've defined the following styles:
7880

7981
```js
80-
export const inactive = style(theme => ({
82+
export const inactive = style((theme) => ({
8183
color: theme.text
8284
}));
8385

@@ -118,17 +120,17 @@ Let's assume we have a treat file with some complex exports:
118120

119121
```js
120122
// styles.treat.js
121-
export const topLevelExport = style(theme => ({
123+
export const topLevelExport = style((theme) => ({
122124
color: theme.red
123125
}));
124126

125127
export const objectExport = {
126-
key: style(theme => ({ color: theme.blue }))
128+
key: style((theme) => ({ color: theme.blue }))
127129
};
128130

129131
export const arrayExport = [
130-
style(theme => ({ color: theme.aqua })),
131-
style(theme => ({ color: theme.pink }))
132+
style((theme) => ({ color: theme.aqua })),
133+
style((theme) => ({ color: theme.pink }))
132134
];
133135
```
134136

docs/introduction.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Now that you've configured the theming system, define and export [themed styles]
112112
// ** THIS CODE WON'T END UP IN YOUR BUNDLE EITHER! **
113113
import { style } from 'treat';
114114

115-
export const button = style(theme => ({
115+
export const button = style((theme) => ({
116116
backgroundColor: theme.brandColor,
117117
height: theme.grid * 11
118118
}));
@@ -128,7 +128,7 @@ import React from 'react';
128128
import { useStyles } from 'react-treat';
129129
import * as styleRefs from './Button.treat.js';
130130

131-
export const Button = props => {
131+
export const Button = (props) => {
132132
const styles = useStyles(styleRefs);
133133

134134
return <button {...props} className={styles.button} />;

docs/react-api.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import React from 'react';
5252
import { useClassName } from 'react-treat';
5353
import * as styleRefs from './Button.treat.js';
5454

55-
export const Button = props => (
55+
export const Button = (props) => (
5656
<button
5757
{...props}
5858
className={useClassName(styles.button)}

docs/setup.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ import styleRefs from './styles.treat';
116116
// Inject the theme name somehow:
117117
const themeName = getThemeName();
118118

119-
import(`../themes/${themeName}.treat`).then(theme => {
119+
import(`../themes/${themeName}.treat`).then((theme) => {
120120
const styles = resolveStyles(theme.default, styleRefs);
121121
// You now have access to themed styles!
122122
});

docs/styling-api.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The `styleMap` function allows you to easily create multiple namespaces within a
5454
```js
5555
import { styleMap } from 'treat';
5656

57-
export const variants = styleMap(theme => ({
57+
export const variants = styleMap((theme) => ({
5858
primary: {
5959
backgroundColor: theme.colors.brand
6060
},
@@ -97,8 +97,8 @@ const spacingTokens = {
9797
large: 16
9898
};
9999
100-
const spacingStyles = property =>
101-
mapValues(spacingTokens, value => ({
100+
const spacingStyles = (property) =>
101+
mapValues(spacingTokens, (value) => ({
102102
[property]: value
103103
}));
104104
@@ -135,10 +135,10 @@ For example, if you wanted to create a nested atomic CSS structure (e.g. `atoms.
135135
import { styleTree } from 'treat';
136136
import { mapValues } from 'lodash';
137137
138-
const responsiveSpacingStyles = property =>
138+
const responsiveSpacingStyles = (property) =>
139139
styleTree((theme, styleNode) =>
140-
mapValues(theme.spacing, space =>
141-
mapValues(theme.breakpoints, minWidth =>
140+
mapValues(theme.spacing, (space) =>
141+
mapValues(theme.breakpoints, (minWidth) =>
142142
styleNode({
143143
'@media': {
144144
[`screen and (min-width: ${minWidth}px)`]: {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
presets: ['babel-preset-gatsby'],
3+
};

packages/gatsby-plugin-treat-example/package.json renamed to examples/gatsby-plugin-treat-example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"private": true,
44
"version": "1.6.2",
55
"devDependencies": {
6-
"@babel/core": "^7.7.5",
6+
"@babel/core": "^7.12.10",
77
"babel-preset-gatsby": "^0.2.26",
88
"gatsby": "^2.18.11",
99
"gatsby-plugin-treat": "^1.6.2",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
import { button } from './Button.treat';
3+
4+
export const Button = ({ ...otherProps }) => (
5+
<button {...otherProps} className={button} />
6+
);

packages/gatsby-plugin-treat-example/src/components/Button.treat.js renamed to examples/gatsby-plugin-treat-example/src/components/Button.treat.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import {style} from 'treat';
2-
import {fontStack} from './fontStack';
1+
import { style } from 'treat';
2+
import { fontStack } from './fontStack';
33

44
const fg = 'deeppink';
55
const bg = 'white';
@@ -14,10 +14,10 @@ export const button = style({
1414
backgroundColor: `${bg}`,
1515
padding: '0.5em 1em',
1616
':hover': {
17-
opacity: 0.75
17+
opacity: 0.75,
1818
},
1919
':disabled': {
2020
cursor: 'default',
21-
opacity: 0.5
22-
}
21+
opacity: 0.5,
22+
},
2323
});

0 commit comments

Comments
 (0)