Skip to content

Commit 1dd2909

Browse files
authored
Merge pull request #14 from vnphanquang/main
Quality of Life Improvements for Development and Publication Workflow
2 parents 843eb65 + 3ad5d23 commit 1dd2909

25 files changed

+1033
-136
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "evilmartians/harmony" }],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/soft-balloons-serve.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@evilmartians/harmony": minor
3+
---
4+
5+
set pacakge as ESM-first, prioritize ESM exports as `.js`, update CommonJS exports as `.cjs`, fix [publint](https://publint.dev/@evilmartians/[email protected]) recommendations

.github/workflows/changesets.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Changesets
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- '.changeset/**'
8+
- '.github/workflows/changesets.yaml'
9+
workflow_dispatch:
10+
11+
env:
12+
CI: true
13+
jobs:
14+
Version:
15+
# prevents this action from running on forks
16+
if: github.repository == 'evilmartians/harmony'
17+
permissions:
18+
contents: write # to create release (changesets/action)
19+
pull-requests: write # to create pull request (changesets/action)
20+
id-token: write # OpenID Connect token needed for provenance
21+
timeout-minutes: 5
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Install Deno
30+
uses: denoland/setup-deno@v2
31+
with:
32+
deno-version: v2.x
33+
34+
- name: Install node dependencies
35+
run: 'deno install'
36+
37+
- name: Create release PR or Publish to npm
38+
uses: changesets/action@v1
39+
with:
40+
version: deno task ci:changesets:version
41+
publish: deno task ci:changesets:publish
42+
commit: 'Changesets versioning & publication'
43+
title: 'Changesets: Versioning & Publication'
44+
createGithubReleases: true
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
48+

.github/workflows/lint.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/publish.yml.disabled

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/tests.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Tests
2+
on:
3+
push:
4+
branches:
5+
- main
6+
paths:
7+
- "scripts/**/*"
8+
- ".github/workflows/tests.yaml"
9+
pull_request:
10+
branches:
11+
- main
12+
workflow_dispatch:
13+
14+
env:
15+
CI: true
16+
jobs:
17+
Test:
18+
if: github.repository == 'evilmartians/harmony' # prevents this action from running on forks
19+
runs-on: ubuntu-latest
20+
timeout-minutes: 10
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Install Deno
28+
uses: denoland/setup-deno@v2
29+
with:
30+
deno-version: v2.x
31+
32+
- name: Install dependencies
33+
run: "deno install"
34+
35+
- name: Lint
36+
run: "deno lint"
37+
38+
- name: Type-check
39+
run: "deno check **/*.ts"
40+
41+
- name: Build
42+
run: "deno task build"
43+
44+
- name: Publint
45+
run: "deno task publint"
46+
47+
- name: Run unit tests
48+
run: "deno task ci:test"

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
dist/
1+
dist
2+
node_modules
3+
coverage

README.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
![Harmony](cover.png)
22

3+
[![github.actions.changesets.badge]][github.actions.changesets] [![MIT][license.badge]][license] [![npm.badge]][npm]
4+
35
# Harmony: Accessible UI Color Palette
46

57
The
68
[Harmony palette](https://www.figma.com/community/file/1287828769207775946/harmony-accessible-ui-color-palette)
79
is designed to elevate control over color contrast in your design system.
10+
811
- Uses OKLCH and APCA for highly consistent color shades
912
- Has P3 options for modern screens
1013
- Created to keep precise control over text and UI element contrast
@@ -38,7 +41,7 @@ Simply import `@evilmartians/harmony/tailwind.css`:
3841

3942
```css
4043
/* app.css, or anywhere within Tailwind-aware context */
41-
@import 'tailwindcss';
44+
@import "tailwindcss";
4245
@import "@evilmartians/harmony/tailwind.css";
4346
```
4447

@@ -82,7 +85,7 @@ export default {
8285
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:
8386

8487
```css
85-
@import '@evilmartians/harmony/css/orange.css';
88+
@import "@evilmartians/harmony/css/orange.css";
8689

8790
h1 {
8891
color: var(--orange-600);
@@ -93,7 +96,7 @@ Harmony also provides an `index.css` file that imports all other css files.
9396
👮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.
9497

9598
```css
96-
@import '@evilmartians/harmony/css/index.css';
99+
@import "@evilmartians/harmony/css/index.css";
97100

98101
/* now you can use any color */
99102
h1 {
@@ -114,3 +117,30 @@ from `@evilmartians/harmony/base`
114117
import palette from "@evilmartians/harmony/base";
115118
console.log(palette.red["50"]); // => oklch(0.988281 0.0046875 20)
116119
```
120+
121+
## Development
122+
123+
### Prerequisites
124+
125+
| Dependency | Version | Description |
126+
| ---------------------------------------------------- | ------- | ----------------- |
127+
| [Deno](https://docs.deno.com/runtime/) | ^2.0 | Runtime |
128+
| [Lefthook](https://github.com/evilmartians/lefthook) | ^0.7.0 | Git-hooks manager |
129+
130+
### Publication Workflow
131+
132+
The project uses [changesets](https://github.com/changesets/changesets) to manage versioning and changelog.
133+
Typical workflow is as follow:
134+
135+
1. make changes to codebase,
136+
2. run `deno task changesets` at project root and follow prompt to generate a "changeset" (logging a change),
137+
3. commit both (1) and (2) into git.
138+
139+
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.
140+
141+
[license.badge]: https://img.shields.io/badge/license-MIT-blue.svg
142+
[license]: ./LICENSE
143+
[npm.badge]: https://img.shields.io/npm/v/@evilmartians/harmony
144+
[npm]: https://www.npmjs.com/package/@evilmartians/harmony
145+
[github.actions.changesets.badge]: https://github.com/evilmartians/harmony/actions/workflows/changesets.yaml/badge.svg?branch=main
146+
[github.actions.changesets]: https://github.com/evilmartians/harmony/actions/workflows/changesets.yaml

deno.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
11
{
22
"tasks": {
33
"build": "deno run --allow-read --allow-write scripts/build.ts",
4+
"publint": "deno run --allow-read --allow-env npm:publint",
45
"test": "deno test --allow-read --allow-write",
5-
"update-snapshots": "deno test --allow-read --allow-write -- --update"
6+
"update-snapshots": "deno test --allow-read --allow-write -- --update",
7+
"changesets": "deno run -A npm:@changesets/cli",
8+
"ci:test": "deno test -A --clean --coverage=coverage --junit-path=coverage/junit.xml",
9+
"ci:coverage": "deno coverage --lcov --output=./coverage/coverage.lcov",
10+
"ci:changesets:version": "deno run -A npm:@changesets/cli version",
11+
"ci:changesets:publish": "deno run -A npm:@changesets/cli publish"
12+
},
13+
"fmt": {
14+
"useTabs": false,
15+
"lineWidth": 100,
16+
"indentWidth": 2,
17+
"semiColons": true,
18+
"singleQuote": false,
19+
"proseWrap": "preserve"
20+
},
21+
"nodeModulesDir": "auto",
22+
"imports": {
23+
"@std/assert": "jsr:@std/assert@^1.0.8",
24+
"@std/path": "jsr:@std/path@^1.0.8",
25+
"@std/testing": "jsr:@std/testing@^1.0.5"
626
}
727
}

0 commit comments

Comments
 (0)