Skip to content

Commit

Permalink
Merge pull request #1 from gliff-ai/issue579
Browse files Browse the repository at this point in the history
feat: Add TS SDK and types
  • Loading branch information
SilviaZeta authored Apr 12, 2022
2 parents a5c4979 + a831064 commit 96bc420
Show file tree
Hide file tree
Showing 24 changed files with 19,941 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# don't ever lint node_modules
node_modules
# don't lint build output
dist

.*.js
*.spec.ts
68 changes: 68 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
parserOptions: {
tsconfigRootDir: __dirname,
project: ["./tsconfig.json"],
},
plugins: ["@typescript-eslint", "mui-unused-classes"],
extends: [
"eslint:recommended",
"airbnb-typescript",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
],
overrides: [
{
files: ["*.ts", "*.tsx"],
rules: {
"global-require": 0,
"import/extensions": 0,
"@typescript-eslint/no-var-requires": 0,
"mui-unused-classes/unused-classes": 2,
"no-void": ["error", { allowAsStatement: true }],
"react/react-in-jsx-scope": "off", // This isn't true as of React 17
"react/jsx-indent": "off", // this just argues with prettier, and we validate against prettier anyway
"react/destructuring-assignment": "off", // This would be nice, but we call a lot of methods on props we pass down which rules it out
"import/prefer-default-export": "off", // Most of the internet agrees this should be off
"no-restricted-syntax": [
// AirBnb don't allow for...of loops. We do, but still want to restrict the rest. Huge argument here: https://github.com/airbnb/javascript/issues/1271
"error",
{
selector: "ForInStatement",
message:
"for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.",
},
{
selector: "LabeledStatement",
message:
"Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.",
},
{
selector: "WithStatement",
message:
"`with` is disallowed in strict mode because it makes code impossible to predict and optimize.",
},
],
"react/static-property-placement": [2, "static public field"],
"no-param-reassign": [2, { props: false }],
},
},
{
files: ["./*.js"],
rules: {
"@typescript-eslint/no-var-requires": "off",
},
env: {
node: true,
},
},
{
files: ["*.test.*", "*.spec.*"],
rules: {
"@typescript-eslint/no-unsafe-member-access": "off",
},
},
],
};
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
reviewers:
- "gliff-ai/frontend"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
reviewers:
- "gliff-ai/frontend"
45 changes: 45 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
- name: "good-first-issue"
color: "FFFFFF"
description: "[Welcome] Perfect for new contributors."
- name: "bug"
color: "FB3640"
description: "[Problem] Something isn’t working or looking right."
- name: "question"
color: "FB3640"
description: "[Problem] Further help and/or information is required."
- name: "feature"
color: "AE79FF"
description: "[Improvement] New feature request."
- name: "enhancement"
color: "AE79FF"
description: "[Improvement] Enhancement request."
- name: "test"
color: "AE79FF"
description: "[Improvement] Anything related to testing or tests."
- name: "deployment"
color: "AE79FF"
description: "[Improvement] Anything relating to deployment."
- name: "major"
color: "00DBFF"
description: "[Release] Major release."
- name: "minor"
color: "00DBFF"
description: "[Release] Minor release."
- name: "patch"
color: "00DBFF"
description: "[Release] Patch release."
- name: "wont-fix"
color: "1C1C1C"
description: "[Inactive] This will not be worked on."
- name: "duplicate"
color: "1C1C1C"
description: "[Inactive] This issue or pull request already exists."
- name: "dependencies"
color: "E6E6E6"
description: "[Update] Pull requests that update a dependency file."
- name: "javascript"
color: "E6E6E6"
description: "[Update] Pull requests that update a Javascript code."
- name: "python"
color: "E6E6E6"
description: "[Update] Pull requests that update a Python code."
12 changes: 12 additions & 0 deletions .github/workflows/add-to-project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: automatically add to project board
on:
issues:
types: [opened, transferred, reopened, unlocked]
pull_request:
types: [opened, edited, synchronize, auto_merge_enabled, reopened]

jobs:
add_to_project:
uses: gliff-ai/.github/.github/workflows/add-to-project.yml@main
secrets:
ROBOT_PAT: ${{ secrets.ROBOT_PAT }}
23 changes: 23 additions & 0 deletions .github/workflows/apply-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Set Repo Label List

on: push

jobs:
labeler:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Run Labeler
if: success()
uses: crazy-max/ghaction-github-labeler@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
yaml-file: .github/labels.yml
skip-delete: false
dry-run: false
exclude: |
help*
*issue
44 changes: 44 additions & 0 deletions .github/workflows/automate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "BrowserStack Test"
on: push
jobs:
ubuntu-job:
name: "BrowserStack Test on Ubuntu"
runs-on: ubuntu-latest # Can be self-hosted runner also
timeout-minutes: 10
steps:
- name: "BrowserStack Env Setup" # Invokes the setup-env action
uses: browserstack/github-actions/setup-env@master
with:
username: ${{ secrets.BROWSERSTACK_USERNAME }}
access-key: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}

- name: "BrowserStack Local Tunnel Setup" # Invokes the setup-local action
uses: browserstack/github-actions/setup-local@master
with:
local-testing: start
local-identifier: random

# The next 3 steps are for building the web application to be tested and starting the web server on the runner environment

- name: "Checkout the repository"
uses: actions/checkout@v2

- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 15

- name: "Building web application to be tested"
run: npm i

- run: npm run build:example

- name: "Running application under test"
run: npx http-server -p 8080 -a bs-local.com dist &

- run: sleep 10

- name: "Running test on BrowserStack" # Invokes the actual test script that would run on BrowserStack browsers
run: TARGET_URL=http://bs-local.com:8080/ npm run test:e2e
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/automerge-bots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: auto-merge PRs by dependabot or gliff-ai-robot
on: pull_request_target

permissions:
pull-requests: write
contents: write

jobs:
automerge-bots:
uses: gliff-ai/.github/.github/workflows/automerge-bots.yml@main
secrets:
ROBOT_PAT: ${{ secrets.ROBOT_PAT }}
55 changes: 55 additions & 0 deletions .github/workflows/azure-static-web-apps-black-wave-0f4ddd903.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Azure Static Web Apps CI/CD

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- main

jobs:
build_and_deploy_job:
if: (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.action != 'closed')) && github.actor!= 'dependabot[bot]'
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 15
- name: Setup dependencies
run: npm i
- name: Build
run: npm run build:example
- name: Build And Deploy
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLACK_WAVE_0F4DDD903 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/dist" # App source code path
output_location: "/dist"
skip_app_build: true
###### End of Repository/Build Configurations ######
env:
NODE_VERSION: 15.3.0

close_pull_request_job:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_BLACK_WAVE_0F4DDD903 }}
action: "close"
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main, staging ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main, staging ]
schedule:
- cron: '29 6 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'typescript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
12 changes: 12 additions & 0 deletions .github/workflows/dependency-minor-batch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: scheduled batch of minor/patch updates
on:
schedule:
- cron: "00 06 * * 1"

jobs:
npm_update:
uses: gliff-ai/.github/.github/workflows/dependency-updates.yml@main
with:
package_manager: npm
secrets:
ROBOT_PAT: ${{ secrets.ROBOT_PAT }}
Loading

0 comments on commit 96bc420

Please sign in to comment.