Skip to content

Commit

Permalink
feat: alpha branch
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdehaven committed Jan 4, 2024
1 parent 982f399 commit 8860869
Show file tree
Hide file tree
Showing 62 changed files with 13,566 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
dist

docs/.vitepress/.temp/
docs/.vitepress/.cache/
docs/.vitepress/dist/
80 changes: 80 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
module.exports = {
root: true,
parserOptions: {
parser: '@typescript-eslint/parser',
ecmaVersion: 2020,
},
env: {
node: true,
},
plugins: ['vue', 'import', '@typescript-eslint'],
extends: [
'eslint:recommended',
'plugin:vue/vue3-recommended',
'standard',
],
rules: {
quotes: ['error', 'single', {
avoidEscape: true,
}],
'no-multi-spaces': 'error',
'no-trailing-spaces': 'error',
'no-empty': 'off',
'padded-blocks': 'off',
'comma-dangle': ['error', 'always-multiline'],
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'max-len': [process.env.NODE_ENV === 'production' ? 'warn' : 'off', {
code: 120,
ignoreTrailingComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
}],
'space-before-function-paren': 'off',
'vue/attributes-order': ['error', {
alphabetical: true,
}],
'@typescript-eslint/no-explicit-any': 'off',
// Avoids false errors like “'NodeListOf' is not defined”.
'no-undef': 'off',
// Turns off some non-TypeScript rules in favor of their specific TypeScript rules to avoid false negatives:
indent: 'off',
'@typescript-eslint/indent': ['error', 2],
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',
'@typescript-eslint/space-before-function-paren': ['error', {
anonymous: 'never',
named: 'never',
asyncArrow: 'always',
}],
// Ensures ESLint understands that `defineEmits<{ ... }>()` does _not_ fail this rule.
'func-call-spacing': 'off',
'@typescript-eslint/func-call-spacing': 'error',
'@typescript-eslint/consistent-type-imports': ['error', {
prefer: 'type-imports',
fixStyle: 'separate-type-imports',
}],
'vue/no-restricted-static-attribute': ['error',
{
key: 'data-test-id',
message: 'Using "data-test-id" is not allowed. Use "data-testid" instead.',
},
{
key: 'data-tracking-id',
message: 'Using "data-tracking-id" is not allowed. Use "data-testid" instead.',
},
],
'vue/no-restricted-v-bind': ['error',
{
argument: 'data-test-id',
message: 'Using "data-test-id" is not allowed. Use "data-testid" instead.',
},
{
argument: 'data-tracking-id',
message: 'Using "data-tracking-id" is not allowed. Use "data-testid" instead.',
},
],
},
}
15 changes: 15 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# These owners will be the default owners for everything in
# the repo. They will be requested for review whenever someone
# opens a PR, unless a later match takes precedence.
* @adamdehaven @jillztom @Kong/team-core-ui

# Workflows & CI
/.github/ @adamdehaven @jillztom
/lefthook.yaml @adamdehaven @jillztom

# ================================================
# Renovate Bot approvals
# Allow Kongponents BOT to approve dependency updates
# These rules MUST remain at the bottom as the last entry
package.json @kongponents-bot @Kong/team-core-ui @adamdehaven @jillztom
yarn.lock @kongponents-bot @Kong/team-core-ui @adamdehaven @jillztom
61 changes: 61 additions & 0 deletions .github/actions/setup-pnpm-with-dependencies/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Setup PNPM with Yarn Dependencies
description: Reusable composition of setup-node, cache, and pnpm install actions
inputs:
nodejs-version:
description: 'Version of NodeJS to use (ex: 18.18.2)'
default: '18.18.2'
force-install:
description: When 'true', pnpm install will be executed regardless of a cache hit
required: false
default: 'false'
frozen-lockfile:
description: When false, pnpm install will use the --no-frozen-lockfile flag
required: false
default: 'true'
outputs:
cache-hit:
description: Whether or not there was a cache hit
value: ${{ steps.dependency-cache.outputs.cache-hit }}
runs:
using: composite
steps:

- name: get Node version
id: node-version
shell: bash
run: |
voltaNodeVersion=$(cat package.json|jq -r ".volta.node")
if [[ $voltaNodeVersion == null ]]; then
voltaNodeVersion="${{ inputs.nodejs-version }}"
fi
voltaPnpmVersion=$(cat package.json|jq -r ".volta.pnpm")
if [[ $voltaPnpmVersion == null ]]; then
voltaPnpmVersion="8.10.5"
fi
echo "node-version=${voltaNodeVersion}">> $GITHUB_OUTPUT
echo "pnpm-version=${voltaPnpmVersion}">> $GITHUB_OUTPUT
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ steps.node-version.outputs.node-version }}

