Skip to content

Commit

Permalink
feat!: migrate to esm
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Oct 31, 2023
1 parent 6e92bea commit f78793d
Show file tree
Hide file tree
Showing 108 changed files with 2,563 additions and 2,448 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.cjs/
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ node_modules

# ignore generated nut tests
test/nuts/generated/

oclif.lock
File renamed without changes.
16 changes: 12 additions & 4 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{
"require": "ts-node/register,source-map-support/register",
"require": [
"ts-node/register"
],
"watch-extensions": "ts",
"watch-files": ["src", "test"],
"watch-files": [
"src",
"test"
],
"recursive": true,
"reporter": "spec",
"timeout": 10000
}
"timeout": 10000,
"node-option": [
"loader=ts-node/esm"
]
}
21 changes: 0 additions & 21 deletions bin/dev

This file was deleted.

3 changes: 1 addition & 2 deletions bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\dev" %*
node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
8 changes: 8 additions & 0 deletions bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
// eslint-disable-next-line node/shebang
async function main() {
const {execute} = await import('@oclif/core')
await execute({development: true, dir: import.meta.url})
}

await main()
3 changes: 0 additions & 3 deletions bin/run

This file was deleted.

9 changes: 9 additions & 0 deletions bin/run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env node

// eslint-disable-next-line node/shebang
async function main() {
const {execute} = await import('@oclif/core')
await execute({dir: import.meta.url})
}

await main()
File renamed without changes.
72 changes: 28 additions & 44 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,91 +3,71 @@
"description": "Commands to interact with source formatted metadata",
"version": "2.10.45",
"author": "Salesforce",
"main": "lib/index.js",
"bugs": "https://github.com/forcedotcom/cli/issues",
"dependencies": {
"@oclif/core": "^2.15.0",
"@oclif/core": "^3.9.2",
"@salesforce/apex-node": "^2.1.0",
"@salesforce/core": "^5.3.10",
"@salesforce/kit": "^3.0.14",
"@salesforce/sf-plugins-core": "^3.1.25",
"@salesforce/sf-plugins-core": "^4.0.0",
"@salesforce/source-deploy-retrieve": "^9.7.27",
"@salesforce/source-tracking": "^4.2.17",
"chalk": "^4.1.2",
"got": "^11.8.6",
"proxy-agent": "^6.3.1",
"tslib": "^2"
"chalk": "^5.3.0",
"got": "^13.0.0",
"proxy-agent": "^6.3.1"
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^4.0.14",
"@oclif/plugin-help": "^5.2.17",
"@salesforce/cli-plugins-testkit": "^4.4.8",
"@salesforce/dev-config": "^4.0.1",
"@salesforce/dev-scripts": "^5.11.0",
"@oclif/plugin-command-snapshot": "^5.0.1",
"@oclif/plugin-help": "^6.0.5",
"@salesforce/cli-plugins-testkit": "^5.0.0-dev.1",
"@salesforce/dev-scripts": "^6.0.3",
"@salesforce/plugin-command-reference": "^3.0.25",
"@salesforce/plugin-deploy-retrieve": "^1.19.0",
"@salesforce/plugin-info": "^2.6.50",
"@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/ts-sinon": "1.4.8",
"@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.8",
"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.9",
"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",
"oclif": "^4.0.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": "^5.2.2"
},
"config": {},
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
},
"files": [
"/lib",
"/messages",
"/oclif.manifest.json"
"/oclif.manifest.json",
"/oclif.lock"
],
"homepage": "https://github.com/salesforcecli/plugin-source",
"keywords": [
"force",
"salesforce",
"sfdx",
"salesforcedx",
"sf",
"sf-plugin",
"sfdx",
"sfdx-plugin"
],
"license": "BSD-3-Clause",
"oclif": {
"commands": "./lib/commands",
"bin": "sfdx",
"bin": "sf",
"devPlugins": [
"@oclif/plugin-command-snapshot",
"@oclif/plugin-help",
Expand Down Expand Up @@ -126,7 +106,9 @@
},
"hooks": {
"sf-doctor-@salesforce/plugin-source": "./lib/hooks/diagnostics"
}
},
"flexibleTaxonomy": true,
"topicSeparator": " "
},
"repository": "salesforcecli/plugin-source",
"scripts": {
Expand Down Expand Up @@ -252,7 +234,7 @@
"output": []
},
"test:command-reference": {
"command": "\"./bin/dev\" commandreference:generate --erroronwarnings",
"command": "ts-node \"./bin/dev.js\" commandreference:generate --erroronwarnings",
"files": [
"src/**/*.ts",
"messages/**",
Expand All @@ -263,7 +245,7 @@
]
},
"test:deprecation-policy": {
"command": "\"./bin/dev\" snapshot:compare",
"command": "ts-node \"./bin/dev.js\" snapshot:compare",
"files": [
"src/**/*.ts"
],
Expand All @@ -273,12 +255,14 @@
]
},
"test:json-schema": {
"command": "\"./bin/dev\" schema:compare",
"command": "ts-node \"./bin/dev.js\" schema:compare",
"files": [
"src/**/*.ts",
"schemas"
],
"output": []
}
}
},
"exports": "./lib/index.js",
"type": "module"
}
20 changes: 11 additions & 9 deletions src/commands/force/mdapi/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +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 { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { Duration, env } from '@salesforce/kit';
import { Lifecycle, Messages, Org } from '@salesforce/core';
import { DeployVersionData, MetadataApiDeploy } from '@salesforce/source-deploy-retrieve';
Expand All @@ -21,16 +23,16 @@ import {
reportsFormatters,
targetUsernameFlag,
TestLevel,
} from '../../../deployCommand';
import { DeployCommandAsyncResult } from '../../../formatters/source/deployAsyncResultFormatter';
import { MdDeployResult, MdDeployResultFormatter } from '../../../formatters/mdapi/mdDeployResultFormatter';
import { ProgressFormatter } from '../../../formatters/progressFormatter';
import { DeployProgressBarFormatter } from '../../../formatters/deployProgressBarFormatter';
import { DeployProgressStatusFormatter } from '../../../formatters/deployProgressStatusFormatter';
import { MdDeployAsyncResultFormatter } from '../../../formatters/mdapi/mdDeployAsyncResultFormatter';
import { ResultFormatterOptions } from '../../../formatters/resultFormatter';
} from '../../../deployCommand.js';
import { DeployCommandAsyncResult } from '../../../formatters/source/deployAsyncResultFormatter.js';
import { MdDeployResult, MdDeployResultFormatter } from '../../../formatters/mdapi/mdDeployResultFormatter.js';
import { ProgressFormatter } from '../../../formatters/progressFormatter.js';
import { DeployProgressBarFormatter } from '../../../formatters/deployProgressBarFormatter.js';
import { DeployProgressStatusFormatter } from '../../../formatters/deployProgressStatusFormatter.js';
import { MdDeployAsyncResultFormatter } from '../../../formatters/mdapi/mdDeployAsyncResultFormatter.js';
import { ResultFormatterOptions } from '../../../formatters/resultFormatter.js';

