Simplify and improve overall structure (#1044)
* simplify CI and make it consistent with CI of tailwindcss * add contributing guidelines * use correct org name * ensure `yarn lint` is fully passing without warnings * add subject to change message for `insiders` build
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
# Contributing
|
||||
|
||||
Thanks for your interest in contributing to Headless UI! Please take a moment to review this document **before submitting a pull request**.
|
||||
|
||||
## Pull requests
|
||||
|
||||
**Please ask first before starting work on any significant new features.**
|
||||
|
||||
It's never a fun experience to have your pull request declined after investing a lot of time and effort into a new feature. To avoid this from happening, we request that contributors create [an issue](https://github.com/tailwindlabs/headlessui/issues) to first discuss any significant new features. This includes things like adding new components, exposing internal information, etc.
|
||||
Also make sure that you are making changes to both the `React` and `Vue` versions so that we can ensure feature parity.
|
||||
|
||||
## Monorepo
|
||||
|
||||
The Headless UI repo is a monorepo using `yarn` workspaces. Note that we are using `yarn` version 1.
|
||||
|
||||
## Coding standards
|
||||
|
||||
Our code formatting rules are defined by TSDX, which uses `eslint` and we also use `prettier`. You can check your code against these standards by running:
|
||||
|
||||
```sh
|
||||
yarn lint
|
||||
```
|
||||
|
||||
To automatically fix any style violations in your code, you can run:
|
||||
|
||||
```sh
|
||||
yarn lint --fix
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
You can run the test suite using the following commands:
|
||||
|
||||
```sh
|
||||
yarn test
|
||||
```
|
||||
|
||||
You can also run them for React of Vue individually:
|
||||
|
||||
```sh
|
||||
yarn react test
|
||||
|
||||
# or
|
||||
|
||||
yarn vue test
|
||||
```
|
||||
|
||||
Please ensure that the tests are passing when submitting a pull request. If you're adding new features to Headless UI, please include tests.
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
name: Release Dev
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [develop]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
registry-url: 'https://registry.npmjs.org'
|
||||
|
||||
- name: Use cached node_modules
|
||||
id: cache
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: '**/node_modules'
|
||||
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-modules-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
nodeModules-
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Test
|
||||
run: npm test
|
||||
env:
|
||||
CI: true
|
||||
|
||||
- name: Resolve version
|
||||
id: vars
|
||||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||
|
||||
- name: "Version based on commit: 0.0.0-dev.${{ steps.vars.outputs.sha_short }}"
|
||||
run: npm version -w packages 0.0.0-dev.${{ steps.vars.outputs.sha_short }} --force --no-git-tag-version
|
||||
|
||||
- name: Publish
|
||||
run: npm publish -w packages --tag dev
|
||||
env:
|
||||
CI: true
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Release Next
|
||||
name: Release Insiders
|
||||
|
||||
on:
|
||||
push:
|
||||
@@ -44,11 +44,11 @@ jobs:
|
||||
id: vars
|
||||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
|
||||
|
||||
- name: "Version based on commit: 0.0.0-next.${{ steps.vars.outputs.sha_short }}"
|
||||
run: npm version -w packages 0.0.0-next.${{ steps.vars.outputs.sha_short }} --force --no-git-tag-version
|
||||
- name: "Version based on commit: 0.0.0-insiders.${{ steps.vars.outputs.sha_short }}"
|
||||
run: npm version -w packages 0.0.0-insiders.${{ steps.vars.outputs.sha_short }} --force --no-git-tag-version
|
||||
|
||||
- name: Publish
|
||||
run: npm publish -w packages --tag next
|
||||
run: npm publish -w packages --tag insiders
|
||||
env:
|
||||
CI: true
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
@@ -13,6 +13,22 @@
|
||||
|
||||
For full documentation, visit [headlessui.dev](https://headlessui.dev).
|
||||
|
||||
### Installing the latest version
|
||||
|
||||
You can install the latest version by using:
|
||||
|
||||
- `npm install @headlessui/react@latest` or `yarn add @headlessui/react@latest`.
|
||||
- `npm install @headlessui/vue@latest` or `yarn add @headlessui/vue@latest`.
|
||||
|
||||
### Installing the insiders version
|
||||
|
||||
You can install the insiders version (which points to whatever the latest commit on the `main` branch is) by using:
|
||||
|
||||
- `npm install @headlessui/react@insiders` or `yarn add @headlessui/react@insiders`.
|
||||
- `npm install @headlessui/vue@insiders` or `yarn add @headlessui/vue@insiders`.
|
||||
|
||||
**Note:** The insiders build doesn't follow semver and therefore doesn't guarantee that the APIs will be the same once they are released.
|
||||
|
||||
## Packages
|
||||
|
||||
| Name | Version | Downloads |
|
||||
@@ -29,3 +45,8 @@ For help, discussion about best practices, or any other conversation that would
|
||||
For casual chit-chat with others using the library:
|
||||
|
||||
[Join the Tailwind CSS Discord Server](https://discord.gg/7NF8GNe)
|
||||
|
||||
## Contributing
|
||||
|
||||
If you're interested in contributing to Headless UI, please read our [contributing docs](https://github.com/tailwindlabs/headlessui/blob/main/.github/CONTRIBUTING.md) **before submitting a pull request**.
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ let Button = forwardRefWithAs(function Button<TTag extends ElementType = typeof
|
||||
}
|
||||
}
|
||||
},
|
||||
[dispatch, isWithinPanel, state.disclosureState]
|
||||
[dispatch, isWithinPanel, state.disclosureState, state.buttonId]
|
||||
)
|
||||
|
||||
let handleKeyUp = useCallback((event: ReactKeyboardEvent<HTMLButtonElement>) => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import React, { createElement, useEffect, useRef } from 'react'
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { render } from '@testing-library/react'
|
||||
|
||||
import { Popover } from './popover'
|
||||
import { suppressConsoleLogs } from '../../test-utils/suppress-console-logs'
|
||||
|
||||
Reference in New Issue
Block a user