Skip to content

Commit 56f4275

Browse files
iivvaannxxclaude
andcommitted
fix: warn when packages is empty instead of silently deploying a no-op
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 654f31d commit 56f4275

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/deploy-actions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ async function deployActions (config, deployConfig = {}, logFunc) {
6161
const dist = config.actions.dist
6262
const hasAnyActions = Object.values(config.manifest.full.packages)
6363
.some(pkg => Object.keys(pkg.actions || {}).length > 0)
64+
if (!hasAnyActions) {
65+
log('Warning: no actions defined in manifest — deploy is a no-op and will undeploy any previously-deployed actions for this project.')
66+
}
6467
if (
6568
hasAnyActions &&
6669
(!deployConfig.filterEntities || deployConfig.filterEntities.actions) &&

test/deploy.actions.test.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -583,18 +583,22 @@ test('Deploy actions should pass if there are no build files and filter does not
583583
await expect(deployActions(global.sampleAppConfig, { filterEntities: { triggers: ['trigger1'] } })).resolves.toEqual({})
584584
})
585585

586-
test('Deploy actions should succeed when packages: {} (empty packages, no actions defined)', async () => {
586+
test('Deploy actions should succeed and warn when packages: {} (empty packages, no actions defined)', async () => {
587587
const emptyPackagesConfig = deepCopy(global.sampleAppConfig)
588588
emptyPackagesConfig.manifest.full.packages = {}
589589
runtimeLibUtils.processPackage.mockReturnValue(deepCopy(mockEntities))
590-
await expect(deployActions(emptyPackagesConfig)).resolves.toBeDefined()
590+
const logSpy = jest.fn()
591+
await expect(deployActions(emptyPackagesConfig, {}, logSpy)).resolves.toBeDefined()
592+
expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('no actions defined in manifest'))
591593
})
592594

593-
test('Deploy actions should succeed when a package has no actions key (pkg.actions || {} guard)', async () => {
595+
test('Deploy actions should succeed and warn when a package has no actions key (pkg.actions || {} guard)', async () => {
594596
const noActionsPkgConfig = deepCopy(global.sampleAppConfig)
595597
noActionsPkgConfig.manifest.full.packages = { emptyPkg: {} }
596598
runtimeLibUtils.processPackage.mockReturnValue(deepCopy(mockEntities))
597-
await expect(deployActions(noActionsPkgConfig)).resolves.toBeDefined()
599+
const logSpy = jest.fn()
600+
await expect(deployActions(noActionsPkgConfig, {}, logSpy)).resolves.toBeDefined()
601+
expect(logSpy).toHaveBeenCalledWith(expect.stringContaining('no actions defined in manifest'))
598602
})
599603

600604
// lonely

0 commit comments

Comments
 (0)