Skip to content

Commit

Permalink
feat!: core7 (#564)
Browse files Browse the repository at this point in the history
* refactor: multiple isogit error handling

BREAKING CHANGE: core7, sdr11, jsforce-node

* chore: node16 module resolution
  • Loading branch information
mshanemc committed Apr 10, 2024
1 parent 2ddd245 commit d0d8f7b
Show file tree
Hide file tree
Showing 22 changed files with 112 additions and 292 deletions.
8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -45,20 +45,20 @@
},
"dependencies": {
"@oclif/core": "^3.26.0",
"@salesforce/core": "^6.7.6",
"@salesforce/core": "^7.0.0",
"@salesforce/kit": "^3.1.0",
"@salesforce/source-deploy-retrieve": "^10.9.1",
"@salesforce/source-deploy-retrieve": "^11.0.0",
"@salesforce/ts-types": "^2.0.9",
"fast-xml-parser": "^4.3.6",
"graceful-fs": "^4.2.11",
"isomorphic-git": "1.23.0",
"ts-retry-promise": "^0.8.0"
},
"devDependencies": {
"@salesforce/cli-plugins-testkit": "^5.1.13",
"@salesforce/cli-plugins-testkit": "^5.2.0",
"@salesforce/dev-scripts": "^8.5.0",
"@types/graceful-fs": "^4.1.9",
"eslint-plugin-sf-plugin": "^1.17.5",
"eslint-plugin-sf-plugin": "^1.18.0",
"ts-node": "^10.9.2",
"ts-patch": "^3.1.2",
"typescript": "^5.4.4"
Expand Down
2 changes: 1 addition & 1 deletion src/shared/functions.ts
Expand Up @@ -6,7 +6,7 @@
*/

import { sep, normalize, isAbsolute, relative } from 'node:path';
import * as fs from 'node:fs';
import fs from 'node:fs';
import { isString } from '@salesforce/ts-types';
import {
FileResponseSuccess,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/localComponentSetArray.ts
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 'node:fs';
import fs from 'node:fs';
import { resolve } from 'node:path';
import { NamedPackageDir, Logger } from '@salesforce/core';
import {
Expand Down
20 changes: 10 additions & 10 deletions src/shared/localShadowRepo.ts
Expand Up @@ -5,12 +5,13 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

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

Expand Down Expand Up @@ -278,16 +279,15 @@ export class ShadowRepo {
} catch (e) {
if (e instanceof git.Errors.MultipleGitError) {
this.logger.error(`${e.errors.length} errors on git.add, showing the first 5:`, e.errors.slice(0, 5));
const error = new SfError(
e.message,
e.name,
[
throw SfError.create({
message: e.message,
name: e.name,
data: e.errors.map((err) => err.message),
cause: e,
actions: [
`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.`,
],
1
);
error.setData(e.errors);
throw error;
});
}
redirectToCliRepoError(e);
}
Expand Down
4 changes: 2 additions & 2 deletions src/shared/remoteSourceTrackingService.ts
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 'node:path';
import * as fs from 'node:fs';
import path from 'node:path';
import fs from 'node:fs';
import { EOL } from 'node:os';
import { retryDecorator, NotRetryableError } from 'ts-retry-promise';
import { Logger, Org, Messages, Lifecycle, SfError, Connection, lockInit } from '@salesforce/core';
Expand Down
2 changes: 1 addition & 1 deletion src/sourceTracking.ts
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 'node:fs';
import fs from 'node:fs';
import { resolve, sep, normalize } from 'node:path';
import { NamedPackageDir, Logger, Org, SfProject, Lifecycle } from '@salesforce/core';
import { AsyncCreatable } from '@salesforce/kit';
Expand Down
2 changes: 1 addition & 1 deletion test/nuts/local/commitPerf.nut.ts
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 'node:path';
import path from 'node:path';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
import { ShadowRepo } from '../../../src/shared/localShadowRepo';
Expand Down
2 changes: 1 addition & 1 deletion test/nuts/local/customLabelsMetadataKeyTranslation.nut.ts
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 'node:path';
import path from 'node:path';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
import { ComponentStatus } from '@salesforce/source-deploy-retrieve';
Expand Down
6 changes: 3 additions & 3 deletions test/nuts/local/localTrackingScenario.nut.ts
Expand Up @@ -5,11 +5,11 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import { EOL } from 'node:os';
import * as path from 'node:path';
import * as fs from 'node:fs';
import path from 'node:path';
import fs from 'node:fs';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
import { shouldThrow } from '@salesforce/core/lib/testSetup';
import { shouldThrow } from '@salesforce/core/testSetup';
import { ShadowRepo } from '../../../src/shared/localShadowRepo';

describe('end-to-end-test for local tracking', () => {
Expand Down
2 changes: 1 addition & 1 deletion test/nuts/local/nonTopLevelIgnore.nut.ts
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 'node:path';
import path from 'node:path';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
import * as fs from 'graceful-fs';
Expand Down
6 changes: 3 additions & 3 deletions test/nuts/local/partialBundleDelete.nut.ts
Expand Up @@ -4,11 +4,11 @@
* 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 'node:path';
import * as fs from 'node:fs';
import path from 'node:path';
import fs from 'node:fs';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
import * as sinon from 'sinon';
import sinon from 'sinon';
import { RegistryAccess } from '@salesforce/source-deploy-retrieve';
import { getComponentSets } from '../../../src/shared/localComponentSetArray';

Expand Down
2 changes: 1 addition & 1 deletion test/nuts/local/pkgDirMatching.nut.ts
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 'node:path';
import path from 'node:path';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import * as fs from 'graceful-fs';
import { expect } from 'chai';
Expand Down
2 changes: 1 addition & 1 deletion test/nuts/local/relativePkgDirs.nut.ts
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 'node:path';
import path from 'node:path';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import * as fs from 'graceful-fs';
import { expect } from 'chai';
Expand Down
2 changes: 1 addition & 1 deletion test/nuts/local/tracking-scale.nut.ts
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 'node:path';
import path from 'node:path';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
import * as fs from 'graceful-fs';
Expand Down
4 changes: 2 additions & 2 deletions test/nuts/mpd.nut.ts
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 'node:path';
import * as fs from 'node:fs';
import path from 'node:path';
import fs from 'node:fs';
import { TestSession } from '@salesforce/cli-plugins-testkit';
import { expect } from 'chai';
import { Org, SfProject } from '@salesforce/core';
Expand Down
4 changes: 3 additions & 1 deletion test/tsconfig.json
Expand Up @@ -2,6 +2,8 @@
"extends": "@salesforce/dev-config/tsconfig-test-strict",
"include": ["./**/*.ts"],
"compilerOptions": {
"skipLibCheck": true
"skipLibCheck": true,
"moduleResolution": "Node16",
"module": "Node16"
}
}
2 changes: 1 addition & 1 deletion test/unit/conflicts.test.ts
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 'node:path';
import path from 'node:path';
import * as sinon from 'sinon';
import { expect } from 'chai';
import { ForceIgnore, ComponentSet, RegistryAccess } from '@salesforce/source-deploy-retrieve';
Expand Down
6 changes: 3 additions & 3 deletions test/unit/deleteCustomLabels.test.ts
Expand Up @@ -4,11 +4,11 @@
* 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 'node:fs';
import * as sinon from 'sinon';
import fs from 'node:fs';
import sinon from 'sinon';
import { SourceComponent, RegistryAccess } from '@salesforce/source-deploy-retrieve';
import { expect } from 'chai';
import { deleteCustomLabels } from '../../src/';
import { deleteCustomLabels } from '../../src/shared/functions';

const registry = new RegistryAccess();
// const customLabelsType = registry.getTypeByName('CustomLabels');
Expand Down
7 changes: 4 additions & 3 deletions test/unit/localShadowRepo.test.ts
Expand Up @@ -4,10 +4,11 @@
* 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 'node:path';
import path from 'node:path';
import * as os from 'node:os';
import * as fs from 'node:fs';
import * as git from 'isomorphic-git';
import fs from 'node:fs';
// @ts-expect-error isogit has both ESM and CJS exports but node16 module/resolution identifies it as ESM
import git from 'isomorphic-git';
import { expect } from 'chai';
import sinon = require('sinon');
import { ShadowRepo } from '../../src/shared/localShadowRepo';
Expand Down
2 changes: 1 addition & 1 deletion test/unit/remoteSourceTracking.test.ts
Expand Up @@ -10,7 +10,7 @@
import { writeFile, mkdir, readFile } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import { sep, dirname } from 'node:path';
import { MockTestOrgData, instantiateContext, stubContext, restoreContext } from '@salesforce/core/lib/testSetup';
import { MockTestOrgData, instantiateContext, stubContext, restoreContext } from '@salesforce/core/testSetup';
import { Logger, Messages, Org } from '@salesforce/core';
// eslint-disable-next-line no-restricted-imports
import * as kit from '@salesforce/kit';
Expand Down
4 changes: 3 additions & 1 deletion tsconfig.json
Expand Up @@ -3,7 +3,9 @@
"compilerOptions": {
"outDir": "./lib",
"skipLibCheck": true,
"plugins": [{ "transform": "@salesforce/core/lib/messageTransformer", "import": "messageTransformer" }]
"plugins": [{ "transform": "@salesforce/core/messageTransformer", "import": "messageTransformer" }],
"moduleResolution": "Node16",
"module": "Node16"
},
"include": ["src/**/*.ts"]
}

0 comments on commit d0d8f7b

Please sign in to comment.