Messages.importMessagesDirectory(__dirname);
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
const messages = Messages.loadMessages('@salesforce/plugin-source', 'md.deploy');
const deployMessages = Messages.loadMessages('@salesforce/plugin-source', 'deployCommand');

Expand Down
8 changes: 5 additions & 3 deletions src/commands/force/mdapi/deploy/cancel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +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 { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { Connection, Messages, SfError } from '@salesforce/core';
import { Duration } from '@salesforce/kit';
import { RequestStatus } from '@salesforce/source-deploy-retrieve';
Expand All @@ -15,13 +17,13 @@ import {
Ux,
} from '@salesforce/sf-plugins-core';
import { Interfaces } from '@oclif/core';
import { DeployCommand } from '../../../../deployCommand';
import { DeployCommand } from '../../../../deployCommand.js';
import {
DeployCancelCommandResult,
DeployCancelResultFormatter,
} from '../../../../formatters/deployCancelResultFormatter';
} from '../../../../formatters/deployCancelResultFormatter.js';

Messages.importMessagesDirectory(__dirname);
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
const messages = Messages.loadMessages('@salesforce/plugin-source', 'md.cancel');

const replacement = 'project deploy cancel';
Expand Down
14 changes: 8 additions & 6 deletions src/commands/force/mdapi/deploy/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +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 { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { Messages, Org } from '@salesforce/core';
import { Duration, env } from '@salesforce/kit';
import { RequestStatus } from '@salesforce/source-deploy-retrieve';
Expand All @@ -16,13 +18,13 @@ import {
Ux,
} from '@salesforce/sf-plugins-core';
import { Interfaces } from '@oclif/core';
import { MdDeployResult, MdDeployResultFormatter } from '../../../../formatters/mdapi/mdDeployResultFormatter';
import { DeployCommand, getCoverageFormattersOptions, reportsFormatters } from '../../../../deployCommand';
import { ProgressFormatter } from '../../../../formatters/progressFormatter';
import { DeployProgressBarFormatter } from '../../../../formatters/deployProgressBarFormatter';
import { DeployProgressStatusFormatter } from '../../../../formatters/deployProgressStatusFormatter';
import { MdDeployResult, MdDeployResultFormatter } from '../../../../formatters/mdapi/mdDeployResultFormatter.js';
import { DeployCommand, getCoverageFormattersOptions, reportsFormatters } from '../../../../deployCommand.js';
import { ProgressFormatter } from '../../../../formatters/progressFormatter.js';
import { DeployProgressBarFormatter } from '../../../../formatters/deployProgressBarFormatter.js';
import { DeployProgressStatusFormatter } from '../../../../formatters/deployProgressStatusFormatter.js';

Messages.importMessagesDirectory(__dirname);
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
const messages = Messages.loadMessages('@salesforce/plugin-source', 'md.deployreport');

const replacement = 'project deploy report';
Expand Down
10 changes: 6 additions & 4 deletions src/commands/force/mdapi/retrieve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +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 { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { Lifecycle, Messages, Org, SfError, SfProject } from '@salesforce/core';
import { Duration } from '@salesforce/kit';
import {
Expand All @@ -22,15 +24,15 @@ import {
Ux,
} from '@salesforce/sf-plugins-core';
import { Interfaces } from '@oclif/core';
import { resolveZipFileName, SourceCommand } from '../../../sourceCommand';
import { Stash } from '../../../stash';
import { resolveZipFileName, SourceCommand } from '../../../sourceCommand.js';
import { Stash } from '../../../stash.js';
import {
RetrieveCommandAsyncResult,
RetrieveCommandResult,
RetrieveResultFormatter,
} from '../../../formatters/mdapi/retrieveResultFormatter';
} from '../../../formatters/mdapi/retrieveResultFormatter.js';

Messages.importMessagesDirectory(__dirname);
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
const messages = Messages.loadMessages('@salesforce/plugin-source', 'md.retrieve');
const spinnerMessages = Messages.loadMessages('@salesforce/plugin-source', 'spinner');
const retrieveMessages = Messages.loadMessages('@salesforce/plugin-source', 'retrieve');
Expand Down
10 changes: 6 additions & 4 deletions src/commands/force/mdapi/retrieve/report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +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 { fileURLToPath } from 'node:url';
import { dirname } from 'node:path';
import { Messages, Org, SfError } from '@salesforce/core';
import { Duration } from '@salesforce/kit';
import { MetadataApiRetrieve, MetadataApiRetrieveStatus, RetrieveResult } from '@salesforce/source-deploy-retrieve';
Expand All @@ -15,15 +17,15 @@ import {
Ux,
} from '@salesforce/sf-plugins-core';
import { Interfaces } from '@oclif/core';
import { resolveZipFileName, SourceCommand } from '../../../../sourceCommand';
import { Stash, MdRetrieveData } from '../../../../stash';
import { resolveZipFileName, SourceCommand } from '../../../../sourceCommand.js';
import { Stash, MdRetrieveData } from '../../../../stash.js';
import {
RetrieveCommandResult,
RetrieveCommandAsyncResult,
RetrieveResultFormatter,
} from '../../../../formatters/mdapi/retrieveResultFormatter';
} from '../../../../formatters/mdapi/retrieveResultFormatter.js';

Messages.importMessagesDirectory(__dirname);
Messages.importMessagesDirectory(dirname(fileURLToPath(import.meta.url)));
const messages = Messages.loadMessages('@salesforce/plugin-source', 'md.retrieve');
const spinnerMessages = Messages.loadMessages('@salesforce/plugin-source', 'spinner');
export type ReportCommandResult = RetrieveCommandResult | RetrieveCommandAsyncResult;
Expand Down
Loading

0 comments on commit f78793d

Please sign in to comment.