Skip to content

Commit

Permalink
feat: migrate to ESM + bump deps(#983)
Browse files Browse the repository at this point in the history
* fix(deps): use plugins-core7

* chore: esmification

* chore: remove synthetic imports

* chore: remove * as

* test: stubbable childProcess

* feat: delete unused deprecated command

* chore: dead code cleanup

* refactor: simplify s3 class

* chore: command reference, schema, snapshots

* refactor: pr comments
  • Loading branch information
mshanemc authored Jan 19, 2024
1 parent 25ff123 commit 2cc3b0a
Show file tree
Hide file tree
Showing 60 changed files with 2,768 additions and 2,123 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
tmp/
# use yarn by default, so ignore npm
package-lock.json
oclif.lock

# never checkin npm config
.npmrc
Expand Down
3 changes: 0 additions & 3 deletions .lintstagedrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"require": "ts-node/register,source-map-support/register",
"watch-extensions": "ts",
"watch-files": ["src/**/*.ts", "test/**/*.ts"],
"recursive": true,
"reporter": "spec",
"timeout": 50000
"timeout": 50000,
"node-option": ["loader=ts-node/esm"]
}
14 changes: 8 additions & 6 deletions bin/dev.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env ts-node
// eslint-disable-next-line node/shebang, unicorn/prefer-top-level-await
(async () => {
const oclif = await import('@oclif/core');
await oclif.execute({ development: true, dir: __dirname });
})();
#!/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();
12 changes: 7 additions & 5 deletions bin/run.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/usr/bin/env node

// eslint-disable-next-line unicorn/prefer-top-level-await
(async () => {
const oclif = await import('@oclif/core');
await oclif.execute({ development: false, dir: __dirname });
})();
// eslint-disable-next-line node/shebang
async function main() {
const { execute } = await import('@oclif/core');
await execute({ dir: import.meta.url });
}

