Skip to content

Commit

Permalink
Node.js -> Bun
Browse files Browse the repository at this point in the history
  • Loading branch information
tadashi-aikawa committed Jun 9, 2024
1 parent e269eb0 commit a0f1c02
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 9,984 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,14 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1

- run: npm install
- run: npm run build
- run: bun ci

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
Expand Down
15 changes: 5 additions & 10 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,17 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: arduino/setup-task@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v3
with:
node-version: '18'
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1

- run: task ci
- run: bun ci

- name: "Discord notification (not success)"
uses: rjstone/discord-webhook-notify@v1
if: "! success()"
with:
description: "⚠ Silhouette Tests failed!"
footer: "Node.js v18"
footer: "Bun"
severity: error
avatarUrl: https://cdn.otamart.com/item-picture/26205822/0-1574353123758.jpg
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
Expand All @@ -45,7 +40,7 @@ jobs:
if: always()
with:
description: "✅ Silhouette Tests passed!"
footer: "Node.js v18"
footer: "Bun"
severity: info
avatarUrl: https://cdn.otamart.com/item-picture/26205822/0-1574353123758.jpg
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
Binary file added bun.lockb
Binary file not shown.
34 changes: 32 additions & 2 deletions esbuild.config.mjs → esbuild.config.mts
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import esbuild from "esbuild";
import process from "process";
import builtins from "builtin-modules";
import fs from "fs";
import path from "path";
import chokidar from "chokidar";
import esbuildSvelte from "esbuild-svelte";
import sveltePreprocess from "svelte-preprocess";

// TODO: 自分のVaultパスを設定する
const VAULT_DIR = "/mnt/c/Users/syoum/work/minerva";
const PLUGIN_DIR_NAME = "silhouette";
const FILES = ["main.js", "manifest.json", "styles.css"];

// ---

const banner = `/*
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
if you want to view the source, please visit the github repository of this plugin
*/
`;
import esbuildSvelte from "esbuild-svelte";
import sveltePreprocess from "svelte-preprocess";

const prod = process.argv[2] === "production";

Expand Down Expand Up @@ -53,4 +63,24 @@ if (prod) {
process.exit(0);
} else {
await context.watch();

const pluginDir = path.join(VAULT_DIR, ".obsidian/plugins", PLUGIN_DIR_NAME);

console.log(`📁 Creating ${pluginDir} (if not existed)`);
fs.mkdirSync(pluginDir, { recursive: true });

const hotreloadPath = path.join(pluginDir, ".hotreload", "");
console.log(`🌶️ Creating a ${hotreloadPath}`);
fs.writeFileSync(hotreloadPath, "");

const watcher = chokidar.watch(FILES, { persistent: true });
watcher
.on("add", (p) => {
console.log(`♨️ ${p} is added`);
fs.copyFileSync(p, path.join(pluginDir, p));
})
.on("change", (p) => {
console.log(`♨️ ${p} is changed`);
fs.copyFileSync(p, path.join(pluginDir, p));
});
}
Loading

0 comments on commit a0f1c02

Please sign in to comment.