Skip to content

Commit

Permalink
feat: JSR CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
eliassjogreen committed Aug 22, 2024
1 parent 6b9872c commit 77e77df
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 5 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Publish

on:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: denoland/setup-deno@v1
- run: deno publish
5 changes: 5 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
{
"name": "@denosaurs/typefetch",
"version": "0.3.1",
"exports": {
".": "./mod.ts"
},
"tasks": {
"update": "deno run --allow-net --allow-write update.ts"
}
Expand Down
8 changes: 4 additions & 4 deletions emoji.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Emoji } from "./types.ts";
import emojis from "./all.json" with { type: "json" };
import { reUnicode } from "./unicode.ts";

export { Emoji };
export type { Emoji };

// Regex to parse emoji in a string - e.g. :coffee:
const reEmojiName = /:([a-zA-Z0-9_\-\+]+):/g;
Expand Down Expand Up @@ -128,7 +128,7 @@ export function replace(
}

/** Replace all emoji names in a string with actual emojis. */
export function emojify(str: string) {
export function emojify(str: string): string {
if (!str) return "";
return str
.split(reEmojiName)
Expand All @@ -142,12 +142,12 @@ export function emojify(str: string) {
}

/** Replace all emoji in a string with actual emoji names. */
export function unemojify(str: string) {
export function unemojify(str: string): string {
return replace(str, (emoji) => wrapColons(emoji.aliases[0]));
}

/** Tagged template version of emojify */
export function emoji(template: TemplateStringsArray, ...args: string[]) {
export function emoji(template: TemplateStringsArray, ...args: string[]): string {
const chunks = [];
for (let i = 0; i < template.length; i++) {
chunks.push(emojify(template[i]));
Expand Down
2 changes: 1 addition & 1 deletion update.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Usage: deno run --allow-net --allow-write update.ts 14
import { Emoji } from "./types.ts";
import type { Emoji } from "./types.ts";

const Qualification = {
FULLY_QUALIFIED: "fully-qualified",
Expand Down

0 comments on commit 77e77df

Please sign in to comment.