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: make esm #1094

Merged
merged 36 commits into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
858bab3
feat: make esm
mdonnalley Aug 24, 2023
c55d6e6
fix: deprecation-policy test
mdonnalley Sep 1, 2023
08752fe
chore: bump dev-scripts
mdonnalley Sep 1, 2023
6d7bc3f
chore: bump plugin-release-management
mdonnalley Sep 1, 2023
9357eb1
fix: convert import.meta.url to file path
mdonnalley Sep 1, 2023
cbe8e9c
chore: update tsconfig.json
mdonnalley Sep 5, 2023
52fcee4
chore: update deps
mdonnalley Sep 6, 2023
941368c
chore: update prepare script
mdonnalley Sep 11, 2023
366bd35
Merge branch 'main' into mdonnalley/esm
mdonnalley Sep 11, 2023
4fb03b9
chore: merge conflicts
mdonnalley Sep 11, 2023
6f85ef8
refactor: display-release-notes hook
mdonnalley Sep 19, 2023
e2f12d9
chore: update oclif eslint deps
mdonnalley Sep 19, 2023
a868d2d
refactor: post-install-release-notes script
mdonnalley Sep 19, 2023
a7e44b9
chore: clean up
mdonnalley Sep 19, 2023
6e4ada7
chore: bump core and sf-plugins-core
mdonnalley Sep 22, 2023
51ecf00
Merge branch 'main' into mdonnalley/esm
mdonnalley Sep 22, 2023
1b08766
chore: regen yarn.lock
mdonnalley Sep 22, 2023
69f2e81
Merge branch 'main' into mdonnalley/esm
mdonnalley Oct 2, 2023
a870ace
chore: bump deps
mdonnalley Oct 2, 2023
4928aa6
chore: bump plugin-release-management
mdonnalley Oct 2, 2023
1d0d7f7
chore: add back compile to prepare script
mdonnalley Oct 2, 2023
d247771
chore: bump plugin-release-management
mdonnalley Oct 2, 2023
2ef5564
Merge branch 'main' into mdonnalley/esm
mdonnalley Oct 2, 2023
0a39f07
chore: code review
mdonnalley Oct 5, 2023
8f42f2d
chore: update test tsconfig
mdonnalley Oct 5, 2023
d11a3c5
chore: remove tslib
mdonnalley Oct 5, 2023
d3a7e63
chore: bump oclif
mdonnalley Oct 5, 2023
0c28b2f
Merge branch 'main' into mdonnalley/esm
mdonnalley Oct 5, 2023
03aa07c
chore: bump oclif
mdonnalley Oct 5, 2023
89425ac
chore: bump mocha
mdonnalley Oct 5, 2023
30b1102
chore: remove globby
mdonnalley Oct 5, 2023
ac358af
Merge branch 'main' into mdonnalley/esm
mdonnalley Oct 5, 2023
3ecb802
fix: types in custom help
mdonnalley Oct 5, 2023
b9329dc
chore: bump core
mdonnalley Oct 5, 2023
72c33c5
chore: bump oclif
mdonnalley Oct 6, 2023
3a562e3
Merge branch 'main' into mdonnalley/esm
mdonnalley Oct 6, 2023
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
6 changes: 0 additions & 6 deletions .eslintrc

This file was deleted.

File renamed without changes.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ docs
oclif.manifest.json

# -- CLEAN ALL
*.tsbuildinfo
.eslintcache
.wireit
node_modules

# --
Expand Down
5 changes: 3 additions & 2 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"require": "ts-node/register,source-map-support/register",
"require": "ts-node/register",
"watch-extensions": "ts",
"recursive": true,
"reporter": "spec",
"timeout": 5000,
"exclude": "node_modules/**/*"
"exclude": "node_modules/**/*",
"node-option": ["loader=ts-node/esm"]
}
6 changes: 1 addition & 5 deletions .sfdevrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
{
"script": {
"prepare": "sf-install && yarn compile && yarn lint",
"pretest": "echo disable # sf-compile-test",
"lint": "eslint \"src/**/*.ts\""
}
"exclude-scripts": ["test", "test:deprecation-policy", "test:command-reference", "test:json-schema"]
}
13 changes: 0 additions & 13 deletions bin/dev

This file was deleted.

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

async function main() {
const oclif = await import('@oclif/core');
oclif.settings.performanceEnabled = true;
await oclif.execute({ development: true, dir: import.meta.url });
}

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

This file was deleted.

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

// Pre-process/prune flags before creating or running the actual CLI
(await import('../dist/flags.js')).preprocessCliFlags(process);

const oclif = await import('@oclif/core');
const { createRequire } = await import('module');
const pjson = createRequire(import.meta.url)('../package.json');

const cli = await import('../dist/cli.js');

async function main() {
// Since the CLI is a single process, we can have a larger amount of max listeners since
// the process gets shut down. Don't set it to 0 (no limit) since we should still be aware
// of rouge event listeners
process.setMaxListeners(parseInt(process.env.SF_MAX_EVENT_LISTENERS, 10) || 1000);

// Don't let other plugins override the CLI specified max listener count
process.setMaxListeners = () => {};

cli
.create({ version: pjson.version, bin: pjson.oclif.bin, channel: 'stable' })
.run()
.then(async () => {
await oclif.flush();
})
.catch(async (err) => {
await oclif.handle(err);
});
}

