Skip to content

Commit

Permalink
Merge pull request #14 from vnphanquang/main
Browse files Browse the repository at this point in the history
Quality of Life Improvements for Development and Publication Workflow
  • Loading branch information
11bit authored Dec 5, 2024
2 parents 843eb65 + 3ad5d23 commit 1dd2909
Show file tree
Hide file tree
Showing 25 changed files with 1,033 additions and 136 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/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "evilmartians/harmony" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
5 changes: 5 additions & 0 deletions .changeset/soft-balloons-serve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@evilmartians/harmony": minor
---

set pacakge as ESM-first, prioritize ESM exports as `.js`, update CommonJS exports as `.cjs`, fix [publint](https://publint.dev/@evilmartians/[email protected]) recommendations
48 changes: 48 additions & 0 deletions .github/workflows/changesets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Changesets
on:
push:
branches:
- main
paths:
- '.changeset/**'
- '.github/workflows/changesets.yaml'
workflow_dispatch:

env:
CI: true
jobs:
Version:
# prevents this action from running on forks
if: github.repository == 'evilmartians/harmony'
permissions:
contents: write # to create release (changesets/action)
pull-requests: write # to create pull request (changesets/action)
id-token: write # OpenID Connect token needed for provenance
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Install node dependencies
run: 'deno install'

- name: Create release PR or Publish to npm
uses: changesets/action@v1
with:
version: deno task ci:changesets:version
publish: deno task ci:changesets:publish
commit: 'Changesets versioning & publication'
title: 'Changesets: Versioning & Publication'
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

40 changes: 0 additions & 40 deletions .github/workflows/lint.yml

This file was deleted.

39 changes: 0 additions & 39 deletions .github/workflows/publish.yml.disabled

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Tests
on:
push:
branches:
- main
paths:
- "scripts/**/*"
- ".github/workflows/tests.yaml"
pull_request:
branches:
- main
workflow_dispatch:

env:
CI: true
jobs:
Test:
if: github.repository == 'evilmartians/harmony' # prevents this action from running on forks
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install Deno
uses: denoland/setup-deno@v2
with:
deno-version: v2.x

- name: Install dependencies
run: "deno install"

- name: Lint
run: "deno lint"

- name: Type-check
run: "deno check **/*.ts"

- name: Build
run: "deno task build"

- name: Publint
run: "deno task publint"

- name: Run unit tests
run: "deno task ci:test"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
dist/
dist
node_modules
coverage
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
![Harmony](cover.png)

[![github.actions.changesets.badge]][github.actions.changesets] [![MIT][license.badge]][license] [![npm.badge]][npm]

# Harmony: Accessible UI Color Palette

The
[Harmony palette](https://www.figma.com/community/file/1287828769207775946/harmony-accessible-ui-color-palette)
is designed to elevate control over color contrast in your design system.

- Uses OKLCH and APCA for highly consistent color shades
- Has P3 options for modern screens
- Created to keep precise control over text and UI element contrast
Expand Down Expand Up @@ -38,7 +41,7 @@ Simply import `@evilmartians/harmony/tailwind.css`:

```css
/* app.css, or anywhere within Tailwind-aware context */
@import 'tailwindcss';
@import "tailwindcss";
@import "@evilmartians/harmony/tailwind.css";
```

Expand Down Expand Up @@ -82,7 +85,7 @@ export default {
Harmony palette provides a set of files with css variables. Each file contains all shades for one color in OKLCH with RGB fallbacks for old browsers. Just import colors you need and use them in css:

```css
@import '@evilmartians/harmony/css/orange.css';
@import "@evilmartians/harmony/css/orange.css";

h1 {
color: var(--orange-600);
Expand All @@ -93,7 +96,7 @@ Harmony also provides an `index.css` file that imports all other css files.
👮WARNING: this file is **huge** and should be used only in combination with PurgeCSS (with `variables` option enabled), other tools that can clean unused css variables, or if you really need all the colors.

```css
@import '@evilmartians/harmony/css/index.css';
@import "@evilmartians/harmony/css/index.css";

/* now you can use any color */
h1 {
Expand All @@ -114,3 +117,30 @@ from `@evilmartians/harmony/base`
import palette from "@evilmartians/harmony/base";
console.log(palette.red["50"]); // => oklch(0.988281 0.0046875 20)
```

## Development

### Prerequisites

| Dependency | Version | Description |
| ---------------------------------------------------- | ------- | ----------------- |
| [Deno](https://docs.deno.com/runtime/) | ^2.0 | Runtime |
| [Lefthook](https://github.com/evilmartians/lefthook) | ^0.7.0 | Git-hooks manager |

### Publication Workflow

The project uses [changesets](https://github.com/changesets/changesets) to manage versioning and changelog.
Typical workflow is as follow:

1. make changes to codebase,
2. run `deno task changesets` at project root and follow prompt to generate a "changeset" (logging a change),
3. commit both (1) and (2) into git.

The [changesets Github action](./.github/workflows/changesets.yaml) is triggered on `push` to `main` and will create a corresponding "Changesets: Versioning & Publication" pull request, which, upon merged, will trigger publication of the new version to NPM.

[license.badge]: https://img.shields.io/badge/license-MIT-blue.svg
[license]: ./LICENSE
[npm.badge]: https://img.shields.io/npm/v/@evilmartians/harmony
[npm]: https://www.npmjs.com/package/@evilmartians/harmony
[github.actions.changesets.badge]: https://github.com/evilmartians/harmony/actions/workflows/changesets.yaml/badge.svg?branch=main
[github.actions.changesets]: https://github.com/evilmartians/harmony/actions/workflows/changesets.yaml
22 changes: 21 additions & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
{
"tasks": {
"build": "deno run --allow-read --allow-write scripts/build.ts",
"publint": "deno run --allow-read --allow-env npm:publint",
"test": "deno test --allow-read --allow-write",
"update-snapshots": "deno test --allow-read --allow-write -- --update"
"update-snapshots": "deno test --allow-read --allow-write -- --update",
"changesets": "deno run -A npm:@changesets/cli",
"ci:test": "deno test -A --clean --coverage=coverage --junit-path=coverage/junit.xml",
"ci:coverage": "deno coverage --lcov --output=./coverage/coverage.lcov",
"ci:changesets:version": "deno run -A npm:@changesets/cli version",
"ci:changesets:publish": "deno run -A npm:@changesets/cli publish"
},
"fmt": {
"useTabs": false,
"lineWidth": 100,
"indentWidth": 2,
"semiColons": true,
"singleQuote": false,
"proseWrap": "preserve"
},
"nodeModulesDir": "auto",
"imports": {
"@std/assert": "jsr:@std/assert@^1.0.8",
"@std/path": "jsr:@std/path@^1.0.8",
"@std/testing": "jsr:@std/testing@^1.0.5"
}
}
Loading

0 comments on commit 1dd2909

Please sign in to comment.