Skip to content

Commit d0d8f7b

Browse files
authored
feat!: core7 (#564)
* refactor: multiple isogit error handling BREAKING CHANGE: core7, sdr11, jsforce-node * chore: node16 module resolution
1 parent 2ddd245 commit d0d8f7b

22 files changed

+112
-292
lines changed

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,20 @@
4545
},
4646
"dependencies": {
4747
"@oclif/core": "^3.26.0",
48-
"@salesforce/core": "^6.7.6",
48+
"@salesforce/core": "^7.0.0",
4949
"@salesforce/kit": "^3.1.0",
50-
"@salesforce/source-deploy-retrieve": "^10.9.1",
50+
"@salesforce/source-deploy-retrieve": "^11.0.0",
5151
"@salesforce/ts-types": "^2.0.9",
5252
"fast-xml-parser": "^4.3.6",
5353
"graceful-fs": "^4.2.11",
5454
"isomorphic-git": "1.23.0",
5555
"ts-retry-promise": "^0.8.0"
5656
},
5757
"devDependencies": {
58-
"@salesforce/cli-plugins-testkit": "^5.1.13",
58+
"@salesforce/cli-plugins-testkit": "^5.2.0",
5959
"@salesforce/dev-scripts": "^8.5.0",
6060
"@types/graceful-fs": "^4.1.9",
61-
"eslint-plugin-sf-plugin": "^1.17.5",
61+
"eslint-plugin-sf-plugin": "^1.18.0",
6262
"ts-node": "^10.9.2",
6363
"ts-patch": "^3.1.2",
6464
"typescript": "^5.4.4"

src/shared/functions.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77

88
import { sep, normalize, isAbsolute, relative } from 'node:path';
9-
import * as fs from 'node:fs';
9+
import fs from 'node:fs';
1010
import { isString } from '@salesforce/ts-types';
1111
import {
1212
FileResponseSuccess,

src/shared/localComponentSetArray.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as fs from 'node:fs';
7+
import fs from 'node:fs';
88
import { resolve } from 'node:path';
99
import { NamedPackageDir, Logger } from '@salesforce/core';
1010
import {

src/shared/localShadowRepo.ts

+10-10
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77

8-
import * as path from 'node:path';
8+
import path from 'node:path';
99
import * as os from 'node:os';
1010
import * as fs from 'graceful-fs';
1111
import { NamedPackageDir, Logger, SfError } from '@salesforce/core';
1212
import { env } from '@salesforce/kit';
13-
import * as git from 'isomorphic-git';
13+
// @ts-expect-error isogit has both ESM and CJS exports but node16 module/resolution identifies it as ESM
14+
import git from 'isomorphic-git';
1415
import { Performance } from '@oclif/core';
1516
import { chunkArray, excludeLwcLocalOnlyTest, folderContainsPath } from './functions';
1617

@@ -278,16 +279,15 @@ export class ShadowRepo {
278279
} catch (e) {
279280
if (e instanceof git.Errors.MultipleGitError) {
280281
this.logger.error(`${e.errors.length} errors on git.add, showing the first 5:`, e.errors.slice(0, 5));
281-
const error = new SfError(
282-
e.message,
283-
e.name,
284-
[
282+
throw SfError.create({
283+
message: e.message,
284+
name: e.name,
285+
data: e.errors.map((err) => err.message),
286+
cause: e,
287+
actions: [
285288
`One potential reason you're getting this error is that the number of files that source tracking is batching exceeds your user-specific file limits. Increase your hard file limit in the same session by executing 'ulimit -Hn ${this.maxFileAdd}'. Or set the 'SFDX_SOURCE_TRACKING_BATCH_SIZE' environment variable to a value lower than the output of 'ulimit -Hn'.\nNote: Don't set this environment variable too close to the upper limit or your system will still hit it. If you continue to get the error, lower the value of the environment variable even more.`,
286289
],
287-
1
288-
);
289-
error.setData(e.errors);
290-
throw error;
290+
});
291291
}
292292
redirectToCliRepoError(e);
293293
}

src/shared/remoteSourceTrackingService.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77

8-
import * as path from 'node:path';
9-
import * as fs from 'node:fs';
8+
import path from 'node:path';
9+
import fs from 'node:fs';
1010
import { EOL } from 'node:os';
1111
import { retryDecorator, NotRetryableError } from 'ts-retry-promise';
1212
import { Logger, Org, Messages, Lifecycle, SfError, Connection, lockInit } from '@salesforce/core';

src/sourceTracking.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as fs from 'node:fs';
7+
import fs from 'node:fs';
88
import { resolve, sep, normalize } from 'node:path';
99
import { NamedPackageDir, Logger, Org, SfProject, Lifecycle } from '@salesforce/core';
1010
import { AsyncCreatable } from '@salesforce/kit';

test/nuts/local/commitPerf.nut.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as path from 'node:path';
7+
import path from 'node:path';
88
import { TestSession } from '@salesforce/cli-plugins-testkit';
99
import { expect } from 'chai';
1010
import { ShadowRepo } from '../../../src/shared/localShadowRepo';

test/nuts/local/customLabelsMetadataKeyTranslation.nut.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as path from 'node:path';
7+
import path from 'node:path';
88
import { TestSession } from '@salesforce/cli-plugins-testkit';
99
import { expect } from 'chai';
1010
import { ComponentStatus } from '@salesforce/source-deploy-retrieve';

test/nuts/local/localTrackingScenario.nut.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77
import { EOL } from 'node:os';
8-
import * as path from 'node:path';
9-
import * as fs from 'node:fs';
8+
import path from 'node:path';
9+
import fs from 'node:fs';
1010
import { TestSession } from '@salesforce/cli-plugins-testkit';
1111
import { expect } from 'chai';
12-
import { shouldThrow } from '@salesforce/core/lib/testSetup';
12+
import { shouldThrow } from '@salesforce/core/testSetup';
1313
import { ShadowRepo } from '../../../src/shared/localShadowRepo';
1414

1515
describe('end-to-end-test for local tracking', () => {

test/nuts/local/nonTopLevelIgnore.nut.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as path from 'node:path';
7+
import path from 'node:path';
88
import { TestSession } from '@salesforce/cli-plugins-testkit';
99
import { expect } from 'chai';
1010
import * as fs from 'graceful-fs';

test/nuts/local/partialBundleDelete.nut.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as path from 'node:path';
8-
import * as fs from 'node:fs';
7+
import path from 'node:path';
8+
import fs from 'node:fs';
99
import { TestSession } from '@salesforce/cli-plugins-testkit';
1010
import { expect } from 'chai';
11-
import * as sinon from 'sinon';
11+
import sinon from 'sinon';
1212
import { RegistryAccess } from '@salesforce/source-deploy-retrieve';
1313
import { getComponentSets } from '../../../src/shared/localComponentSetArray';
1414

test/nuts/local/pkgDirMatching.nut.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as path from 'node:path';
7+
import path from 'node:path';
88
import { TestSession } from '@salesforce/cli-plugins-testkit';
99
import * as fs from 'graceful-fs';
1010
import { expect } from 'chai';

test/nuts/local/relativePkgDirs.nut.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as path from 'node:path';
7+
import path from 'node:path';
88
import { TestSession } from '@salesforce/cli-plugins-testkit';
99
import * as fs from 'graceful-fs';
1010
import { expect } from 'chai';

test/nuts/local/tracking-scale.nut.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77

8-
import * as path from 'node:path';
8+
import path from 'node:path';
99
import { TestSession } from '@salesforce/cli-plugins-testkit';
1010
import { expect } from 'chai';
1111
import * as fs from 'graceful-fs';

test/nuts/mpd.nut.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
77

8-
import * as path from 'node:path';
9-
import * as fs from 'node:fs';
8+
import path from 'node:path';
9+
import fs from 'node:fs';
1010
import { TestSession } from '@salesforce/cli-plugins-testkit';
1111
import { expect } from 'chai';
1212
import { Org, SfProject } from '@salesforce/core';

test/tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
"extends": "@salesforce/dev-config/tsconfig-test-strict",
33
"include": ["./**/*.ts"],
44
"compilerOptions": {
5-
"skipLibCheck": true
5+
"skipLibCheck": true,
6+
"moduleResolution": "Node16",
7+
"module": "Node16"
68
}
79
}

test/unit/conflicts.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as path from 'node:path';
7+
import path from 'node:path';
88
import * as sinon from 'sinon';
99
import { expect } from 'chai';
1010
import { ForceIgnore, ComponentSet, RegistryAccess } from '@salesforce/source-deploy-retrieve';

test/unit/deleteCustomLabels.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as fs from 'node:fs';
8-
import * as sinon from 'sinon';
7+
import fs from 'node:fs';
8+
import sinon from 'sinon';
99
import { SourceComponent, RegistryAccess } from '@salesforce/source-deploy-retrieve';
1010
import { expect } from 'chai';
11-
import { deleteCustomLabels } from '../../src/';
11+
import { deleteCustomLabels } from '../../src/shared/functions';
1212

1313
const registry = new RegistryAccess();
1414
// const customLabelsType = registry.getTypeByName('CustomLabels');

test/unit/localShadowRepo.test.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
* Licensed under the BSD 3-Clause license.
55
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
66
*/
7-
import * as path from 'node:path';
7+
import path from 'node:path';
88
import * as os from 'node:os';
9-
import * as fs from 'node:fs';
10-
import * as git from 'isomorphic-git';
9+
import fs from 'node:fs';
10+
// @ts-expect-error isogit has both ESM and CJS exports but node16 module/resolution identifies it as ESM
11+
import git from 'isomorphic-git';
1112
import { expect } from 'chai';
1213
import sinon = require('sinon');
1314
import { ShadowRepo } from '../../src/shared/localShadowRepo';

test/unit/remoteSourceTracking.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import { writeFile, mkdir, readFile } from 'node:fs/promises';
1111
import { existsSync } from 'node:fs';
1212
import { sep, dirname } from 'node:path';
13-
import { MockTestOrgData, instantiateContext, stubContext, restoreContext } from '@salesforce/core/lib/testSetup';
13+
import { MockTestOrgData, instantiateContext, stubContext, restoreContext } from '@salesforce/core/testSetup';
1414
import { Logger, Messages, Org } from '@salesforce/core';
1515
// eslint-disable-next-line no-restricted-imports
1616
import * as kit from '@salesforce/kit';

tsconfig.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"compilerOptions": {
44
"outDir": "./lib",
55
"skipLibCheck": true,
6-
"plugins": [{ "transform": "@salesforce/core/lib/messageTransformer", "import": "messageTransformer" }]
6+
"plugins": [{ "transform": "@salesforce/core/messageTransformer", "import": "messageTransformer" }],
7+
"moduleResolution": "Node16",
8+
"module": "Node16"
79
},
810
"include": ["src/**/*.ts"]
911
}

0 commit comments

Comments
 (0)