Skip to content

Commit a361b4b

Browse files
Changes - full component
1 parent 1ca2f57 commit a361b4b

34 files changed

+2283
-988
lines changed

.eslintrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"max-len":["warn", 150],
3232
"space-before-blocks":"error",
3333
"prefer-spread": ["off"],
34-
"react-hooks/exhaustive-deps": "off"
34+
"react-hooks/exhaustive-deps": "off",
35+
"no-extra-boolean-cast": "off"
3536
},
3637
"settings": {
3738
"react": {

.github/workflows/deploy.yml

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ReleaseType:
7+
description: 'Release Type'
8+
required: true
9+
default: 'warning'
10+
type: choice
11+
options:
12+
- Major
13+
- Feature
14+
- Bug
15+
16+
jobs:
17+
update-and-publish:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: 16.x
27+
scope: '@keyvaluesystems'
28+
29+
- name: Install dependencies
30+
run: npm install
31+
32+
- name: Run tests
33+
run: npm run test
34+
35+
- name: 'Set release type : ${{ inputs.ReleaseType }}'
36+
id: release_type
37+
uses: ASzc/change-string-case-action@v5
38+
with:
39+
string: ${{ inputs.ReleaseType }}
40+
41+
- name: Extract Current Branch and Validate
42+
id: get_current_branch
43+
shell: bash
44+
run: |
45+
BRANCH="${GITHUB_REF#refs/heads/}"
46+
if [ "$BRANCH" == 'master' ]
47+
then
48+
echo "Branch validation Successful"
49+
else
50+
echo "Releases only taken from master branch"
51+
exit 1
52+
fi
53+
54+
- name: Get Latest version from package.json
55+
run: |
56+
# Get the latest version from package.json
57+
LATEST_VERSION=$(node -p "require('./package.json').version")
58+
59+
# Output the latest version as a workflow env
60+
echo "latest_version=$LATEST_VERSION" >> $GITHUB_ENV
61+
62+
- name: Get new version
63+
id: get_next_version
64+
uses: christian-draeger/[email protected]
65+
with:
66+
current-version: ${{ env.latest_version }}
67+
version-fragment: ${{ steps.release_type.outputs.lowercase }}
68+
69+
- name: Update version in package.json and package-lock.json
70+
run: |
71+
OLD_VERSION=${{ env.latest_version }}
72+
NEW_VERSION=${{ steps.get_next_version.outputs.next-version }}
73+
74+
npm version $NEW_VERSION --no-git-tag-version
75+
git config user.name github-actions
76+
git config user.email [email protected]
77+
git add package.json package-lock.json
78+
git commit -m "Bump version from $OLD_VERSION to $NEW_VERSION"
79+
git push origin HEAD:master
80+
81+
- name: Build Package
82+
run: npm run build
83+
84+
- name: Publish package
85+
run: npm publish --access public --//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}
86+
if: success()
87+
88+
- name: Revert package.json and package-lock.json
89+
run: |
90+
# Revert package.json and package-lock.json to the previous version
91+
npm version ${{ env.latest_version }} --no-git-tag-version
92+
git commit -am "Revert to version ${{ env.latest_version }}"
93+
git push origin HEAD:master
94+
if: failure()
95+
96+
- name: Create GitHub release
97+
if: success()
98+
uses: actions/create-release@v1
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
with:
102+
tag_name: v${{ steps.get_next_version.outputs.next-version }}
103+
release_name: Release v${{ steps.get_next_version.outputs.next-version }}
104+
# body: Release ${{ env.NEW_VERSION }}
105+
draft: false
106+
prerelease: false
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Test Suite
2+
3+
on:
4+
pull_request:
5+
# The branches below must be a subset of the branches above
6+
branches: [main]
7+
8+
jobs:
9+
test-and-build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
node-version: [16.x]
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v2
17+
with:
18+
ref: ${{ github.event.pull_request.head.sha }}
19+
fetch-depth: 0
20+
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
26+
- name: Install dependencies
27+
run: npm install
28+
29+
- name: Linting
30+
run: npm run eslint
31+
32+
- name: Run tests
33+
run: npm run test
34+
35+
- name: Build
36+
run: npm run build

.storybook/main.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const path = require('path');
2+
module.exports = {
3+
"stories": [
4+
"../src/**/*.stories.mdx",
5+
"../src/**/*.stories.@(js|jsx|ts|tsx)"
6+
],
7+
"addons": [
8+
"@storybook/addon-links",
9+
"@storybook/addon-essentials",
10+
"@storybook/addon-interactions"
11+
],
12+
"framework": "@storybook/react",
13+
"core": {
14+
"builder": "@storybook/builder-webpack5"
15+
},
16+
"webpackFinal": async (config) => {
17+
config.module.rules.push({
18+
rules: [{
19+
test: /\.scss$/,
20+
use: ['style-loader', 'css-loader', 'sass-loader']
21+
}],
22+
resolve: {
23+
alias: {
24+
'assets': path.resolve(__dirname, '../src/assets')
25+
}
26+
}
27+
});
28+
return config;
29+
}
30+
}

.storybook/preview.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const parameters = {
2+
actions: { argTypesRegex: "^on[A-Z].*" },
3+
controls: {
4+
matchers: {
5+
color: /(background|color)$/i,
6+
date: /Date$/,
7+
},
8+
},
9+
}

0 commit comments

Comments
 (0)