diff --git a/lib/inject-collector-cache-config-extension.js b/lib/inject-collector-cache-config-extension.js index 7370a81..fe0cf3d 100644 --- a/lib/inject-collector-cache-config-extension.js +++ b/lib/inject-collector-cache-config-extension.js @@ -69,15 +69,17 @@ module.exports.register = function ({ playbook, config = {} }) { } logger.info(`Use the cache found at ${cacheDir}`) } else { + const cachedConfig = [] const normalizedCollectorConfig = Array.isArray(collectorConfig) ? collectorConfig : [collectorConfig] - origin.descriptor.ext.collector = normalizedCollectorConfig + origin.descriptor.ext.collector = cachedConfig normalizedCollectorConfig.forEach((collector) => { const { scan: scanConfig = [] } = collector // cache the output of the build const scanDir = expandPath(scanConfig.dir, expandPathContext) logger.info(`Configuring collector to cache '${scanDir}' at '${cacheDir}'`) const cachedCollectorConfig = createCachedCollectorConfig(scanDir, cacheDir) - normalizedCollectorConfig.push.apply(normalizedCollectorConfig, cachedCollectorConfig) + cachedConfig.push(collector) + cachedConfig.push.apply(cachedConfig, cachedCollectorConfig) }) // add the zip of cache to be published zipInfo.push({ cacheDir, zipCacheFile }) diff --git a/test/inject-collector-cache-config-extension-test.js b/test/inject-collector-cache-config-extension-test.js index 17c90e4..6959bce 100644 --- a/test/inject-collector-cache-config-extension-test.js +++ b/test/inject-collector-cache-config-extension-test.js @@ -229,13 +229,13 @@ describe('inject-collector-cache-config-extension', () => { }, }, { - scan: { - dir: './build/antora-resources-2', + run: { + command: `node '${resolvedCacheScanDirIndexJs}' '${scan}' '${cache}'`, }, }, { - run: { - command: `node '${resolvedCacheScanDirIndexJs}' '${scan}' '${cache}'`, + scan: { + dir: './build/antora-resources-2', }, }, {