This commit is contained in:
Alex 2024-05-05 23:10:22 +08:00
parent b90837be00
commit c4dac91a20
6 changed files with 80 additions and 59 deletions

35
.github/workflows/release.yml vendored Normal file
View file

@ -0,0 +1,35 @@
name: Release plugin
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: Build plugin
run: |
npm install
npm run build
npm run deploy
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
tag="${GITHUB_REF#refs/tags/}"
gh release create "$tag" \
--title="$tag" \
--draft \
dist/main.js dist/manifest.json dist/styles.css

0
README.md Normal file
View file

View file

@ -9,7 +9,7 @@ if you want to view the source, please visit the github repository of this plugi
*/
`;
const prod = process.argv[2] === "production";
const watch = process.argv[2] === "watch";
const context = await esbuild.context({
banner: {
@ -47,16 +47,16 @@ const context = await esbuild.context({
format: "cjs",
target: "es2022",
logLevel: "info",
sourcemap: prod ? false : "inline",
sourcemap: watch ? "inline" : false,
minify: true,
treeShaking: true,
outfile: "main.js",
logOverride: { "empty-import-meta": "silent" },
});
if (prod) {
if (watch) {
await context.watch();
} else {
await context.rebuild();
process.exit(0);
} else {
await context.watch();
}

View file

@ -4,10 +4,9 @@
"description": "Solo RPG toolkit for Obsidian (https://obsidian.md)",
"main": "./dist/api.js",
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "tsc --noEmit -skipLibCheck && node esbuild.config.mjs production && npm run rollup",
"rollup": "tsc --emitDeclarationOnly --declaration --declarationMap --project tsconfig.json --outDir dist",
"version": "node version-bump.mjs && git add manifest.json versions.json"
"dev": "node esbuild.config.mjs watch",
"build": "tsc --noEmit -skipLibCheck && node esbuild.config.mjs",
"deploy": "rm -rf ./dist && mkdir dist && cp main.js dist && cp styles.css dist && cp manifest.json dist"
},
"keywords": [],
"author": "Alex Kurowski",

View file

@ -1,34 +1,38 @@
export default {
basic: [
"very young",
"young",
"elderly",
"very short",
"short",
"tall",
"very tall",
"beautiful",
"poor",
"introverted",
"extroverted",
"cheerful",
"sad",
"calm",
"impulsive",
"humble",
"vain",
"rude",
"kind",
"serious",
"witty",
"taciturn",
"chatty",
"ascetic",
"epicurean",
"cunning",
"naive",
"short-tempered",
"beautiful",
"bored",
"calm",
"cautious",
"chatty",
"cheerful",
"cunning",
"dry",
"elderly",
"epicurean",
"extrovert",
"humble",
"impulsive",
"introvert",
"kind",
"mild",
"naive",
"poor",
"rude",
"sad",
"serious",
"short",
"short-temper",
"taciturn",
"tall",
"tired",
"vain",
"very short",
"very tall",
"very young",
"witty",
"young",
],
hairColor: [
"black",

View file

@ -90,33 +90,16 @@ const getSomeName = () => {
const getJob = () => capitalize(randomFrom(dictionary.occupations));
const getLooks = () => {
const age = randomFrom(dictionary.descriptors.age);
const height = randomFrom(dictionary.descriptors.height);
const basic = randomFrom(dictionary.descriptors.basic);
const hairColor = randomFrom(dictionary.descriptors.hairColor);
const hairLength = randomFrom(dictionary.descriptors.hairLength);
const basic: string[] = [];
const extra: string[] = [];
const hair =
hairLength === "no"
? `${hairLength} hair`
: `${hairLength} ${hairColor} hair`;
if (age) basic.push(age);
if (height) basic.push(height);
if (hairLength === "no") {
extra.push(`${hairLength} hair`);
} else {
extra.push(`${hairLength} ${hairColor} hair`);
}
const basicStr = basic.join(", ");
const extraStr = extra.join(", ");
if (basic.length && extra.length) {
return capitalize(`${basicStr}, with ${extraStr}`);
} else if (basic.length && !extra.length) {
return capitalize(basicStr);
} else if (!basic.length && extra.length) {
return capitalize(extraStr);
} else {
return "Just some guy";
}
return capitalize(`${basic} looking, with ${hair}`);
};
const getTown = () =>