Skip to content

Commit 9e1340b

Browse files
authored
Merge pull request #1225 from tsg-ut/fix/build-dirname-paths
fix: .build/ 実行時の __dirname 依存パス問題を追加修正 (wordhero, slack/oauth/tunnel)
2 parents cb600b0 + 8e5012b commit 9e1340b

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/slack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const tsgEventClient = new TeamEventClient(eventClient, process.env.TEAM_
5151
const loadTokensDeferred = new Deferred<Token[]>();
5252
const loadTokens = async () => {
5353
const db = await sqlite.open({
54-
filename: path.join(__dirname, '..', 'tokens.sqlite3'),
54+
filename: path.join(process.cwd(), 'tokens.sqlite3'),
5555
driver: sqlite3.Database,
5656
});
5757
const tokens: Token[] = await db.all(sql`SELECT * FROM tokens WHERE bot_access_token <> ''`).catch((): Token[] => []);

oauth/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const log = logger.child({bot: 'oauth'});
1111

1212
export const server = ({webClient: slack}: SlackInterface) => async (fastify: FastifyInstance) => {
1313
const db = await sqlite.open({
14-
filename: path.join(__dirname, '..', 'tokens.sqlite3'),
14+
filename: path.join(process.cwd(), 'tokens.sqlite3'),
1515
driver: sqlite3.Database,
1616
});
1717
await db.run(`

tunnel/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const getEmojiImageUrl = async (name: string, team: string): Promise<string> =>
3535
export const server = ({webClient: tsgSlack, eventClient}: SlackInterface) => {
3636
const callback: FastifyPluginAsync = async (fastify, _opts) => {
3737
const db = await open({
38-
filename: path.join(__dirname, '..', 'tokens.sqlite3'),
38+
filename: path.join(process.cwd(), 'tokens.sqlite3'),
3939
driver: sqlite3.Database,
4040
});
4141
const kmcToken = await db.get(sql`SELECT * FROM tokens WHERE team_id = ${process.env.KMC_TEAM_ID}`).catch((): null => null);

wordhero/generateCrossword.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const convertToNewFormat = (board: string[]) => (
2323

2424
const generate = async (usedAt: string): Promise<Crossword> => {
2525
if (stocks.length === 0) {
26-
const generator = spawn('../target/release/crossword_generator_main', {cwd: __dirname});
26+
const generator = spawn('target/release/crossword_generator_main', {cwd: process.cwd()});
2727
const output = await new Promise<Buffer>((resolve) => {
2828
generator.stdout.pipe(concat({encoding: 'buffer'}, (data: Buffer) => {
2929
resolve(data);

0 commit comments

Comments
 (0)