Skip to content

Commit 1758142

Browse files
committed
fix:正しくトランスファイルされなかった問題を修正
1 parent 40b8289 commit 1758142

File tree

4 files changed

+47
-74
lines changed

4 files changed

+47
-74
lines changed

.github/workflows/deploy.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ jobs:
2727
- name: Build TypeScript
2828
run: npm run build
2929

30+
- name: Verify build output
31+
run: |
32+
echo "📁 dist フォルダの内容:"
33+
ls -la dist/
34+
echo ""
35+
echo "📄 appsscript.json の内容:"
36+
cat dist/appsscript.json
37+
echo ""
38+
echo "📊 main.js のサイズ:"
39+
wc -c dist/main.js
40+
3041
- name: Setup clasp credentials
3142
env:
3243
CLASPRC_JSON: ${{ secrets.CLASPRC_JSON }}

esbuild.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import esbuild from 'esbuild';
2-
import { GasPlugin } from 'esbuild-gas-plugin';
32
import { copyFileSync, mkdirSync } from 'fs';
43

54
// distフォルダを作成(存在しない場合)
@@ -14,7 +13,11 @@ esbuild
1413
bundle: true,
1514
minify: true,
1615
outfile: './dist/main.js',
17-
plugins: [GasPlugin],
16+
format: 'iife',
17+
globalName: '__bundle__',
18+
footer: {
19+
js: 'function onEdit(e){__bundle__.onEdit(e)}',
20+
},
1821
})
1922
.then(() => {
2023
console.log('✅ Build succeeded!');

src/App.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/main.ts

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,33 @@
1-
import { onEdit, testNotification } from './App';
1+
import { getApplicationFromRow } from './application';
2+
import { sendDiscordNotification } from './discord';
23

3-
interface Global {
4-
onEdit: typeof onEdit;
5-
testNotification: typeof testNotification;
6-
}
7-
declare const global: Global;
4+
/**
5+
* スプレッドシートに行が追加されたときのトリガー
6+
*/
7+
export function onEdit(e: GoogleAppsScript.Events.SheetsOnEdit) {
8+
try {
9+
const range = e.range;
10+
const sheet = range.getSheet();
11+
const row = range.getRow();
12+
13+
// ヘッダー行(1行目)は無視
14+
if (row <= 1) {
15+
return;
16+
}
17+
18+
// 申請情報を取得
19+
const application = getApplicationFromRow(sheet, row);
820

9-
// entryPoints
10-
global.onEdit = onEdit;
11-
global.testNotification = testNotification;
21+
if (!application) {
22+
Logger.log(`行${row}: 申請情報が不完全のため通知をスキップ`);
23+
return;
24+
}
25+
26+
// Discord通知を送信
27+
sendDiscordNotification(application);
28+
Logger.log(`行${row}: 通知送信完了`);
29+
} catch (error) {
30+
Logger.log(`エラー: ${error}`);
31+
throw error;
32+
}
33+
}

0 commit comments

Comments
 (0)