Skip to content
This repository has been archived by the owner on Jan 5, 2023. It is now read-only.

chore: Convert to monorepo #613

Merged
merged 44 commits into from
Apr 22, 2022
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
5f73759
Move to monorepo setup
mayank99 Apr 1, 2022
a483695
Fix build
mayank99 Apr 1, 2022
b54e98a
Oopsie
mayank99 Apr 1, 2022
0e5631b
Fix README
mayank99 Apr 1, 2022
e6db666
Fix deprecation
mayank99 Apr 1, 2022
f1c4901
Fix publish workflows
mayank99 Apr 1, 2022
c976537
Install webpack5 in root
mayank99 Apr 1, 2022
aad0c98
Increase delay in Header tests
mayank99 Apr 1, 2022
0a768df
Merge branch 'main' into mayank/monorepo
mayank99 Apr 1, 2022
ee5dc5b
Merge branch 'main' into mayank/monorepo
mayank99 Apr 8, 2022
8de8b26
Fix typo in tsconfig
mayank99 Apr 8, 2022
724299d
Clean up gitignore
mayank99 Apr 8, 2022
042926e
Whoops bad merge
mayank99 Apr 8, 2022
6693de4
Remove leftovers
mayank99 Apr 8, 2022
4ca5ca5
Fix parallel yarn dev
mayank99 Apr 8, 2022
3ea4d4f
Fix `format` command
mayank99 Apr 8, 2022
257efe9
tests
veekeys Apr 8, 2022
363d5e0
Clean up nested gitignores
mayank99 Apr 8, 2022
23ef614
Remove favicon and font family from playground
mayank99 Apr 8, 2022
f4175ee
Move vscode to root and ignore md from prettier
mayank99 Apr 8, 2022
b0a62ad
Only keep README in root
mayank99 Apr 8, 2022
1cdc02f
Update deps
mayank99 Apr 8, 2022
e85bb71
Even cleaner README
mayank99 Apr 8, 2022
871507a
Merge branch 'main' into mayank/monorepo
mayank99 Apr 8, 2022
e4763db
Copy README on build
mayank99 Apr 8, 2022
213c2d5
Revert README
mayank99 Apr 8, 2022
58c2f19
Revert delay in Header.stories.tsx
mayank99 Apr 8, 2022
07ef30a
Merge branch 'main' into mayank/monorepo
mayank99 Apr 11, 2022
60ce4f1
Use `yarn dev` in github workflow
mayank99 Apr 11, 2022
4639a7b
Merge branch 'main' into mayank/monorepo
mayank99 Apr 11, 2022
dcc01f4
Fix linting and move configs into separate package
mayank99 Apr 18, 2022
23d82d5
Merge branch 'main' into mayank/monorepo
mayank99 Apr 18, 2022
457bcda
Match os theme in playground
mayank99 Apr 18, 2022
2e6979f
Disallow pushing with eslint warnings
mayank99 Apr 18, 2022
94d170e
Clean up eslintignore
mayank99 Apr 18, 2022
112ecd1
Fix bad merge
mayank99 Apr 18, 2022
be2eee7
Merge branch 'main' into mayank/monorepo
mayank99 Apr 20, 2022
d3a1212
Merge branch 'main' into mayank/monorepo
mayank99 Apr 20, 2022
28cbabf
Merge branch 'main' into mayank/monorepo
mayank99 Apr 21, 2022
80daaea
Wrap tooltip timer in `act` to fix warning
mayank99 Apr 21, 2022
0523924
Lock to patch version of `turbo`
mayank99 Apr 21, 2022
b6c1f5f
Remove `eslint-plugin-node`
mayank99 Apr 21, 2022
0b92fe3
Include md files in package
mayank99 Apr 21, 2022
13c0c35
Fix `copy-files` syntax
mayank99 Apr 21, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 0 additions & 6 deletions .eslintignore

This file was deleted.

44 changes: 0 additions & 44 deletions .eslintrc.js

This file was deleted.

