Skip to content

Commit

Permalink
refactor: devScripts update (#789)
Browse files Browse the repository at this point in the history
* chore: updates from devScripts

* chore: type safety on error code

---------

Co-authored-by: mshanemc <[email protected]>
  • Loading branch information
svc-cli-bot and mshanemc authored Oct 31, 2023
1 parent be9c147 commit d8b043b
Show file tree
Hide file tree
Showing 71 changed files with 465 additions and 319 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@oclif/plugin-command-snapshot": "^4.0.12",
"@salesforce/cli-plugins-testkit": "^4.4.7",
"@salesforce/dev-config": "^4.0.1",
"@salesforce/dev-scripts": "^5.11.0",
"@salesforce/dev-scripts": "^5.12.2",
"@salesforce/plugin-command-reference": "^3.0.40",
"@salesforce/plugin-settings": "^1.4.27",
"@salesforce/plugin-source": "^2.10.30",
Expand All @@ -34,16 +34,16 @@
"@types/shelljs": "^0.8.13",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"chai": "^4.3.8",
"chai": "^4.3.10",
"cross-env": "^7.0.3",
"eslint": "^8.52.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-salesforce": "^2.0.1",
"eslint-config-salesforce-license": "^0.2.0",
"eslint-config-salesforce-typescript": "^1.1.1",
"eslint-config-salesforce-typescript": "^2.0.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jsdoc": "^43.0.5",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-sf-plugin": "^1.16.7",
"husky": "^7.0.4",
"jsforce": "^2.0.0-beta.28",
Expand All @@ -55,8 +55,8 @@
"shx": "0.3.4",
"sinon": "11.1.2",
"ts-node": "^10.9.1",
"typescript": "^4.9.5",
"wireit": "^0.14.0"
"typescript": "^5.2.2",
"wireit": "^0.14.1"
},
"config": {},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
/* eslint-disable class-methods-use-this */