await main();
File renamed without changes.
121 changes: 97 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"version": "2.13.0",
"author": "Salesforce",
"bin": {
"sf": "./bin/run",
"sfdx": "./bin/run"
"sf": "./bin/run.js",
"sfdx": "./bin/run.js"
},
"homepage": "https://github.com/salesforcecli/cli",
"bugs": "https://github.com/forcedotcom/cli/issues",
"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0"
mshanemc marked this conversation as resolved.
Show resolved Hide resolved
},
"packageManager": "[email protected]",
"files": [
Expand All @@ -27,7 +27,8 @@
"sf"
],
"license": "BSD-3-Clause",
"main": "dist/index.js",
"exports": "./dist/index.js",
"type": "module",
"oclif": {
"bin": "sf",
"binAliases": [
Expand Down Expand Up @@ -121,7 +122,7 @@
]
},
"dependencies": {
"@oclif/core": "2.15.0",
"@oclif/core": "3.0.3",
"@oclif/plugin-autocomplete": "2.3.9",
"@oclif/plugin-commands": "2.2.28",
"@oclif/plugin-help": "5.2.20",
Expand Down Expand Up @@ -150,9 +151,8 @@
"@salesforce/plugin-templates": "55.5.14",
"@salesforce/plugin-trust": "2.6.18",
"@salesforce/plugin-user": "2.3.35",
"@salesforce/sf-plugins-core": "3.1.28",
"debug": "^4.3.4",
"tslib": "^2.4.1"
"@salesforce/sf-plugins-core": "4.0.0",
"debug": "^4.3.4"
},
"pinnedDependencies": [
"@oclif/plugin-autocomplete",
Expand Down Expand Up @@ -191,14 +191,14 @@
},
"repository": "salesforcecli/cli",
"scripts": {
"build": "sf-build",
"build": "wireit",
"channel:promote": "sf-release channel:promote",
"clean": "sf-clean",
"clean-all": "sf-clean all",
"compile": "sf-compile",
"compile": "wireit",
"docs": "sf-docs",
"format": "sf-format",
"lint": "eslint \"src/**/*.ts\"",
"format": "wireit",
"lint": "wireit",
"oclif-artifacts": "oclif manifest",
"pack:deb": "oclif pack:deb",
"pack:macos": "oclif pack:macos",
Expand All @@ -213,13 +213,13 @@
"prepare": "sf-install && yarn compile && yarn lint",
"prepublishOnly": "npm shrinkwrap",
"pretarball": "sf-release cli:tarballs:prepare --types",
"pretest": "echo disable # sf-compile-test",
"promote": "oclif promote",
"promote-dist-tags": "./scripts/promote-dist-tags",
"promote:verify": "sf-release cli:versions:inspect --channels stable --locations archive --cli sf",
"promote:verify-rc": "sf-release cli:versions:inspect --channels stable-rc --locations archive --cli sf",
"test": "sf-test",
"test": "wireit",
"test:deprecation-policy": "sf-release cli:artifacts:compare",
"test:only": "wireit",
"test:smoke-unix": "sf-release cli:tarballs:smoke",
"upload:deb": "oclif upload:deb",
"upload:macos": "oclif upload:macos",
Expand All @@ -229,10 +229,10 @@
},
"types": "dist/index.d.ts",
"devDependencies": {
"@oclif/plugin-command-snapshot": "^3.3.0",
"@oclif/plugin-command-snapshot": "^4.0.2",
"@salesforce/dev-config": "^4.0.1",
"@salesforce/dev-scripts": "^3.1.1",
"@salesforce/plugin-release-management": "^4.4.0",
"@salesforce/dev-scripts": "^5.10.0",
"@salesforce/plugin-release-management": "^4.4.7",
"@salesforce/prettier-config": "^0.0.3",
"@salesforce/ts-sinon": "^1.4.17",
"@types/debug": "^4.1.9",
Expand All @@ -241,24 +241,97 @@
"aws-sdk": "^2.1468.0",
"chai": "^4.3.10",
"eslint": "^8.50.0",
"eslint-config-oclif": "^3.1",
"eslint-config-oclif-typescript": "^0.2.0",
"eslint-config-oclif": "^5",
"eslint-config-oclif-typescript": "^2.0.1",
"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": "^46.8.2",
"globby": "^11.1.0",
"husky": "^7.0.4",
"mocha": "^9.2.2",
"mocha": "^10",
"nyc": "^15.1.0",
"oclif": "^3.17.2",
"oclif": "^4.0.0-beta.5",
"prettier": "^2.8.8",
"pretty-quick": "^3.1.3",
"sinon": "^11.1.2",
"sinon": "^15.2.0",
"ts-node": "^10.9.1",
"typescript": "^4.9.5"
"typescript": "^5",
"wireit": "^0.9.5"
},
"wireit": {
"build": {
"dependencies": [
"compile",
"lint"
]
},
"compile": {
"command": "tsc -p . --pretty --incremental",
"files": [
"src/**/*.ts",
"**/tsconfig.json",
"messages/**"
],
"output": [
"lib/**",
"*.tsbuildinfo"
],
"clean": "if-file-deleted"
},
"format": {
"command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"",
"files": [
"src/**/*.ts",
"test/**/*.ts",
"schemas/**/*.json",
"command-snapshot.json",
".prettier*"
],
"output": []
},
"lint": {
"command": "eslint src test --color --cache --cache-location .eslintcache",
"files": [
"src/**/*.ts",
"test/**/*.ts",
"messages/**",
"**/.eslint*",
"**/tsconfig.json"
],
"output": []
},
"test:compile": {
"command": "tsc -p \"./test\" --pretty",
"files": [
"test/**/*.ts",
"**/tsconfig.json"
],
"output": []
},
"test": {
"dependencies": [
"test:compile",
"test:only",
"lint"
]
},
"test:only": {
"command": "nyc mocha \"test/**/*.test.ts\"",
"env": {
"FORCE_COLOR": "2"
},
"files": [
"test/**/*.ts",
"src/**/*.ts",
"**/tsconfig.json",
".mocha*",
"!*.nut.ts",
".nycrc"
],
"output": []
}
}
}
Loading
Loading