Skip to content

Commit 8fa264b

Browse files
committed
Updates configs & ci
Update turbo.json Update turbo.json Update nx.json Update benchmark.yml restore build-storybook fixes dependencies Create sizeDiff.yml Update sizeDiff.yml Update sizeDiff.yml Update .npmpackagejsonlintrc.json rm lodash from icon-button rm bad references from palette story fix nx?
1 parent 02a0fbb commit 8fa264b

File tree

9 files changed

+59
-55
lines changed

9 files changed

+59
-55
lines changed

.github/workflows/benchmark.yml

+10-7
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@ jobs:
1313
name: Baseline Build
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
17-
18-
# Only setup & build if there was no build cache hit
1916
- name: Use Node.js 16
2017
uses: actions/setup-node@v3
2118
with:
2219
node-version: '16'
2320

21+
- uses: actions/checkout@v2
22+
2423
- name: Install
2524
run: yarn install --frozen-lockfile --prefer-offline
2625

@@ -31,13 +30,15 @@ jobs:
3130
name: Build with Turbo
3231
runs-on: ubuntu-latest
3332
steps:
34-
- uses: actions/checkout@v2
35-
3633
- name: Use Node.js 16
3734
uses: actions/setup-node@v3
3835
with:
3936
node-version: '16'
4037

38+
- uses: actions/checkout@v2
39+
with:
40+
fetch-depth: 0
41+
4142
- name: Install
4243
run: yarn install --frozen-lockfile --prefer-offline
4344

@@ -48,13 +49,15 @@ jobs:
4849
name: Build with Nx
4950
runs-on: ubuntu-latest
5051
steps:
51-
- uses: actions/checkout@v2
52-
5352
- name: Use Node.js 16
5453
uses: actions/setup-node@v3
5554
with:
5655
node-version: '16'
5756

57+
- uses: actions/checkout@v2
58+
with:
59+
fetch-depth: 0
60+
5861
- name: Install
5962
run: yarn install --frozen-lockfile --prefer-offline
6063

.github/workflows/sizeDiff.yml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: File Size
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
sizeDiff:
9+
name: Check file size
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Use Node.js 16
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: '16'
18+
cache: yarn
19+
cache-dependency-path: 'yarn.lock'
20+
21+
- run: yarn install --frozen-lockfile --prefer-offline
22+
23+
- uses: actions/cache/restore@v3
24+
name: Restore build cache
25+
id: build-cache
26+
with:
27+
path: |
28+
**/dist
29+
!**/node_modules
30+
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/rollup.config.js', '**/babel.config.js', '**/src/', '**/scripts/', '!**/node_modules', '!**/dist') }}
31+
32+
- uses: preactjs/compressed-size-action@v2
33+
with:
34+
repo-token: ${{ secrets.GITHUB_TOKEN }}
35+
clean-script: 'clean'
36+
build-script: 'build'

.npmpackagejsonlintrc.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{
77
"patterns": ["./packages/code/package.json"],
88
"rules": {
9-
"prefer-caret-version-dependencies": "warning"
9+
"prefer-caret-version-dependencies": "off"
1010
}
1111
}
1212
]

nx.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
"tsc": {
2020
"dependsOn": ["^tsc", "^build"],
21-
"outputs": ["{projectRoot}/dist/*.d.ts"]
21+
"outputs": ["{projectRoot}/dist"]
2222
}
2323
}
2424
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"build": "turbo run build tsc",
1313
"build:turbo": "turbo run build tsc",
1414
"build:nx": "nx run-many -t build,tsc",
15-
"build:storybook": "storybook build",
15+
"build-storybook": "storybook build",
1616
"build:docs": "npx ts-node ./scripts/parse-tsdocs.ts",
1717
"lint": "npm-run-all --parallel lint:*",
1818
"lint:prettier": "prettier --check \"**/*.{js,ts,tsx,json,md,yml}\"",

packages/icon-button/package.json

-3
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,5 @@
3939
},
4040
"bugs": {
4141
"url": "https://jira.mongodb.org/projects/PD/summary"
42-
},
43-
"devDependencies": {
44-
"lodash": "^4.17.21"
4542
}
4643
}

packages/palette/src/Palette.story.tsx

