Skip to content

Commit

Permalink
Merge pull request #1 from inkonchain/feat/init
Browse files Browse the repository at this point in the history
feat: initial repo, basic button with Storybook
  • Loading branch information
eitjuh authored Nov 8, 2024
2 parents 8ff77e1 + f6f1253 commit 2b3ceb2
Show file tree
Hide file tree
Showing 22 changed files with 5,416 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @inkonchain/developers-secret
30 changes: 30 additions & 0 deletions .github/actions/base-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Basic Setup"
description: "Basic setup with pnpm and cache restore"
runs:
using: "composite"
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
run_install: false

- name: Setup Node 20
uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "pnpm"

- name: Add pnpm store path to env var
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- name: Restore Cache
uses: actions/cache@v4
with:
path: |
${{ steps.pnpm-cache.outputs.STORE_PATH }}
**/node_modules
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
66 changes: 66 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: PR Checks
on: [pull_request]
jobs:
install_modules:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: false
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Add pnpm store path to env var
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Cache node modules
uses: actions/cache@v4
with:
path: |
${{ steps.pnpm-cache.outputs.STORE_PATH }}
**/node_modules
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
lint:
needs: install_modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/base-setup
name: Base Setup
- name: Run linting
run: pnpm run lint

format:
needs: install_modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/base-setup
name: Base Setup
- name: Run formatting
run: pnpm run format:check

build:
needs: install_modules
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/base-setup
name: Base Setup
- name: Debug Environment Variables
run: env
- name: Building app
run: pnpm run build
- name: Cache build
uses: actions/cache/save@v4
with:
path: apps/web/.next
key: ${{ runner.os }}-build-store-${{ hashFiles('./apps/web/src') }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist
node_modules
*storybook.log
17 changes: 17 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { StorybookConfig } from "@storybook/react-vite";

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-onboarding",
"@storybook/addon-essentials",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
"@storybook/addon-themes",
],
framework: {
name: "@storybook/react-vite",
options: {},
},
};
export default config;
27 changes: 27 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Preview, ReactRenderer } from "@storybook/react";
import { withThemeByDataAttribute } from "@storybook/addon-themes";

import "../src/tailwind.css";

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
decorators: [
withThemeByDataAttribute<ReactRenderer>({
themes: {
light: "",
dark: "dark",
},
defaultTheme: "light",
attributeName: "data-theme",
}),
],
};

export default preview;
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# ink-kit

Ink Kit
62 changes: 62 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import { FlatCompat } from "@eslint/eslintrc";
import js from "@eslint/js";
import importsPlugin from "eslint-plugin-import";
import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended";
import reactHooksPlugin from "eslint-plugin-react-hooks";
import simpleImportSort from "eslint-plugin-simple-import-sort";
import unusedImports from "eslint-plugin-unused-imports";
import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});

export default [
{
ignores: ["dist"],
},
...compat.extends(),
eslintPluginPrettierRecommended,
{
plugins: {
"simple-import-sort": simpleImportSort,
"unused-imports": unusedImports,
"react-hooks": reactHooksPlugin,
import: importsPlugin,
},

rules: {
"react-hooks/exhaustive-deps": "error",

"import/newline-after-import": [
"error",
{
count: 1,
},
],

"unused-imports/no-unused-imports": "error",

"simple-import-sort/imports": [
"error",
{
groups: [
["^react", "^@?\\w"],
["^(@)(/.*|$)"],
["^\\u0000"],
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
["^.+\\.?(css)$"],
],
},
],

"simple-import-sort/exports": "error",
},
},
];
62 changes: 62 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "@inkonchain/ink-kit",
"version": "1.0.0",
"description": "",
"main": "dist/index.cjs.js",
"module": "dist/index.es.js",
"types": "dist/index.d.ts",
"files": [
"/dist"
],
"scripts": {
"build": "tsc && vite build",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"lint": "eslint",
"lint:fix": "eslint --fix",
"format": "prettier --write \"**/*.{ts,tsx,md,mdx,css,scss}\"",
"format:check": "prettier --check \"**/*.{ts,tsx,md,mdx,css,scss}\"",
"test": "playwright test",
"fix:all": "pnpm run lint:fix && pnpm run format"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@chromatic-com/storybook": "^3.2.2",
"@storybook/addon-essentials": "^8.4.2",
"@storybook/addon-interactions": "^8.4.2",
"@storybook/addon-onboarding": "^8.4.2",
"@storybook/addon-themes": "^8.4.2",
"@storybook/blocks": "^8.4.2",
"@storybook/react": "^8.4.2",
"@storybook/react-vite": "^8.4.2",
"@storybook/test": "^8.4.2",
"@types/react": "^18.3.12",
"autoprefixer": "^10.4.20",
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-unused-imports": "^4.1.4",
"postcss": "^8.4.47",
"prettier": "^3.3.3",
"react": "^18.3.1",
"storybook": "^8.4.2",
"tailwindcss": "^3.4.14",
"tslib": "^2.8.1",
"typescript": "^5.6.3",
"vite": "^5.4.10",
"vite-plugin-dts": "^4.3.0"
},
"peerDependencies": {
"react": "^18"
},
"dependencies": {
"clsx": "^2.1.1",
"tailwind-merge": "^2.5.4"
},
"packageManager": "[email protected]"
}
Loading

0 comments on commit 2b3ceb2

Please sign in to comment.