diff --git a/CHANGELOG.md b/CHANGELOG.md index 35a548c..78d425e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). The format is based on [Keep a Changelog](http://keepachangelog.com/). +## Version 0.0.2 - 2025-09-04 + +### Fixed + +- Recompilation after compilation of an empty project + ## Version 0.0.1 - 2025-09-03 ### Added diff --git a/lib/getModel.js b/lib/getModel.js index 5da62f9..af0dab7 100644 --- a/lib/getModel.js +++ b/lib/getModel.js @@ -28,7 +28,12 @@ export default async function getModel(projectPath) { return compiled })() - await cds.model + try { + await cds.model + } catch (e) { + cds.model = undefined + throw e + } return cds.model } @@ -37,6 +42,9 @@ async function compileModel(projectPath) { cds.root = projectPath const startTime = Date.now() const resolved = cds.resolve(projectPath + '/*', { cache: {} }) // use CAP standard resolution for model compilation + if (!resolved) { + throw new Error(`No CDS files in path: ${projectPath}`) + } let compiled = await cds.load(resolved, { docs: true, locations: true }) if (!compiled || (Array.isArray(compiled) && compiled.length === 0)) { throw new Error(`Failed to load CDS model from path: ${projectPath}`)