Skip to content

Commit 858cf6a

Browse files
committed
ci: continuous integration and publish
1 parent d06c70f commit 858cf6a

18 files changed

+3844
-193
lines changed

.eslintrc.js

+10
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ module.exports = {
2626
// Fixes eslint not being able to detect react version
2727
react: { pragma: 'React', fragment: 'Fragment', version: 'detect' },
2828
},
29+
env: {
30+
browser: true,
31+
node: true,
32+
},
2933
rules: {
3034
'max-params': ['error', 3],
3135
'prettier/prettier': 'error',
@@ -87,5 +91,11 @@ module.exports = {
8791
'react/no-multi-comp': ['off'],
8892
},
8993
},
94+
{
95+
files: ['**/*.js'],
96+
rules: {
97+
'@typescript-eslint/no-var-requires': ['off'],
98+
},
99+
},
90100
],
91101
};

.github/workflows/ci.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 'Continuous Integration'
2+
3+
on:
4+
pull_request:
5+
6+
permissions:
7+
contents: write
8+
packages: write
9+
actions: read
10+
pull-requests: write
11+
12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
jobs:
17+
verify:
18+
name: Verify
19+
runs-on: ubuntu-20.04
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v4
23+
24+
- name: Collect Workflow Telemetry
25+
uses: catchpoint/workflow-telemetry-action@v2
26+
with:
27+
comment_on_pr: false
28+
29+
- name: Setup node
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version-file: '.nvmrc'
33+
cache: 'yarn'
34+
35+
- name: Node modules cache
36+
uses: actions/cache@v4
37+
with:
38+
path: node_modules
39+
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
40+
41+
- name: Install dependencies
42+
run: yarn install --immutable --inline-builds
43+
44+
- name: Format
45+
run: yarn format-check
46+
47+
- name: Lint
48+
run: yarn lint
49+
50+
- name: Typecheck
51+
run: yarn type-check

.github/workflows/publish.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: 'Publish'
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
actions: read
12+
pull-requests: write
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
16+
cancel-in-progress: true
17+
18+
jobs:
19+
publish:
20+
name: Publish
21+
if: github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(release):')
22+
runs-on: ubuntu-20.04
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
27+
- name: Collect Workflow Telemetry
28+
uses: catchpoint/workflow-telemetry-action@v2
29+
with:
30+
comment_on_pr: false
31+
32+
- name: Setup node
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version-file: '.nvmrc'
36+
cache: 'yarn'
37+
38+
- name: Node modules cache
39+
uses: actions/cache@v4
40+
with:
41+
path: node_modules
42+
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}
43+
44+
- name: Install dependencies
45+
run: yarn install --immutable --inline-builds
46+
47+
- name: Format
48+
run: yarn format-check
49+
50+
- name: Lint
51+
run: yarn lint
52+
53+
- name: Typecheck
54+
run: yarn type-check
55+
56+
- name: Build
57+
run: yarn build
58+
59+
- name: Release npm package
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
62+
NPM_TOKEN: ${{ secrets.GH_TOKEN }}
63+
run: npx semantic-release

.husky/commit-msg

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no -- commitlint --edit ${1}

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn lint-staged -c ./lint-staged.config.js

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v20.12.2

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ dist
22
node_modules
33
.yarn
44
src/icons/**
5+
CHANGELOG.md

.releaserc

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/release-notes-generator",
8+
"@semantic-release/changelog",
9+
"@semantic-release/npm",
10+
[
11+
"@semantic-release/github",
12+
{
13+
"successComment": false,
14+
"failComment": false,
15+
"labels": false
16+
}
17+
],
18+
[
19+
"@semantic-release/git",
20+
{
21+
"assets": [
22+
"package.json",
23+
"CHANGELOG.md"
24+
],
25+
"message": "chore(release): ${nextRelease.version}"
26+
}
27+
]
28+
]
29+
}

commitlint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = { extends: ['@commitlint/config-conventional'] };

lint-staged.config.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module.exports = {
2+
// Type check TypeScript files
3+
'**/*.(ts|tsx)': () => 'yarn type-check',
4+
5+
// Lint then format TypeScript and JavaScript files
6+
'**/*.(ts|tsx|js)': filenames => [
7+
`yarn lint:fix ${filenames.join(' ')}`,
8+
`yarn format ${filenames.join(' ')}`,
9+
],
10+
11+
// Format MarkDown and JSON
12+
'**/*.(md|json)': filenames => `yarn format ${filenames.join(' ')}`,
13+
};

package.json

