mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
Fix extension reloading and schedule hooks when using the cli to start Directus (#20188)
* Fix extension reloading and schedule hooks Fixes #20169, fixes #20184 * Add changeset
This commit is contained in:
committed by
GitHub
parent
f29b5a167a
commit
10a59ba783
5
.changeset/chatty-laws-switch.md
Normal file
5
.changeset/chatty-laws-switch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@directus/api': patch
|
||||
---
|
||||
|
||||
Fixed extension reloading and schedule hooks when using the cli to start Directus
|
||||
@@ -60,11 +60,13 @@ const nodeResolve = nodeResolveDefault as unknown as typeof nodeResolveDefault.d
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const defaultOptions: ExtensionManagerOptions = {
|
||||
schedule: true,
|
||||
watch: env['EXTENSIONS_AUTO_RELOAD'] && env['NODE_ENV'] !== 'development',
|
||||
};
|
||||
|
||||
export class ExtensionManager {
|
||||
private options: ExtensionManagerOptions = {
|
||||
schedule: true,
|
||||
watch: env['EXTENSIONS_AUTO_RELOAD'] && env['NODE_ENV'] !== 'development',
|
||||
};
|
||||
private options: ExtensionManagerOptions = defaultOptions;
|
||||
|
||||
/**
|
||||
* Whether or not the extensions have been read from disk and registered into the system
|
||||
@@ -140,13 +142,10 @@ export class ExtensionManager {
|
||||
* @param {boolean} options.watch - Whether or not to watch the local extensions folder for changes
|
||||
*/
|
||||
public async initialize(options: Partial<ExtensionManagerOptions> = {}): Promise<void> {
|
||||
if (options.schedule !== undefined) {
|
||||
this.options.schedule = options.schedule;
|
||||
}
|
||||
|
||||
if (options.watch !== undefined) {
|
||||
this.options.watch = options.watch;
|
||||
}
|
||||
this.options = {
|
||||
...defaultOptions,
|
||||
...options,
|
||||
};
|
||||
|
||||
const wasWatcherInitialized = this.watcher !== null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user