24 changes: 12 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Use Node 12.X
- name: Use Node 16.X
uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: 16.x
cache: yarn

- run: yarn install --frozen-lockfile

- run: yarn audit

- run: yarn lint
- run: yarn lint:copyright ${{ github.workspace }}/*/**.{js,ts,tsx}
- run: yarn workspace @itwin/itwinui-react lint:copyright ${{ github.workspace }}/*/**.{js,ts,tsx}
- run: yarn build
- run: yarn build-storybook
- run: yarn workspace @itwin/itwinui-react build-storybook

unit-test:
name: Run unit tests
Expand All @@ -37,21 +37,21 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Use Node 12.X
- name: Use Node 16.X
uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: 16.x
cache: yarn

- run: yarn install --frozen-lockfile

- run: yarn test --coverage
- run: yarn workspace @itwin/itwinui-react test --coverage
bentleyvk marked this conversation as resolved.
Show resolved Hide resolved

- name: Publish test results
uses: EnricoMi/publish-unit-test-result-action@v1.16
if: always()
with:
files: 'coverage/junit.xml'
files: 'packages/iTwinUI-react/coverage/junit.xml'
comment_mode: off
check_name: 'Test results'
fail_on: 'nothing'
Expand All @@ -63,14 +63,14 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Use Node 12.X
- name: Use Node 16.X
uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: 16.x
cache: yarn

- run: yarn install --frozen-lockfile

# `&` symbol is needed as it prevents Storybook from running endlessly
- run: yarn storybook &
- run: yarn creevey
- run: yarn workspace @itwin/itwinui-react storybook &
- run: yarn workspace @itwin/itwinui-react creevey
9 changes: 5 additions & 4 deletions .github/workflows/publish-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Use Node 12.X
uses: actions/setup-node@v2.1.5
- name: Use Node 16.X
uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: 16.x
cache: yarn

- run: yarn install --frozen-lockfile
- run: yarn build-storybook
- run: yarn workspace @itwin/itwinui-react build-storybook

- name: Publish storybook
uses: peaceiris/actions-gh-pages@v3.7.3
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Use Node 12.X
- name: Use Node 16.X
uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: 16.x
registry-url: https://registry.npmjs.org/
bentleyvk marked this conversation as resolved.
Show resolved Hide resolved

- run: yarn install
- run: yarn build

- run: npm publish --access public
working-directory: './lib'
working-directory: './packages/iTwinUI-react'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_PUBLISH_ITWIN }}

Expand Down
45 changes: 18 additions & 27 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,40 +1,31 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# dependencies
node_modules/
node_modules/*
node_modules
.pnp
veekeys marked this conversation as resolved.
Show resolved Hide resolved
.pnp.js

# testing
coverage/
coverage/*
coverage

# production
build/
build/*
# next.js
.next/
veekeys marked this conversation as resolved.
Show resolved Hide resolved
out/
build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
*.pem
veekeys marked this conversation as resolved.
Show resolved Hide resolved

# Error/Debug logs
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
debug.log*

# Compiled Components
lib/
lib/*
.pnpm-debug.log*
veekeys marked this conversation as resolved.
Show resolved Hide resolved

# Compiled Styles
src/**/*.css

