Skip to content

Commit

Permalink
feat: v1.0.0 liftup
Browse files Browse the repository at this point in the history
  • Loading branch information
akashahmad committed Nov 29, 2023
0 parents commit e33e49b
Show file tree
Hide file tree
Showing 136 changed files with 25,271 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"presets": ["@babel/preset-env", "@babel/preset-react", "@babel/preset-typescript"],
"plugins": [
"@babel/plugin-transform-class-properties",
"@babel/plugin-transform-object-rest-spread",
"@babel/plugin-syntax-dynamic-import"
]
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 4
indent_style = space
max_line_length = 120

[*.{scss,css,yml,yaml}]
indent_size = 2
49 changes: 49 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"parserOptions": {
"ecmaVersion": 2023,
"sourceType": "module"
},
"ignorePatterns": [
"/node_modules/**/*",
"/^.*/",
"webpack.config.js",
"commitlint.config.js"
],
"env": {
"node": true,
"es6": true,
"jest/globals": true
},
"plugins": [
"jest",
"@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react/recommended",
"eslint-config-prettier"
],
"rules": {
"no-console": "off",
"strict": [
"error",
"never"
],
"jest/valid-expect": "error",
"jest/no-focused-tests": "error",
"jest/no-disabled-tests": "warn",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
"@typescript-eslint/no-explicit-any": "warn"
},
"settings": {
"react": {
"version": "detect"
}
}
}
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @akashahmad
108 changes: 108 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: CI

on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]

jobs:
lint-and-test:
env:
CI: true
runs-on: ubuntu-latest

steps:
- name: 📦 Checkout Github Repository
uses: actions/checkout@v4

- name: 📊 Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm

- name: 🛠️ Setup Node.js and NPM
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: 🔃 Cache or restore deps
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: 📥 Download dependencies
run: npm install

- name: ⚙️ Run Lint Script
run: npm run lint

- name: 🧪 Run Tests
run: npm run test:ci

- name: 📤 Upload code coverage to artifacts
uses: actions/upload-artifact@v3
with:
name: test-coverage-report
path: coverage

build-and-publish:
needs: lint-and-test
env:
CI: true
runs-on: ubuntu-latest

if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ secrets.GITHUB_TOKEN }}

- name: 📦 Checkout Github Repository
uses: actions/checkout@v4

- name: 📊 Read .nvmrc
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
id: nvm

- name: 🛠️ Setup Node.js and NPM
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"

- name: 🔃 Cache or restore deps
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: 📥 Download dependencies
run: npm install

- name: ⚙️ Build Components
run: npm run compile

- name: 📤 Upload build files to artifacts
uses: actions/upload-artifact@v3
with:
name: library-build
path: lib

- name: 🚀 Semantic Release on NPM & Github
uses: cycjimmy/semantic-release-action@v4
with:
branch: main
extra_plugins: |
conventional-changelog-conventionalcommits
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/npm
@semantic-release/git
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
node_modules/

# Build
lib/

# Yarn
.yarn-error.log
package-lock.json
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Test
coverage/

# Storybook
storybook-static/
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no-install commitlint --edit "$1"
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
9 changes: 9 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"*.ts": ["prettier --write", "eslint"],
"*.tsx": ["prettier --write", "eslint"],
"*.md": ["prettier --write"],
"*.spec.tsx": ["jest"],
"*.spec.ts": ["jest"],
"*.json": ["prettier --write"],
"*.css": ["stylelint"]
}
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
registry=https://registry.npmjs.org/
package-lock=false
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.18.2
39 changes: 39 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
*.scss
*.less
.husky/
.yarn/
yarn.lock
*.md
.github/
.storybook/
.yarn/
scripts/

## file extensions
*.*
!*.css
!*.js
!*.json
!*.jsx
!*.less
!*.md
!*.mdx
!*.ts
!*.tsx
!*.yml
LICENSE

# gitignore
node_modules/
lib/
.yarn-error.log
package-lock.json
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
coverage/
storybook-static/
14 changes: 14 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"printWidth": 120,
"tabWidth": 4,
"trailingComma": "all",
"arrowParens": "avoid",
"overrides": [
{
"files": ["*.yml", "*.yaml"],
"options": {
"tabWidth": 2
}
}
]
}
58 changes: 58 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import type { StorybookConfig } from "@storybook/react-webpack5";

import { join, dirname } from "path";

/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, "package.json")));
}
const config: StorybookConfig = {
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
addons: [
getAbsolutePath("@storybook/addon-links"),
getAbsolutePath("@storybook/addon-essentials"),
getAbsolutePath("@storybook/addon-interactions"),
{
name: "@storybook/addon-storysource",
options: {
loaderOptions: {
injectStoryParameters: false,
},
},
},
],
framework: {
name: getAbsolutePath("@storybook/react-webpack5"),
options: {
fastRefresh: true,
},
},
docs: {
autodocs: "tag",
},
// Require to process tailwind styles
webpackFinal: async config => {
if (config.module && config.module.rules) {
config.module.rules.push({
test: /\.css$/,
use: [
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [require("tailwindcss"), require("autoprefixer")],
},
},
},
],
});
}

return config;
},
};

export default config;
17 changes: 17 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type { Preview } from "@storybook/react";

import "../src/styles/storybook.css";

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/i,
},
},
},
};

export default preview;
1 change: 1 addition & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage/
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"css.validate": false,
"less.validate": false,
"scss.validate": false
}
Loading

0 comments on commit e33e49b

Please sign in to comment.