Skip to content

Commit

Permalink
feat: use new not-config-file stl (#999)
Browse files Browse the repository at this point in the history
* feat: use new not-config-file stl

* chore: remove debug

* chore: remove more devDeps

* chore: bump source-testkit

* test: more cli fixes

* chore: bump testkit

* chore: bump source-testkit for fix

* test: cli on testkit.assignPermsets

* test: cli for manifest:create

* test: more cli in nuts

* test: correct componetStatus

* fix: correct status on push filtering
  • Loading branch information
mshanemc authored Nov 8, 2023
1 parent 589031e commit 5821898
Show file tree
Hide file tree
Showing 66 changed files with 690 additions and 674 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ module.exports = {
'plugin:sf-plugin/recommended',
],
ignorePatterns: ['test/nuts/ebikes-lwc/**', 'test/nuts/nestedLWCProject/**'],
rules: {
// This rule requires the `strictNullChecks` compiler option to be turned on to function correctly @typescript-eslint/prefer-nullish-coalescing
// we never got PS to strict nulls because it's not worth the effort
'@typescript-eslint/prefer-nullish-coalescing': 'off',
},
};
51 changes: 10 additions & 41 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"dependencies": {
"@oclif/core": "^2.15.0",
"@salesforce/apex-node": "^2.1.0",
"@salesforce/core": "^5.3.10",
"@salesforce/kit": "^3.0.14",
"@salesforce/core": "^5.3.18",
"@salesforce/kit": "^3.0.15",
"@salesforce/sf-plugins-core": "^3.1.25",
"@salesforce/source-deploy-retrieve": "^9.7.28",
"@salesforce/source-tracking": "^4.2.17",
"@salesforce/source-deploy-retrieve": "^9.8.4",
"@salesforce/source-tracking": "^4.3.0",
"chalk": "^4.1.2",
"got": "^11.8.6",
"proxy-agent": "^6.3.1",
Expand All @@ -21,51 +21,23 @@
"devDependencies": {
"@oclif/plugin-command-snapshot": "^4.0.14",
"@oclif/plugin-help": "^5.2.20",
"@salesforce/cli-plugins-testkit": "^4.4.12",
"@salesforce/dev-config": "^4.0.1",
"@salesforce/dev-scripts": "^5.11.0",
"@salesforce/cli-plugins-testkit": "^5.0.2",
"@salesforce/dev-scripts": "^6.0.3",
"@salesforce/plugin-command-reference": "^3.0.45",
"@salesforce/plugin-deploy-retrieve": "^1.19.3",
"@salesforce/plugin-info": "^2.6.51",
"@salesforce/plugin-settings": "^1.4.28",
"@salesforce/plugin-templates": "^55.5.14",
"@salesforce/plugin-user": "^2.3.36",
"@salesforce/prettier-config": "^0.0.3",
"@salesforce/source-testkit": "^2.1.34",
"@salesforce/source-testkit": "^2.1.62",
"@salesforce/ts-sinon": "1.4.19",
"@swc/core": "1.3.39",
"@types/archiver": "^5.3.2",
"@types/debug": "^4.1.7",
"@types/shelljs": "^0.8.11",
"@typescript-eslint/eslint-plugin": "^5.42.1",
"@typescript-eslint/parser": "^5.62.0",
"archiver": "^5.3.2",
"chai": "^4.3.10",
"chai-each": "^0.0.1",
"cross-env": "^7.0.3",
"debug": "^4.3.3",
"eslint": "^8.51.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-salesforce": "^2.0.2",
"eslint-config-salesforce-license": "^0.2.0",
"eslint-config-salesforce-typescript": "^1.1.1",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-jsdoc": "^43.0.5",
"eslint-plugin-sf-plugin": "^1.16.13",
"fast-glob": "^3.3.1",
"husky": "^7.0.4",
"mocha": "^9.1.3",
"nyc": "^15.1.0",
"oclif": "^3.16.0",
"prettier": "^2.8.8",
"pretty-quick": "^3.1.3",
"shelljs": "^0.8.5",
"shx": "0.3.4",
"sinon": "10.0.0",
"ts-node": "^10.4.0",
"typescript": "^4.9.5",
"wireit": "^0.10.0"
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
},
"config": {},
"engines": {
Expand All @@ -92,10 +64,7 @@
"@oclif/plugin-command-snapshot",
"@oclif/plugin-help",
"@salesforce/plugin-command-reference",
"@salesforce/plugin-deploy-retrieve",
"@salesforce/plugin-templates",
"@salesforce/plugin-settings",
"@salesforce/plugin-user"
"@salesforce/plugin-deploy-retrieve"
],
"topics": {
"force": {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/force/source/push.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { Duration, env } from '@salesforce/kit';
import { Lifecycle, Messages } from '@salesforce/core';
import { DeployResult, DeployVersionData, RequestStatus } from '@salesforce/source-deploy-retrieve';
import { ComponentStatus, DeployResult, DeployVersionData, RequestStatus } from '@salesforce/source-deploy-retrieve';
import { SourceTracking } from '@salesforce/source-tracking';
import { getBoolean } from '@salesforce/ts-types';
import {
Expand Down Expand Up @@ -209,7 +209,7 @@ export default class Push extends DeployCommand {
result.response.status === RequestStatus.Succeeded ||
// successful-ish (only warnings about deleted things that are already deleted)
(result.response.status === RequestStatus.Failed &&
result.getFileResponses().every((fr) => fr.state !== 'Failed') &&
result.getFileResponses().every((fr) => fr.state !== ComponentStatus.Failed) &&
!result.response.errorMessage);
// all successes
if (this.deployResults.every((result) => isSuccessLike(result))) {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/force/source/retrieve.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, join, resolve } from 'path';
import * as fs from 'fs';
import { dirname, join, resolve } from 'node:path';
import * as fs from 'node:fs';

import { Lifecycle, Messages, SfError, SfProject } from '@salesforce/core';
import { Duration } from '@salesforce/kit';
Expand Down
4 changes: 2 additions & 2 deletions src/deployCommand.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 path from 'path';
import * as fs from 'fs';
import * as path from 'node:path';
import * as fs from 'node:fs';
import {
AsyncResult,
ComponentSet,
Expand Down
3 changes: 1 addition & 2 deletions src/formatters/deployReportResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import { MetadataApiDeployStatus, RequestStatus } from '@salesforce/source-deploy-retrieve';
import { getString } from '@salesforce/ts-types';
import { SfError, Messages } from '@salesforce/core';
import { DeployResultFormatter } from './deployResultFormatter';

Expand All @@ -16,7 +15,7 @@ export type DeployReportCommandResult = MetadataApiDeployStatus;

export class DeployReportResultFormatter extends DeployResultFormatter {
public display(): void {
const status = getString(this, 'result.response.status', 'unknown');
const status = this.result.response.status ?? 'unknown';
this.ux.log(`Status: ${status}`);
if (!this.isVerbose()) {
const componentsTotal = this.getNumResult('numberComponentsTotal');
Expand Down
9 changes: 5 additions & 4 deletions src/formatters/deployResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
* 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 chalk from 'chalk';

import { Messages, SfError } from '@salesforce/core';
import { ensureArray } from '@salesforce/kit';
import { asString, get, getBoolean, getNumber, getString } from '@salesforce/ts-types';
import {
ComponentStatus,
DeployMessage,
DeployResult,
Failures,
Expand Down Expand Up @@ -107,7 +108,7 @@ export class DeployResultFormatter extends ResultFormatter {
}

protected hasStatus(status: RequestStatus): boolean {
return getString(this.result, 'response.status') === status;
return this.result.response.status === status;
}

protected isRunTestsEnabled(): boolean {
Expand Down Expand Up @@ -170,7 +171,7 @@ export class DeployResultFormatter extends ResultFormatter {
}

protected displayDeletions(): void {
const deletions = this.fileResponses.filter((f) => f.state === 'Deleted');
const deletions = this.fileResponses.filter((f) => f.state === ComponentStatus.Deleted);
if (!deletions.length) {
return;
}
Expand All @@ -197,7 +198,7 @@ export class DeployResultFormatter extends ResultFormatter {
if (this.fileResponses?.length) {
const fileResponses: FileResponse[] = [];
this.fileResponses
.filter((f) => f.state === 'Failed')
.filter((f) => f.state === ComponentStatus.Failed)
.map((f: FileResponse & { error: string }) => {
fileResponses.push(f);
fileResponseFailures.set(`${f.type}#${f.fullName}`, f.error);
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/mdapi/mdDeployAsyncResultFormatter.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 { EOL } from 'os';
import { EOL } from 'node:os';

import { Messages } from '@salesforce/core';
import { AsyncResult } from '@salesforce/source-deploy-retrieve';
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/mdapi/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 { join, parse } from 'path';
import { join, parse } from 'node:path';
import { blue } from 'chalk';
import { getNumber } from '@salesforce/ts-types';
import {
Expand Down
4 changes: 2 additions & 2 deletions src/formatters/resultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/
/* eslint-disable class-methods-use-this */

import * as path from 'path';
import * as fs from 'fs';
import * as path from 'node:path';
import * as fs from 'node:fs';
import { Failures, FileProperties, FileResponse, Successes } from '@salesforce/source-deploy-retrieve';
import { getNumber } from '@salesforce/ts-types';
import * as chalk from 'chalk';
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/source/deployAsyncResultFormatter.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 { EOL } from 'os';
import { EOL } from 'node:os';

import { Messages } from '@salesforce/core';
import { cloneJson } from '@salesforce/kit';
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/source/pullFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class PullResultFormatter extends ResultFormatter {
}

protected hasStatus(status: RequestStatus): boolean {
return getString(this.result, 'response.status') === status;
return this.result?.response?.status === status;
}

protected hasComponents(): boolean {
Expand Down
8 changes: 4 additions & 4 deletions src/formatters/source/pushResultFormatter.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 { relative, resolve as pathResolve } from 'path';
import { relative, resolve as pathResolve } from 'node:path';
import * as chalk from 'chalk';

import { Messages, SfError } from '@salesforce/core';
Expand Down Expand Up @@ -104,7 +104,7 @@ export class PushResultFormatter extends ResultFormatter {
protected correctFileResponses(): FileResponse[] {
const withoutUnchanged = this.results.some((result) => result.getFileResponses().length)
? this.results.flatMap((result) =>
result.getFileResponses().filter((fileResponse) => fileResponse.state !== 'Unchanged')
result.getFileResponses().filter((fileResponse) => fileResponse.state !== ComponentStatus.Unchanged)
)
: [];
if (!this.deletes.length) {
Expand Down Expand Up @@ -155,7 +155,7 @@ export class PushResultFormatter extends ResultFormatter {
return;
}
if (this.isSuccess() && this.fileResponses?.length) {
const successes = this.fileResponses.filter((f) => f.state !== 'Failed');
const successes = this.fileResponses.filter((f) => f.state !== ComponentStatus.Failed);
if (!successes.length) {
return;
}
Expand Down Expand Up @@ -205,7 +205,7 @@ export class PushResultFormatter extends ResultFormatter {
if (this.fileResponses?.length) {
const fileResponses: FileResponse[] = [];
this.fileResponses
.filter((f) => f.state === 'Failed')
.filter((f) => f.state === ComponentStatus.Failed)
.map((f: FileResponse & { error: string }) => {
fileResponses.push(f);
fileResponseFailures.set(`${f.type}#${f.fullName}`, f.error);
Expand Down
4 changes: 2 additions & 2 deletions src/sourceCommand.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, extname } from 'path';
import * as fs from 'fs';
import { dirname, resolve, extname } from 'node:path';
import * as fs from 'node:fs';
import { Messages, SfError } from '@salesforce/core';
import { ComponentSet } from '@salesforce/source-deploy-retrieve';
import { getString, Optional } from '@salesforce/ts-types';
Expand Down
2 changes: 1 addition & 1 deletion src/stash.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 fs from 'fs';
import * as fs from 'node:fs';
import { ConfigFile, Logger, Messages, SfError } from '@salesforce/core';
import { JsonMap, Optional } from '@salesforce/ts-types';

Expand Down
2 changes: 1 addition & 1 deletion src/trackingFunctions.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 { ChangeResult, SourceTracking, SourceTrackingOptions } from '@salesforce/source-tracking';
import { Messages, SfError } from '@salesforce/core';
Expand Down
4 changes: 4 additions & 0 deletions test/.eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,9 @@ module.exports = {
'@typescript-eslint/explicit-function-return-type': 'off',
// Mocked out the methods that shouldn't do anything in the tests.
'@typescript-eslint/no-empty-function': 'off',

// This rule requires the `strictNullChecks` compiler option to be turned on to function correctly @typescript-eslint/prefer-nullish-coalescing
// we never got PS to strict nulls because it's not worth the effort
'@typescript-eslint/prefer-nullish-coalescing': 'off',
},
};
2 changes: 1 addition & 1 deletion test/commands/mdapi/cancel.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 } from 'path';
import { join } from 'node:path';
import * as sinon from 'sinon';
import { expect } from 'chai';
import { spyMethod, stubMethod } from '@salesforce/ts-sinon';
Expand Down
4 changes: 2 additions & 2 deletions test/commands/mdapi/retrieve.test.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 * as sinon from 'sinon';
import { expect } from 'chai';
import { Lifecycle, SfProject } from '@salesforce/core';
Expand Down
4 changes: 2 additions & 2 deletions test/commands/mdapi/retrieveReport.test.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 * as sinon from 'sinon';
import { expect } from 'chai';
import { fromStub, stubInterface, stubMethod } from '@salesforce/ts-sinon';
Expand Down
2 changes: 1 addition & 1 deletion test/commands/source/cancel.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 } from 'path';
import { join } from 'node:path';
import * as sinon from 'sinon';
import { expect } from 'chai';
import { fromStub, spyMethod, stubInterface, stubMethod } from '@salesforce/ts-sinon';
Expand Down
2 changes: 1 addition & 1 deletion test/commands/source/deploy.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 } from 'path';
import { join } from 'node:path';
import * as sinon from 'sinon';
import { expect } from 'chai';
import { ComponentSetBuilder, ComponentSetOptions, MetadataApiDeployOptions } from '@salesforce/source-deploy-retrieve';
Expand Down
2 changes: 1 addition & 1 deletion test/commands/source/deployCommand.test.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 { expect } from 'chai';
import { getCoverageFormattersOptions } from '../../../src/deployCommand';

Expand Down
2 changes: 1 addition & 1 deletion test/commands/source/progressBarFormatter.test.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 { EventEmitter } from 'events';
import { EventEmitter } from 'node:events';
import { MetadataApiDeploy } from '@salesforce/source-deploy-retrieve';
import { spyMethod } from '@salesforce/ts-sinon';
import { assert, expect } from 'chai';
Expand Down
2 changes: 1 addition & 1 deletion test/commands/source/report.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 } from 'path';
import { join } from 'node:path';
import * as sinon from 'sinon';
import { expect } from 'chai';
import { fromStub, spyMethod, stubInterface, stubMethod } from '@salesforce/ts-sinon';
Expand Down
Loading

0 comments on commit 5821898

Please sign in to comment.