-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't start plugins for apps without a plugin entrypoint (#850)
* fix: don't start plugins for apps without a plugin entrypoint * fix: don't start app when there's just a plugin entrypoint * fix: implement feedback * fix: simplify boolean logic * fix: improve message again
- Loading branch information
1 parent
750327c
commit a89d4cf
Showing
3 changed files
with
52 additions
and
31 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
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,26 @@ | ||
const { reporter } = require('@dhis2/cli-helpers-engine') | ||
const fs = require('fs-extra') | ||
|
||
/** | ||
* Gets the original `entrypoints` property in d2.config.js | ||
* without applying defaults. Used to detect if there is actually | ||
* supposed to be an app entrypoint for this... app. Temporary until | ||
* the build process is redesigned to allow building plugins without | ||
* apps (LIBS-479) | ||
*/ | ||
const getOriginalEntrypoints = (paths) => { | ||
try { | ||
if (fs.existsSync(paths.config)) { | ||
reporter.debug('Loading d2 config at', paths.config) | ||
// NB: this import can be confounded by previous object mutations | ||
const originalConfig = require(paths.config) | ||
reporter.debug('loaded', originalConfig) | ||
return originalConfig.entryPoints // may be undefined | ||
} | ||
} catch (e) { | ||
reporter.error('Failed to load d2 config!') | ||
reporter.error(e) | ||
process.exit(1) | ||
} | ||
} | ||
exports.getOriginalEntrypoints = getOriginalEntrypoints |