Compare commits

...

No commits in common. "gauntlet/release" and "main" have entirely different histories.

9 changed files with 2079 additions and 33 deletions

View file

@ -0,0 +1,26 @@
name: Build Plugins
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
name: Build plugins
runs-on: docker
container: catthehacker/ubuntu:act-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm ci
- name: Build plugins
run: npm run build

View file

@ -0,0 +1,32 @@
name: Publish Plugins to Release Branch
on: workflow_dispatch
jobs:
publish:
name: Publish plugins
runs-on: docker
container: catthehacker/ubuntu:act-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up SSH key
uses: actions/ssh-agent@forgejo
with:
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
instance-urls: "www.coastalcommits.com"
- name: Add instance URLs to known_hosts
run: ssh-keyscan -H www.coastalcommits.com >> ~/.ssh/known_hosts
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Configure Git
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@noreply@coastalcommits.com"
git remote set-url origin git@www.coastalcommits.com:${{ github.repository }}
- name: Install dependencies
run: npm ci
- name: Publish plugins to Release branch
run: npm run publish

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
dist
node_modules
.idea

View file

@ -1,25 +0,0 @@
import { jsxs, jsx } from 'react/jsx-runtime';
import { Inline, ActionPanel, Action, Content, Icons } from '@project-gauntlet/api/components';
import { Clipboard, showHud } from '@project-gauntlet/api/helpers';
import { g as getEmojis } from './vendor.js';
// @ts-expect-error
Deno[Deno.internal].core;
function EmojiPicker(props) {
const text = props.text.trim();
if (text.length < 3) {
return undefined;
}
const emoji = getEmojis().find(emoji => emoji.keywords.includes(text));
if (!emoji) {
return undefined;
}
return (jsxs(Inline, { actions: jsx(ActionPanel, { children: jsx(Action, { label: `Copy ${emoji.emoji} to clipboard`, onAction: async () => {
console.log(emoji.emoji);
await Clipboard.writeText(emoji.emoji);
showHud(`${emoji.emoji} copied to clipboard`);
} }) }), children: [jsx(Inline.Left, { children: jsx(Content.H3, { children: text }) }), jsx(Inline.Separator, { icon: Icons.ArrowRight }), jsx(Inline.Right, { children: jsx(Content.H3, { children: emoji.emoji }) })] }));
}
export { EmojiPicker as default };
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZW1vamlwaWNrZXIuanMiLCJzb3VyY2VzIjpbXSwic291cmNlc0NvbnRlbnQiOltdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9

File diff suppressed because one or more lines are too long

1937
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

20
package.json Normal file
View file

@ -0,0 +1,20 @@
{
"name": "cswimr-gauntlet-plugins",
"scripts": {
"publish": "gauntlet publish",
"build": "gauntlet build",
"dev": "gauntlet dev"
},
"dependencies": {
"@project-gauntlet/api": "0.10.0",
"@project-gauntlet/deno": "0.10.0",
"unicode-emoji": "^2.5.0",
"which": "^5.0.0"
},
"devDependencies": {
"@project-gauntlet/tools": "^0.9.0",
"@types/react": "^18.3.3",
"@types/which": "^3.0.4",
"typescript": "^5.5.4"
}
}

49
src/emojipicker.tsx Normal file
View file

@ -0,0 +1,49 @@
import { Action, ActionPanel, Content, Icons, Inline } from "@project-gauntlet/api/components";
import { ReactNode } from "react";
import { Clipboard, showHud } from "@project-gauntlet/api/helpers";
import * as UnicodeEmoji from "unicode-emoji";
// @ts-expect-error
const denoCore: DenoCore = Deno[Deno.internal].core;
export default function EmojiPicker(props: { text: string }): ReactNode | undefined {
const text = props.text.trim();
if (text.length < 3) {
return undefined
};
const emoji = UnicodeEmoji.getEmojis().find(emoji => emoji.keywords.includes(text));
if (!emoji) {
return undefined
};
return (
<Inline
actions={
<ActionPanel>
<Action
label={`Copy ${emoji.emoji} to clipboard`}
onAction={async () => {
console.log(emoji.emoji)
await Clipboard.writeText(emoji.emoji);
showHud(`${emoji.emoji} copied to clipboard`);
}}
/>
</ActionPanel>
}
>
<Inline.Left>
<Content.H3>
{text}
</Content.H3>
</Inline.Left>
<Inline.Separator icon={Icons.ArrowRight}/>
<Inline.Right>
<Content.H3>
{emoji.emoji}
</Content.H3>
</Inline.Right>
</Inline>
);
};

12
tsconfig.json Normal file
View file

@ -0,0 +1,12 @@
{
"compilerOptions": {
"strict": true,
"module": "ES2022",
"esModuleInterop": true,
"target": "ES2022",
"moduleResolution": "bundler",
"jsx": "react-jsx",
"types": ["@project-gauntlet/deno"]
},
"lib": ["ES2020"]
}