Skip to content

Commit

Permalink
Merge pull request #1 from liuxian496/developer
Browse files Browse the repository at this point in the history
Developer
  • Loading branch information
liuxian496 committed Apr 21, 2024
2 parents ba77e36 + 1d95fa7 commit 0e9eb16
Show file tree
Hide file tree
Showing 33 changed files with 649 additions and 1 deletion.
14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', 'plugin:storybook/recommended'],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parser: '@typescript-eslint/parser',
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
41 changes: 41 additions & 0 deletions .github/workflows/cyndi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Storybook Test

on:
push:
branches: ["main", "developer"]
pull_request:
branches: ["main", "developer"]

jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install dependencies
run: yarn

- name: Install Playwright
run: npx playwright install --with-deps

- name: Build Storybook
run: yarn build-storybook --quiet

- name: Serve Storybook and run tests
run: |
npx concurrently -k -s first -n "SB,TEST" -c "magenta,blue" \
"npx http-server storybook-static --port 6006 --silent" \
"npx wait-on tcp:6006 && yarn test-storybook -- --coverage && yarn test-storybook"
- name: Locv Report
run: npx nyc report --reporter=lcov -t coverage/storybook --report-dir coverage/storybook

- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v2
26 changes: 26 additions & 0 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI Create Release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
Please refer to [CHANGELOG.md](https://github.com/liuxian496/cyndi/blob/main/CHANGELOG.md) for details.
draft: false
prerelease: false
58 changes: 58 additions & 0 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
timeout-minutes: 60
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install dependencies
run: yarn

- name: Build Storybook
run: yarn build-storybook

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: "storybook-static"

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# lock
yarn.lock
package-lock.json

# testing
/coverage
/.nyc_output

# npm
.npmrc

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

*storybook.log
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no-install commitlint --edit "$1"
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm test
8 changes: 8 additions & 0 deletions .storybook/cyndi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { create } from '@storybook/theming/create';

export default create({
base: 'light',
brandTitle: 'CYNDI',
brandImage: './cyndi.png',
brandTarget: '_self',
});
35 changes: 35 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import type { AddonOptionsBabel } from "@storybook/addon-coverage";
import type { StorybookConfig } from "@storybook/react-vite";

const coverageConfig: AddonOptionsBabel = {
istanbul: {
include: ["**"],
exclude: ["**/src/test/**"],
excludeNodeModules: true,
},
};

const config: StorybookConfig = {
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
"@storybook/addon-onboarding",
"@storybook/addon-links",
"@storybook/addon-essentials",
"@chromatic-com/storybook",
"@storybook/addon-interactions",
{
name: "@storybook/addon-coverage",
options: {
...coverageConfig,
},
},
],
framework: {
name: "@storybook/react-vite",
options: {},
},
docs: {
autodocs: "tag",
},
};
export default config;
6 changes: 6 additions & 0 deletions .storybook/manager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { addons } from '@storybook/manager-api';
import littenTheme from './cyndi';

addons.setConfig({
theme: littenTheme,
});
14 changes: 14 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Preview } from "@storybook/react";

const preview: Preview = {
parameters: {
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# [0.1.0](https://github.com/liuxian496/cyndi/compare/cd8636cb30848089f4d32c0b4a216adf66fce5b0...v0.1.0) (2024-04-21)


### Features

* 创建工程,添加getPrefixNs、isEmptyString、printArrayItem ([cd8636c](https://github.com/liuxian496/cyndi/commit/cd8636cb30848089f4d32c0b4a216adf66fce5b0))



27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,26 @@
## cyndi
# Cyndi
![GitHub](https://img.shields.io/github/license/liuxian496/cyndi)
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/liuxian496/cyndi/cyndi.yml)
[![Coverage Status](https://coveralls.io/repos/github/liuxian496/cyndi/badge.svg?branch=main)](https://coveralls.io/github/liuxian496/cyndi?branch=main)
![GitHub Repo stars](https://img.shields.io/github/stars/liuxian496/cyndi)


<p>Litten是一个React UI控件库,样式风格参考Google's Material Design,并做了适当取舍。键盘操作、读屏等可访问性,依据W3C「ARIA Authoring Practices Guide(APG)」进行开发。</p>

## 主页
[github.io主页](https://liuxian496.github.io/cyndi/)


## 使用

### 1. 安装cyndi
npm i cyndi

### 2. litten依赖的库
cyndi,依赖下面的库。
1. [react](https://github.com/facebook/react)
2. [lodash](https://github.com/lodash/lodash)

## 如果你想请我喝一杯蜜雪冰城(Buy Me a Mixue Ice Cream & Tea)
<img src=".\\public\\wechat.jpg" height="360">
<img src=".\\public\\alipay.jpg" height="360">
81 changes: 81 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
{
"name": "cyndi",
"private": true,
"version": "0.1.0",
"type": "module",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist"
],
"keywords": [
"react",
"javascript",
"typescript",
"util"
],
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"test": "",
"test-storybook": "test-storybook",
"prepare": "husky"
},
"dependencies": {
"lodash": "^4.17.21",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@chromatic-com/storybook": "^1.3.3",
"@commitlint/cli": "^19.2.2",
"@commitlint/config-conventional": "^19.2.2",
"@storybook/addon-coverage": "^1.0.1",
"@storybook/addon-essentials": "^8.0.8",
"@storybook/addon-interactions": "^8.0.8",
"@storybook/addon-links": "^8.0.8",
"@storybook/addon-onboarding": "^8.0.8",
"@storybook/blocks": "^8.0.8",
"@storybook/react": "^8.0.8",
"@storybook/react-vite": "^8.0.8",
"@storybook/test": "^8.0.8",
"@storybook/test-runner": "^0.17.0",
"@types/react": "^18.2.66",
"@types/react-dom": "^18.2.22",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vitejs/plugin-react": "^4.2.1",
"conventional-changelog": "^5.1.0",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^8.57.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.6",
"eslint-plugin-storybook": "^0.8.0",
"husky": "^9.0.11",
"litten": "^0.9.1",
"storybook": "^8.0.8",
"typescript": "^5.2.2",
"vite": "^5.2.0"
},
"husky": {
"hooks": {
"pre-commit": "npm run test",
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}
}
Binary file added public/alipay.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/cyndi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/wechat.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/assets/react.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/getPrefixNs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { getPrefixNs } from "./util/getPrefixNs";
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export { getPrefixNs } from "./util/getPrefixNs";

export { isEmptyString } from "./util/isEmptyString";

export { printArrayItem } from "./util/printArrayItem";
1 change: 1 addition & 0 deletions src/isEmptyString.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { isEmptyString } from "./util/isEmptyString";
1 change: 1 addition & 0 deletions src/printArrayItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { printArrayItem } from "./util/printArrayItem";
Loading

0 comments on commit 0e9eb16

Please sign in to comment.