Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(*): create package #2

Merged
merged 67 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
d3f4653
feat(*): initial commit :rocket:
adamdehaven Dec 14, 2023
3aa97b7
test: pass fake test
adamdehaven Dec 15, 2023
65048a2
refactor: markdownit composable
adamdehaven Dec 15, 2023
9eecb0c
fix: highlighted line
adamdehaven Dec 16, 2023
050eb87
fix: line highlighting
adamdehaven Dec 16, 2023
5f6abc1
chore(deps): bump packages
adamdehaven Dec 16, 2023
fe256d6
fix: deps and bundle
adamdehaven Dec 16, 2023
9c35f78
refactor: inject ref into composable
adamdehaven Dec 16, 2023
bde6e2d
chore: comments
adamdehaven Dec 16, 2023
1bcca01
chore: comments
adamdehaven Dec 16, 2023
f77100c
chore(deps): bump packages
adamdehaven Dec 18, 2023
a167634
feat: keyboard shortcuts
adamdehaven Dec 18, 2023
c0680d3
chore: add padding
adamdehaven Dec 18, 2023
24de0d4
fix: toggle html
adamdehaven Dec 18, 2023
e3815b6
refactor: markdown content
adamdehaven Dec 18, 2023
952e60f
chore: comments
adamdehaven Dec 18, 2023
a4d8e99
chore: cleanup
adamdehaven Dec 18, 2023
adb2c8d
fix: emitted events
adamdehaven Dec 18, 2023
39accfc
fix: header anchors
adamdehaven Dec 18, 2023
19738b9
chore: cleanup
adamdehaven Dec 18, 2023
b12604d
feat: synchronize scrolling
adamdehaven Dec 18, 2023
7448329
chore: sandbox
adamdehaven Dec 18, 2023
35a0a8e
chore: tweak
adamdehaven Dec 18, 2023
d151a4a
feat: emit events
adamdehaven Dec 18, 2023
df721d5
fix: new line
adamdehaven Dec 18, 2023
6312b9a
feat: fullscreen edit
adamdehaven Dec 18, 2023
ca16c07
fix: markdown container and heights
adamdehaven Dec 19, 2023
f23da9f
fix: html preview
adamdehaven Dec 19, 2023
7288da9
chore: tweak style
adamdehaven Dec 19, 2023
57dd166
refactor: modes
adamdehaven Dec 19, 2023
7fa25fb
refactor: keyboard shortcuts
adamdehaven Dec 19, 2023
3b88ae6
feat: insert new line
adamdehaven Dec 19, 2023
6e5527b
chore: comment
adamdehaven Dec 19, 2023
4d953b6
feat: inline templates
adamdehaven Dec 19, 2023
09508eb
feat: inline templates and lists
adamdehaven Dec 20, 2023
5865498
fix: no max height in preview mode
adamdehaven Dec 20, 2023
0e576a6
fix: padding
adamdehaven Dec 20, 2023
e22fb07
fix: insert text
adamdehaven Dec 20, 2023
4fe8a14
chore: remove comment
adamdehaven Dec 20, 2023
abd5085
fix: button actions
adamdehaven Dec 20, 2023
5c3798b
chore: comment
adamdehaven Dec 20, 2023
02617b6
chore: comment
adamdehaven Dec 20, 2023
ca0b880
feat: detect os
adamdehaven Dec 20, 2023
9cabe4b
feat: tooltips and buttons
adamdehaven Dec 20, 2023
ee1f97c
chore: unused import
adamdehaven Dec 20, 2023
1d50c9d
ci: branches
adamdehaven Dec 20, 2023
cc3cda1
ci: publishing
adamdehaven Dec 20, 2023
40183d4
chore: comment
adamdehaven Dec 20, 2023
b532d4d
ci: use lerna
adamdehaven Dec 21, 2023
6a69bd9
revert: use lerna
adamdehaven Dec 21, 2023
c0bd640
chore: version
adamdehaven Dec 21, 2023
9824e69
ci: prerelease version
adamdehaven Dec 21, 2023
866a037
ci: use yarn
adamdehaven Dec 21, 2023
ecb2646
fix: package.json
adamdehaven Dec 21, 2023
4f70a3c
ci: use yarn
adamdehaven Dec 21, 2023
1f78233
ci: token
adamdehaven Dec 21, 2023
99e4320
chore: update tooltip
adamdehaven Dec 21, 2023
fdada9f
ci: use pnpm
adamdehaven Dec 21, 2023
580b945
chore(deps): bump packages
adamdehaven Dec 21, 2023
faa3e1f
chore: change command
adamdehaven Dec 21, 2023
cf07338
fix: imports
adamdehaven Dec 21, 2023
c46f3c2
ci: debug
adamdehaven Dec 21, 2023
ac6dbe9
chore: trigger ci
adamdehaven Dec 21, 2023
c0a9c0a
chore: trigger ci
adamdehaven Dec 21, 2023
c3693cb
ci: add alpha branch
adamdehaven Dec 21, 2023
46bfe80
chore: debug
adamdehaven Dec 21, 2023
78c4380
ci: add branches
adamdehaven Dec 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/
60 changes: 60 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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',
}],
},
}
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/[email protected]
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 "[email protected]"
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