- name: Install PNPM
shell: bash
run: |
npm i -g pnpm@${{ steps.node-version.outputs.pnpm-version }}
pnpm --version
- name: Dependency Cache
id: dependency-cache
uses: actions/cache@v3
with:
path: '**/node_modules'
key: pnpm-${{ steps.node-version.outputs.pnpm-version }}-${{ steps.node-version.outputs.node-version }}-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Install Dependencies
if: ${{ inputs.force-install == 'true' || steps.dependency-cache.outputs.cache-hit != 'true' }}
shell: bash
run: pnpm i${{ inputs.frozen-lockfile == 'false' && ' --no-frozen-lockfile' || '' }}
12 changes: 12 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Summary

<!--
Be sure your Pull Request includes:
- JIRA ticket number in the title, and link in the summary
- An accurate summary of what is being added/edited/removed
- Tests (unit, component, regression)
- Updated documentation and commented code
- Link to Figma, if applicable
- Conventional Commits
-->
20 changes: 20 additions & 0 deletions .github/workflows/auto-approve.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Renovate Bot dependency updates auto-merge

permissions:
pull-requests: write
contents: write

on: pull_request_target

jobs:
renovate-autoapprove:
runs-on: ubuntu-latest
if: ${{ github.actor == 'renovate[bot]' }}
steps:
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
# Use the bot account PAT to allow auto-approve and merge the PRs
GITHUB_TOKEN: ${{ secrets.KONGPONENTS_BOT_PAT }}
34 changes: 34 additions & 0 deletions .github/workflows/cleanup-preview-packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Cleanup PR preview packages
on:
workflow_dispatch:

schedule:
- cron: '0 2/6 * * 6,0'

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
cleanup:
name: Cleanup PR Previews
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_PUBLIC_PUBLISH }}
GITHUB_TOKEN: ${{ secrets.KONGPONENTS_BOT_PAT }}

steps:
- name: Checkout Source Code
uses: actions/checkout@v4

- name: Prepare cleanup
id: prepare
run: |
echo "openPRs=$(gh pr list --state open --json number|jq -cM 'map(.number|tostring)')" >> $GITHUB_OUTPUT
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
- name: Cleanup PR preview
uses: Kong/public-shared-actions/pr-previews/cleanup@main
with:
package: "@kong/markdown"
openPRs: ${{ steps.prepare.outputs.openPRs }}
21 changes: 21 additions & 0 deletions .github/workflows/commitlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint Commit Messages

on:
pull_request:

jobs:
commitlint:
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

# See https://github.com/wagoid/commitlint-github-action/issues/560
- name: Remove tsconfig
run: rm tsconfig.json

- uses: wagoid/commitlint-github-action@v5.4.4
with:
configFile: commitlint.config.cjs
22 changes: 22 additions & 0 deletions .github/workflows/pr-closed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: On closing PR
on:
pull_request_target:
types:
- closed

jobs:
remove-pr-preview-comment:
name: Remove PR preview comment from PR
runs-on: ubuntu-latest
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_PUBLIC_PUBLISH }}
steps:
- name: Checkout Source Code
uses: actions/checkout@v4

- name: Remove preview consumption comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr_preview_consumption
delete: true
GITHUB_TOKEN: ${{ secrets.KONGPONENTS_BOT_PAT }}
51 changes: 51 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Publish

on:
push:
branches:
- main
- alpha
- beta

jobs:
run-tests:
name: Tests
uses: ./.github/workflows/test.yaml

publish:
name: Build and Publish
needs:
- run-tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.KONGPONENTS_BOT_PAT }}

- name: setup git
run: |
git config user.email "konnectx-engineers+kongponents-bot@konghq.com"
git config user.name "Kong UI Bot"
- name: Create .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN_PUBLIC_PUBLISH }}
# Reference the env variable NPM_TOKEN here, not the secret
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc

- name: Setup PNPM with Dependencies
uses: ./.github/actions/setup-pnpm-with-dependencies/

- name: Build
# Since we lint in the Tests job, we can just build here
run: pnpm run build

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v3
env:
# Since branch protections are on (pushing commits) you need to use a bot PAT
GITHUB_TOKEN: ${{ secrets.KONGPONENTS_BOT_PAT }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN_PUBLIC_PUBLISH }}

Loading

0 comments on commit 8860869

Please sign in to comment.