-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bb65139
Showing
12 changed files
with
1,609 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
dist/ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shamefully-hoist=true |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Typing Avatars | ||
Replaces the typing indicator with the avatars of those who are typing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { readFile, writeFile } from "fs/promises"; | ||
import { createHash } from "crypto"; | ||
|
||
import { rollup } from "rollup"; | ||
import { swc } from "rollup-plugin-swc3"; | ||
import esbuild from "rollup-plugin-esbuild"; | ||
import commonjs from "@rollup/plugin-commonjs"; | ||
import nodeResolve from "@rollup/plugin-node-resolve"; | ||
|
||
const manifest = JSON.parse(await readFile(`./manifest.json`)); | ||
const outPath = `./dist/index.js`; | ||
|
||
try { | ||
const bundle = await rollup({ | ||
input: `./${manifest.main}`, | ||
onwarn: () => { }, | ||
plugins: [ | ||
nodeResolve(), | ||
commonjs(), | ||
esbuild({ minify: true }), | ||
swc({ | ||
env: { | ||
targets: "defaults", | ||
include: [ | ||
"transform-classes", | ||
"transform-arrow-functions", | ||
], | ||
}, | ||
}), | ||
], | ||
}); | ||
|
||
await bundle.write({ | ||
file: outPath, | ||
globals(id) { | ||
if (id.startsWith("@vendetta")) return id.substring(1).replace(/\//g, "."); | ||
const map = { | ||
react: "window.React", | ||
}; | ||
|
||
return map[id] || null; | ||
}, | ||
format: "iife", | ||
compact: true, | ||
exports: "named", | ||
}); | ||
await bundle.close(); | ||
|
||
const toHash = await readFile(outPath); | ||
manifest.hash = createHash("sha256").update(toHash).digest("hex"); | ||
manifest.main = "index.js"; | ||
await writeFile(`./dist/manifest.json`, JSON.stringify(manifest)); | ||
|
||
console.log(`Successfully built ${manifest.name}!`); | ||
} catch (e) { | ||
console.error("Failed to build plugin...", e); | ||
process.exit(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "Typing Avatars", | ||
"description": "Replaces the typing indicator with the avatars of those who are typing.", | ||
"authors": [ | ||
{ | ||
"name": "Fiery", | ||
"id": "890228870559698955" | ||
} | ||
], | ||
"main": "src/index.tsx", | ||
"vendetta": { | ||
"icon": "ic_feedback" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"private": true, | ||
"scripts": { | ||
"build": "node build.mjs" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^24.0.0", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@swc/core": "^1.3.35", | ||
"esbuild": "^0.16.14", | ||
"rollup": "^3.9.1", | ||
"rollup-plugin-esbuild": "^5.0.0", | ||
"rollup-plugin-swc3": "^0.8.0", | ||
"vendetta-types": "latest" | ||
}, | ||
"pnpm": { | ||
"peerDependencyRules": { | ||
"ignoreMissing": [ | ||
"react", | ||
"react-native" | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.