-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor/code: code cleanup to improve type safety and dev experience (…
…#313) The following fixes were put in - make typecasts explicit - remove dead SMS trigger code - import apps statically instead of dynamically through the file system - additional tests to enforce fixes - remove circular imports for if-then - remove unused type root for build --------- Co-authored-by: Kuan Wee Loong <[email protected]>
- Loading branch information
1 parent
eb81ae6
commit 6606533
Showing
52 changed files
with
278 additions
and
279 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import fs from 'fs' | ||
import { join } from 'path' | ||
import { describe, expect, it } from 'vitest' | ||
|
||
import exportedApps from '@/apps' | ||
|
||
describe('index.ts', () => { | ||
it('should export all apps keys that also match their folder names', () => { | ||
const exportedAppNames = Object.keys(exportedApps) | ||
|
||
// Dynamic apps | ||
const folderPath = join(__dirname, '..') | ||
|
||
const appFolderNames = fs | ||
.readdirSync(folderPath, { withFileTypes: true }) | ||
.filter((dirent) => dirent.isDirectory() && dirent.name !== '__tests__') | ||
.map((dirent) => dirent.name) | ||
// Set comparison | ||
expect(exportedAppNames.length).toEqual(appFolderNames.length) | ||
expect(exportedAppNames.sort()).toEqual(appFolderNames.sort()) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { IApp } from '@plumber/types' | ||
|
||
import customApiApp from './custom-api' | ||
import delayApp from './delay' | ||
import formsgApp from './formsg' | ||
import postmanApp from './postman' | ||
import schedulerApp from './scheduler' | ||
import slackApp from './slack' | ||
import telegramBotApp from './telegram-bot' | ||
import toolboxApp from './toolbox' | ||
import twilioApp from './twilio' | ||
import vaultWorkspaceApp from './vault-workspace' | ||
import webhookApp from './webhook' | ||
|
||
const apps: Record<string, IApp> = { | ||
[customApiApp.key]: customApiApp, | ||
[delayApp.key]: delayApp, | ||
[formsgApp.key]: formsgApp, | ||
[postmanApp.key]: postmanApp, | ||
[schedulerApp.key]: schedulerApp, | ||
[slackApp.key]: slackApp, | ||
[telegramBotApp.key]: telegramBotApp, | ||
[toolboxApp.key]: toolboxApp, | ||
[vaultWorkspaceApp.key]: vaultWorkspaceApp, | ||
[webhookApp.key]: webhookApp, | ||
[twilioApp.key]: twilioApp, | ||
} | ||
|
||
export default apps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.