-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: update config patterns, include husky hooks, etc
- Loading branch information
1 parent
ab1917c
commit 6df0d1d
Showing
22 changed files
with
242 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# whether to pregenerate static CSS with Panda | ||
PREGENERATE_STATIC_CSS=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Test 🧪 | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
jobs: | ||
test: | ||
name: Run Storybook tests 🃏 | ||
timeout-minutes: 60 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- name: Install dependencies | ||
run: bun i | ||
- name: Install Playwright | ||
run: npx playwright install --with-deps | ||
- name: Build Storybook | ||
# https://github.com/storybookjs/storybook/issues/6408 | ||
run: NODE_OPTIONS=--max_old_space_size=8192 bun storybook:build --quiet | ||
- name: Serve Storybook and run tests | ||
run: bun test:ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
build | ||
node_modules | ||
build | ||
coverage | ||
generated | ||
storybook-static | ||
|
||
.env* | ||
!.env*.template |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
bun commitlint --edit $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
bun lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"*.{ts,tsx}": ["bun format", "bun lint"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { RuleConfigSeverity } from "@commitlint/types"; | ||
|
||
import type { UserConfig as CommitlintUserConfig } from "@commitlint/types"; | ||
|
||
// TODO extract to dedicated repo with unit tests (test different commit message inputs) | ||
|
||
/** | ||
* `commitlint` configuration. | ||
* @see https://commitlint.js.org/#/reference-configuration | ||
*/ | ||
const commitlintConfig: CommitlintUserConfig = { | ||
extends: ["@commitlint/config-conventional"], | ||
// whether to use default ignore rules | ||
defaultIgnores: true, | ||
// rule overrides | ||
rules: { | ||
// specify valid types | ||
"type-enum": [ | ||
RuleConfigSeverity.Error, | ||
"always", | ||
[ | ||
"build", // build system, dependencies, tooling | ||
"chore", // maintenance | ||
"ci", // continuous integration | ||
"docs", // update documentation | ||
"feature", // add a feature | ||
"fix", // fix a bug | ||
"perf", // performance improvement | ||
"refactor", // change project/code structure | ||
// "revert", // revert a commit (intentionally omitted) | ||
"style", // formatting, visual changes | ||
"test", // update tests (unit, integration, E2E, etc.) | ||
], | ||
], | ||
}, | ||
}; | ||
|
||
export default commitlintConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Application config. | ||
*/ | ||
const app = { | ||
name: { short: "Tigris", full: "Tigris UI Library" }, | ||
organization: { | ||
name: "Tigris", | ||
}, | ||
}; | ||
|
||
export default app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** | ||
* Environment variables. | ||
*/ | ||
export const { PREGENERATE_STATIC_CSS } = process.env; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { default as app } from "./app.config"; | ||
export * from "./env.config"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { modalRecipe } from "../../components/Modal/Modal.recipe"; | ||
|
||
export const recipes = {}; | ||
|
||
export const slotRecipes = { | ||
modal: modalRecipe, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { default as mapArrayToObject } from "./mapArrayToObject"; | ||
export { default as sleep } from "./sleep"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
type ComputedPropertyName = string | number | symbol; | ||
|
||
// TODO extract to Omni common utils | ||
|
||
/** | ||
* Map an array to an object. | ||
* @param arr Array to map. | ||
* @param val Value to assign to each key. | ||
* @returns Object with the array values as keys and the value of each key is an array with a single value: "*". | ||
* | ||
* @example | ||
* mapArrayToObject(["a", "b", "c"], "letter"); // { a: "letter", b: "letter", c: "letter" } | ||
*/ | ||
const mapArrayToObject = <T extends ComputedPropertyName, V>( | ||
arr: T[], | ||
val: V | ||
) => arr.reduce((o, key) => ({ ...o, [key]: val }), {}); | ||
|
||
export default mapArrayToObject; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { getJestConfig } from "@storybook/test-runner"; | ||
|
||
/** | ||
* Storybook test runner Jest configuration. | ||
* @see https://github.com/storybookjs/test-runner#jest-options | ||
* @type {import('@jest/types').Config.InitialOptions} | ||
*/ | ||
export default { | ||
// default configuration from `@storybook/test-runner` | ||
...getJestConfig(), | ||
// set test timeout (default is 15s) | ||
testTimeout: 30000, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"compilerOptions": { | ||
"noEmit": false, | ||
// enable declaration generation | ||
"declaration": true, | ||
"emitDeclarationOnly": true, | ||
"moduleResolution": "node", | ||
// generate declaration source map | ||
"declarationMap": true, | ||
"noImplicitAny": false | ||
}, | ||
// overwrite include from composed `tsconfig` | ||
"include": [], | ||
"files": ["src/index.ts"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.