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!: migrate to ESM #672

Merged
merged 8 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 6 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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.cjs
2 changes: 1 addition & 1 deletion .git2gus/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"productTag": "a1aB00000004Bx8IAE",
"defaultBuild": "offcore.tooling.56",
"defaultBuild": "offcore.tooling.59",
"issueTypeLabels": {
"feature": "USER STORY",
"regression": "BUG P1",
Expand Down
39 changes: 0 additions & 39 deletions .github/ISSUE_TEMPLATE/Bug_report.md

This file was deleted.

16 changes: 0 additions & 16 deletions .github/ISSUE_TEMPLATE/Feature_request.md

This file was deleted.

9 changes: 0 additions & 9 deletions .github/no-response.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,5 @@ node_modules
.idea

oclif.manifest.json

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

This file was deleted.

2 changes: 1 addition & 1 deletion bin/dev.cmd
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +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()
20 changes: 10 additions & 10 deletions command-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[
{
"command": "limits:api:display",
"plugin": "@salesforce/plugin-limits",
"flags": ["api-version", "json", "loglevel", "target-org"],
"alias": ["force:limits:api:display", "org:list:limits"],
"alias": ["force:limits:api:display", "limits:api:display"],
"command": "org:list:limits",
"flagAliases": ["apiversion", "targetusername", "u"],
"flagChars": ["o"],
"flagAliases": ["apiversion", "targetusername", "u"]
"flags": ["api-version", "json", "loglevel", "target-org"],
"plugin": "@salesforce/plugin-limits"
},
{
"command": "limits:recordcounts:display",
"plugin": "@salesforce/plugin-limits",
"flags": ["api-version", "json", "loglevel", "sobject", "target-org"],
"alias": ["force:limits:recordcounts:display", "org:list:sobject:record-counts"],
"alias": ["force:limits:recordcounts:display", "limits:recordcounts:display"],
"command": "org:list:sobject:record-counts",
"flagAliases": ["apiversion", "sobjecttype", "targetusername", "u"],
"flagChars": ["o", "s"],
"flagAliases": ["apiversion", "sobjecttype", "targetusername", "u"]
"flags": ["api-version", "json", "loglevel", "sobject", "target-org"],
"plugin": "@salesforce/plugin-limits"
}
]
File renamed without changes.
4 changes: 0 additions & 4 deletions messages/display.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,3 @@ For each limit, this command returns the maximum allocation and the remaining al
- Display limits in the org with alias "my-scratch-org":

<%= config.bin %> <%= command.id %> --target-org my-scratch-org

# targetOrg

Login username or alias for the target org.
6 changes: 1 addition & 5 deletions messages/recordcounts.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ Use this command to get an approximate count of the records in standard or custo

<%= config.bin %> <%= command.id %> --sobject Account --sobject Lead --target-org my-scratch-org

# sobjectFlagDescription
# flags.sobject.summary

API name of the standard or custom object for which to display record counts.

# targetOrg

Login username or alias for the target org.
91 changes: 38 additions & 53 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,111 +4,94 @@
"version": "2.3.41",
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"main": "lib/index.js",
"dependencies": {
"@oclif/core": "^2.15.0",
"@oclif/core": "^3.9.0",
"@salesforce/core": "^5.3.10",
"@salesforce/kit": "^3.0.11",
"@salesforce/sf-plugins-core": "^3.1.28",
"@salesforce/ts-types": "^2.0.9",
"tslib": "^2"
"@salesforce/sf-plugins-core": "^4.0.0",
"@salesforce/ts-types": "^2.0.9"
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^4.0.15",
"@oclif/test": "^2.5.6",
"@salesforce/cli-plugins-testkit": "^4.4.7",
"@salesforce/dev-config": "^4.0.1",
"@salesforce/dev-scripts": "^5.12.0",
"@oclif/plugin-command-snapshot": "^5.0.1",
"@oclif/test": "^3",
"@salesforce/cli-plugins-testkit": "^5",
"@salesforce/dev-scripts": "^6.0.1",
"@salesforce/plugin-command-reference": "^3.0.42",
"@salesforce/prettier-config": "^0.0.3",
"@salesforce/ts-sinon": "^1.4.17",
"@swc/core": "^1.3.32",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"chai": "^4.3.10",
"eslint": "^8.52.0",
"eslint-config-prettier": "^8.10.0",
"eslint-config-salesforce": "^2.0.2",
"eslint-config-salesforce-license": "^0.2.0",
"eslint-config-salesforce-typescript": "^2.0.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-jsdoc": "^46.8.2",
"eslint-plugin-sf-plugin": "^1.16.9",
"husky": "^7.0.4",
"mocha": "^9.1.3",
"nyc": "^15.1.0",
"oclif": "^3.17.2",
"prettier": "^2.8.8",
"pretty-quick": "^3.1.0",
"eslint-plugin-sf-plugin": "^1.16.12",
"oclif": "^4.0.3",
"shx": "0.3.4",
"sinon": "10.0.0",
"swc": "^1.0.11",
Copy link
Contributor

Choose a reason for hiding this comment

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

since bin/dev is way different now, does that mean we don't need swc anymore?

"ts-node": "^10.4.0",
"typescript": "^5.2.2",
"wireit": "^0.14.1"
"typescript": "^5.2.2"
},
"config": {},
"engines": {
"node": ">=16.0.0"
"node": ">=18.0.0"
},
"files": [
"/lib",
"/messages",
"/oclif.manifest.json",
"/schemas"
"/schemas",
"/oclif.lock"
],
"homepage": "https://github.com/salesforcecli/plugin-limits",
"keywords": [
"force",
"salesforce",
"sfdx",
"salesforcedx",
"sfdx-plugin"
"sf-plugin",
"sf",
"sfdx-plugin",
"sfdx"
],
"license": "BSD-3-Clause",
"oclif": {
"commands": "./lib/commands",
"additionalHelpFlags": [
"-h"
],
"bin": "sfdx",
"bin": "sf",
"devPlugins": [
"@oclif/plugin-help",
"@oclif/plugin-command-snapshot",
"@salesforce/plugin-command-reference"
],
"topics": {
"limits": {
"description": "Display an org’s limits.",
"org": {
"external": true,
"subtopics": {
"api": {
"description": "Display an org’s API limits."
"list": {
"external": true
},
"recordcounts": {
"description": "Display record counts for an org."
"subtopics": {
"sobject": {
"external": true
}
}
}
}
}
},
"flexibleTaxonomy": true,
"topicSeparator": " "
},
"repository": "salesforcecli/plugin-limits",
"scripts": {
"build": "wireit",
"clean": "sf-clean",
"clean-all": "sf-clean all",
"clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
"clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json oclif.lock",
"compile": "wireit",
"docs": "sf-docs",
"format": "wireit",
"lint": "wireit",
"postpack": "shx rm -f oclif.manifest.json",
"postpack": "shx rm -f oclif.manifest.json oclif.lock",
"prepack": "sf-prepack",
"prepare": "sf-install",
"test": "wireit",
"test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel --jobs 5",
"test:only": "wireit",
"version": "oclif-dev readme"
"version": "oclif readme"
},
"publishConfig": {
"access": "public"
Expand Down Expand Up @@ -189,7 +172,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 @@ -200,7 +183,7 @@
]
},
"test:deprecation-policy": {
"command": "\"./bin/dev\" snapshot:compare",
"command": "ts-node \"./bin/dev.js\" snapshot:compare",
"files": [
"src/**/*.ts"
],
Expand All @@ -210,12 +193,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"
}
File renamed without changes.
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 { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import { Messages, SfError } from '@salesforce/core';
import {
SfCommand,
Expand All @@ -12,7 +14,7 @@ import {
requiredOrgFlagWithDeprecations,
} from '@salesforce/sf-plugins-core';

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

type ApiLimit = {
Expand All @@ -31,7 +33,7 @@ interface Result {
export type ApiLimits = ApiLimit[];

export class LimitsApiDisplayCommand extends SfCommand<ApiLimits> {
public static readonly aliases = ['force:limits:api:display', 'org:list:limits'];
public static readonly aliases = ['force:limits:api:display', 'limits:api:display'];
public static readonly summary = messages.getMessage('summary');
public static readonly description = messages.getMessage('description');
public static readonly examples = messages.getMessages('examples');
Expand Down
Loading