-
Notifications
You must be signed in to change notification settings - Fork 120
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-export all models as a top-level export (#534)
This PR re-exports all models in the entrypoint `nylas.ts` file, allowing users to easily import all models; e.g: ```ts import Nylas, { WebhookTriggers } from "nylas"; ``` The nylas entrypoint exports everything fro models/index.ts, which is a file that's generated by script in the prebuild step of `npm build`.
- Loading branch information
1 parent
19678d9
commit ede9b1a
Showing
5 changed files
with
44 additions
and
1 deletion.
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
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,15 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const comment = '// This file is generated by scripts/generateModelIndex.js\n'; | ||
const modelsDir = path.join(__dirname, '..', 'src', 'models'); | ||
let indexContent = ''; | ||
|
||
fs.readdirSync(modelsDir).forEach(file => { | ||
if (file.endsWith('.ts') && file !== 'index.ts') { | ||
const modelName = file.replace('.ts', '.js'); | ||
indexContent += `export * from './${modelName}';\n`; | ||
} | ||
}); | ||
|
||
fs.writeFileSync(path.join(modelsDir, 'index.ts'), comment + indexContent); |
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 @@ | ||
// This file is generated by scripts/generateModelIndex.js | ||
export * from './applicationDetails.js'; | ||
export * from './attachments.js'; | ||
export * from './auth.js'; | ||
export * from './availability.js'; | ||
export * from './calendars.js'; | ||
export * from './connectors.js'; | ||
export * from './contacts.js'; | ||
export * from './credentials.js'; | ||
export * from './drafts.js'; | ||
export * from './error.js'; | ||
export * from './events.js'; | ||
export * from './folders.js'; | ||
export * from './freeBusy.js'; | ||
export * from './grants.js'; | ||
export * from './listQueryParams.js'; | ||
export * from './messages.js'; | ||
export * from './redirectUri.js'; | ||
export * from './response.js'; | ||
export * from './smartCompose.js'; | ||
export * from './threads.js'; | ||
export * from './webhooks.js'; |
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