+19-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@lace/ui",
2+
"name": "@input-output-hk/lace-ui-toolkit",
33
"version": "0.1.0",
44
"description": "Lace UI Toolkit",
55
"homepage": "https://github.com/input-output-hk/lace-ui-toolkit/blob/main/README.md",
@@ -10,6 +10,12 @@
1010
"type": "git",
1111
"url": "git+https://github.com/input-output-hk/lace-ui-toolkit.git"
1212
},
13+
"files": [
14+
"LICENSE",
15+
"README.md",
16+
"dist",
17+
"package.json"
18+
],
1319
"license": "Apache-2.0",
1420
"author": "IOHK",
1521
"main": "dist/index.js",
@@ -22,15 +28,18 @@
2228
"cleanup": "yarn exec rm -rf dist node_modules",
2329
"format": "yarn prettier --write .",
2430
"format-check": "yarn prettier --check .",
25-
"lint": "yarn eslint --ext .ts,.tsx .",
26-
"lint:fix": "yarn eslint --ext .ts,.tsx --fix .",
31+
"lint": "yarn eslint --ext .ts,.tsx,.js,.jsx .",
32+
"lint:fix": "yarn eslint --ext .ts,.tsx,.js,.jsx --fix .",
2733
"storybook": "NODE_OPTIONS=--openssl-legacy-provider; start-storybook -p 6006",
2834
"test": "echo \"@lace/ui: no test command specified\"",
2935
"test-storybook": "test-storybook",
3036
"test-storybook:ci": "NODE_OPTIONS=--openssl-legacy-provider; export STORYBOOK_TEST=1; concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"yarn build-storybook && http-server storybook-static --port 6006\" \"wait-on http://127.0.0.1:6006/ && yarn test-storybook\"",
3137
"type-check": "tsc --noEmit",
3238
"watch": "yarn build --watch"
3339
},
40+
"publishConfig": {
41+
"registry": "https://npm.pkg.github.com"
42+
},
3443
"dependencies": {
3544
"@radix-ui/react-alert-dialog": "^1.0.4",
3645
"@radix-ui/react-avatar": "^1.0.2",
@@ -64,10 +73,14 @@
6473
"devDependencies": {
6574
"@babel/cli": "^7.22.10",
6675
"@babel/core": "^7.21.0",
76+
"@commitlint/cli": "^17.6.3",
77+
"@commitlint/config-conventional": "^17.6.3",
6778
"@rollup/plugin-commonjs": "20.0.0",
6879
"@rollup/plugin-image": "2.1.1",
6980
"@rollup/plugin-node-resolve": "13.0.4",
7081
"@rollup/plugin-typescript": "^11.1.1",
82+
"@semantic-release/changelog": "^6.0.3",
83+
"@semantic-release/git": "^10.0.1",
7184
"@storybook/addon-actions": "^6.5.16",
7285
"@storybook/addon-essentials": "^6.5.16",
7386
"@storybook/addon-interactions": "^6.5.16",
@@ -100,11 +113,14 @@
100113
"eslint-plugin-react": "7.31.8",
101114
"eslint-plugin-storybook": "^0.6.11",
102115
"http-server": "^14.1.1",
116+
"husky": "^8.0.3",
103117
"jest-image-snapshot": "^6.1.0",
118+
"lint-staged": "^13.2.2",
104119
"prettier": "3.2.5",
105120
"rollup": "2.56.3",
106121
"rollup-plugin-copy": "^3.4.0",
107122
"rollup-plugin-peer-deps-external": "^2.2.4",
123+
"semantic-release": "^21.0.2",
108124
"storybook": "7.6.7",
109125
"storybook-addon-pseudo-states": "^1.15.2",
110126
"typescript": "^4.9.5",

src/design-system/cards/create-card-variant-component.util.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ export type VariantCardProps = Omit<CardProps, 'scheme'>;
99

1010
export const createCardVariantComponent =
1111
<Props extends VariantCardProps>(scheme: Scheme) =>
12+
// eslint-disable-next-line react/display-name
1213
(props: Readonly<Props>) => <BaseCard {...props} scheme={scheme} />;
13-
14-
createCardVariantComponent.displayName = 'createCardVariantComponent';

src/design-system/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export { Metadata, MetadataLink } from './metadata';
2727
export { PasswordBox } from './password-box';
2828
export { TextLink } from './text-link';
2929
export * as ProfileDropdown from './profile-dropdown';
30+
export type { AccountData } from './profile-dropdown';
3031
export { TextBox } from './text-box';
3132
export { Variants, Section, colorSchemaDecorator } from './decorators';
3233
export * as EducationalCard from './educational-card';

src/design-system/select/select.stories.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,7 @@ const getOptionTestId = ({
318318
}>): string =>
319319
`theme_${colorScheme}-select-${variant}-align_${align}-${optionValue}`;
320320

321+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
321322
export const Interactions: ComponentStory<any> = (): JSX.Element => {
322323
const { lightThemePortalContainer, darkThemePortalContainer } =
323324
usePortalContainer();

src/design-system/table/table-row.component.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ export const Row = <T extends object>({
9292
data-testid={`${dataTestId}-list-${cell}`}
9393
>
9494
<span className={cx.cellInner}>
95+
{/* @ts-expect-error improve */}
9596
{(typeof cellRenderers?.[cell] === 'function'
9697
? cellRenderers[cell]?.({ value: data[cell] })
9798
: data[cell]) ?? '-'}

src/design-system/text/create-text.util.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export const createText = <
4747
}: Readonly<CreateTextArguments<T, W>>): ForwardRefExoticComponent<
4848
TextProps<W>
4949
> =>
50+
// eslint-disable-next-line react/display-name
5051
forwardRef<typeof Tag, TextProps<W>>(
5152
(
5253
{ weight = defaultWeight, color = 'primary', className, ...props },
@@ -65,5 +66,3 @@ export const createText = <
6566
/>
6667
),
6768
);
68-
69-
createText.displayName = 'createText';

tsconfig.eslint.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
{
22
"extends": "./tsconfig.json",
3-
"include": [".eslintrc.js", "src/**/*", "rollup.config.js", ".storybook/**/*"]
3+
"include": [
4+
".eslintrc.js",
5+
".storybook/**/*",
6+
"commitlint.config.js",
7+
"lint-staged.config.js",
8+
"rollup.config.js",
9+
"src/**/*"
10+
]
411
}

0 commit comments

Comments
 (0)