diff --git a/lib/partial-build-extension.js b/lib/partial-build-extension.js index acf47fe..3a2d40b 100644 --- a/lib/partial-build-extension.js +++ b/lib/partial-build-extension.js @@ -39,7 +39,7 @@ module.exports.register = function ({ config = {} }) { } if (isBranch && version.endsWith('-SNAPSHOT')) version = version.slice(0, -9) const versionsInManifest = Object.values(siteManifestData.components)[0].versions - if (!(version in versionsInManifest && isBranch === !!versionsInManifest[version].prerelease)) { + if (!isAuthorMode && !(version in versionsInManifest && isBranch === !!versionsInManifest[version].prerelease)) { const category = require('path').basename(module.id, '.js') await fsp.writeFile(ospath.join(playbook.dir, '.full-build'), '') console.log(`${category}: version ${version} not previously built; reverting to full build`) diff --git a/test/partial-build-extension-test.js b/test/partial-build-extension-test.js index 67c8d08..5660357 100644 --- a/test/partial-build-extension-test.js +++ b/test/partial-build-extension-test.js @@ -181,6 +181,28 @@ describe('partial-build-extension', () => { }) }) + it('should rewrite content sources when SNAPSHOT version not found if refname is HEAD', async () => { + const playBookDir = WORK_DIR + await fsp.mkdir(ospath.join(WORK_DIR, '.git'), { recursive: true }) + await runScenario({ + refname: 'HEAD', + version: '7.0.0-SNAPSHOT', + expectedRefs: { branches: ['HEAD'], tags: [], url: '.' }, + playbookDir: playBookDir, + }) + }) + + it('should rewrite content sources when release version not found if refname is HEAD', async () => { + const playBookDir = WORK_DIR + await fsp.mkdir(ospath.join(WORK_DIR, '.git'), { recursive: true }) + await runScenario({ + refname: 'HEAD', + version: '7.0.0', + expectedRefs: { branches: ['HEAD'], tags: [], url: '.' }, + playbookDir: playBookDir, + }) + }) + it('should error if refname is HEAD and version undefined', async () => { expect(await trapAsyncError(() => runScenario({ refname: 'HEAD' }))).to.throw( 'When using author mode version is required. Specify config.version or env BUILD_VERSION'