From cbffe9634e2926f5626cb9be52be90d51a07cefa Mon Sep 17 00:00:00 2001 From: Cristian Dominguez <6853656+cristiand391@users.noreply.github.com> Date: Fri, 5 Jan 2024 16:57:24 -0300 Subject: [PATCH 1/2] fix: don't cast opts to boolean (#862) * fix: don't cast opts to boolean * test(nut): deploy empty manifest * test: fix deploy nut --- src/utils/deploy.ts | 6 ++---- test/nuts/deploy/metadata.nut.ts | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/utils/deploy.ts b/src/utils/deploy.ts index ac4a5ee2..bedc5cea 100644 --- a/src/utils/deploy.ts +++ b/src/utils/deploy.ts @@ -5,8 +5,6 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ - - import { ConfigAggregator, Messages, Org, SfError, SfProject } from '@salesforce/core'; import { Duration } from '@salesforce/kit'; import { Nullable } from '@salesforce/ts-types'; @@ -26,7 +24,7 @@ import { DEPLOY_STATUS_CODES } from './errorCodes.js'; import { DeployCache } from './deployCache.js'; import { writeManifest } from './manifestCache.js'; -Messages.importMessagesDirectoryFromMetaUrl(import.meta.url) +Messages.importMessagesDirectoryFromMetaUrl(import.meta.url); export const cacheMessages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'cache'); const deployMessages = Messages.loadMessages('@salesforce/plugin-deploy-retrieve', 'deploy.metadata'); @@ -156,7 +154,7 @@ export async function executeDeploy( }); componentSet = await buildComponentSet(opts, stl); if (componentSet.size === 0) { - if (Boolean(opts['source-dir']) ?? Boolean(opts.manifest) ?? Boolean(opts.metadata) ?? throwOnEmpty) { + if (opts['source-dir'] ?? opts.manifest ?? opts.metadata ?? throwOnEmpty) { // the user specified something to deploy, but there isn't anything throw new SfError( deployMessages.getMessage('error.nothingToDeploy'), diff --git a/test/nuts/deploy/metadata.nut.ts b/test/nuts/deploy/metadata.nut.ts index dfa818f8..bba4bd67 100644 --- a/test/nuts/deploy/metadata.nut.ts +++ b/test/nuts/deploy/metadata.nut.ts @@ -5,13 +5,23 @@ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause */ +import { join } from 'node:path'; +import * as fs from 'node:fs'; import { fileURLToPath } from 'node:url'; import { expect } from 'chai'; import { SourceTestkit } from '@salesforce/source-testkit'; import { DeployResultJson } from '../../../src/utils/types.js'; +const packageXml = ` + + 59.0 + +`; + describe('deploy metadata NUTs', () => { let testkit: SourceTestkit; + const packageFile = 'package.xml'; + let xmlPath: string | undefined; before(async () => { testkit = await SourceTestkit.create({ @@ -19,12 +29,23 @@ describe('deploy metadata NUTs', () => { nut: fileURLToPath(import.meta.url), }); await testkit.deploy({ args: '--source-dir force-app', exitCode: 0 }); + xmlPath = join(testkit.projectDir, packageFile); + await fs.promises.writeFile(xmlPath, packageXml); }); after(async () => { await testkit?.clean(); }); + it('should throw if component set is empty', async () => { + try { + await testkit.deploy({ args: '--manifest package.xml --dry-run', json: true, exitCode: 1 }); + } catch (e) { + const err = e as Error; + expect(err.name).to.equal('NothingToDeploy'); + } + }); + it('should deploy ApexClasses from wildcard match (single character)', async () => { const response = await testkit.deploy({ args: '--metadata "ApexClass:P*"' }); expect(response?.status).to.equal(0); From d79ff3db6f059d8c8a798fd9d8c5b1240755ad93 Mon Sep 17 00:00:00 2001 From: svc-cli-bot Date: Fri, 5 Jan 2024 19:58:18 +0000 Subject: [PATCH 2/2] chore(release): 2.2.14 [skip ci] --- CHANGELOG.md | 6 ++++++ README.md | 34 +++++++++++++++++----------------- package.json | 2 +- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d43ebb3..65f6ccbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [2.2.14](https://github.com/salesforcecli/plugin-deploy-retrieve/compare/2.2.13...2.2.14) (2024-01-05) + +### Bug Fixes + +- don't cast opts to boolean ([#862](https://github.com/salesforcecli/plugin-deploy-retrieve/issues/862)) ([cbffe96](https://github.com/salesforcecli/plugin-deploy-retrieve/commit/cbffe9634e2926f5626cb9be52be90d51a07cefa)) + ## [2.2.13](https://github.com/salesforcecli/plugin-deploy-retrieve/compare/2.2.12...2.2.13) (2024-01-03) ### Bug Fixes diff --git a/README.md b/README.md index bc76ae0e..fc56f3a7 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ FLAG DESCRIPTIONS If you specify this parameter, don’t specify --metadata or --source-dir. ``` -_See code: [src/commands/project/convert/mdapi.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/convert/mdapi.ts)_ +_See code: [src/commands/project/convert/mdapi.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/convert/mdapi.ts)_ ## `sf project convert source` @@ -153,7 +153,7 @@ USAGE | -m ] FLAGS - -d, --output-dir= [default: metadataPackage_1704317868204] Output directory to store the Metadata + -d, --output-dir= [default: metadataPackage_1704484694041] Output directory to store the Metadata API–formatted files in. -m, --metadata=... Metadata component names to convert. -n, --package-name= Name of the package to associate with the metadata-formatted files. @@ -213,7 +213,7 @@ FLAG DESCRIPTIONS Override the api version used for api requests made by this command ``` -_See code: [src/commands/project/convert/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/convert/source.ts)_ +_See code: [src/commands/project/convert/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/convert/source.ts)_ ## `sf project delete source` @@ -352,7 +352,7 @@ FLAG DESCRIPTIONS - Separate the test names with spaces: --tests Test1 Test2 "Test With Space" ``` -_See code: [src/commands/project/delete/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/delete/source.ts)_ +_See code: [src/commands/project/delete/source.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/delete/source.ts)_ ## `sf project delete tracking` @@ -388,7 +388,7 @@ EXAMPLES $ sf project delete tracking --target-org my-scratch ``` -_See code: [src/commands/project/delete/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/delete/tracking.ts)_ +_See code: [src/commands/project/delete/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/delete/tracking.ts)_ ## `sf project deploy cancel` @@ -458,7 +458,7 @@ FLAG DESCRIPTIONS project deploy report". ``` -_See code: [src/commands/project/deploy/cancel.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/deploy/cancel.ts)_ +_See code: [src/commands/project/deploy/cancel.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/deploy/cancel.ts)_ ## `sf project deploy preview` @@ -541,7 +541,7 @@ FLAG DESCRIPTIONS All child components are included. If you specify this flag, don’t specify --metadata or --source-dir. ``` -_See code: [src/commands/project/deploy/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/deploy/preview.ts)_ +_See code: [src/commands/project/deploy/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/deploy/preview.ts)_ ## `sf project deploy quick` @@ -625,7 +625,7 @@ FLAG DESCRIPTIONS deploy report". ``` -_See code: [src/commands/project/deploy/quick.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/deploy/quick.ts)_ +_See code: [src/commands/project/deploy/quick.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/deploy/quick.ts)_ ## `sf project deploy report` @@ -720,7 +720,7 @@ FLAG DESCRIPTIONS --coverage-formatters lcov --coverage-formatters clover ``` -_See code: [src/commands/project/deploy/report.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/deploy/report.ts)_ +_See code: [src/commands/project/deploy/report.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/deploy/report.ts)_ ## `sf project deploy resume` @@ -804,7 +804,7 @@ FLAG DESCRIPTIONS --coverage-formatters lcov --coverage-formatters clover ``` -_See code: [src/commands/project/deploy/resume.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/deploy/resume.ts)_ +_See code: [src/commands/project/deploy/resume.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/deploy/resume.ts)_ ## `sf project deploy start` @@ -1016,7 +1016,7 @@ FLAG DESCRIPTIONS --coverage-formatters lcov --coverage-formatters clover ``` -_See code: [src/commands/project/deploy/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/deploy/start.ts)_ +_See code: [src/commands/project/deploy/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/deploy/start.ts)_ ## `sf project deploy validate` @@ -1178,7 +1178,7 @@ FLAG DESCRIPTIONS --coverage-formatters lcov --coverage-formatters clover ``` -_See code: [src/commands/project/deploy/validate.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/deploy/validate.ts)_ +_See code: [src/commands/project/deploy/validate.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/deploy/validate.ts)_ ## `sf project generate manifest` @@ -1253,7 +1253,7 @@ EXAMPLES $ sf project generate manifest --from-org test@myorg.com --include-packages unlocked ``` -_See code: [src/commands/project/generate/manifest.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/generate/manifest.ts)_ +_See code: [src/commands/project/generate/manifest.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/generate/manifest.ts)_ ## `sf project list ignored` @@ -1294,7 +1294,7 @@ EXAMPLES $ sf project list ignored --source-dir package.xml ``` -_See code: [src/commands/project/list/ignored.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/list/ignored.ts)_ +_See code: [src/commands/project/list/ignored.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/list/ignored.ts)_ ## `sf project reset tracking` @@ -1342,7 +1342,7 @@ EXAMPLES $ sf project reset tracking --revision 30 ``` -_See code: [src/commands/project/reset/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/reset/tracking.ts)_ +_See code: [src/commands/project/reset/tracking.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/reset/tracking.ts)_ ## `sf project retrieve preview` @@ -1398,7 +1398,7 @@ FLAG DESCRIPTIONS Overrides your default org. ``` -_See code: [src/commands/project/retrieve/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/retrieve/preview.ts)_ +_See code: [src/commands/project/retrieve/preview.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/retrieve/preview.ts)_ ## `sf project retrieve start` @@ -1544,6 +1544,6 @@ FLAG DESCRIPTIONS If you specify this parameter, don’t specify --metadata or --source-dir. ``` -_See code: [src/commands/project/retrieve/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.13/src/commands/project/retrieve/start.ts)_ +_See code: [src/commands/project/retrieve/start.ts](https://github.com/salesforcecli/plugin-deploy-retrieve/blob/2.2.14/src/commands/project/retrieve/start.ts)_ diff --git a/package.json b/package.json index 4c8665f0..912694a0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@salesforce/plugin-deploy-retrieve", "description": "deploy and retrieve commands for sf", - "version": "2.2.13", + "version": "2.2.14", "author": "Salesforce", "bugs": "https://github.com/forcedotcom/cli/issues", "dependencies": {