Skip to content

Commit

Permalink
chore: first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
David Dias committed Jul 27, 2023
0 parents commit 4f43b93
Show file tree
Hide file tree
Showing 53 changed files with 14,687 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/**
node_modules/
jest.config.js
42 changes: 42 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"env": {
"node": true,
"es6": true,
"jest/globals": true
},
"plugins": [
"jest",
"@typescript-eslint"
],
// "extends": [
// "plugin:github/recommended"
// ],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module",
"project": "./tsconfig.json"
},
"overrides": [
{
"extends": [
"plugin:@typescript-eslint/recommended-requiring-type-checking"
],
"files": [
"./**/*.{ts,tsx}"
]
},
{
"files": [
"src/**/*.test.ts"
],
"parserOptions": {
"project": "./tsconfig.test.json"
}
}
],
"rules": {
"@typescript-eslint/no-floating-promises": "off",
"camelcase": "off"
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/** -diff linguist-generated=true
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: npm
directory: /
schedule:
interval: daily
59 changes: 59 additions & 0 deletions .github/workflows/check-dist.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# `dist/index.js` is a special file in Actions.
# When you reference an action with `uses:` in a workflow,
# `index.js` is the code that will run.
# For our project, we generate this file through a build process
# from other source files.
# We need to make sure the checked-in `index.js` actually matches what we expect it to be.
name: Check dist/

on:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
workflow_dispatch:

jobs:
check-dist:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Detect Node version
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvmrc

- name: Use Node.js ${{ steps.nvmrc.outputs.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvmrc.outputs.NODE_VERSION }}"

- name: Install dependencies
run: npm ci

- name: Rebuild the dist/ directory
run: |
npm run check
npm run build
- name: Compare the expected and actual dist/ directories
run: |
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. See status below:"
git diff
exit 1
fi
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v2
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
name: dist
path: dist/
124 changes: 124 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: "Build tests"

on:
pull_request:
paths-ignore:
- "**.md"
push:
branches:
- main
paths-ignore:
- "**.md"
workflow_dispatch:

permissions:
contents: read
pull-requests: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Detect Node version
run: echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
id: nvmrc

- name: Use Node.js ${{ steps.nvmrc.outputs.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: "${{ steps.nvmrc.outputs.NODE_VERSION }}"

- name: Install dependencies
run: |
npm install
- name: Lint, test, build
run: |
npm run all
- name: Save Action Artifact
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: release-artifact
path: |
./dist
action.yml
package.json
!dist/utils
basic:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Action Artifact
uses: actions/download-artifact@v3
with:
name: release-artifact
path: ./

- name: Display structure of downloaded files
run: ls -R

- name: Simple release for output
uses: ./
id: release-notification
with:
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Print the output
run: echo "${{ steps.release-notification.outputs.releaseInfo }}" | jq '.' > output.json

slack:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Action Artifact
uses: actions/download-artifact@v3
with:
name: release-artifact
path: ./

- name: Release to Slack
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
sentry_project_name: ${{ secrets.SENTRY_PROJECT_NAME }}
sentry_project_id: ${{ secrets.SENTRY_PROJECT_ID }}
grafana_dashboard_link: https://example.grafana.net/d/xxxx/web-overview?orgId=1

jira:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download Action Artifact
uses: actions/download-artifact@v3
with:
name: release-artifact
path: ./

- name: Release to Slack
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
jira_ticket_prefix: "KCAN"
jira_instance_url: "https://example.atlassian.net/browse"

78 changes: 78 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Dependency directory
node_modules

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# OS metadata
.DS_Store
Thumbs.db

# Ignore built ts files
__tests__/runner/*
lib/**/*
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.20.0
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
registry = https://registry.npmjs.org/
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.20.0
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
**/.cache/**
**/.husky/**

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

dist/
node_modules/

# misc
.DS_Store
*.pem
3 changes: 3 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('@thedaviddias/prettier-config'),
}
39 changes: 39 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"search.exclude": {
".git": true,
"**/node_modules": false,
"CHANGELOG": true,
"CODE_OF_CONDUCT": true,
"CONTRIBUTING": true,
"coverage": true,
"LICENCE": true,
"node_modules": true,
"package.lock": true,
"dist": true
},
"editor.formatOnSave": true,
"javascript.format.enable": true,
"javascript.validate.enable": false,
"typescript.validate.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.format": true,
},
"[javascript]": {
"editor.formatOnSave": true
},
"[typescript]": {
"editor.formatOnSave": true
},
"eslint.format.enable": true,
"eslint.run": "onSave",
"typescript.enablePromptUseWorkspaceTsdk": true,
"[markdown]": {
"editor.formatOnSave": true,
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
},
}
}
Loading

0 comments on commit 4f43b93

Please sign in to comment.