-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gregg Setzer
committed
Jul 12, 2024
1 parent
d6bb8fa
commit 6a232b4
Showing
22 changed files
with
12,816 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
extends: [ | ||
'plugin:react/recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier', | ||
'plugin:prettier/recommended', | ||
], | ||
parserOptions: { | ||
ecmaVersion: 2018, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
jsx: true, | ||
}, | ||
}, | ||
rules: {}, | ||
settings: { | ||
react: { | ||
version: 'detect', | ||
}, | ||
}, | ||
ignorePatterns: ["dist/"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
# This is a basic GitHub Action workflow file. It's going to be triggered | ||
# when code is merged into the main branch. | ||
|
||
name: Build, Test and Publish | ||
|
||
# This specifies the events that will trigger the workflow. | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
# A workflow consists of one or more jobs that run in parallel. | ||
jobs: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
steps: | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
registry-url: 'https://npm.pkg.github.com' | ||
scope: '@greggsetzer' | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build project | ||
run: | | ||
npm run lint | ||
npm run build | ||
- name: Run unit tests | ||
run: npm test | ||
|
||
- name: Save build output | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: dist | ||
path: ./dist | ||
|
||
# Job #2 - bump the NPM Package.json version # and publish to GitHub Packages. | ||
bump-version-and-publish: | ||
runs-on: ubuntu-latest | ||
needs: build-and-test | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download build output | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: dist | ||
path: ./dist | ||
|
||
- name: Specify the node version | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20.x' | ||
|
||
- name: Configure Git Credentials | ||
run: | | ||
git config user.email "${{ github.actor }}@users.noreply.github.com" | ||
git config user.name "${{ github.actor}}" | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Ensure a clean working directory | ||
run: | | ||
git add . | ||
git commit -m "Clean working directory" || echo "No changes to commit" | ||
- name: Pull the latest | ||
run: | ||
git pull | ||
|
||
- name: Bump version | ||
run: npm version patch | ||
env: | ||
CI: true | ||
|
||
- name: Commit version bump | ||
run: | | ||
git add package.json package-lock.json | ||
git commit -m "Bump version" || echo "No changes to commit" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}" | ||
|
||
- name: Add global .npmrc file | ||
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc | ||
|
||
- name: Publish to GitHub packages | ||
run: | ||
npm publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.DS_Store | ||
.idea | ||
coverage | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@greggsetzer:registry=https://npm.pkg.github.com/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"printWidth": 80, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"semi": true, | ||
"singleQuote": true, | ||
"trailingComma": "es5", | ||
"bracketSpacing": true, | ||
"jsxBracketSameLine": false, | ||
"arrowParens": "always", | ||
"proseWrap": "preserve", | ||
"endOfLine": "lf" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import type { Config } from '@jest/types'; | ||
|
||
const config: Config.InitialOptions = { | ||
roots: ['<rootDir>/src', '<rootDir>/tests'], | ||
transform: { | ||
'^.+\\.tsx?$': 'ts-jest', | ||
}, | ||
testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$', | ||
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], | ||
setupFilesAfterEnv: ['<rootDir>/setupTests.ts'], | ||
collectCoverage: true, | ||
coverageDirectory: 'coverage', | ||
coverageReporters: ['text', 'html'], | ||
collectCoverageFrom: [ | ||
'src/**/*.{ts,tsx}', // Collect coverage from all TypeScript files in the src directory | ||
'!src/**/*.d.ts', // Exclude type definition files | ||
'!src/**/index.ts', // Exclude index files if needed | ||
'!src/**/*.stories.tsx', // Exclude storybook files if any | ||
'!src/**/__tests__/**', // Exclude test files | ||
'!src/**/tests/**', // Exclude test-related directories | ||
], | ||
testEnvironment: 'jsdom', | ||
}; | ||
|
||
export default config; |
Oops, something went wrong.