Skip to content

Commit

Permalink
Merge pull request #468 from salesforcecli/devScripts2023-12-28
Browse files Browse the repository at this point in the history
refactor: devScripts update
  • Loading branch information
svc-cli-bot authored Dec 28, 2023
2 parents 4cb253c + 12c5433 commit 6a10351
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 187 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^3.15.1",
"@salesforce/core": "^6.4.0",
"@salesforce/core": "^6.4.2",
"@salesforce/kit": "^3.0.15",
"@salesforce/sf-plugins-core": "^5.0.12",
"chalk": "^5.3.0",
Expand All @@ -15,14 +15,14 @@
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.0.5",
"@salesforce/cli-plugins-testkit": "^5.1.2",
"@salesforce/dev-scripts": "^8.1.2",
"@salesforce/dev-scripts": "^8.1.3",
"@salesforce/plugin-command-reference": "^3.0.54",
"@salesforce/ts-types": "^2.0.9",
"@types/chai-as-promised": "^7.1.8",
"@types/chai-string": "^1.4.5",
"chai-as-promised": "7.1.1",
"chai-string": "^1.5.0",
"eslint-plugin-sf-plugin": "^1.16.15",
"eslint-plugin-sf-plugin": "^1.17.0",
"jsforce": "^2.0.0-beta.28",
"oclif": "^4.1.0",
"shx": "0.3.4",
Expand Down
6 changes: 3 additions & 3 deletions src/commands/org/create/shape.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 } from 'node:path';
import { fileURLToPath } from 'node:url';


import {
SfCommand,
requiredOrgFlagWithDeprecations,
Expand All @@ -17,7 +17,7 @@ import { Messages, Connection, Logger } from '@salesforce/core';
import type { SaveResult } from 'jsforce';
import { isShapeEnabled, JsForceError } from '../../../shared/orgShapeListUtils.js';

Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'shape.create');

export interface ShapeCreateResult {
Expand Down
6 changes: 3 additions & 3 deletions src/commands/org/create/snapshot.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 { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';


import {
Flags,
SfCommand,
Expand All @@ -16,7 +16,7 @@ import {
import { StateAggregator, Messages, SfError } from '@salesforce/core';
import { OrgSnapshot, queryByNameOrId, printSingleRecordTable } from '../../../shared/snapshot.js';

Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'snapshot.create');

export class SnapshotCreate extends SfCommand<OrgSnapshot> {
Expand Down
6 changes: 3 additions & 3 deletions src/commands/org/delete/shape.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 } from 'node:path';
import { fileURLToPath } from 'node:url';


import {
Flags,
SfCommand,
Expand All @@ -18,7 +18,7 @@ import { Messages, SfError } from '@salesforce/core';
import { isShapeEnabled } from '../../../shared/orgShapeListUtils.js';
import utils, { DeleteAllResult } from '../../../shared/deleteUtils.js';

Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'shape.delete');

export interface OrgShapeDeleteResult extends DeleteAllResult {
Expand Down
6 changes: 3 additions & 3 deletions src/commands/org/delete/snapshot.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 { EOL } from 'node:os';
import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';


import {
Flags,
SfCommand,
Expand All @@ -18,7 +18,7 @@ import { Messages } from '@salesforce/core';
import type { SaveResult, SaveError } from 'jsforce';
import { queryByNameOrId } from '../../../shared/snapshot.js';

Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'snapshot.delete');

// jsforce can return SaveError[] or never[]
Expand Down
6 changes: 3 additions & 3 deletions src/commands/org/get/snapshot.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 { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';


import {
Flags,
SfCommand,
Expand All @@ -16,7 +16,7 @@ import {
import { Messages } from '@salesforce/core';
import { OrgSnapshot, queryByNameOrId, printSingleRecordTable } from '../../../shared/snapshot.js';

Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'snapshot.get');

export class SnapshotGet extends SfCommand<OrgSnapshot> {
Expand Down
6 changes: 3 additions & 3 deletions src/commands/org/list/shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';


import { Flags, loglevel, SfCommand } from '@salesforce/sf-plugins-core';
import { Messages } from '@salesforce/core';
import chalk from 'chalk';
import utils, { OrgShapeListResult } from '../../../shared/orgShapeListUtils.js';

Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'shape.list');

// default columns for the shape list
Expand Down
6 changes: 3 additions & 3 deletions src/commands/org/list/snapshot.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 { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';


import {
loglevel,
orgApiVersionFlagWithDeprecations,
Expand All @@ -15,7 +15,7 @@ import {
import { Messages } from '@salesforce/core';
import { OrgSnapshot, queryAll, printRecordTable } from '../../../shared/snapshot.js';

Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'snapshot.list');

export class SnapshotList extends SfCommand<OrgSnapshot[]> {
Expand Down
6 changes: 3 additions & 3 deletions src/shared/deleteUtils.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 { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';


import { Messages, Connection } from '@salesforce/core';
import { JsForceError } from './orgShapeListUtils.js';

Expand Down Expand Up @@ -49,7 +49,7 @@ export const deleteAll = async (conn: Connection, username: string): Promise<Del
} catch (err) {
const JsForceErr = err as JsForceError;
if (JsForceErr.errorCode && JsForceErr.errorCode === 'INVALID_TYPE') {
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'shape.delete');

// ShapeExportPref is not enabled, or user does not have CRUD access
Expand Down
8 changes: 4 additions & 4 deletions src/shared/orgShapeListUtils.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 } from 'node:path';
import { fileURLToPath } from 'node:url';


import { AuthInfo, Connection, Logger, Messages, Org, OrgAuthorization, SfError } from '@salesforce/core';
import { settleAll } from '@salesforce/kit';

Expand Down Expand Up @@ -61,7 +61,7 @@ export async function getAllShapesFromOrg(orgAuth: OrgAuthorization): Promise<Or
} else {
logger.error(false, 'Error finding org shapes', JsForceErr);
const error = SfError.wrap(JsForceErr);
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'messages');
error.message = messages.getMessage('errorWithOrg', [orgAuth.username, JsForceErr.message]);
return Promise.reject(error);
Expand All @@ -86,7 +86,7 @@ export const getAllOrgShapesFromAuthenticatedOrgs = async (): Promise<{
}> => {
const orgs = await AuthInfo.listAllAuthorizations((orgAuth) => !orgAuth.error && !orgAuth.isScratchOrg);
if (orgs.length === 0) {
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'messages');
throw messages.createError('noAuthFound');
}
Expand Down
6 changes: 3 additions & 3 deletions src/shared/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';


import { ux } from '@oclif/core';
import { Connection, SfError, Messages } from '@salesforce/core';
import { capitalCase } from 'change-case';

Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url)
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'snapshot');

export interface OrgSnapshotRequest {
Expand Down
Loading

0 comments on commit 6a10351

Please sign in to comment.