# Storybook
storybook-static/*
# local env files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move these up so not shown as change

.env.local
.env.development.local
.env.test.local
.env.production.local

# Yalc
.yalc/*
yalc.lock
# turbo
.turbo
112 changes: 25 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,105 +1,43 @@
<p align="center">
<img src="https://itwinplatformcdn.azureedge.net/iTwinUI/iTwinUI-logo.png" alt="iTwinUI logo" />
</p>
# Turborepo starter

<h1 align="center">iTwinUI-react</h1>
This is the monorepo for iTwinUI-react.

<div align="center">

[![itwinui-react on npm](https://img.shields.io/npm/v/@itwin/itwinui-react)](https://www.npmjs.com/package/@itwin/itwinui-react)
[![Build status](https://github.com/iTwin/iTwinUI-react/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/iTwin/iTwinUI-react/actions/workflows/build.yml?query=branch%3Amain)
## What's inside?

</div>
This repo uses [Yarn v1](https://classic.yarnpkg.com/lang/en/) as a package manager. It includes the following packages/apps:

## What is iTwinUI-react?
### Apps and Packages

iTwinUI-react is a library built on top of the [iTwinUI](https://github.com/iTwin/iTwinUI) library.
The goal of this project is to provide React components for using the styles and components from the core `iTwinUI` project. Check out the [demo website](https://itwin.github.io/iTwinUI-react/?path=/story/overview--overview) to see the components in action.
- `packages/iTwinUI-react`: the main library containing all iTwinUI-react components.
- `apps/playground`: a Vite app for testing iTwinUI-react components in a realistic setting.

---
## Development

## Installation
### Build

```
npm install @itwin/itwinui-react
```

```
yarn add @itwin/itwinui-react
```

---

## Usage

Import the component you want and start using it!

```jsx
import { Button } from '@itwin/itwinui-react';

const App = () => (
<Button>Hello!</Button>
);
```

Yes, that's really all you need as you can see in this live interactive demo:
To build all apps and packages, run the following command from the monorepo root:

[![Edit Button](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/itwinui-react-minimal-example-xq2t3)

---

## Theming

By default, all components use the light theme but we also provide support for switching to dark theme in two different ways:

- Use `ThemeProvider` in your root component where you can pass one of the following values:
- `light` (default)
- `dark`
- `os` (which respects the color scheme of the operating system)

```jsx
import { ThemeProvider } from '@itwin/itwinui-react';

const App = () => (
<>
<ThemeProvider theme='dark' />
// Your code goes here.
</>
);
```console
yarn run build
veekeys marked this conversation as resolved.
Show resolved Hide resolved
```

- The `useTheme` hook also provides the same functionality as `ThemeProvider`.
### Develop

```jsx
import { useTheme } from '@itwin/itwinui-react';
To develop all apps and packages, run the following command from the monorepo root:

const App = () => {
useTheme('dark');
return (
<>
// Your code goes here.
</>
);
};
```console
yarn run dev
veekeys marked this conversation as resolved.
Show resolved Hide resolved
```

*Note: You only need to use one of these methods, and it only needs to be done once.*

---

## FAQ

For a list of frequently asked questions, visit the [wiki](https://github.com/iTwin/iTwinUI-react/wiki/FAQ).

---

## Contributing

We welcome you to contribute and make this UI design system better. You can submit feature requests or bugs by creating an [issue](https://github.com/iTwin/iTwinUI-react/issues).
Please read our [CONTRIBUTING.md](https://github.com/iTwin/iTwinUI-react/blob/main/CONTRIBUTING.md) for more information.
This will start the vite playground at https://localhost:4000 and storybook at https://localhost:6006
veekeys marked this conversation as resolved.
Show resolved Hide resolved

---
## Useful Links

## Changelog
Learn more about the power of Turborepo:

Read our [CHANGELOG.md](https://github.com/iTwin/iTwinUI-react/blob/main/CHANGELOG.md) to find recent changes.
- [Pipelines](https://turborepo.org/docs/features/pipelines)
- [Caching](https://turborepo.org/docs/features/caching)
- [Remote Caching (Beta)](https://turborepo.org/docs/features/remote-caching)
- [Scoped Tasks](https://turborepo.org/docs/features/scopes)
- [Configuration Options](https://turborepo.org/docs/reference/configuration)
- [CLI Usage](https://turborepo.org/docs/reference/command-line-reference)
28 changes: 28 additions & 0 deletions apps/playground/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Logs
veekeys marked this conversation as resolved.
Show resolved Hide resolved
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

# yalc shit
.yalc
yalc.lock
13 changes: 13 additions & 0 deletions apps/playground/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/src/favicon.svg" />
veekeys marked this conversation as resolved.
Show resolved Hide resolved
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>iTwinUI test app</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>