+9-41
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
1-
import React, { useRef, useState } from 'react';
1+
import React from 'react';
22
import { isUndefined } from 'lodash';
33
import { darken, lighten, readableColor, transparentize } from 'polished';
44

55
import { css, cx } from '@leafygreen-ui/emotion';
66
import { HTMLElementProps, StoryMetaType } from '@leafygreen-ui/lib';
7-
import {
8-
focusRing,
9-
hoverRing,
10-
transitionDuration,
11-
typeScales,
12-
} from '@leafygreen-ui/tokens';
13-
import Tooltip from '@leafygreen-ui/tooltip';
147

158
import palette from './palette';
169

@@ -30,31 +23,20 @@ const colorBlock = css`
3023
padding-bottom: 100%;
3124
border-radius: 8px;
3225
cursor: pointer;
33-
transition: box-shadow ease-in-out ${transitionDuration.default}ms;
34-
&:hover {
35-
box-shadow: ${hoverRing.light.gray};
36-
}
37-
&:focus {
38-
box-shadow: ${focusRing.light.default};
39-
}
4026
`;
4127

4228
const hexLabelStyle = css`
4329
width: calc(100% - 1em);
4430
position: absolute;
4531
left: 50%;
4632
margin: auto;
47-
font-size: ${typeScales.body1.fontSize}px;
48-
line-height: ${typeScales.body1.lineHeight}px;
4933
text-align: center;
5034
padding: 3px 0.3rem;
5135
border-radius: 4px;
5236
transform: translate(-50%, -125%);
5337
`;
5438

5539
const nameLabelStyle = css`
56-
font-size: ${typeScales.body1.fontSize}px;
57-
line-height: ${typeScales.body1.lineHeight}px;
5840
text-align: center;
5941
color: ${palette.gray.dark1};
6042
margin: auto;
@@ -82,8 +64,6 @@ interface ColorBlockProps extends HTMLElementProps<'div'> {
8264
}
8365

8466
function ColorBlock({ hue, shade, ...rest }: ColorBlockProps) {
85-
const [copied, setCopied] = useState(false);
86-
const colorBlockRef = useRef<HTMLButtonElement>(null);
8767
const name = `${hue} ${shade ?? ''}`;
8868

8969
let color: string;
@@ -109,29 +89,11 @@ function ColorBlock({ hue, shade, ...rest }: ColorBlockProps) {
10989
background-color: ${lighten(0.2, color)};
11090
`;
11191

112-
const copyHex = () => {
113-
navigator.clipboard.writeText(color);
114-
115-
setCopied(true);
116-
117-
setTimeout(() => {
118-
setCopied(false);
119-
}, 1500);
120-
};
121-
12292
return (
12393
<div className={cx(colorBlockWrapper, colorBlockWrapperDynamic)} {...rest}>
124-
<button className={cx(colorBlock, colorBlockColor)} onClick={copyHex} />
94+
<button className={cx(colorBlock, colorBlockColor)} />
12595
<div className={cx(hexLabelStyle, hexLabelColor)}>{color}</div>
12696
<div className={nameLabelStyle}>{name}</div>
127-
<Tooltip
128-
open={copied}
129-
refEl={colorBlockRef}
130-
usePortal={false}
131-
spacing={0}
132-
>
133-
Copied {color}
134-
</Tooltip>
13597
</div>
13698
);
13799
}
@@ -162,7 +124,13 @@ export function AllColors() {
162124

163125
return (
164126
<div>
165-
<ColorBlock hue="white" name="white" style={{ marginRight: '24px' }} />
127+
<ColorBlock
128+
hue="white"
129+
name="white"
130+
className={css`
131+
marginright: '24px';
132+
`}
133+
/>
166134
<ColorBlock hue="black" name="black" />
167135
{hues.map(hue => {
168136
const hueValues = palette[hue];

turbo.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"tsc": {
1212
"dependsOn": ["^tsc", "^build"],
13-
"outputs": ["dist/**/*.d.ts", "tsconfig.tsbuildinfo"]
13+
"outputs": ["dist/**", "tsconfig.tsbuildinfo"]
1414
}
1515
}
1616
}

0 commit comments

Comments
 (0)