Skip to content

Commit

Permalink
Merge pull request #531 from ngdangtu-vn/core/log-msg
Browse files Browse the repository at this point in the history
add log msg on missing Site instance
  • Loading branch information
oscarotero authored Dec 17, 2023
2 parents 475a6fe + 91b7bb6 commit cb72ce9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ and this project try to adheres to [Semantic Versioning](https://semver.org/).
Go to the `v1` branch to see the changelog of Lume 1.

## [2.0.3] - Unreleased
### Added
- add critical log on rare case where developer forget to export the Site instance in the `_config.ts`

### Changed
- `decap_cms` plugin: Add a script in the homepage to redirect to /admin/
when an invite token or recovery token is detected from netlify identity.
Expand Down
6 changes: 6 additions & 0 deletions cli/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ export async function createSite(config?: string): Promise<Site> {
if (url) {
log.info(`Loading config file <dim>${url}</dim>`);
const mod = await import(url);
if (!mod.default) {
log.critical(
`[Lume] Missing Site instance! Ensure your config file does export the Site instance as default.`,
);
throw new Error("Site instance is not found");
}
return mod.default;
}

Expand Down

0 comments on commit cb72ce9

Please sign in to comment.