Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: core7 #564

Merged
merged 4 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
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 '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
Original file line number Diff line number Diff line change
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),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the previous code was saving the whole iso-git errors array but I think this is ok, those are still accessible in e.cause.errors in caller code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, cause is meant to cover that. data is typed now as AnyJson and TS didn't like Error[] (because error is a class, has various methods, etc).

Which is probably an improvement.

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
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 '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
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 '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
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 '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
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 '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
Original file line number Diff line number Diff line change
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
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 '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
Original file line number Diff line number Diff line change
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
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 '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
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 '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
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 '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
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 '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
Original file line number Diff line number Diff line change
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
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 '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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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"]
}
Loading
Loading