await main();
142 changes: 67 additions & 75 deletions command-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[
{
"alias": [],
"command": "channel:promote",
"plugin": "@salesforce/plugin-release-management",
"flagAliases": ["candidate", "maxage", "target", "targets"],
"flagChars": ["C", "T", "c", "d", "i", "m", "p", "s", "t", "v", "x"],
"flags": [
"architecture-target",
"cli",
Expand All @@ -16,45 +18,45 @@
"version",
"xz"
],
"alias": [],
"flagChars": ["C", "T", "c", "d", "i", "m", "p", "s", "t", "v", "x"],
"flagAliases": ["candidate", "maxage", "target", "targets"]
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "cli:artifacts:compare",
"plugin": "@salesforce/plugin-release-management",
"flags": ["current", "json", "plugin", "previous"],
"alias": [],
"command": "cli:artifacts:compare",
"flagAliases": [],
"flagChars": ["c", "p", "r"],
"flagAliases": []
"flags": ["current", "json", "plugin", "previous"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "cli:install:jit:test",
"plugin": "@salesforce/plugin-release-management",
"flags": ["jit-plugin", "json"],
"alias": [],
"command": "cli:install:jit:test",
"flagAliases": [],
"flagChars": ["j"],
"flagAliases": []
"flags": ["jit-plugin", "json"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "cli:install:test",
"plugin": "@salesforce/plugin-release-management",
"flags": ["channel", "cli", "json", "method", "output-file"],
"alias": [],
"command": "cli:install:test",
"flagAliases": [],
"flagChars": ["c", "m"],
"flagAliases": []
"flags": ["channel", "cli", "json", "method", "output-file"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "cli:release:automerge",
"plugin": "@salesforce/plugin-release-management",
"flags": ["dry-run", "json", "owner", "pull-number", "repo", "verbose"],
"alias": [],
"command": "cli:release:automerge",
"flagAliases": ["org"],
"flagChars": ["d"],
"flagAliases": ["org"]
"flags": ["dry-run", "json", "owner", "pull-number", "repo", "verbose"],
"plugin": "@salesforce/plugin-release-management"
},
{
"alias": ["cli:latestrc:build"],
"command": "cli:release:build",
"plugin": "@salesforce/plugin-release-management",
"flagAliases": ["rctag"],
"flagChars": ["c", "d", "g"],
"flags": [
"build-only",
"empty",
Expand All @@ -70,104 +72,94 @@
"start-from-github-ref",
"start-from-npm-dist-tag"
],
"alias": ["cli:latestrc:build"],
"flagChars": ["c", "d", "g"],
"flagAliases": ["rctag"]
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "cli:releasenotes",
"plugin": "@salesforce/plugin-release-management",
"flags": ["cli", "json", "markdown", "since"],
"alias": [],
"command": "cli:releasenotes",
"flagAliases": [],
"flagChars": ["c", "m", "s"],
"flagAliases": []
"flags": ["cli", "json", "markdown", "since"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "cli:schemas:compare",
"plugin": "@salesforce/plugin-release-management",
"flags": ["json"],
"alias": [],
"flagChars": [],
"flagAliases": []
},
{
"command": "cli:tarballs:prepare",
"plugin": "@salesforce/plugin-release-management",
"flags": ["dryrun", "json", "types", "verbose"],
"alias": [],
"flagAliases": [],
"flagChars": ["d", "t"],
"flagAliases": []
"flags": ["dryrun", "json", "types", "verbose"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "cli:tarballs:smoke",
"plugin": "@salesforce/plugin-release-management",
"flags": ["json", "verbose"],
"alias": [],
"command": "cli:tarballs:smoke",
"flagAliases": [],
"flagChars": [],
"flagAliases": []
"flags": ["json", "verbose"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "cli:tarballs:verify",
"plugin": "@salesforce/plugin-release-management",
"flags": ["cli", "json", "windows-username-buffer"],
"alias": [],
"command": "cli:tarballs:verify",
"flagAliases": [],
"flagChars": ["c", "w"],
"flagAliases": []
"flags": ["cli", "json", "windows-username-buffer"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "cli:versions:inspect",
"plugin": "@salesforce/plugin-release-management",
"flags": ["channels", "cli", "dependencies", "json", "locations", "salesforce"],
"alias": [],
"command": "cli:versions:inspect",
"flagAliases": [],
"flagChars": ["c", "d", "l", "s"],
"flagAliases": []
"flags": ["channels", "cli", "dependencies", "json", "locations", "salesforce"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "dependabot:automerge",
"plugin": "@salesforce/plugin-release-management",
"flags": ["dryrun", "json", "max-version-bump", "merge-method", "owner", "repo", "skip-ci"],
"alias": [],
"command": "dependabot:automerge",
"flagAliases": [],
"flagChars": ["d", "m", "o", "r", "s"],
"flagAliases": []
"flags": ["dryrun", "json", "max-version-bump", "merge-method", "owner", "repo", "skip-ci"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "github:check:closed",
"plugin": "@salesforce/plugin-release-management",
"flags": ["github-token", "gus", "json"],
"alias": [],
"command": "github:check:closed",
"flagAliases": [],
"flagChars": ["o"],
"flagAliases": []
"flags": ["github-token", "gus", "json"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "npm:dependencies:pin",
"plugin": "@salesforce/plugin-release-management",
"flags": ["dryrun", "json", "tag"],
"alias": [],
"command": "npm:dependencies:pin",
"flagAliases": [],
"flagChars": ["d", "t"],
"flagAliases": []
"flags": ["dryrun", "json", "tag"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "npm:package:release",
"plugin": "@salesforce/plugin-release-management",
"flags": ["dryrun", "githubtag", "install", "json", "npmaccess", "npmtag", "prerelease", "sign", "verify"],
"alias": [],
"command": "npm:package:release",
"flagAliases": [],
"flagChars": ["a", "d", "s", "t"],
"flagAliases": []
"flags": ["dryrun", "githubtag", "install", "json", "npmaccess", "npmtag", "prerelease", "sign", "verify"],
"plugin": "@salesforce/plugin-release-management"
},
{
"command": "plugins:trust:verify",
"plugin": "@salesforce/plugin-trust",
"flags": ["json", "loglevel", "npm", "registry"],
"alias": [],
"command": "plugins:trust:verify",
"flagAliases": [],
"flagChars": ["n", "r"],
"flagAliases": []
"flags": ["json", "loglevel", "npm", "registry"],
"plugin": "@salesforce/plugin-trust"
},
{
"command": "repositories",
"plugin": "@salesforce/plugin-release-management",
"flags": ["columns", "csv", "extended", "filter", "json", "no-header", "no-truncate", "output", "sort"],
"alias": [],
"command": "repositories",
"flagAliases": [],
"flagChars": ["x"],
"flagAliases": []
"flags": ["columns", "csv", "extended", "filter", "json", "no-header", "no-truncate", "output", "sort"],
"plugin": "@salesforce/plugin-release-management"
}
]
File renamed without changes.
7 changes: 0 additions & 7 deletions messages/cli.schemas.compare.md

This file was deleted.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@
"version": "4.5.27",
"author": "Salesforce",
"bugs": "https://github.com/forcedotcom/cli/issues",
"type": "module",
"bin": {
"sf-release": "bin/run.js"
},
"dependencies": {
"@oclif/core": "^3",
"@oclif/core": "^3.18.1",
"@octokit/core": "^4.2.4",
"@octokit/plugin-paginate-rest": "^6.1.2",
"@octokit/plugin-throttling": "^5.2.3",
"@salesforce/cli-plugins-testkit": "^4.4.12",
"@salesforce/core": "^6.4.7",
"@salesforce/kit": "^3.0.15",
"@salesforce/plugin-command-reference": "^3.0.61",
"@salesforce/plugin-trust": "^2.6.23",
"@salesforce/sf-plugins-core": "^5.0.13",
"@salesforce/plugin-trust": "^3.3.1",
"@salesforce/sf-plugins-core": "^7.1.1",
"@salesforce/ts-types": "^2.0.9",
"aws-sdk": "^2.1535.0",
"chalk": "^4.1.0",
"chalk": "^5.3.0",
"fast-glob": "^3.3.2",
"got": "^11.8.6",
"got": "^13",
"just-diff": "^5.2.0",
"proxy-agent": "^6.3.1",
"semver": "^7.5.2",
"shelljs": "^0.8.4",
"shelljs": "^0.8.5",
"standard-version": "^9.0.0",
"strip-ansi": "^6",
"tslib": "^2",
"yarn-deduplicate": "^3.1.0"
},
"devDependencies": {
Expand All @@ -40,7 +40,7 @@
"@types/shelljs": "^0.8.15",
"aws-sdk-mock": "^5.8.0",
"eslint-plugin-sf-plugin": "^1.17.0",
"oclif": "^4",
"oclif": "^4.3.1",
"shx": "0.3.4",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
Expand Down
38 changes: 38 additions & 0 deletions schemas/channel-promote.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/PromoteResult",
"definitions": {
"PromoteResult": {
"type": "object",
"properties": {
"dryRun": {
"type": "boolean"
},
"cli": {
"$ref": "#/definitions/CLI"
},
"target": {
"type": "string"
},
"sha": {
"type": "string"
},
"version": {
"type": "string"
},
"platforms": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["dryRun", "cli", "target", "sha", "version", "platforms"],
"additionalProperties": false
},
"CLI": {
"type": "string",
"enum": ["sf", "sfdx"]
}
}
}
Loading

0 comments on commit 2cc3b0a

Please sign in to comment.