Skip to content

Commit

Permalink
v4: Monorepo & Refactor to Vanilla Core (#122)
Browse files Browse the repository at this point in the history
Co-authored-by: Rogin Farrer <rfarrer@wayfair.com>
  • Loading branch information
roginfarrer and Rogin Farrer authored Jan 16, 2023
1 parent b015402 commit 1ee93e8
Show file tree
Hide file tree
Showing 80 changed files with 18,908 additions and 16,999 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@2.2.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
17 changes: 17 additions & 0 deletions .changeset/witty-birds-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
'@collapsed/core': major
'@collapsed/react': major
---

## BREAKING CHANGES

- Adopts React 18's `useId`, making the library incompatible with React <18
- Switch to `tsup` from `microbundle` for bundling library. No longer exports a UMD version, just CJS and MJS

## Features & Bug fixes

- Refactors core functionality to vanilla JS (with a React) adapter, which I think should fix #103 and fix #100
- Added `onExpandedChange` option
- Tries to detect if `getToggleProps` is used. If the toggle element ref can be accessed, the `aria-labelledby` attribute will be added to the collapse element
- Added `role="region"` to collapse
- Updated toggle props to pass the appropriate attributes to the element, whether it's a button or not
55 changes: 55 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tests

on:
push:
branches:
- main
pull_request:

jobs:
main:
runs-on: ubuntu-latest
# To use Turborepo Remote Caching, set the following environment variables for the job.
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2

- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: latest

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'pnpm'

- name: Install Dependencies
run: pnpm install

- name: Build
run: pnpm build

- name: Lint
run: pnpm lint

- name: Test
run: pnpm test

- name: Cypress
run: cd packages/react && npx cypress install && npx cypress run --component && cd -

# - name: Cypress run
# uses: cypress-io/github-action@v5
# with:
# command-prefix: npx
# install: false
# component: true
# working-directory: ./packages/react
70 changes: 42 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,59 @@
name: Release npm package
name: Release

on:
push:
branches:
- main
pull_request:

jobs:
test:
name: 'CI'
release:
name: Publish & Deploy
runs-on: ubuntu-latest
env:
CI: true
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 14
- name: Install Dependencies
uses: bahmutov/npm-install@v1
- name: Build
run: yarn build
- name: Lint
run: yarn lint
- name: Test
run: yarn test
node-version: 16

release:
name: Publish to NPM
needs: test
# publish only when merged in master on original repo, not on PR
if: github.repository == 'roginfarrer/react-collapsed' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
node-version: 14
version: 7
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Dependencies
uses: bahmutov/npm-install@v1
run: pnpm install

- name: Build
run: yarn build
- run: npx semantic-release
run: pnpm build

- name: Create release PR or publish to npm
uses: changesets/action@v1
with:
publish: pnpm publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ node_modules
.cache
dist
storybook-static
.turbo
.parcel-cache
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.18.0
v16
27 changes: 13 additions & 14 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
MIT License
The MIT License (MIT)

Copyright (c) 2019-2020 Rogin Farrer
Copyright (c) 2019-2023, Rogin Farrer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
98 changes: 0 additions & 98 deletions MIGRATION-2.x-to-3.x.md

This file was deleted.

Loading

0 comments on commit 1ee93e8

Please sign in to comment.