diff --git a/esbuild.js b/esbuild.js index ffe388a..d7aada9 100644 --- a/esbuild.js +++ b/esbuild.js @@ -1,16 +1,26 @@ -import esbuild from "esbuild"; -import { GasPlugin } from "esbuild-gas-plugin"; +import esbuild from 'esbuild'; +import { GasPlugin } from 'esbuild-gas-plugin'; +import { copyFileSync, mkdirSync } from 'fs'; + +// distフォルダを作成(存在しない場合) +mkdirSync('./dist', { recursive: true }); + +// appsscript.jsonをコピー +copyFileSync('./src/appsscript.json', './dist/appsscript.json'); esbuild .build({ - entryPoints: ["./src/main.ts"], + entryPoints: ['./src/main.ts'], bundle: true, minify: true, - outfile: "./dist/main.js", + outfile: './dist/main.js', plugins: [GasPlugin], }) - .catch((error) => { - console.log('ビルドに失敗しました') + .then(() => { + console.log('✅ Build succeeded!'); + }) + .catch(error => { + console.log('❌ ビルドに失敗しました'); console.error(error); process.exit(1); }); diff --git a/src/appsscript.json b/src/appsscript.json new file mode 100644 index 0000000..7eb58df --- /dev/null +++ b/src/appsscript.json @@ -0,0 +1,6 @@ +{ + "timeZone": "Asia/Tokyo", + "dependencies": {}, + "exceptionLogging": "STACKDRIVER", + "runtimeVersion": "V8" +}