import { EOL } from 'os';
import { EOL } from 'node:os';
import { writeFile, readFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import { Hook } from '@oclif/core';
Expand Down
4 changes: 2 additions & 2 deletions src/commands/project/convert/mdapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { dirname, resolve } from 'path';
import * as fs from 'fs';
import { dirname, resolve } from 'node:path';
import * as fs from 'node:fs';
import { Messages, SfError } from '@salesforce/core';
import {
ComponentSet,
Expand Down
4 changes: 2 additions & 2 deletions src/commands/project/convert/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { resolve } from 'path';
import * as fs from 'fs';
import { resolve } from 'node:path';
import * as fs from 'node:fs';

import { Messages } from '@salesforce/core';
import {
Expand Down
6 changes: 3 additions & 3 deletions src/commands/project/delete/source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as os from 'node:os';
import { Interfaces } from '@oclif/core';
import { Lifecycle, Messages, Org, SfError } from '@salesforce/core';
import {
Expand Down
7 changes: 6 additions & 1 deletion src/commands/project/deploy/cancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ export default class DeployMetadataCancel extends SfCommand<DeployResultJson> {
protected catch(error: SfCommand.Error): Promise<SfCommand.Error> {
if (error.name.includes('INVALID_ID_FIELD')) {
const err = messages.createError('error.CannotCancelDeploy');
return super.catch({ ...error, name: err.name, message: err.message, code: err.code });
return super.catch({
...error,
name: err.name,
message: err.message,
...(typeof err.code === 'string' || typeof err.code === 'number' ? { code: err.code } : {}),
});
}
return super.catch(error);
}
Expand Down
7 changes: 6 additions & 1 deletion src/commands/project/deploy/quick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,12 @@ export default class DeployMetadataQuick extends SfCommand<DeployResultJson> {
protected catch(error: SfCommand.Error): Promise<SfCommand.Error> {
if (error.name.includes('INVALID_ID_FIELD')) {
const err = messages.createError('error.CannotQuickDeploy');
return super.catch({ ...error, name: err.name, message: err.message, code: err.code });
return super.catch({
...error,
name: err.name,
message: err.message,
...(typeof err.code === 'string' || typeof err.code === 'number' ? { code: err.code } : {}),
});
}
return super.catch(error);
}
Expand Down
7 changes: 6 additions & 1 deletion src/commands/project/deploy/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,12 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
}
if (error.message.includes('client has timed out')) {
const err = messages.createError('error.ClientTimeout', [this.config.bin]);
return super.catch({ ...error, name: err.name, message: err.message, code: err.code });
return super.catch({
...error,
name: err.name,
message: err.message,
...(typeof err.code === 'string' || typeof err.code === 'number' ? { code: err.code } : {}),
});
}
return super.catch(error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/project/deploy/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as os from 'os';
import * as os from 'node:os';
import { bold } from 'chalk';
import { EnvironmentVariable, Lifecycle, Messages, OrgConfigProperties, SfError } from '@salesforce/core';
import { CodeCoverageWarnings, DeployVersionData, RequestStatus } from '@salesforce/source-deploy-retrieve';
Expand Down
4 changes: 2 additions & 2 deletions src/commands/project/generate/manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { join } from 'path';
import * as fs from 'fs';
import { join } from 'node:path';
import * as fs from 'node:fs';
import { Messages, Org } from '@salesforce/core';
import { ComponentSetBuilder } from '@salesforce/source-deploy-retrieve';
import {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/project/list/ignored.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'path';
import * as fs from 'fs';
import * as path from 'node:path';
import * as fs from 'node:fs';
import { Messages, SfError } from '@salesforce/core';
import { ForceIgnore } from '@salesforce/source-deploy-retrieve';
import { SfCommand, Flags } from '@salesforce/sf-plugins-core';
Expand Down
6 changes: 3 additions & 3 deletions src/commands/project/retrieve/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { rm } from 'fs/promises';
import { dirname, join, resolve } from 'path';
import { rm } from 'node:fs/promises';
import { dirname, join, resolve } from 'node:path';

import * as fs from 'fs';
import * as fs from 'node:fs';
import { EnvironmentVariable, Lifecycle, Messages, OrgConfigProperties, SfError, SfProject } from '@salesforce/core';
import {
RetrieveResult,
Expand Down
4 changes: 2 additions & 2 deletions src/formatters/deployResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'path';
import * as path from 'node:path';
import { EOL } from 'node:os';
import * as fs from 'fs';
import * as fs from 'node:fs';
import { ux } from '@oclif/core';
import { DeployResult, FileResponse, RequestStatus } from '@salesforce/source-deploy-retrieve';
import { Org, SfError, Lifecycle } from '@salesforce/core';
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/metadataConvertResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'path';
import * as path from 'node:path';
import { ux } from '@oclif/core';
import { ConvertResult } from '@salesforce/source-deploy-retrieve';
import { Formatter, ConvertMdapiJson } from '../utils/types';
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/metadataRetrieveResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'path';
import * as path from 'node:path';
import { ux } from '@oclif/core';
import { FileResponse, RetrieveResult } from '@salesforce/source-deploy-retrieve';
import { Messages } from '@salesforce/core';
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/retrieveResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'path';
import * as path from 'node:path';
import { Ux } from '@salesforce/sf-plugins-core';
import { FileResponse, RetrieveMessage, RetrieveResult } from '@salesforce/source-deploy-retrieve';
import { NamedPackageDir, SfProject } from '@salesforce/core';
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/sourceConvertResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { resolve } from 'path';
import { resolve } from 'node:path';
import { ux } from '@oclif/core';
import { ConvertResult } from '@salesforce/source-deploy-retrieve';
import { SfError, Messages } from '@salesforce/core';
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/testResultsFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as os from 'os';
import * as os from 'node:os';
import { ux } from '@oclif/core';
import { dim, underline } from 'chalk';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'path';
import * as path from 'node:path';

import {
ApexTestResultData,
Expand Down
4 changes: 2 additions & 2 deletions src/utils/flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as fs from 'fs';
import { resolve, extname } from 'path';
import * as fs from 'node:fs';
import { resolve, extname } from 'node:path';
import { Flags } from '@oclif/core';
import { Messages, Lifecycle } from '@salesforce/core';
import { PathInfo, TestLevel, reportsFormatters } from './types';
Expand Down
6 changes: 3 additions & 3 deletions src/utils/manifestCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'path';
import { homedir } from 'os';
import * as fs from 'fs';
import * as path from 'node:path';
import { homedir } from 'node:os';
import * as fs from 'node:fs';
import { ComponentSet } from '@salesforce/source-deploy-retrieve';
import { Global } from '@salesforce/core';

Expand Down
2 changes: 1 addition & 1 deletion src/utils/metadataDeployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
/* eslint-disable class-methods-use-this */

import { EOL } from 'os';
import { EOL } from 'node:os';
import { cyan, red } from 'chalk';
import { Duration } from '@salesforce/kit';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/utils/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as path from 'path';
import * as path from 'node:path';
import { blue, bold } from 'chalk';
import { StandardColors } from '@salesforce/sf-plugins-core';
import { FileResponse, FileResponseFailure, FileResponseSuccess } from '@salesforce/source-deploy-retrieve';
Expand Down
2 changes: 1 addition & 1 deletion src/utils/previewOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as path from 'path';
import * as path from 'node:path';
import { ux } from '@oclif/core';
import { StandardColors } from '@salesforce/sf-plugins-core';
import { bold, dim } from 'chalk';
Expand Down
2 changes: 1 addition & 1 deletion test/commands/convert/source.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { join, resolve, sep } from 'path';
import { join, resolve, sep } from 'node:path';
import { ComponentSetBuilder, ComponentSetOptions, MetadataConverter } from '@salesforce/source-deploy-retrieve';
import * as sinon from 'sinon';
import { expect } from 'chai';
Expand Down
2 changes: 1 addition & 1 deletion test/commands/delete/source.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as fs from 'fs';
import * as fs from 'node:fs';
import * as sinon from 'sinon';
import { expect } from 'chai';
import {
Expand Down
2 changes: 1 addition & 1 deletion test/commands/deploy.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as path from 'path';
import * as path from 'node:path';
import { SourceTestkit } from '@salesforce/source-testkit';
import { writeJson } from '../../src/commands/deploy';
import { TestLevel } from '../../src/utils/types';
Expand Down
4 changes: 2 additions & 2 deletions test/commands/deploy/metadata/cancel.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as fs from 'fs';
import * as path from 'path';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { strict as assert } from 'node:assert';
import { TestSession, execCmd } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
Expand Down
4 changes: 2 additions & 2 deletions test/commands/deploy/metadata/resume.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as fs from 'fs';
import * as path from 'path';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { strict as assert } from 'node:assert';
import { SourceTestkit } from '@salesforce/source-testkit';
import { expect } from 'chai';
Expand Down
2 changes: 1 addition & 1 deletion test/commands/deploy/metadata/validate.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as path from 'path';
import * as path from 'node:path';
import { SourceTestkit } from '@salesforce/source-testkit';
import { isObject } from '@salesforce/ts-types';
import { assert, expect } from 'chai';
Expand Down
2 changes: 1 addition & 1 deletion test/commands/retrieve/start.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as path from 'path';
import * as path from 'node:path';
import * as sinon from 'sinon';
import { expect } from 'chai';
import {
Expand Down
4 changes: 2 additions & 2 deletions test/nuts/convert/mdapi.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as fs from 'fs';
import * as path from 'path';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { expect, assert } from 'chai';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { ComponentSet, SourceComponent } from '@salesforce/source-deploy-retrieve';
Expand Down
4 changes: 2 additions & 2 deletions test/nuts/convert/source.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import * as fs from 'fs';
import * as path from 'path';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { expect } from 'chai';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { ConvertResultJson } from '../../../src/utils/types';
Expand Down
4 changes: 2 additions & 2 deletions test/nuts/delete/source.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as fs from 'fs';
import * as path from 'path';
import * as fs from 'node:fs';
import * as path from 'node:path';
import { expect } from 'chai';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
import { SourceTestkit } from '@salesforce/source-testkit';
Expand Down
2 changes: 1 addition & 1 deletion test/nuts/deploy/formatter.nut.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import * as path from 'path';
import * as path from 'node:path';
import { EOL } from 'node:os';
import { expect } from 'chai';
import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit';
Expand Down
Loading

0 comments on commit d8b043b

Please sign in to comment.