Skip to content

Commit 596ad9d

Browse files
committed
initial
0 parents  commit 596ad9d

File tree

20 files changed

+8175
-0
lines changed

20 files changed

+8175
-0
lines changed

.github/workflows/publish.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: '20'
20+
registry-url: 'https://registry.npmjs.org'
21+
cache: 'npm'
22+
23+
- name: Install Yarn
24+
run: npm install -g yarn
25+
26+
- name: Install dependencies by Yarn
27+
run: yarn install --frozen-lockfile
28+
29+
- name: Lint check
30+
run: yarn lint
31+
32+
- name: Build
33+
run: yarn build:prod
34+
35+
- name: Update version
36+
run: |
37+
git config user.name "github-actions"
38+
git config user.email "[email protected]"
39+
yarn version --patch
40+
git push origin HEAD --tags
41+
42+
- name: Publish to npm
43+
run: npm publish --access public
44+
env:
45+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
46+
47+
- name: Deploy Storybook to GitHub Pages
48+
uses: bitovi/[email protected]
49+
with:
50+
install_command: yarn install
51+
build_command: yarn story:build
52+
path: storybook-static
53+
checkout: false

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
dist
3+
.storybook
4+
storybook-static
5+
coverage

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 80,
6+
"tabWidth": 2
7+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a design-system for nqh.d3v application

babel.config.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
presets: [
3+
'@babel/preset-env',
4+
['@babel/preset-react', { runtime: 'automatic' }],
5+
'@babel/preset-typescript',
6+
],
7+
};

eslint.config.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { defineConfig } from 'eslint/config';
2+
import js from '@eslint/js';
3+
import reactPlugin from 'eslint-plugin-react';
4+
import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin';
5+
import typescriptEslintParser from '@typescript-eslint/parser';
6+
import prettierPlugin from 'eslint-plugin-prettier';
7+
import prettierConfig from 'eslint-config-prettier';
8+
9+
export default defineConfig([
10+
{
11+
files: ['**/*.{js,jsx,ts,tsx}'],
12+
languageOptions: {
13+
ecmaVersion: 2021,
14+
sourceType: 'module',
15+
globals: {
16+
browser: true,
17+
jest: true,
18+
node: true,
19+
},
20+
parser: typescriptEslintParser,
21+
parserOptions: {
22+
ecmaFeatures: {
23+
jsx: true,
24+
},
25+
},
26+
},
27+
plugins: {
28+
react: reactPlugin,
29+
'@typescript-eslint': typescriptEslintPlugin,
30+
prettier: prettierPlugin,
31+
},
32+
rules: {
33+
...js.configs.recommended.rules,
34+
...reactPlugin.configs.recommended.rules,
35+
...typescriptEslintPlugin.configs.recommended.rules,
36+
...prettierConfig.rules,
37+
'prettier/prettier': 'error',
38+
'react/prop-types': 'off',
39+
},
40+
},
41+
]);

jest.config.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import fs from 'fs';
2+
3+
fs.mkdir('./report/sonarqube', { recursive: true }, () => {});
4+
5+
/** @type {import('jest').Config} */
6+
const config = {
7+
preset: 'ts-jest',
8+
testEnvironment: 'jsdom',
9+
moduleNameMapper: {
10+
'\\.(css|less|scss|sass)$': 'identity-obj-proxy',
11+
},
12+
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
13+
testTimeout: 50000,
14+
collectCoverageFrom: ['**/*.(t|j)s', '**/*.tsx'],
15+
coveragePathIgnorePatterns: [
16+
'node_modules',
17+
'coverage',
18+
'<rootDir>/(.*).(setup|config).(t|j)s',
19+
'<rootDir>/test',
20+
],
21+
coverageReporters: ['clover', 'json', 'lcov', 'text', 'json-summary'],
22+
coverageDirectory: './report/coverage',
23+
testResultsProcessor: 'jest-sonar-reporter',
24+
maxWorkers: 3,
25+
};
26+
27+
export default config;

jest.setup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "@testing-library/jest-dom";

package.json

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"name": "@nqhd3v/react",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "dist/esm/index.js",
6+
"scripts": {
7+
"start": "rollup -c -w",
8+
"test": "jest",
9+
"build": "rollup -c",
10+
"story": "storybook dev -p 6006",
11+
"story:build": "storybook build",
12+
"lint": "eslint src/**/*.{ts,tsx}",
13+
"lint:format": "prettier --write src/**/*.{ts,tsx}"
14+
},
15+
"files": [
16+
"dist"
17+
],
18+
"keywords": [],
19+
"author": "",
20+
"license": "ISC",
21+
"type": "module",
22+
"devDependencies": {
23+
"@babel/preset-env": "^7.27.2",
24+
"@babel/preset-react": "^7.27.1",
25+
"@babel/preset-typescript": "^7.27.1",
26+
"@rollup/plugin-commonjs": "^28.0.5",
27+
"@rollup/plugin-node-resolve": "^16.0.1",
28+
"@rollup/plugin-terser": "^0.4.4",
29+
"@rollup/plugin-typescript": "^12.1.2",
30+
"@storybook/addon-docs": "^9.0.10",
31+
"@storybook/addon-onboarding": "^9.0.10",
32+
"@storybook/addon-webpack5-compiler-swc": "^3.0.0",
33+
"@storybook/react-webpack5": "^9.0.10",
34+
"@testing-library/dom": "^10.4.0",
35+
"@testing-library/jest-dom": "^6.6.3",
36+
"@testing-library/react": "^16.3.0",
37+
"@types/jest": "^29.5.14",
38+
"@types/react": "^19.1.8",
39+
"@types/react-dom": "^19.1.6",
40+
"@typescript-eslint/eslint-plugin": "^8.34.0",
41+
"@typescript-eslint/parser": "^8.34.0",
42+
"babel-jest": "^30.0.0",
43+
"eslint": "^9.29.0",
44+
"eslint-config-prettier": "^10.1.5",
45+
"eslint-plugin-prettier": "^5.4.1",
46+
"eslint-plugin-react": "^7.37.5",
47+
"eslint-plugin-react-hooks": "^5.2.0",
48+
"jest": "^30.0.0",
49+
"jest-environment-jsdom": "^30.0.0",
50+
"jest-sonar-reporter": "^2.0.0",
51+
"jsdom": "^26.1.0",
52+
"prettier": "^3.5.3",
53+
"react": "^19.1.0",
54+
"react-dom": "^19.1.0",
55+
"rollup": "^4.43.0",
56+
"rollup-plugin-dts": "^6.2.1",
57+
"rollup-plugin-postcss": "^4.0.2",
58+
"storybook": "^9.0.10",
59+
"ts-jest": "^29.4.0",
60+
"ts-node": "^10.9.2",
61+
"typescript": "^5.8.3"
62+
},
63+
"dependencies": {
64+
"@testing-library/user-event": "^14.6.1"
65+
},
66+
"jest-junit": {
67+
"outputDirectory": "./report/unit",
68+
"outputName": "test-report.xml"
69+
},
70+
"jestSonar": {
71+
"reportPath": "./report/sonarqube",
72+
"reportFile": "report.xml",
73+
"indent": 4
74+
}
75+
}

report/sonarqube/report.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testExecutions version="1">
3+
<file path="/Users/huynguyen/apps/dev/dev-react/test/components/button/index.test.tsx">
4+
<testCase name="Component - Button should render correctly" duration="88"/>
5+
</file>
6+
</testExecutions>

0 commit comments

Comments
 (0)