├── .dockerignore ├── .editorconfig ├── .eslintrc.js ├── .git2gus └── config.json ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── Bug_report.md │ └── Feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── no-response.yml └── workflows │ ├── automerge-dependabot.yml │ ├── automerge-nightly-pr.yml │ ├── build-docker-full.yml │ ├── build-docker-slim.yml │ ├── create-cli-release.yml │ ├── create-github-release.yml │ ├── just-nut.yml │ ├── just-nuts.yml │ ├── make-pr-for-nightly.yml │ ├── make-pr-for-release.yml │ ├── promote-nightly-to-rc.yml │ ├── promote-rc-to-latest.yml │ ├── promote.yml │ ├── test.yml │ ├── update-docker-node-version.yml │ ├── validate-pr.yml │ └── workflow-failure.yml ├── .gitignore ├── .husky ├── commit-msg ├── pre-commit └── pre-push ├── .images └── vscodeScreenshot.png ├── .lintstagedrc.js ├── .mocharc.json ├── .nycrc ├── .prettierrc.json ├── .sfdevrc.json ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── DEVELOPER.md ├── LICENSE.txt ├── README.md ├── RELEASE.md ├── SECURITY.md ├── bin ├── dev.sh ├── run ├── run.cmd └── run.sh ├── command-snapshot.json ├── commitlint.config.js ├── dockerfiles ├── Dockerfile_full ├── Dockerfile_slim ├── UpdatingNodeVersion.md └── update-docker-node-version.js ├── messages ├── messages.json └── org.json ├── package.json ├── schemas └── salesforce-alm │ └── schemas │ └── scratchOrgDefinitionSchema.json ├── scripts ├── checkSalesforceDx.ts ├── determine-sf-version.js ├── include-sf.js ├── post-install-release-notes.js ├── promote-stable-rc-mac ├── promote-stable-rc-tarballs ├── promote-stable-rc-win └── verify-promote ├── src ├── cli.ts ├── declaration.d.ts ├── flags.ts ├── help │ ├── sfdxCommandHelp.ts │ └── sfdxHelp.ts ├── hooks │ ├── displayReleaseNotes.ts │ ├── incomplete.ts │ ├── pluginsPreinstall.ts │ ├── postupdate.ts │ ├── preupdate.ts │ ├── salesforcedx-check.ts │ └── verifyPluginVersion.ts ├── index.ts ├── util │ └── env.ts └── versions.js ├── test ├── .eslintrc.js ├── cli.test.ts ├── env.test.ts ├── flags.test.ts ├── node-version.test.ts ├── tsconfig.json ├── verifyPluginVersion.test.ts └── versions.test.ts ├── tsconfig.json └── yarn.lock /.dockerignore: -------------------------------------------------------------------------------- 1 | README.md 2 | LICENSE 3 | .gitignore 4 | .yarnrc 5 | package.json 6 | package-lock.json 7 | yarn.lock 8 | .git 9 | .circleci/ 10 | .github/ 11 | .vscode 12 | scripts/ 13 | node_modules/ 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | module.exports = { 8 | extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'], 9 | }; 10 | -------------------------------------------------------------------------------- /.git2gus/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "productTag": "a1aB00000004Bx8IAE", 3 | "defaultBuild": "offcore.tooling.56", 4 | "issueTypeLabels": { 5 | "feature": "USER STORY", 6 | "regression": "BUG P1", 7 | "bug": "BUG P3" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # These owners will be the default owners for everything in 2 | # the repo. Unless a later match takes precedence, 3 | # @forcedotcom/pdt will be requested for 4 | # review when someone opens a pull request. 5 | * @salesforcecli/cli 6 | #ECCN:Open Source 7 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | --- 5 | 6 | 9 | 10 | 13 | 14 | ### Summary 15 | 16 | _Short summary of what is going on or to provide context_. 17 | 18 | ### Steps To Reproduce: 19 | 20 | 1. This is step 1. 21 | 1. This is step 2. All steps should start with '1.' 22 | 23 | ### Expected result 24 | 25 | _Describe what should have happened_. 26 | 27 | ### Actual result 28 | 29 | _Describe what actually happened instead_. 30 | 31 | ### Additional information 32 | 33 | _Feel free to attach a screenshot_. 34 | 35 | **VS Code Version**: 36 | 37 | **SFDX CLI Version**: 38 | 39 | **OS and version**: 40 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | --- 5 | 6 | **Is your feature request related to a problem? Please describe.** 7 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 8 | 9 | **Describe the solution you'd like** 10 | A clear and concise description of what you want to happen. 11 | 12 | **Describe alternatives you've considered** 13 | A clear and concise description of any alternative solutions or features you've considered. 14 | 15 | **Additional context** 16 | Add any other context or screenshots about the feature request here. 17 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ### What does this PR do? 2 | 3 | ### What issues does this PR fix or reference? 4 | -------------------------------------------------------------------------------- /.github/no-response.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-no-response - https://github.com/probot/no-response 2 | 3 | daysUntilClose: 7 4 | responseRequiredLabel: 'more information required' 5 | closeComment: > 6 | This issue has been automatically closed because there has been no response 7 | to our request for more information from the original author. Currently, there 8 | is not enough information provided for us to take action. Please reply and 9 | reopen this issue if you need additional assistance. 10 | -------------------------------------------------------------------------------- /.github/workflows/automerge-dependabot.yml: -------------------------------------------------------------------------------- 1 | name: automerge-dependabot 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: '18 1,4,7,10 * * *' 6 | 7 | jobs: 8 | automerge: 9 | uses: salesforcecli/github-workflows/.github/workflows/automerge.yml@main 10 | with: 11 | mergeMethod: squash 12 | secrets: inherit 13 | -------------------------------------------------------------------------------- /.github/workflows/automerge-nightly-pr.yml: -------------------------------------------------------------------------------- 1 | name: automerge-nightly-pr 2 | 3 | on: 4 | pull_request: 5 | types: [labeled] 6 | 7 | # This job relies on defining required checks in your branch protection settings 8 | # Settings > Branches > 'main' > Require status checks to pass before merging 9 | 10 | jobs: 11 | automerge: 12 | runs-on: ubuntu-latest 13 | if: startsWith(github.event.pull_request.title, 'Release PR for') && endsWith(github.event.pull_request.title, 'nightly') 14 | steps: 15 | - name: Install plugin-release-management 16 | run: npm install -g @salesforce/plugin-release-management --omit=dev 17 | - name: Automerge 18 | uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd 19 | with: 20 | max_attempts: 15 21 | retry_wait_seconds: 120 # 15 attempts every two minutes 22 | command: sf-release cli:release:automerge --owner salesforcecli --repo sfdx-cli --pull-number ${{ github.event.pull_request.number }} --verbose 23 | retry_on: error 24 | timeout_minutes: 60 25 | env: 26 | GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 27 | -------------------------------------------------------------------------------- /.github/workflows/build-docker-full.yml: -------------------------------------------------------------------------------- 1 | name: build-docker-full 2 | on: 3 | workflow_call: 4 | inputs: 5 | version: 6 | type: string 7 | description: The release semver version 8 | required: true 9 | channel: 10 | type: string 11 | description: The release channel (latest-rc, nightly, dev, etc) 12 | required: true 13 | 14 | jobs: 15 | buildPush: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Check out the repo 19 | uses: actions/checkout@v3 20 | 21 | - name: Yarn install 22 | uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main 23 | 24 | - name: Log in to Docker Hub 25 | uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 26 | with: 27 | username: ${{ secrets.DOCKER_USERNAME }} 28 | password: ${{ secrets.DOCKER_PASSWORD }} 29 | 30 | - name: Extract metadata (tags, labels) for Docker 31 | id: meta 32 | uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 33 | with: 34 | images: salesforce/salesforcedx 35 | 36 | - name: Get sf version to bundle 37 | id: sf-version 38 | run: | 39 | VERSION=$(node -e 'require("./scripts/determine-sf-version").getVersion()') 40 | echo "version=$VERSION" >> "$GITHUB_OUTPUT" 41 | 42 | - name: Build and push Docker image 43 | uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc 44 | with: 45 | context: . 46 | push: true 47 | labels: ${{ steps.meta.outputs.labels }} 48 | file: dockerfiles/Dockerfile_full 49 | # We are using latest-rc SF_CLI_VERSION version. Soon both CLIs will not be bundled together 50 | build-args: | 51 | SALESFORCE_CLI_VERSION=${{ inputs.version }} 52 | SF_CLI_VERSION=${{ steps.sf-version.outputs.version }} 53 | # TODO: Do we want _all_ docker images to release with the version in their name? 54 | # Should we skip this on prereleases? 55 | tags: salesforce/salesforcedx:${{ inputs.channel }}-full, salesforce/salesforcedx:${{ inputs.version }}-full 56 | 57 | verify: 58 | needs: buildPush 59 | runs-on: ubuntu-latest 60 | container: 61 | image: salesforce/salesforcedx:${{ inputs.version }}-full 62 | steps: 63 | - name: verify node, sfdx, jq 64 | # without bash this will fail. Not sure what the default shell is but it doesn't like the [[(())]] bashism 65 | shell: bash 66 | run: | 67 | set -e 68 | node -v 69 | sfdx version --verbose 70 | jq --help 71 | NODE_VERSION=$(sfdx version --verbose --json | jq '.nodeVersion') 72 | SFDX_CLI_VERSION=$(sfdx version --verbose --json | jq '.cliVersion') 73 | if [[ ((`echo $SFDX_CLI_VERSION | grep -c "sfdx-cli/"` > 0))]] 74 | then 75 | echo "sfdx-cli installed -" $SFDX_CLI_VERSION 76 | else 77 | echo "The sfdx-cli installation could not be verified" 78 | exit 1 79 | fi 80 | if [[ ((`echo $NODE_VERSION | grep -c "v"` > 0))]] 81 | then 82 | echo "node installed -" $NODE_VERSION 83 | else 84 | echo "The node installation could not be verified" 85 | exit 1 86 | fi 87 | -------------------------------------------------------------------------------- /.github/workflows/build-docker-slim.yml: -------------------------------------------------------------------------------- 1 | name: build-docker-slim 2 | on: 3 | workflow_call: 4 | inputs: 5 | version: 6 | type: string 7 | description: The release semver version 8 | required: true 9 | channel: 10 | type: string 11 | description: The release channel (latest-rc, nightly, dev, etc) 12 | required: true 13 | 14 | jobs: 15 | buildPush: 16 | runs-on: ubuntu-latest 17 | steps: 18 | - name: Check out the repo 19 | uses: actions/checkout@v3 20 | 21 | - uses: actions/setup-node@v3 22 | with: 23 | node-version: lts/* 24 | cache: yarn 25 | 26 | # for whatever version got passed in, we need the download url for the linux xz tarball 27 | - uses: salesforcecli/github-workflows/.github/actions/versionInfo@main 28 | id: version-info 29 | with: 30 | version: ${{ inputs.version }} 31 | 32 | - name: Set up Docker Buildx 33 | uses: docker/setup-buildx-action@v2 34 | 35 | - name: Log in to Docker Hub 36 | uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 37 | with: 38 | username: ${{ secrets.DOCKER_USERNAME }} 39 | password: ${{ secrets.DOCKER_PASSWORD }} 40 | 41 | - name: Extract metadata (tags, labels) for Docker 42 | id: meta 43 | uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 44 | with: 45 | images: salesforce/salesforcedx 46 | 47 | - name: Build and push Docker image 48 | uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc 49 | with: 50 | context: . 51 | push: true 52 | labels: ${{ steps.meta.outputs.labels }} 53 | file: dockerfiles/Dockerfile_slim 54 | build-args: | 55 | DOWNLOAD_URL=${{ steps.version-info.outputs.url }} 56 | # TODO: Do we want _all_ docker images to release with the version in their name? 57 | # Should we skip this on prereleases? 58 | tags: salesforce/salesforcedx:${{ inputs.channel }}-slim, salesforce/salesforcedx:${{ steps.version-info.outputs.version }}-slim 59 | 60 | verify: 61 | needs: buildPush 62 | runs-on: ubuntu-latest 63 | container: 64 | image: salesforce/salesforcedx:${{ inputs.version }}-slim 65 | steps: 66 | - name: verify sfdx, java 67 | # without bash this will fail. Not sure what the default shell is but it doesn't like the [[(())]] bashism 68 | shell: bash 69 | run: | 70 | set -e 71 | sfdx version 72 | SFDX_CLI_VERSION=$(sfdx version) 73 | JAVA_VERSION=$(java --version | head -n 1) 74 | if [[ ((`echo $SFDX_CLI_VERSION | grep -c "sfdx-cli/"` > 0))]] 75 | then 76 | echo "sfdx-cli installed -" $SFDX_CLI_VERSION 77 | else 78 | echo "The sfdx-cli installation could not be verified" 79 | exit 1 80 | fi 81 | if [[ ((`echo $JAVA_VERSION | grep -c "openjdk"` > 0))]] 82 | then 83 | echo "Java installed -" $JAVA_VERSION 84 | else 85 | echo "The Java installation could not be verified" 86 | exit 1 87 | fi 88 | -------------------------------------------------------------------------------- /.github/workflows/create-cli-release.yml: -------------------------------------------------------------------------------- 1 | name: create-cli-release 2 | on: 3 | release: 4 | # This works for both releases and prereleases https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release 5 | types: [published] 6 | 7 | jobs: 8 | get-channel: 9 | runs-on: ubuntu-latest 10 | outputs: 11 | channel: ${{ steps.release-channel.outputs.group1 }} 12 | s3-channel: ${{ steps.s3-release-channel.outputs.s3-channel }} 13 | steps: 14 | - name: Get release channel Github release 15 | id: release-channel 16 | uses: actions-ecosystem/action-regex-match@9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665b 17 | with: 18 | text: ${{ github.event.release.body }} 19 | # https://regex101.com/r/tYAJ8L/1 20 | regex: '!! Release as ([a-z-]+) !!' 21 | - name: Confirm regex channel match 22 | if: ${{ !steps.release-channel.outputs.group1 }} 23 | uses: actions/github-script@v3 24 | with: 25 | script: | 26 | core.setFailed('Release channel was not found in release body. Exiting') 27 | - name: Get release channel for s3 28 | id: s3-release-channel 29 | run: | 30 | CHANNEL=${{ steps.release-channel.outputs.group1 }} 31 | S3_CHANNEL=${CHANNEL/latest/stable} 32 | echo "s3-channel=$S3_CHANNEL" >> "$GITHUB_OUTPUT" 33 | - name: Channel Notice 34 | run: | 35 | echo "::notice title=Channel::Channel found in Github Release: ${{ steps.release-channel.outputs.group1 }}" 36 | echo "::notice title=S3 Channel::Channel that will be used in S3: ${{ steps.s3-release-channel.outputs.s3-channel }}" 37 | 38 | npm-release: 39 | uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main 40 | needs: [get-channel] 41 | secrets: inherit 42 | with: 43 | tag: ${{ needs.get-channel.outputs.channel }} 44 | githubTag: ${{ github.event.release.tag_name }} 45 | 46 | pack-verify-upload-tarballs: 47 | needs: [get-channel, npm-release] 48 | uses: salesforcecli/github-workflows/.github/workflows/tarballs.yml@main 49 | with: 50 | upload: true 51 | cli: sfdx 52 | version: ${{ github.event.release.tag_name }} 53 | channel: ${{ needs.get-channel.outputs.s3-channel }} 54 | nodeVersion: ${{ vars.TARBALL_NODE_VERSION }} 55 | secrets: inherit 56 | 57 | archives-verify: 58 | # Skip archive-verify on prereleases 59 | if: ${{ contains(fromJSON('["latest", "latest-rc", "nightly"]'), needs.get-channel.outputs.channel) }} 60 | runs-on: ubuntu-latest 61 | needs: [get-channel, pack-verify-upload-tarballs] 62 | steps: 63 | - uses: actions/checkout@v3 64 | - uses: actions/setup-node@v3 65 | with: 66 | node-version: lts/* 67 | cache: npm 68 | - run: npm install -g @salesforce/plugin-release-management --omit=dev 69 | # Retry several times because the S3 cache can cause failures 70 | - name: Version inspect (with retries) 71 | uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd 72 | with: 73 | max_attempts: 5 74 | retry_wait_seconds: 120 75 | command: sf-release cli:versions:inspect -c ${{ needs.get-channel.outputs.s3-channel }} -l archive 76 | retry_on: error 77 | timeout_minutes: 60 78 | 79 | pack-upload-mac: 80 | needs: [get-channel, pack-verify-upload-tarballs] 81 | uses: salesforcecli/github-workflows/.github/workflows/packUploadMac.yml@main 82 | with: 83 | cli: sfdx 84 | version: ${{ github.event.release.tag_name }} 85 | channel: ${{ needs.get-channel.outputs.s3-channel }} 86 | nodeVersion: ${{ vars.TARBALL_NODE_VERSION }} 87 | secrets: inherit 88 | 89 | # The rename-mac-pkg job is only needed as long as the developer site is linking to the old sfdx.pkg file and the mac signing job is only signing the old file as well. 90 | # It can be removed once those are updated to use the new name, sfdx-x64.pkg. 91 | rename-mac-pkg: 92 | needs: [get-channel, pack-upload-mac] 93 | runs-on: ubuntu-latest 94 | env: 95 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 96 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 97 | AWS_EC2_METADATA_DISABLED: true 98 | steps: 99 | - uses: salesforcecli/github-workflows/.github/actions/renameMacPkg@main 100 | with: 101 | cli: sfdx 102 | channel: ${{ needs.get-channel.outputs.s3-channel }} 103 | 104 | pack-upload-win: 105 | needs: [get-channel, pack-verify-upload-tarballs] 106 | uses: salesforcecli/github-workflows/.github/workflows/packUploadWindows.yml@main 107 | with: 108 | cli: sfdx 109 | version: ${{ github.event.release.tag_name }} 110 | channel: ${{ needs.get-channel.outputs.s3-channel }} 111 | nodeVersion: ${{ vars.TARBALL_NODE_VERSION }} 112 | secrets: inherit 113 | 114 | build-docker-slim: 115 | needs: [get-channel, pack-verify-upload-tarballs] 116 | uses: ./.github/workflows/build-docker-slim.yml 117 | with: 118 | version: ${{ github.event.release.tag_name }} 119 | channel: ${{ needs.get-channel.outputs.channel }} 120 | secrets: inherit 121 | 122 | build-docker-full: 123 | needs: [get-channel, npm-release] 124 | uses: ./.github/workflows/build-docker-full.yml 125 | with: 126 | version: ${{ github.event.release.tag_name }} 127 | channel: ${{ needs.get-channel.outputs.channel }} 128 | secrets: inherit 129 | 130 | announce-cli-patch-in-slack: 131 | # Do not announce prereleases or nightlies 132 | # https://docs.github.com/en/actions/learn-github-actions/expressions#contains 133 | if: ${{ contains(fromJSON('["latest", "latest-rc"]'), needs.get-channel.outputs.channel ) }} 134 | runs-on: ubuntu-latest 135 | needs: 136 | - get-channel 137 | - pack-verify-upload-tarballs 138 | - npm-release 139 | - build-docker-slim 140 | - build-docker-full 141 | - pack-upload-win 142 | - pack-upload-mac 143 | - rename-mac-pkg 144 | steps: 145 | - name: Announce patch in Slack 146 | uses: slackapi/slack-github-action@v1.21.0 147 | env: 148 | SLACK_WEBHOOK_URL: ${{ secrets.PLATFORM_CLI_CHANNEL_SLACK_INCOMING_WEBHOOK }} 149 | SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 150 | with: 151 | payload: | 152 | { 153 | "blocks": [{ 154 | "type": "section", 155 | "text": { 156 | "type": "mrkdwn", 157 | "text": ":bandaid-4506: `sfdx-cli@${{ needs.get-channel.outputs.channel }}` has been patched in version `${{ github.event.release.tag_name }}` :bandaid-4506:\nPlease ensure you are running the newest version of `sfdx`" 158 | } 159 | }] 160 | } 161 | 162 | run-just-nuts: 163 | needs: 164 | - get-channel 165 | - pack-verify-upload-tarballs 166 | - npm-release 167 | - build-docker-slim 168 | - build-docker-full 169 | - pack-upload-win 170 | - pack-upload-mac 171 | - rename-mac-pkg 172 | uses: ./.github/workflows/just-nuts.yml 173 | with: 174 | channel-or-version: ${{ needs.get-channel.outputs.channel }} 175 | secrets: inherit 176 | -------------------------------------------------------------------------------- /.github/workflows/create-github-release.yml: -------------------------------------------------------------------------------- 1 | name: create-github-release 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | - release-base/** 8 | types: 9 | - closed 10 | 11 | jobs: 12 | # This job determines the channel that will be released. 13 | validate-channel: 14 | # All release PRs must have the 'release' branch prefix 15 | # They must start with the string 'Release PR for'. 16 | # Must also be merged=true (this ignores PRs that are closed without merging) 17 | if: startsWith(github.head_ref, 'release') && startsWith(github.event.pull_request.title, 'Release PR for') && github.event.pull_request.merged == true 18 | runs-on: ubuntu-latest 19 | outputs: 20 | channel: ${{ steps.found-channel.outputs.channel }} 21 | steps: 22 | - name: Get release channel from PR title 23 | id: release-channel 24 | uses: actions-ecosystem/action-regex-match@9e6c4fb3d5e898f505be7a1fb6e7b0a278f6665b 25 | with: 26 | text: ${{ github.event.pull_request.title }} 27 | # https://regex101.com/r/66VrAs/1 28 | regex: 'as ([a-z-]+)$' 29 | 30 | # Exit the build if no channel is match 31 | - name: Confirm regex channel match 32 | if: ${{ !steps.release-channel.outputs.group1 }} 33 | uses: actions/github-script@v3 34 | with: 35 | script: | 36 | core.setFailed('Release channel was not found in PR title. Exiting') 37 | 38 | # Checkout needed to validate prerelease version in package.json 39 | - name: Check out the repo 40 | if: ${{ !contains(fromJSON('["latest", "latest-rc", "nightly"]'), steps.release-channel.outputs.group1) }} 41 | uses: actions/checkout@v3 42 | 43 | - name: Get prerelease from package.json 44 | id: check-prerelease 45 | if: ${{ !contains(fromJSON('["latest", "latest-rc", "nightly"]'), steps.release-channel.outputs.group1) }} 46 | uses: salesforcecli/github-workflows/.github/actions/getPreReleaseTag@main 47 | 48 | # Package.json version must contain "alpha" tag: example 1.2.3-beta.0 (beta) 49 | # Package.json "alpha" tag must match PR title channel 50 | - name: Validate prerelease tag 51 | if: ${{ !contains(fromJSON('["latest", "latest-rc", "nightly"]'), steps.release-channel.outputs.group1) && (!steps.check-prerelease.outputs.tag || steps.check-prerelease.outputs.tag != steps.release-channel.outputs.group1) }} 52 | uses: actions/github-script@v3 53 | with: 54 | script: | 55 | core.setFailed('Prerelease requires a dist tag name in your package.json like beta in 1.1.1-beta.0') 56 | 57 | # Echo and set the matched channel 58 | - name: Set channel output 59 | id: found-channel 60 | run: | 61 | echo "Found channel: ${{ steps.release-channel.outputs.group1 }}" 62 | echo "::notice title=Channel::Channel found in PR title: ${{ steps.release-channel.outputs.group1 }}" 63 | echo "channel=${{ steps.release-channel.outputs.group1 }}" >> "$GITHUB_OUTPUT" 64 | 65 | create-tag-and-release-in-github: 66 | needs: [validate-channel] 67 | runs-on: ubuntu-latest 68 | steps: 69 | - name: Checkout repo 70 | uses: actions/checkout@v3 71 | - uses: notiz-dev/github-action-json-property@2192e246737701f108a4571462b76c75e7376216 72 | id: packageVersion 73 | with: 74 | path: 'package.json' 75 | prop_path: 'version' 76 | - name: Create Github Release 77 | uses: actions/create-release@v1 78 | env: 79 | GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 80 | with: 81 | tag_name: ${{ steps.packageVersion.outputs.prop }} 82 | release_name: ${{ steps.packageVersion.outputs.prop }} 83 | prerelease: ${{ !contains(fromJSON('["latest", "latest-rc", "nightly"]'), needs.validate-channel.outputs.channel) }} 84 | # This channel value is read from the Github Release body to determine the channel. Be cautious editing 85 | body: | 86 | !! Release as ${{ needs.validate-channel.outputs.channel }} !! 87 | -------------------------------------------------------------------------------- /.github/workflows/just-nut.yml: -------------------------------------------------------------------------------- 1 | name: just-nut 2 | on: 3 | workflow_dispatch: 4 | inputs: 5 | channel-or-version: 6 | description: Version or channel of the CLI to test against (nightly, latest-rc, 7.112.1) 7 | type: string 8 | required: true 9 | repository: 10 | description: 'The repo that will be cloned (format: owner/repo). This contains the NUTs you want to run. Ex: salesforcecli/plugin-user' 11 | type: string 12 | required: true 13 | command: 14 | required: false 15 | type: string 16 | default: yarn test:nuts 17 | description: 'command to execute (ex: yarn test:nuts)' 18 | os: 19 | required: false 20 | description: 'runs-on property, ex: ubuntu-latest, windows-latest' 21 | type: string 22 | default: 'ubuntu-latest' 23 | workflow_call: 24 | inputs: 25 | channel-or-version: 26 | description: Version or channel of the CLI to test against (nightly, latest-rc, 7.112.1) 27 | type: string 28 | required: true 29 | repository: 30 | description: 'The repo that will be cloned (format: owner/repo). This contains the NUTs you want to run. Ex: salesforcecli/plugin-user' 31 | type: string 32 | required: true 33 | command: 34 | required: false 35 | type: string 36 | default: yarn test:nuts 37 | description: 'command to execute (ex: yarn test:nuts)' 38 | os: 39 | required: false 40 | description: 'runs-on property, ex: ubuntu-latest, windows-latest' 41 | type: string 42 | default: 'ubuntu-latest' 43 | 44 | jobs: 45 | just-nut: 46 | name: ${{inputs.repository}} 47 | runs-on: ${{inputs.os}} 48 | env: 49 | TESTKIT_EXECUTABLE_PATH: sfdx 50 | TESTKIT_AUTH_URL: ${{ secrets.TESTKIT_AUTH_URL}} 51 | TESTKIT_HUB_USERNAME: ${{ secrets.TESTKIT_HUB_USERNAME}} 52 | TESTKIT_JWT_CLIENT_ID: ${{ secrets.TESTKIT_JWT_CLIENT_ID}} 53 | TESTKIT_JWT_KEY: ${{ secrets.TESTKIT_JWT_KEY}} 54 | TESTKIT_HUB_INSTANCE: ${{ secrets.TESTKIT_HUB_INSTANCE}} 55 | ONEGP_TESTKIT_AUTH_URL: ${{ secrets.ONEGP_TESTKIT_AUTH_URL }} 56 | TESTKIT_SETUP_RETRIES: 2 57 | SF_DISABLE_TELEMETRY: true 58 | 59 | steps: 60 | - uses: actions/checkout@v3 61 | with: 62 | repository: ${{inputs.repository}} 63 | token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 64 | path: . 65 | - uses: actions/setup-node@v3 66 | with: 67 | node-version: lts/* 68 | cache: yarn 69 | # NOTE: This will install the highest v1 of sf. This will typically be the nightly. 70 | - name: Install CLIs 71 | uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd 72 | with: 73 | max_attempts: 3 74 | retry_wait_seconds: 60 75 | command: npm install -g sfdx-cli@${{ inputs.channel-or-version }} @salesforce/cli@^1 --omit=dev 76 | timeout_minutes: 60 77 | - uses: salesforcecli/github-workflows/.github/actions/yarnInstallWithRetries@main 78 | - name: Run NUT (with retries) 79 | uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd 80 | with: 81 | max_attempts: 3 82 | retry_wait_seconds: 1 83 | command: ${{ inputs.command }} 84 | retry_on: error 85 | timeout_minutes: 60 86 | -------------------------------------------------------------------------------- /.github/workflows/just-nuts.yml: -------------------------------------------------------------------------------- 1 | name: just-nuts 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | channel-or-version: 7 | required: true 8 | description: Version or channel of the CLI to test against (nightly, latest-rc, 7.112.1) 9 | type: string 10 | workflow_call: 11 | inputs: 12 | channel-or-version: 13 | required: true 14 | description: Version or channel of the CLI to test against (nightly, latest-rc, 7.112.1) 15 | type: string 16 | 17 | jobs: 18 | basic: 19 | strategy: 20 | fail-fast: false 21 | max-parallel: 6 22 | matrix: 23 | os: [ubuntu-latest, windows-latest] 24 | repository: 25 | - salesforcecli/plugin-auth 26 | - salesforcecli/plugin-community 27 | - salesforcecli/plugin-data 28 | - salesforcecli/plugin-limits 29 | - salesforcecli/plugin-org 30 | - salesforcecli/plugin-schema 31 | - salesforcecli/plugin-settings 32 | - salesforcecli/plugin-signups 33 | - salesforcecli/plugin-user 34 | - salesforcecli/plugin-packaging 35 | - salesforcecli/plugin-custom-metadata 36 | uses: ./.github/workflows/just-nut.yml 37 | with: 38 | repository: ${{matrix.repository}} 39 | channel-or-version: ${{ inputs.channel-or-version }} 40 | os: ${{matrix.os}} 41 | secrets: inherit 42 | source: 43 | strategy: 44 | fail-fast: false 45 | matrix: 46 | os: [ubuntu-latest, windows-latest] 47 | command: 48 | - yarn test:nuts:mdapi 49 | - yarn test:nuts:deploy:metadata 50 | - yarn test:nuts:deploy:async 51 | - yarn test:nuts:deploy:destructive 52 | - yarn test:nuts:deploy:manifest 53 | - yarn test:nuts:deploy:quick 54 | - yarn test:nuts:deploy:rest 55 | - yarn test:nuts:deploy:sourcepath 56 | - yarn test:nuts:deploy:testlevel 57 | - yarn test:nuts:retrieve 58 | - yarn test:nuts:specialTypes 59 | - yarn test:nuts:tracking 60 | uses: ./.github/workflows/just-nut.yml 61 | with: 62 | repository: salesforcecli/plugin-source 63 | channel-or-version: ${{ inputs.channel-or-version }} 64 | os: ${{matrix.os}} 65 | command: ${{matrix.command}} 66 | secrets: inherit 67 | deploy-retrieve: 68 | strategy: 69 | fail-fast: false 70 | matrix: 71 | os: [ubuntu-latest, windows-latest] 72 | command: 73 | - yarn test:nuts:deb 74 | - yarn test:nuts:deploy:metadata:manifest 75 | - yarn test:nuts:deploy:metadata:metadata 76 | - yarn test:nuts:deploy:metadata:metadata-dir 77 | - yarn test:nuts:deploy:metadata:source-dir 78 | - yarn test:nuts:deploy:metadata:test-level 79 | - yarn test:nuts:destructive 80 | - yarn test:nuts:manifest 81 | - yarn test:nuts:retrieve 82 | - yarn test:nuts:specialTypes 83 | - yarn test:nuts:static 84 | - yarn test:nuts:tracking 85 | uses: ./.github/workflows/just-nut.yml 86 | with: 87 | repository: salesforcecli/plugin-deploy-retrieve 88 | channel-or-version: ${{ inputs.channel-or-version }} 89 | os: ${{matrix.os}} 90 | command: ${{matrix.command}} 91 | secrets: inherit 92 | -------------------------------------------------------------------------------- /.github/workflows/make-pr-for-nightly.yml: -------------------------------------------------------------------------------- 1 | name: make-pr-for-nightly 2 | 3 | on: 4 | schedule: 5 | # Daily at: 6 | # 6pm MST 7 | # 7pm MST 8 | # 8pm CST 9 | # 9pm EST 10 | # 11pm ARG 11 | - cron: '0 2 * * *' 12 | workflow_dispatch: 13 | inputs: 14 | only: 15 | type: string 16 | required: false 17 | description: '[--only] comma-separated list, no spaces, of dependencies that you want to bump.' 18 | 19 | jobs: 20 | make-pr-for-nightly: 21 | env: 22 | GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 23 | SFDX_HIDE_RELEASE_NOTES: true 24 | runs-on: 'ubuntu-latest' 25 | steps: 26 | - name: Check out repository as our bot user 27 | uses: actions/checkout@v3 28 | with: 29 | token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 30 | 31 | - name: Set up NodeJS 32 | uses: actions/setup-node@v3 33 | with: 34 | node-version: lts/* 35 | 36 | - name: Look up sfdx-cli latest-rc version 37 | uses: salesforcecli/github-workflows/.github/actions/versionInfo@main 38 | id: latest-rc-version 39 | with: 40 | version: latest-rc 41 | npmPackage: 'sfdx-cli' 42 | 43 | - name: Parse latest-rc semver 44 | uses: booxmedialtd/ws-action-parse-semver@e4a833cf5d612066a210bd9b62d1c3b20be3b325 45 | id: latest-rc-semver-info 46 | with: 47 | input_string: ${{ steps.latest-rc-version.outputs.version }} 48 | 49 | - name: Look up sfdx-cli package.json version 50 | uses: notiz-dev/github-action-json-property@2192e246737701f108a4571462b76c75e7376216 51 | id: package-json-version 52 | with: 53 | path: 'package.json' 54 | prop_path: 'version' 55 | 56 | - name: Parse package.json semver 57 | uses: booxmedialtd/ws-action-parse-semver@e4a833cf5d612066a210bd9b62d1c3b20be3b325 58 | id: package-json-semver-info 59 | with: 60 | input_string: ${{ steps.package-json-version.outputs.prop }} 61 | 62 | - name: Log version info 63 | run: | 64 | echo "INFO | Semver version in 'latest-rc' is ${{ steps.latest-rc-version.outputs.version }}" 65 | echo "INFO | Semver minor in 'latest-rc' is ${{ steps.latest-rc-semver-info.outputs.minor }}" 66 | echo "INFO | Semver version in 'main' is ${{ steps.package-json-version.outputs.prop }}" 67 | echo "INFO | Semver minor in 'main' is ${{ steps.package-json-semver-info.outputs.minor }}" 68 | shell: bash 69 | 70 | - name: Install @salesforce/plugin-release-management 71 | run: npm install -g @salesforce/plugin-release-management --omit=dev 72 | 73 | - name: Set git config defaults 74 | uses: salesforcecli/github-workflows/.github/actions/gitConfig@main 75 | 76 | - name: Fetch all branches 77 | run: git fetch 78 | 79 | # --only input using a "ternary-ish": https://github.com/actions/runner/issues/409#issuecomment-752775072 80 | # ${{ x && 'ifTrue' || 'ifFalse' }} 81 | 82 | - name: Build nightly PR (minor) 83 | run: sf-release cli:release:build --start-from-github-ref main ${{ inputs.only && format('--only {0}', inputs.only) || '' }} --label nightly-automerge --release-channel nightly 84 | # If the package.json 'minor' IS EQUAL TO the latest-rc 'minor', we want to bump 'minor' 85 | if: ${{ steps.package-json-semver-info.outputs.minor == steps.latest-rc-semver-info.outputs.minor }} 86 | 87 | - name: Build nightly PR (patch) 88 | run: sf-release cli:release:build --start-from-github-ref main --patch ${{ inputs.only && format('--only {0}', inputs.only) || '' }} --label nightly-automerge --release-channel nightly 89 | # If the package.json 'minor' IS GREATER THAN the latest-rc 'minor', we want to bump 'patch' 90 | if: ${{ steps.package-json-semver-info.outputs.minor > steps.latest-rc-semver-info.outputs.minor }} 91 | -------------------------------------------------------------------------------- /.github/workflows/make-pr-for-release.yml: -------------------------------------------------------------------------------- 1 | name: make-pr-for-release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | start-from-github-ref: 7 | type: string 8 | description: '[--start-from-github-ref] A github ref to start the release from, examples: main, 7.144.0, f476e8e' 9 | start-from-npm-dist-tag: 10 | type: string 11 | description: '[--start-from-npm-dist-tag] An npm dist-tag to start the release from, examples: nightly, latest-rc' 12 | release-channel: 13 | type: string 14 | required: true 15 | description: '[--release-channel] The promote channel for this release, examples: nightly, latest-rc, latest, dev, beta, etc...' 16 | patch: 17 | type: boolean 18 | default: false 19 | description: '[--patch] Increment the patch instead of the minor version' 20 | pinned-deps: 21 | type: boolean 22 | default: true 23 | description: '[--pinned-deps] Bump the versions of the packages listed in the "pinnedDependencies" section' 24 | resolutions: 25 | type: boolean 26 | default: true 27 | description: '[--resolutions] Bump the versions of packages listed in the "resolutions" section' 28 | jit: 29 | type: boolean 30 | default: true 31 | description: '[--jit] Bump the versions of the packages listed in the "jitPlugins" (just-in-time) section' 32 | only: 33 | type: string 34 | description: '[--only] Comma-separated list (no spaces) of dependencies that you want to bump' 35 | empty: 36 | type: boolean 37 | default: false 38 | description: '[--empty] Create an empty release PR for pushing changes to later (version will still be bumped)' 39 | 40 | jobs: 41 | make-pr: 42 | env: 43 | GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 44 | SFDX_HIDE_RELEASE_NOTES: true 45 | runs-on: 'ubuntu-latest' 46 | steps: 47 | - uses: actions/checkout@v3 48 | with: 49 | token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 50 | - uses: actions/setup-node@v3 51 | with: 52 | node-version: lts/* 53 | - run: npm install -g @salesforce/plugin-release-management --omit=dev 54 | - uses: salesforcecli/github-workflows/.github/actions/gitConfig@main 55 | - run: git fetch --tag 56 | - run: | 57 | sf-release cli:release:build \ 58 | --release-channel ${{ inputs.release-channel }} \ 59 | ${{ inputs.pinned-deps && '--pinned-deps' || '--no-pinned-deps' }} \ 60 | ${{ inputs.resolutions && '--resolutions' || '--no-resolutions' }} \ 61 | ${{ inputs.jit && '--jit' || '--no-jit' }} \ 62 | ${{ inputs.start-from-github-ref && format('--start-from-github-ref {0}', inputs.start-from-github-ref) || '' }} \ 63 | ${{ inputs.start-from-npm-dist-tag && format('--start-from-npm-dist-tag {0}', inputs.start-from-npm-dist-tag) || '' }} \ 64 | ${{ inputs.patch && '--patch' || '' }} \ 65 | ${{ inputs.only && format('--only {0}', inputs.only) || '' }} 66 | -------------------------------------------------------------------------------- /.github/workflows/promote-nightly-to-rc.yml: -------------------------------------------------------------------------------- 1 | name: promote-nightly-to-rc 2 | 3 | on: 4 | workflow_dispatch: 5 | workflow_run: 6 | workflows: 7 | - promote-rc-to-latest 8 | types: 9 | - completed 10 | 11 | jobs: 12 | promote: 13 | # Only run on 'workflow_dispatch' or if the 'workflow_run' was successful 14 | if: ${{ !github.event.workflow_run || github.event.workflow_run.conclusion == 'success' }} 15 | uses: ./.github/workflows/promote.yml 16 | secrets: inherit 17 | with: 18 | old-channel: nightly 19 | new-channel: latest-rc 20 | 21 | promote-verify: 22 | runs-on: ubuntu-latest 23 | needs: [promote] 24 | steps: 25 | - uses: actions/checkout@v3 26 | - uses: actions/setup-node@v3 27 | with: 28 | node-version: lts/* 29 | cache: yarn 30 | - uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd 31 | name: verify promote scripts 32 | with: 33 | max_attempts: 5 34 | retry_wait_seconds: 120 35 | command: ./scripts/verify-promote nightly latest-rc 36 | retry_on: error 37 | timeout_minutes: 60 38 | - name: Install plugin-release-management 39 | uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd 40 | with: 41 | max_attempts: 5 42 | retry_wait_seconds: 120 43 | command: npm install -g @salesforce/plugin-release-management --omit=dev 44 | retry_on: error 45 | timeout_minutes: 60 46 | - name: Verify promoted versions 47 | uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd 48 | with: 49 | max_attempts: 5 50 | retry_wait_seconds: 120 51 | command: sf-release cli:versions:inspect -c stable-rc -l archive 52 | retry_on: error 53 | timeout_minutes: 60 54 | 55 | announce-promotion-to-slack: 56 | needs: [promote-verify] 57 | runs-on: ubuntu-latest 58 | steps: 59 | - name: Get nightly version 60 | id: nightly-version 61 | run: | 62 | VERSION=$(npm view sfdx-cli@nightly --json | jq -r '.version') 63 | echo "version=$VERSION" >> "$GITHUB_OUTPUT" 64 | 65 | - name: Announce promotion 66 | id: slack 67 | uses: slackapi/slack-github-action@v1.21.0 68 | env: 69 | SLACK_WEBHOOK_URL: ${{ secrets.PLATFORM_CLI_CHANNEL_SLACK_INCOMING_WEBHOOK }} 70 | SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 71 | with: 72 | payload: | 73 | { 74 | "blocks": [{ 75 | "type": "section", 76 | "text": { 77 | "type": "mrkdwn", 78 | "text": ":owl3: `sfdx-cli` version `${{ steps.nightly-version.outputs.version }}` has been promoted from `nightly` to `latest-rc` :owl3:\nRun `sfdx whatsnew -v latest-rc` to see what's new" 79 | } 80 | }] 81 | } 82 | -------------------------------------------------------------------------------- /.github/workflows/promote-rc-to-latest.yml: -------------------------------------------------------------------------------- 1 | name: promote-rc-to-latest 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | # Thursdays 1pm central 7 | - cron: '0 18 * * 4' 8 | 9 | jobs: 10 | promote: 11 | uses: ./.github/workflows/promote.yml 12 | secrets: inherit 13 | with: 14 | old-channel: latest-rc 15 | new-channel: latest 16 | use-ctc: true 17 | 18 | promote-verify: 19 | runs-on: ubuntu-latest 20 | needs: [promote] 21 | steps: 22 | - uses: actions/checkout@v3 23 | - uses: actions/setup-node@v3 24 | with: 25 | node-version: lts/* 26 | cache: yarn 27 | - uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd 28 | name: verify promote scripts 29 | with: 30 | max_attempts: 5 31 | retry_wait_seconds: 120 32 | command: ./scripts/verify-promote latest-rc latest 33 | retry_on: error 34 | timeout_minutes: 60 35 | - name: Install plugin-release-management 36 | uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd 37 | with: 38 | max_attempts: 5 39 | retry_wait_seconds: 120 40 | command: npm install -g @salesforce/plugin-release-management --omit=dev 41 | retry_on: error 42 | timeout_minutes: 60 43 | - name: Verify promoted versions 44 | uses: nick-fields/retry@943e742917ac94714d2f408a0e8320f2d1fcafcd 45 | with: 46 | max_attempts: 5 47 | retry_wait_seconds: 120 48 | command: sf-release cli:versions:inspect -c stable -l archive 49 | retry_on: error 50 | timeout_minutes: 60 51 | 52 | announce-promotion-to-slack: 53 | runs-on: ubuntu-latest 54 | needs: [promote-verify] 55 | steps: 56 | - name: Get latest-rc version 57 | id: latest-rc-version 58 | run: | 59 | VERSION=$(npm view sfdx-cli@latest-rc --json | jq -r '.version') 60 | echo "version=$VERSION" >> "$GITHUB_OUTPUT" 61 | 62 | - name: Announce promotion 63 | id: slack 64 | uses: slackapi/slack-github-action@v1.21.0 65 | env: 66 | SLACK_WEBHOOK_URL: ${{ secrets.PLATFORM_CLI_CHANNEL_SLACK_INCOMING_WEBHOOK }} 67 | SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 68 | with: 69 | payload: | 70 | { 71 | "blocks": [{ 72 | "type": "section", 73 | "text": { 74 | "type": "mrkdwn", 75 | "text": ":rocket: `sfdx-cli` version `${{ steps.latest-rc-version.outputs.version }}` has been promoted from `latest-rc` to `latest` :rocket:\nRun `sfdx whatsnew -v latest` to see what's new" 76 | } 77 | }] 78 | } 79 | -------------------------------------------------------------------------------- /.github/workflows/promote.yml: -------------------------------------------------------------------------------- 1 | name: promote 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | version: 7 | type: string 8 | description: 'Semver version to promote. Example: 7.123.1' 9 | old-channel: 10 | type: string 11 | description: 'Existing channel to promote. Example: Promote **latest-rc** to latest' 12 | new-channel: 13 | type: string 14 | description: 'The channel to promote to. Example: Promote latest-rc to **latest**' 15 | required: true 16 | use-ctc: 17 | type: boolean 18 | required: false 19 | description: Open a change case for this promotion. Only needed for promotions to latest. 20 | workflow_dispatch: 21 | inputs: 22 | version: 23 | type: string 24 | description: 'Semver version to promote. Example: 7.123.1' 25 | old-channel: 26 | type: string 27 | description: 'Existing channel to promote. Example: Promote **latest-rc** to latest' 28 | new-channel: 29 | type: string 30 | description: 'The channel to promote to. Example: Promote latest-rc to **latest**' 31 | required: true 32 | use-ctc: 33 | type: boolean 34 | required: false 35 | description: Open a change case for this promotion. Only needed for promotions to latest. 36 | 37 | jobs: 38 | validate-inputs: 39 | runs-on: ubuntu-latest 40 | steps: 41 | - name: Ensure either 'version' or 'old-channel' is passed" 42 | if: ${{ !inputs.version && !inputs.old-channel }} 43 | run: | 44 | echo "ERROR: You must pass either 'version' or 'old-channel' to promote from." 45 | echo "-> Use 'version' if you are promoting a new semver version to a channel. Example: I want to promote version '7.123.1' to channel 'dev'. 46 | echo "-> Use 'old-channel' if you are promoting an existing channel to another channel. Example: I want to promote channel 'latest-rc' to channel 'latest'. 47 | exit 1 48 | - name: Ensure only one "starting point" 49 | if: ${{ inputs.version && inputs.old-channel }} 50 | run: | 51 | echo "ERROR: Inputs 'version' and 'old-channel' cannot both be passed (exactlyOne)." 52 | echo "-> Use 'version' if you are promoting a new semver version to a channel. Example: I want to promote version '7.123.1' to channel 'dev'. 53 | echo "-> Use 'old-channel' if you are promoting an existing channel to another channel. Example: I want to promote channel 'latest-rc' to channel 'latest'. 54 | exit 1 55 | - name: Ensure channels do not include "stable" 56 | if: ${{ contains(inputs.old-channel, 'stable') || contains(inputs.new-channel, 'stable') }} 57 | run: | 58 | echo "ERROR: Do not use 'stable' in channel names. Use 'latest' instead. 59 | echo "-> S3 resources (stable, stable-rc) will be translated for you and will eventually be deprecated in favor of 'latest' and 'latest-rc' 60 | exit 1 61 | 62 | # Even if inputs.version is passed, we still need the SHA for a later step 63 | get-package-info: 64 | needs: [validate-inputs] 65 | runs-on: ubuntu-latest 66 | outputs: 67 | version: ${{ steps.version-info.outputs.version }} 68 | sha: ${{ steps.version-info.outputs.sha }} 69 | steps: 70 | - uses: actions/checkout@v3 71 | - uses: actions/setup-node@v3 72 | with: 73 | node-version: lts/* 74 | cache: yarn 75 | - uses: salesforcecli/github-workflows/.github/actions/versionInfo@main 76 | id: version-info 77 | with: 78 | version: ${{ inputs.version || inputs.old-channel }} 79 | 80 | # Replace 'latest' with 'stable' for S3 resources 81 | build-s3-channel: 82 | runs-on: ubuntu-latest 83 | needs: [get-package-info] 84 | outputs: 85 | s3-new-channel: ${{ steps.replace-channel.outputs.s3-new-channel }} 86 | steps: 87 | - id: replace-channel 88 | run: | 89 | NEW_CHANNEL=${{ inputs.new-channel }} 90 | S3_NEW_CHANNEL=${NEW_CHANNEL/latest/stable} 91 | echo "s3-new-channel=$S3_NEW_CHANNEL" >> "$GITHUB_OUTPUT" 92 | 93 | # CTC is only needed for promotions to 'latest' 94 | # Note: "Optional" GHA jobs are tricky to get right. Edit with caution. 95 | # Working example: https://github.com/iowillhoit/gha-sandbox/blob/main/.github/workflows/needing-an-optional-job-alternate.yml 96 | open-ctc-or-skip: 97 | needs: [build-s3-channel] 98 | runs-on: static-ip-ubuntu-runners 99 | outputs: 100 | changeCaseId: ${{ steps.open-ctc.outputs.changeCaseId }} 101 | steps: 102 | - name: Open CTC 103 | id: open-ctc 104 | if: inputs.use-ctc 105 | uses: salesforcecli/github-workflows/.github/actions/ctcOpen@main 106 | with: 107 | SF_CHANGE_CASE_SFDX_AUTH_URL: ${{ secrets.SF_CHANGE_CASE_SFDX_AUTH_URL}} 108 | SF_CHANGE_CASE_TEMPLATE_ID: ${{ secrets.SF_CHANGE_CASE_TEMPLATE_ID}} 109 | SF_CHANGE_CASE_CONFIGURATION_ITEM: ${{ secrets.SF_CHANGE_CASE_CONFIGURATION_ITEM}} 110 | SVC_CLI_BOT_GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN}} 111 | - name: Check open-ctc status 112 | if: always() 113 | run: | 114 | RESULT=${{ steps.open-ctc.outcome }} 115 | if [[ "$RESULT" != 'success' && "$RESULT" != 'skipped' ]]; then 116 | echo "Step 'open-ctc' failed! Exiting." 117 | exit 1 118 | else 119 | echo "Step 'open-ctc' was successful or was skipped, proceeding." 120 | fi 121 | 122 | docker-promote: 123 | needs: [open-ctc-or-skip, get-package-info] 124 | if: success() 125 | runs-on: ubuntu-latest 126 | steps: 127 | - name: Check out the repo 128 | uses: actions/checkout@v3 129 | 130 | - name: Set up Docker Buildx 131 | uses: docker/setup-buildx-action@v2 132 | 133 | - name: Log in to Docker Hub 134 | uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 135 | with: 136 | username: ${{ secrets.DOCKER_USERNAME }} 137 | password: ${{ secrets.DOCKER_PASSWORD }} 138 | 139 | - run: | 140 | docker pull salesforce/salesforcedx:${{ needs.get-package-info.outputs.version }}-slim 141 | docker tag salesforce/salesforcedx:${{ needs.get-package-info.outputs.version }}-slim salesforce/salesforcedx:${{ inputs.new-channel }}-slim 142 | docker push salesforce/salesforcedx:${{ inputs.new-channel }}-slim 143 | 144 | docker pull salesforce/salesforcedx:${{ needs.get-package-info.outputs.version }}-full 145 | docker tag salesforce/salesforcedx:${{ needs.get-package-info.outputs.version }}-full salesforce/salesforcedx:${{ inputs.new-channel }}-full 146 | docker push salesforce/salesforcedx:${{ inputs.new-channel }}-full 147 | 148 | npm-promote: 149 | needs: [open-ctc-or-skip, get-package-info] 150 | if: success() 151 | runs-on: ubuntu-latest 152 | steps: 153 | - uses: actions/setup-node@v3 154 | with: 155 | node-version: lts/* 156 | # NOTE: If you try to use yarn here, it will use the wrong registry and throw 401s 157 | - run: | 158 | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc 159 | npm dist-tag add sfdx-cli@${{ needs.get-package-info.outputs.version }} ${{ inputs.new-channel }} 160 | 161 | oclif-promote: 162 | needs: [open-ctc-or-skip, get-package-info, build-s3-channel] 163 | if: success() 164 | runs-on: ubuntu-latest 165 | steps: 166 | - uses: actions/checkout@v3 167 | - uses: actions/setup-node@v3 168 | with: 169 | node-version: lts/* 170 | cache: yarn 171 | - run: yarn install 172 | - run: yarn promote --version ${{ needs.get-package-info.outputs.version }} --sha ${{ needs.get-package-info.outputs.sha }} --channel ${{ needs.build-s3-channel.outputs.s3-new-channel }} --max-age 300 --macos --win --indexes --xz 173 | env: 174 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 175 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 176 | 177 | # This job is renames the sfdx-x64.pkg that oclif v3 produces to sfdx.pkg which matches what oclif v2 produces. 178 | # Doing so avoids breaking changes for customers relying on the old URLs to download the CLI. 179 | # It can be removed once the developer site is linking to the new sfdx-x64.pkg file and the mac signing job is signing the new -x64.pkg file. 180 | rename-mac-pkg: 181 | needs: [open-ctc-or-skip, oclif-promote, build-s3-channel] 182 | if: success() 183 | runs-on: ubuntu-latest 184 | env: 185 | AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 186 | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 187 | AWS_EC2_METADATA_DISABLED: true 188 | steps: 189 | - uses: salesforcecli/github-workflows/.github/actions/renameMacPkg@main 190 | with: 191 | cli: sfdx 192 | channel: ${{ needs.build-s3-channel.outputs.s3-new-channel }} 193 | 194 | ctcCloseSuccess: 195 | needs: [open-ctc-or-skip, npm-promote, docker-promote, oclif-promote, rename-mac-pkg] 196 | if: needs.open-ctc-or-skip.result == 'success' && needs.open-ctc-or-skip.outputs.changeCaseId && needs.npm-promote.result == 'success' && needs.docker-promote.result == 'success' && needs.oclif-promote.result == 'success' && needs.rename-mac-pkg.result == 'success' 197 | uses: salesforcecli/github-workflows/.github/workflows/ctcClose.yml@main 198 | secrets: inherit 199 | with: 200 | changeCaseId: ${{needs.open-ctc-or-skip.outputs.changeCaseId}} 201 | 202 | ctcCloseFail: 203 | needs: [open-ctc-or-skip, npm-promote, docker-promote, oclif-promote, rename-mac-pkg] 204 | if: always() && needs.open-ctc-or-skip.outputs.changeCaseId && (needs.open-ctc-or-skip.result != 'success' || needs.npm-promote.result != 'success' || needs.docker-promote.result != 'success' || needs.oclif-promote.result != 'success' || needs.rename-mac-pkg.result != 'success') 205 | uses: salesforcecli/github-workflows/.github/workflows/ctcClose.yml@main 206 | secrets: inherit 207 | with: 208 | changeCaseId: ${{ needs.open-ctc-or-skip.outputs.changeCaseId }} 209 | status: Not Implemented 210 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: ut and tarballs 2 | 3 | on: 4 | pull_request: 5 | types: [opened, reopened, synchronize] 6 | 7 | concurrency: 8 | group: ut-tarballs-${{ github.ref }} 9 | cancel-in-progress: true 10 | 11 | jobs: 12 | yarn-lockfile-check: 13 | uses: salesforcecli/github-workflows/.github/workflows/lockFileCheck.yml@main 14 | 15 | ut: 16 | uses: salesforcecli/github-workflows/.github/workflows/unitTest.yml@main 17 | secrets: inherit 18 | 19 | tarballs: 20 | uses: salesforcecli/github-workflows/.github/workflows/tarballs.yml@main 21 | secrets: inherit 22 | # schema: 23 | # runs-on: ubuntu-latest 24 | # steps: 25 | # - uses: actions/checkout@v3 26 | # - uses: actions/setup-node@v3 27 | # with: 28 | # cache: yarn 29 | # - run: yarn install 30 | # - run: yarn test:json-schema 31 | -------------------------------------------------------------------------------- /.github/workflows/update-docker-node-version.yml: -------------------------------------------------------------------------------- 1 | name: update-docker-node-version 2 | 3 | on: 4 | workflow_dispatch: 5 | schedule: 6 | # Wednesday 7a central (12 UTC) 7 | - cron: '0 12 * * 3' 8 | 9 | jobs: 10 | update-node: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | with: 15 | token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 16 | - uses: actions/setup-node@v3 17 | with: 18 | node-version: ${{ vars.TARBALL_NODE_VERSION}} 19 | cache: yarn 20 | - run: yarn install 21 | - run: node ./dockerfiles/update-docker-node-version.js 22 | - uses: salesforcecli/github-workflows/.github/actions/gitConfig@main 23 | # Push changes if 'git status' is not empty 24 | - run: | 25 | if [[ -n $(git status --short) ]]; then 26 | git add dockerfiles/Dockerfile_full 27 | git commit -m "chore: update node in dockerfile_full" --no-verify 28 | git push --no-verify 29 | else 30 | echo "Already up to date" 31 | fi 32 | -------------------------------------------------------------------------------- /.github/workflows/validate-pr.yml: -------------------------------------------------------------------------------- 1 | name: validate-pr 2 | 3 | on: 4 | pull_request: 5 | types: [opened, reopened, edited] 6 | # only applies to PRs that intent to be released to the public 7 | branches: 8 | - main 9 | - release-base/* 10 | 11 | jobs: 12 | validate-pr: 13 | uses: salesforcecli/github-workflows/.github/workflows/validatePR.yml@main 14 | -------------------------------------------------------------------------------- /.github/workflows/workflow-failure.yml: -------------------------------------------------------------------------------- 1 | name: workflow-failure 2 | 3 | on: 4 | workflow_run: 5 | workflows: 6 | - automerge-nightly-pr 7 | - create-cli-release 8 | - create-github-release 9 | - make-pr-for-nightly 10 | - make-pr-for-release 11 | - promote 12 | - promote-nightly-to-rc 13 | - promote-rc-to-latest 14 | - update-docker-node-version 15 | types: 16 | - completed 17 | 18 | # There seems to be an issue where the workflow_run is sometimes missing from the event 19 | # For context: "github.event.workflow_run.conclusion" 20 | # Using a workaround that was found here: https://github.com/community/community/discussions/21090#discussioncomment-3226271 21 | jobs: 22 | get-workflow-conclusion: 23 | name: Lookup conclusion of workflow_run event 24 | runs-on: ubuntu-latest 25 | outputs: 26 | conclusion: ${{ fromJson(steps.get_conclusion.outputs.data).conclusion }} 27 | steps: 28 | - name: Get Workflow Run 29 | uses: octokit/request-action@v2.1.0 30 | id: get_conclusion 31 | with: 32 | route: GET /repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }} 33 | env: 34 | GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 35 | failure-notify: 36 | runs-on: ubuntu-latest 37 | needs: [get-workflow-conclusion] 38 | if: ${{ needs.get-workflow-conclusion.outputs.conclusion == 'failure' }} 39 | steps: 40 | - name: Announce Failure 41 | id: slack 42 | uses: slackapi/slack-github-action@v1.21.0 43 | env: 44 | SLACK_WEBHOOK_URL: ${{ secrets.CLI_ALERTS_SLACK_WEBHOOK }} 45 | SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 46 | with: 47 | # Payload can be visually tested here: https://app.slack.com/block-kit-builder/T01GST6QY0G#%7B%22blocks%22:%5B%5D%7D 48 | # Only copy over the "blocks" array to the Block Kit Builder 49 | payload: | 50 | { 51 | "text": "Workflow \"${{ github.event.workflow_run.name }}\" failed in ${{ github.event.workflow_run.repository.name }}", 52 | "blocks": [ 53 | { 54 | "type": "header", 55 | "text": { 56 | "type": "plain_text", 57 | "text": ":bh-alert: Workflow \"${{ github.event.workflow_run.name }}\" failed in ${{ github.event.workflow_run.repository.name }} :bh-alert:" 58 | } 59 | }, 60 | { 61 | "type": "section", 62 | "text": { 63 | "type": "mrkdwn", 64 | "text": "*Repo:* ${{ github.event.workflow_run.repository.html_url }}\n*Workflow name:* `${{ github.event.workflow_run.name }}`\n*Job url:* ${{ github.event.workflow_run.html_url }}" 65 | } 66 | } 67 | ] 68 | } 69 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # -- CLEAN 2 | tmp/ 3 | # use yarn by default, so ignore npm 4 | package-lock.json 5 | .cache 6 | # never checkin npm config 7 | .npmrc 8 | 9 | # debug logs 10 | npm-error.log 11 | yarn-error.log 12 | lerna-debug.log 13 | 14 | # compile source 15 | lib 16 | dist 17 | release 18 | 19 | # test artifacts 20 | *xunit.xml 21 | *checkstyle.xml 22 | *unitcoverage 23 | .nyc_output 24 | coverage 25 | 26 | # generated docs 27 | docs 28 | oclif.manifest.json 29 | 30 | # ignore sfdx-trust files 31 | *.tgz 32 | *.sig 33 | package.json.bak. 34 | 35 | .sfdx 36 | Library 37 | 38 | # -- CLEAN ALL 39 | *.tsbuildinfo 40 | .eslintcache 41 | .wireit 42 | node_modules 43 | 44 | # -- 45 | # put files here you don't want cleaned with sf-clean 46 | 47 | npm-shrinkwrap.json 48 | 49 | # os specific files 50 | .DS_Store 51 | .idea 52 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | yarn commitlint --edit 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | yarn lint && yarn pretty-quick --staged 5 | -------------------------------------------------------------------------------- /.husky/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | yarn build && yarn test 5 | -------------------------------------------------------------------------------- /.images/vscodeScreenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/salesforcecli/sfdx-cli/7dde8fe6f47050fdf6e5ebb2104303abba6d995e/.images/vscodeScreenshot.png -------------------------------------------------------------------------------- /.lintstagedrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | '**/*.{js,json,md}?(x)': () => 'npm run reformat' 3 | }; 4 | -------------------------------------------------------------------------------- /.mocharc.json: -------------------------------------------------------------------------------- 1 | { 2 | "require": "ts-node/register,source-map-support/register", 3 | "watch-extensions": "ts", 4 | "recursive": true, 5 | "reporter": "spec", 6 | "timeout": 5000 7 | } 8 | -------------------------------------------------------------------------------- /.nycrc: -------------------------------------------------------------------------------- 1 | { 2 | "nyc": { 3 | "extends": "@salesforce/dev-config/nyc" 4 | } 5 | } -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | "@salesforce/prettier-config" 2 | -------------------------------------------------------------------------------- /.sfdevrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude-scripts": ["clean", "test", "prepack", "pretest"] 3 | } 4 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible Node.js debug attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Attach to Suspended", 9 | "type": "node", 10 | "request": "attach", 11 | "port": 9229 12 | }, 13 | { 14 | "type": "node", 15 | "request": "launch", 16 | "name": "Launch Program", 17 | "skipFiles": ["/**"], 18 | "program": "${workspaceFolder}/bin/run", 19 | "cwd": "${env:HOME}/salesforce/tmp", 20 | "args": ["plugins:install", "sdfx-cli@latest-rc"], 21 | "console": "integratedTerminal", 22 | "internalConsoleOptions": "openOnSessionStart", 23 | "env": { 24 | "NODE_ENV": "development", 25 | "SFDX_ENV": "development" 26 | }, 27 | "runtimeArgs": ["--preserve-symlinks"], 28 | "preLaunchTask": "Compile" 29 | }, 30 | { 31 | "name": "mocha tests", 32 | "type": "node", 33 | "request": "launch", 34 | "cwd": "${workspaceRoot}", 35 | "program": "${workspaceRoot}/node_modules/.bin/_mocha", 36 | "protocol": "inspector", 37 | "args": ["--timeout", "999999", "--colors", "--recursive", "dist"], 38 | "runtimeArgs": ["--nolazy"] 39 | } 40 | ] 41 | } 42 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "typescript.tsdk": "node_modules/typescript/lib", 3 | "cSpell.words": ["mrkdwn"] 4 | } 5 | -------------------------------------------------------------------------------- /.vscode/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "2.0.0", 3 | "problemMatcher": "$tsc-watch", 4 | "tasks": [ 5 | { 6 | "label": "Compile", 7 | "group": { 8 | "kind": "build", 9 | "isDefault": true 10 | }, 11 | "command": "yarn", 12 | "type": "shell", 13 | "presentation": { 14 | "focus": false, 15 | "panel": "dedicated" 16 | }, 17 | "args": ["run", "prepack"], 18 | "isBackground": false, 19 | "problemMatcher": { 20 | "owner": "typescript", 21 | "fileLocation": "relative", 22 | "pattern": { 23 | "regexp": "^(.*\\.ts):(\\d*):(\\d*)(\\s*-\\s*)(error|warning|info)\\s*(TS\\d*):\\s*(.*)$", 24 | "file": 1, 25 | "line": 2, 26 | "column": 3, 27 | "severity": 5, 28 | "code": 6, 29 | "message": 7 30 | } 31 | } 32 | }, 33 | { 34 | "label": "Lint", 35 | "command": "yarn", 36 | "type": "shell", 37 | "presentation": { 38 | "focus": false, 39 | "panel": "dedicated" 40 | }, 41 | "args": ["run", "lint"], 42 | "isBackground": false, 43 | "problemMatcher": { 44 | "owner": "typescript", 45 | "fileLocation": "relative", 46 | "pattern": { 47 | "regexp": "^(ERROR|WARNING|INFO):\\s*(.*\\.ts):(\\d*):(\\d*)(\\s*-\\s*)(.*)$", 48 | "file": 2, 49 | "line": 3, 50 | "column": 4, 51 | "severity": 1, 52 | "message": 6 53 | } 54 | } 55 | } 56 | ] 57 | } 58 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. 4 | 5 | ### [7.166.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.166.0...v7.166.1) (2022-08-26) 6 | 7 | ### Bug Fixes 8 | 9 | - skip lwc NUTs because of API 403 ([d949ead](https://github.com/salesforcecli/sfdx-cli/commit/d949ead0050a198cafe1580541986dd505d13cc4)) 10 | 11 | ## [7.166.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.165.0...v7.166.0) (2022-08-25) 12 | 13 | ## [7.165.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.164.2...v7.165.0) (2022-08-18) 14 | 15 | ### [7.164.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.164.1...v7.164.2) (2022-08-17) 16 | 17 | ### [7.164.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.164.0...v7.164.1) (2022-08-11) 18 | 19 | ## [7.164.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.163.0...v7.164.0) (2022-08-11) 20 | 21 | ## [7.163.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.162.0...v7.163.0) (2022-08-05) 22 | 23 | ## [7.162.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.161.0...v7.162.0) (2022-07-29) 24 | 25 | ## [7.161.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.160.0...v7.161.0) (2022-07-21) 26 | 27 | ## [7.160.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.159.0...v7.160.0) (2022-07-14) 28 | 29 | ## [7.159.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.158.1...v7.159.0) (2022-07-07) 30 | 31 | ### [7.158.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.158.0...v7.158.1) (2022-07-01) 32 | 33 | ## [7.158.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.157.0...v7.158.0) (2022-06-30) 34 | 35 | ## [7.157.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.156.1...v7.157.0) (2022-06-23) 36 | 37 | ### [7.156.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.156.0...v7.156.1) (2022-06-23) 38 | 39 | ## [7.156.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.155.1...v7.156.0) (2022-06-23) 40 | 41 | ### [7.155.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.155.0...v7.155.1) (2022-06-14) 42 | 43 | ## [7.155.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.154.0...v7.155.0) (2022-06-09) 44 | 45 | ## [7.154.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.153.1...v7.154.0) (2022-06-02) 46 | 47 | ### [7.153.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.153.0...v7.153.1) (2022-06-02) 48 | 49 | ## [7.153.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.152.0...v7.153.0) (2022-05-27) 50 | 51 | ## [7.152.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.151.1...v7.152.0) (2022-05-19) 52 | 53 | ### [7.151.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.151.0...v7.151.1) (2022-05-17) 54 | 55 | ### Bug Fixes 56 | 57 | - rc patch updates ([0e449ba](https://github.com/salesforcecli/sfdx-cli/commit/0e449babd0b6c751cfdab518f10249e326e2fe86)) 58 | - stray logs [skip ci] ([13495ff](https://github.com/salesforcecli/sfdx-cli/commit/13495ff5b881bd778bc9e1779ad31336d4425407)) 59 | 60 | ## [7.151.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.150.0...v7.151.0) (2022-05-12) 61 | 62 | ## [7.150.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.149.1...v7.150.0) (2022-05-05) 63 | 64 | ### [7.149.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.149.0...v7.149.1) (2022-05-05) 65 | 66 | ## [7.149.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.148.3...v7.149.0) (2022-04-29) 67 | 68 | ### Bug Fixes 69 | 70 | - add schemas to yarn resolutions ([cea2886](https://github.com/salesforcecli/sfdx-cli/commit/cea288610ececf9ad3cf9e24eb7f96607182eed6)) 71 | 72 | ### [7.148.3](https://github.com/salesforcecli/sfdx-cli/compare/v7.148.2...v7.148.3) (2022-04-25) 73 | 74 | ### [7.148.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.148.1...v7.148.2) (2022-04-22) 75 | 76 | ### [7.148.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.148.0...v7.148.1) (2022-04-22) 77 | 78 | ## [7.148.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.147.1...v7.148.0) (2022-04-22) 79 | 80 | ### [7.147.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.147.0...v7.147.1) (2022-04-21) 81 | 82 | ## [7.147.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.146.1...v7.147.0) (2022-04-14) 83 | 84 | ### [7.146.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.146.0...v7.146.1) (2022-04-14) 85 | 86 | ### Bug Fixes 87 | 88 | - xz on the promotes to rc ([92a6f19](https://github.com/salesforcecli/sfdx-cli/commit/92a6f195fbb1d8291b1af7a4a3d4f20a5aac6d2d)) 89 | 90 | ## [7.146.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.145.0...v7.146.0) (2022-04-07) 91 | 92 | ## [7.145.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.144.2...v7.145.0) (2022-03-31) 93 | 94 | ### [7.144.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.144.1...v7.144.2) (2022-03-28) 95 | 96 | ### [7.144.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.144.0...v7.144.1) (2022-03-25) 97 | 98 | ## [7.144.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.143.0...v7.144.0) (2022-03-24) 99 | 100 | ## [7.143.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.142.1...v7.143.0) (2022-03-17) 101 | 102 | ### [7.142.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.142.0...v7.142.1) (2022-03-11) 103 | 104 | ### Bug Fixes 105 | 106 | - add xz ([#513](https://github.com/salesforcecli/sfdx-cli/issues/513)) ([9682120](https://github.com/salesforcecli/sfdx-cli/commit/968212039971bd7abac50bf7c9e35fda45343545)) 107 | 108 | ## [7.142.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.141.1...v7.142.0) (2022-03-11) 109 | 110 | ### Bug Fixes 111 | 112 | - promote xz ([241f5bc](https://github.com/salesforcecli/sfdx-cli/commit/241f5bcd5f3ecf6282d0358e3fb7efd4b7d11f7d)) 113 | 114 | ### [7.141.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.141.0...v7.141.1) (2022-03-08) 115 | 116 | ## [7.141.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.140.0...v7.141.0) (2022-03-03) 117 | 118 | ## [7.140.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.139.0...v7.140.0) (2022-02-24) 119 | 120 | ## [7.139.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.138.1...v7.139.0) (2022-02-17) 121 | 122 | ### Bug Fixes 123 | 124 | - remove call to sfdx ([82560cc](https://github.com/salesforcecli/sfdx-cli/commit/82560cc00da6379be1c90c2a218951a20159300d)) 125 | 126 | ### [7.138.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.138.0...v7.138.1) (2022-02-15) 127 | 128 | ## [7.138.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.137.1...v7.138.0) (2022-02-10) 129 | 130 | ### Features 131 | 132 | - Use community plugin ([#267](https://github.com/salesforcecli/sfdx-cli/issues/267)) ([0fe9799](https://github.com/salesforcecli/sfdx-cli/commit/0fe9799480b9d2b21cf44143bb779abec9be39b1)) 133 | 134 | ### [7.137.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.136.2...v7.137.1) (2022-02-04) 135 | 136 | ### [7.136.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.136.1...v7.136.2) (2022-02-01) 137 | 138 | ### [7.136.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.136.0...v7.136.1) (2022-01-28) 139 | 140 | ## [7.136.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.133.0...v7.136.0) (2022-01-28) 141 | 142 | ### Features 143 | 144 | - warn people about salesforcedx during update ([#436](https://github.com/salesforcecli/sfdx-cli/issues/436)) ([3b076fd](https://github.com/salesforcecli/sfdx-cli/commit/3b076fdaac2901e112b5d5900715d647ba985dcc)) 145 | 146 | ### Bug Fixes 147 | 148 | - no process.exit(0) ([e6c2bb4](https://github.com/salesforcecli/sfdx-cli/commit/e6c2bb43ce12dc4e4b863526b20597502b6af0b2)) 149 | - remove lightning lint command ([fad0a91](https://github.com/salesforcecli/sfdx-cli/commit/fad0a9199f45c2346f0b6bed32cea48cc723c4c2)) 150 | 151 | ## [7.133.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.132.0...v7.133.0) (2022-01-06) 152 | 153 | ### Features 154 | 155 | - add plugin-info hooks ([3dd4018](https://github.com/salesforcecli/sfdx-cli/commit/3dd40180d4cd7e342e6e0ab1248aeeb333e76f8f)) 156 | 157 | ### Bug Fixes 158 | 159 | - script chmod ([ebca03d](https://github.com/salesforcecli/sfdx-cli/commit/ebca03dae2a2595fe8e79c61bb366bbc4542685b)) 160 | 161 | ## [7.132.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.131.0...v7.132.0) (2021-12-16) 162 | 163 | ## [7.131.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.130.1...v7.131.0) (2021-12-09) 164 | 165 | ### [7.130.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.130.0...v7.130.1) (2021-12-03) 166 | 167 | ## [7.130.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.129.0...v7.130.0) (2021-12-03) 168 | 169 | ### Features 170 | 171 | - add plugin-info ([a23ae84](https://github.com/salesforcecli/sfdx-cli/commit/a23ae846f9b151b7f4c7c659de73f0bc6cec8c1f)) 172 | 173 | ## [7.129.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.128.0...v7.129.0) (2021-11-19) 174 | 175 | ## [7.128.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.127.0...v7.128.0) (2021-11-18) 176 | 177 | ## [7.127.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.126.0...v7.127.0) (2021-11-11) 178 | 179 | ## [7.126.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.125.0...v7.126.0) (2021-11-04) 180 | 181 | ### Bug Fixes 182 | 183 | - dir paths ([47dc692](https://github.com/salesforcecli/sfdx-cli/commit/47dc692413400edc286983f842093260f79e8858)) 184 | - don't change dataDir for bundled sf ([fbeaf1f](https://github.com/salesforcecli/sfdx-cli/commit/fbeaf1f1d4b5c6eb0add562bc13b90c57cd70547)) 185 | - oclif manifest command ([1494ade](https://github.com/salesforcecli/sfdx-cli/commit/1494adec7b9f4c6a4f750743ab8d08d34ab1e741)) 186 | - postupdate hook doesn't use npm anymore ([d1f4e21](https://github.com/salesforcecli/sfdx-cli/commit/d1f4e21dd6670f24650074670551ed92565cd2c9)) 187 | - sf install path for tarballs ([a851ec3](https://github.com/salesforcecli/sfdx-cli/commit/a851ec32af698ce57fa55c397968dea2f130e0c5)) 188 | - test new installer packaging ([83160bd](https://github.com/salesforcecli/sfdx-cli/commit/83160bd87b601548668a20951a832be597db96eb)) 189 | - test new installers ([bf2620a](https://github.com/salesforcecli/sfdx-cli/commit/bf2620a3f3ea19a9ddfb821f84ca072e81c8abe8)) 190 | - test new installers with sf included ([afcf758](https://github.com/salesforcecli/sfdx-cli/commit/afcf758bade1569b5d3161a01020566b26d9ebbc)) 191 | - test new installers? ([403e7ff](https://github.com/salesforcecli/sfdx-cli/commit/403e7ff593a2a54d6d84c11cd78ccccf0d35286c)) 192 | - update release management plugin ([1e68acc](https://github.com/salesforcecli/sfdx-cli/commit/1e68acc5262092070591aad194603bc69012d1c3)) 193 | - whoops ([34c1f8f](https://github.com/salesforcecli/sfdx-cli/commit/34c1f8f7e58e29896086bf7aa9e175359b23f6e4)) 194 | - whoops, actually change sf install path for tarballs ([cb32ed3](https://github.com/salesforcecli/sfdx-cli/commit/cb32ed311039ce2ee5c9e28e59321dc5bb8980a4)) 195 | 196 | ## [7.125.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.124.0...v7.125.0) (2021-10-28) 197 | 198 | ### Bug Fixes 199 | 200 | - install sf separately ([52ba0c8](https://github.com/salesforcecli/sfdx-cli/commit/52ba0c8a5ec917166b072d6904196ccce40bda48)) 201 | - postupdate hook ([1c74cd1](https://github.com/salesforcecli/sfdx-cli/commit/1c74cd17e00c9d78e11becfda354efd938bca462)) 202 | 203 | ## [7.124.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.123.1...v7.124.0) (2021-10-21) 204 | 205 | ### [7.123.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.123.0...v7.123.1) (2021-10-21) 206 | 207 | ### Bug Fixes 208 | 209 | - ignore scripts when running yarn install ([c301f72](https://github.com/salesforcecli/sfdx-cli/commit/c301f728110e454497bf36b953f7f575e47871ee)) 210 | - quotes ([d46ec0a](https://github.com/salesforcecli/sfdx-cli/commit/d46ec0a692adcdd49660e5b0634949ce6cf399a6)) 211 | 212 | ## [7.123.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.122.1...v7.123.0) (2021-10-14) 213 | 214 | ### Features 215 | 216 | - use npm postinstall script to install sf ([97791ad](https://github.com/salesforcecli/sfdx-cli/commit/97791ad51347c72c85227e01f058f4d47757f8c7)) 217 | 218 | ### Bug Fixes 219 | 220 | - add some more debugging output ([3923b1f](https://github.com/salesforcecli/sfdx-cli/commit/3923b1fec3f83506d7aeaf2ef4205f488f21781b)) 221 | - call to shelljs.which ([f260a48](https://github.com/salesforcecli/sfdx-cli/commit/f260a4831ee7aa707c5cab03aaebcdf618bbd44e)) 222 | - create path before moving sf to it ([7764405](https://github.com/salesforcecli/sfdx-cli/commit/7764405e31e506e6c2d81bb09d05e13f780ffd1a)) 223 | - don't get sf root from pwd() ([85f6e18](https://github.com/salesforcecli/sfdx-cli/commit/85f6e18ef9aa0e31f7c22451d4a3a455a3640db3)) 224 | - find npmGlobalBin with shelljs ([4255698](https://github.com/salesforcecli/sfdx-cli/commit/425569881bb974f976775fbf61d74ce5c4d20a27)) 225 | - make sure sf gets copied to `sfdx` root ([a4b7443](https://github.com/salesforcecli/sfdx-cli/commit/a4b7443c8a65903dec77f7937db02601332bde74)) 226 | - put sf back in bin folder ([e78ad00](https://github.com/salesforcecli/sfdx-cli/commit/e78ad0071624f9f9debc65a55cdfca3250677264)) 227 | - remove newline from path ([a02d568](https://github.com/salesforcecli/sfdx-cli/commit/a02d568a1dac46225dbe641f40b4867221d3e453)) 228 | - revert find npmGlobalBin with shelljs ([9a03311](https://github.com/salesforcecli/sfdx-cli/commit/9a0331112d420bb92304b35970ea9c695b06cf9f)) 229 | - revert previous "fix" ([041ee7a](https://github.com/salesforcecli/sfdx-cli/commit/041ee7a84e28c06f1d5aecbe5c9f594f02e2f9a9)) 230 | - shelljs.exec whoopsies ([b408631](https://github.com/salesforcecli/sfdx-cli/commit/b4086315f645ec4e9942095a07de2c01534d833d)) 231 | 232 | ### [7.122.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.121.8...v7.122.1) (2021-10-08) 233 | 234 | ### [7.121.8](https://github.com/salesforcecli/sfdx-cli/compare/v7.121.7...v7.121.8) (2021-10-08) 235 | 236 | ### [7.121.7](https://github.com/salesforcecli/sfdx-cli/compare/v7.121.6...v7.121.7) (2021-10-07) 237 | 238 | ### [7.121.6](https://github.com/salesforcecli/sfdx-cli/compare/v7.121.5...v7.121.6) (2021-10-07) 239 | 240 | ### [7.121.5](https://github.com/salesforcecli/sfdx-cli/compare/v7.122.0...v7.121.5) (2021-10-07) 241 | 242 | ## [7.122.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.121.4...v7.122.0) (2021-10-07) 243 | 244 | ### [7.121.4](https://github.com/salesforcecli/sfdx-cli/compare/v7.121.3...v7.121.4) (2021-10-07) 245 | 246 | ### [7.121.3](https://github.com/salesforcecli/sfdx-cli/compare/v7.121.2...v7.121.3) (2021-10-06) 247 | 248 | ### [7.121.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.121.1...v7.121.2) (2021-10-01) 249 | 250 | ### Bug Fixes 251 | 252 | - add resolution for templates ([#296](https://github.com/salesforcecli/sfdx-cli/issues/296)) ([c2dd61e](https://github.com/salesforcecli/sfdx-cli/commit/c2dd61e41842c191bca9af5deaccc5c658a6abee)) 253 | 254 | ### [7.121.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.121.0...v7.121.1) (2021-10-01) 255 | 256 | ### Bug Fixes 257 | 258 | - update sf dep to 1.0.2 ([#295](https://github.com/salesforcecli/sfdx-cli/issues/295)) ([2e13de2](https://github.com/salesforcecli/sfdx-cli/commit/2e13de29201b37686d474c0c1aee261eb9e2639b)) 259 | 260 | ## [7.121.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.120.0...v7.121.0) (2021-09-30) 261 | 262 | ## [7.120.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.119.3...v7.120.0) (2021-09-29) 263 | 264 | ### Bug Fixes 265 | 266 | - update @salesforce/templates to latest ([78b79d1](https://github.com/salesforcecli/sfdx-cli/commit/78b79d1d789402b402a932ab044995d1bc448171)) 267 | - use absolute path to sf ([#276](https://github.com/salesforcecli/sfdx-cli/issues/276)) ([fdd76c1](https://github.com/salesforcecli/sfdx-cli/commit/fdd76c166e384086e05041845a7641fc4d47d45d)) 268 | 269 | ### [7.119.3](https://github.com/salesforcecli/sfdx-cli/compare/v7.119.2...v7.119.3) (2021-09-24) 270 | 271 | ### [7.119.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.119.1...v7.119.2) (2021-09-24) 272 | 273 | ### Bug Fixes 274 | 275 | - do not allow installation of banned plugins ([fed6ef3](https://github.com/salesforcecli/sfdx-cli/commit/fed6ef395209f157b3eb27eb61ec8becee77d51c)) 276 | 277 | ### [7.119.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.119.0...v7.119.1) (2021-09-17) 278 | 279 | ## [7.119.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.118.1...v7.119.0) (2021-09-17) 280 | 281 | ### Bug Fixes 282 | 283 | - verify node installation in full image ([#266](https://github.com/salesforcecli/sfdx-cli/issues/266)) ([36578e2](https://github.com/salesforcecli/sfdx-cli/commit/36578e28f4bbfdc013f94ad2b69b62e7d02bf3fe)) 284 | 285 | ### [7.118.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.118.0...v7.118.1) (2021-09-10) 286 | 287 | ## [7.118.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.117.0...v7.118.0) (2021-09-09) 288 | 289 | ### Bug Fixes 290 | 291 | - add missing env var for docker deps verification ([f26c97c](https://github.com/salesforcecli/sfdx-cli/commit/f26c97ca559d13607aa1d6620974a8035d003710)) 292 | - add script to execute sf ([8e43bed](https://github.com/salesforcecli/sfdx-cli/commit/8e43bed2b6f70d38389eafd8a764bcc6ca6b26c9)) 293 | - enable shell for spawned process ([634a924](https://github.com/salesforcecli/sfdx-cli/commit/634a924dd04806f60bc7daf53c0a14d571df1929)) 294 | - handle non-existent npm executable ([2cca0ba](https://github.com/salesforcecli/sfdx-cli/commit/2cca0ba3169dda59fe9cdeed3f1b5f0af8d70ed2)) 295 | - use absolute path to sf bin ([c799408](https://github.com/salesforcecli/sfdx-cli/commit/c799408d0d009a2fc8127f580e97736bb06132e2)) 296 | 297 | ## [7.117.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.116.2...v7.117.0) (2021-09-02) 298 | 299 | ### [7.116.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.116.1...v7.116.2) (2021-08-27) 300 | 301 | ### Bug Fixes 302 | 303 | - force sdr and ts-types version ([4b48e8e](https://github.com/salesforcecli/sfdx-cli/commit/4b48e8e7bc6060dcaa6775fafde311dabd7d2f89)) 304 | 305 | ### [7.116.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.116.0...v7.116.1) (2021-08-27) 306 | 307 | ### Bug Fixes 308 | 309 | - sdr at top level to resolve ([03ee773](https://github.com/salesforcecli/sfdx-cli/commit/03ee7738d4811037cf1a2a2bb3d10a7382062aa8)) 310 | 311 | ## [7.116.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.115.1...v7.116.0) (2021-08-26) 312 | 313 | ### Bug Fixes 314 | 315 | - dont resolve sf path ([f7d7727](https://github.com/salesforcecli/sfdx-cli/commit/f7d7727fd0e8efcf0072350fde17e2efb2ef50bc)) 316 | 317 | ### [7.115.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.115.0...v7.115.1) (2021-08-23) 318 | 319 | ### Features 320 | 321 | - add update hook to install sf ([50cc886](https://github.com/salesforcecli/sfdx-cli/commit/50cc886b7394b39a6ecb03d120d5a6f169ab62e6)) 322 | - include sf ([c343f3e](https://github.com/salesforcecli/sfdx-cli/commit/c343f3ec8baa8f489e836708f0b798aaa32e3149)) 323 | 324 | ## [7.115.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.114.0...v7.115.0) (2021-08-21) 325 | 326 | ## [7.114.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.113.0...v7.114.0) (2021-08-13) 327 | 328 | ## [7.113.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.112.1...v7.113.0) (2021-08-06) 329 | 330 | ### [7.112.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.112.0...v7.112.1) (2021-08-05) 331 | 332 | ## [7.112.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.111.6...v7.112.0) (2021-07-30) 333 | 334 | ### [7.111.6](https://github.com/salesforcecli/sfdx-cli/compare/v7.111.5...v7.111.6) (2021-07-27) 335 | 336 | ### [7.111.5](https://github.com/salesforcecli/sfdx-cli/compare/v7.111.4...v7.111.5) (2021-07-26) 337 | 338 | ### [7.111.4](https://github.com/salesforcecli/sfdx-cli/compare/v7.111.3...v7.111.4) (2021-07-22) 339 | 340 | ### [7.111.3](https://github.com/salesforcecli/sfdx-cli/compare/v7.111.2...v7.111.3) (2021-07-21) 341 | 342 | ### [7.111.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.111.1...v7.111.2) (2021-07-16) 343 | 344 | ### [7.111.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.111.0...v7.111.1) (2021-07-15) 345 | 346 | ## [7.111.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.110.0...v7.111.0) (2021-07-15) 347 | 348 | ## [7.110.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.109.0...v7.110.0) (2021-07-08) 349 | 350 | ## [7.109.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.108.0...v7.109.0) (2021-07-01) 351 | 352 | ### Features 353 | 354 | - build/promote scripts ([967ab6a](https://github.com/salesforcecli/sfdx-cli/commit/967ab6a9e2af6893e7635902e0399a7346fd73ac)) 355 | - check npm promotions ([9a5ffa1](https://github.com/salesforcecli/sfdx-cli/commit/9a5ffa17e3a5ed34cfe3d6cf5f0f487e6b229431)) 356 | - makes tarball download url an ARG ([e769295](https://github.com/salesforcecli/sfdx-cli/commit/e769295f299d983922efb5c7122502365cf4e151)) 357 | - slim builds latest-rc from tarball ([11bafd9](https://github.com/salesforcecli/sfdx-cli/commit/11bafd9402b9606b122befbb9d26c03fb7fe7147)) 358 | - use node14 ([48a4cbf](https://github.com/salesforcecli/sfdx-cli/commit/48a4cbf6e67544dd55ab9e438c0dcba1b8c72820)) 359 | - yarn scripts and circle yml for docker ([7270d03](https://github.com/salesforcecli/sfdx-cli/commit/7270d03d2ab28cbaf705304ac8d46ba2fb9f6d8e)) 360 | 361 | ### Bug Fixes 362 | 363 | - validated circle config ([eb20bf3](https://github.com/salesforcecli/sfdx-cli/commit/eb20bf31a209db77a2e05db395531ecc58b201b7)) 364 | 365 | ## [7.108.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.107.0...v7.108.0) (2021-06-24) 366 | 367 | ### Features 368 | 369 | - add more version information ([f9c2cb3](https://github.com/salesforcecli/sfdx-cli/commit/f9c2cb31186d2f026f124a972091a02f8f5b9780)) 370 | - changing the interface name ([e00e2ca](https://github.com/salesforcecli/sfdx-cli/commit/e00e2cab0856567d47164c640a518177809d8fa9)) 371 | - update --json command without --verbose ([00827c3](https://github.com/salesforcecli/sfdx-cli/commit/00827c3a5504df5ee6fce2471da008897bdb29b0)) 372 | - updating version command ([e9dc75a](https://github.com/salesforcecli/sfdx-cli/commit/e9dc75ae68ba915c4ac26731a1929067c938e406)) 373 | 374 | ## [7.107.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.106.3...v7.107.0) (2021-06-17) 375 | 376 | ### [7.106.3](https://github.com/salesforcecli/sfdx-cli/compare/v7.106.2...v7.106.3) (2021-06-10) 377 | 378 | ### [7.106.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.106.1...v7.106.2) (2021-06-10) 379 | 380 | ### [7.106.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.106.0...v7.106.1) (2021-06-10) 381 | 382 | ## [7.106.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.105.0...v7.106.0) (2021-06-10) 383 | 384 | ## [7.105.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.104.0...v7.105.0) (2021-06-04) 385 | 386 | ## [7.104.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.103.0...v7.104.0) (2021-05-27) 387 | 388 | ## [7.103.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.102.0...v7.103.0) (2021-05-20) 389 | 390 | ## [7.102.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.101.0...v7.102.0) (2021-05-13) 391 | 392 | ## [7.101.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.100.0...v7.101.0) (2021-05-06) 393 | 394 | ## [7.100.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.99.0...v7.100.0) (2021-04-29) 395 | 396 | ## [7.99.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.98.0...v7.99.0) (2021-04-22) 397 | 398 | ## [7.98.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.97.1...v7.98.0) (2021-04-19) 399 | 400 | ### [7.97.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.97.0...v7.97.1) (2021-04-09) 401 | 402 | ## [7.97.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.96.1...v7.97.0) (2021-04-08) 403 | 404 | ### [7.96.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.96.0...v7.96.1) (2021-04-08) 405 | 406 | ### Bug Fixes 407 | 408 | - auth for npm ([fc2941b](https://github.com/salesforcecli/sfdx-cli/commit/fc2941b34831633ad43e6e86ab47cbf5545735ec)) 409 | - dist tag retry ([c349b00](https://github.com/salesforcecli/sfdx-cli/commit/c349b00d5f2e51b6d2bd1c43f4c65be0c2e85210)) 410 | - dist tag retry ([1256450](https://github.com/salesforcecli/sfdx-cli/commit/1256450e626d6e7001ca2c8e38031f62094b3696)) 411 | - dist tag retry ([b0d058b](https://github.com/salesforcecli/sfdx-cli/commit/b0d058b35d3bc31610399b5d71418355e25c7916)) 412 | - dist tag retry ([399a266](https://github.com/salesforcecli/sfdx-cli/commit/399a2660655083ab6880f9e36919c7c14dcf7d86)) 413 | - dist tag retry ([4f14e00](https://github.com/salesforcecli/sfdx-cli/commit/4f14e0082ecca9a0e6a906c34c04749dd6d419f5)) 414 | - dist tag retry ([8f063d0](https://github.com/salesforcecli/sfdx-cli/commit/8f063d0b38bfbc2fb47e8b3e819cbc22f43fb8c9)) 415 | - dist tag retry ([840d36d](https://github.com/salesforcecli/sfdx-cli/commit/840d36d12449fe3f8806ea05200900ba95805621)) 416 | - dist tag retry ([a3e2516](https://github.com/salesforcecli/sfdx-cli/commit/a3e25167733f886b8c2213c610d9ea04c8b8f73e)) 417 | - npmrc if npm_token in env ([5981458](https://github.com/salesforcecli/sfdx-cli/commit/59814586084213633ed99b97c5148122ca423e66)) 418 | - plus plugin for close case ([044b06f](https://github.com/salesforcecli/sfdx-cli/commit/044b06f41f9305802ae713260018fca7eb8cd91a)) 419 | - promotes depend on tarballs ([13313e5](https://github.com/salesforcecli/sfdx-cli/commit/13313e5c344cd5cb5b8eb205a6921ff759251068)) 420 | - ready for real use ([284fcaa](https://github.com/salesforcecli/sfdx-cli/commit/284fcaa3d61c7fcc5d442aff2f175c1dc5ef493b)) 421 | - use stable channel, time change for retry ([afd490a](https://github.com/salesforcecli/sfdx-cli/commit/afd490aab6feed31a421e7dfcc90c008327e60bf)) 422 | - use stable channel, time change for retry ([18605be](https://github.com/salesforcecli/sfdx-cli/commit/18605bed584bb06a091c41c5a0213856a9982dc9)) 423 | 424 | ## [7.96.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.95.0...v7.96.0) (2021-04-05) 425 | 426 | ### Bug Fixes 427 | 428 | - collapse latest-rc promote step into pack/upload ([c2c5c46](https://github.com/salesforcecli/sfdx-cli/commit/c2c5c461c7cfaccce6d233a691a512f6daa6b631)) 429 | - remove targets from promote commands ([a141b3b](https://github.com/salesforcecli/sfdx-cli/commit/a141b3bbb383006c1b590def79e81cf47ccf5b66)) 430 | 431 | ## [7.95.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.94.3...v7.95.0) (2021-04-01) 432 | 433 | ### Bug Fixes 434 | 435 | - allow env override for version promote ([9d87838](https://github.com/salesforcecli/sfdx-cli/commit/9d87838ed6e17b32b598b2c10dff80866d477e59)) 436 | - context and envs ([2708a61](https://github.com/salesforcecli/sfdx-cli/commit/2708a6188e4a101cd3a0fda0c518e34b25463043)) 437 | - cron I hate TZ ([340180a](https://github.com/salesforcecli/sfdx-cli/commit/340180a35a869acce1d16a474e6943a49c54d9a6)) 438 | - cron time ([16a7bde](https://github.com/salesforcecli/sfdx-cli/commit/16a7bde9c6113de1cc352b3c90bf581645804d0d)) 439 | - jq for scripts ([9ad1793](https://github.com/salesforcecli/sfdx-cli/commit/9ad17933e1b2579b80e6c9960c6cafa08683188d)) 440 | - jq/checkout on npm-promotions ([5e96507](https://github.com/salesforcecli/sfdx-cli/commit/5e96507b973dbc94ba1e601c989cb90fb00ca4e1)) 441 | - try with sha override ([8cfc050](https://github.com/salesforcecli/sfdx-cli/commit/8cfc05096369c22f020d4c534815ba70bc1cddf8)) 442 | 443 | ### [7.94.3](https://github.com/salesforcecli/sfdx-cli/compare/v7.94.2...v7.94.3) (2021-03-25) 444 | 445 | ### [7.94.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.94.1...v7.94.2) (2021-03-25) 446 | 447 | ### Bug Fixes 448 | 449 | - promote script [skip ci] ([#68](https://github.com/salesforcecli/sfdx-cli/issues/68)) ([f91b4c2](https://github.com/salesforcecli/sfdx-cli/commit/f91b4c262289c79b7f3aa537bf8a4093d7ada4d6)) 450 | 451 | ### [7.94.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.93.1...v7.94.1) (2021-03-25) 452 | 453 | ### [7.93.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.93.0...v7.93.1) (2021-03-18) 454 | 455 | ## [7.93.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.92.0...v7.93.0) (2021-03-18) 456 | 457 | ## [7.92.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.91.0...v7.92.0) (2021-03-12) 458 | 459 | ## [7.91.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.90.2...v7.91.0) (2021-03-04) 460 | 461 | ### [7.90.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.90.1...v7.90.2) (2021-03-03) 462 | 463 | ### [7.90.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.90.0...v7.90.1) (2021-03-02) 464 | 465 | ## [7.90.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.89.2...v7.90.0) (2021-03-02) 466 | 467 | ### [7.89.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.89.1...v7.89.2) (2021-02-25) 468 | 469 | ### Bug Fixes 470 | 471 | - read version from package.json for promote-stable-rc ([#48](https://github.com/salesforcecli/sfdx-cli/issues/48)) ([6bd6555](https://github.com/salesforcecli/sfdx-cli/commit/6bd6555ebcd014ed38c8b89fd0c3771a5bf548ce)) 472 | 473 | ### [7.89.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.88.4...v7.89.1) (2021-02-23) 474 | 475 | ### Bug Fixes 476 | 477 | - promote scripts use HEAD ([#44](https://github.com/salesforcecli/sfdx-cli/issues/44)) ([40df7af](https://github.com/salesforcecli/sfdx-cli/commit/40df7afdae1847d7e155feafbe2635a3108a39d4)) 478 | 479 | ### [7.88.4](https://github.com/salesforcecli/sfdx-cli/compare/v7.88.3...v7.88.4) (2021-02-20) 480 | 481 | ### [7.88.3](https://github.com/salesforcecli/sfdx-cli/compare/v7.88.2...v7.88.3) (2021-02-17) 482 | 483 | ### [7.88.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.88.1...v7.88.2) (2021-02-16) 484 | 485 | ### [7.88.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.88.0...v7.88.1) (2021-02-11) 486 | 487 | ### Bug Fixes 488 | 489 | - update plugin-update ([373c267](https://github.com/salesforcecli/sfdx-cli/commit/373c26713251415c86a8b323771797c31205e655)) 490 | 491 | ## [7.88.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.87.0...v7.88.0) (2021-02-10) 492 | 493 | ### Features 494 | 495 | - remove s3 check for stability ([#34](https://github.com/salesforcecli/sfdx-cli/issues/34)) [skip-ci] ([f2bd13b](https://github.com/salesforcecli/sfdx-cli/commit/f2bd13bcaf5676ad018540156120988d23361211)) 496 | 497 | ## [7.87.0](https://github.com/salesforcecli/sfdx-cli/compare/v7.86.3...v7.87.0) (2021-02-05) 498 | 499 | ### Features 500 | 501 | - update node version ([23d58a3](https://github.com/salesforcecli/sfdx-cli/commit/23d58a305075f29ae069ba31e7ebc0b95b01cca9)) 502 | 503 | ### Bug Fixes 504 | 505 | - [skip-ci] update readme with latest-rc install info ([4a6a755](https://github.com/salesforcecli/sfdx-cli/commit/4a6a7557e951f034cf81c85d51f763cf0a2c7637)) 506 | 507 | ### [7.86.3](https://github.com/salesforcecli/sfdx-cli/compare/v7.86.2...v7.86.3) (2021-01-29) 508 | 509 | ### Bug Fixes 510 | 511 | - do not sign npm package ([33b44c2](https://github.com/salesforcecli/sfdx-cli/commit/33b44c2ab5fedb813ef5ce20319a508938e77cb0)) 512 | 513 | ### [7.86.2](https://github.com/salesforcecli/sfdx-cli/compare/v7.86.1...v7.86.2) (2021-01-29) 514 | 515 | ### [7.86.1](https://github.com/salesforcecli/sfdx-cli/compare/v7.86.0...v7.86.1) (2021-01-28) 516 | 517 | ## 7.86.0 (2021-01-28) 518 | 519 | ### Features 520 | 521 | - initial oss cli ([ad12027](https://github.com/salesforcecli/sfdx-cli/commit/ad1202771982c8500c5f98ba62656fa163c7e8df)) 522 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Salesforce Open Source Community Code of Conduct 2 | 3 | ## About the Code of Conduct 4 | 5 | Equality is a core value at Salesforce. We believe a diverse and inclusive 6 | community fosters innovation and creativity, and are committed to building a 7 | culture where everyone feels included. 8 | 9 | Salesforce open-source projects are committed to providing a friendly, safe, and 10 | welcoming environment for all, regardless of gender identity and expression, 11 | sexual orientation, disability, physical appearance, body size, ethnicity, nationality, 12 | race, age, religion, level of experience, education, socioeconomic status, or 13 | other similar personal characteristics. 14 | 15 | The goal of this code of conduct is to specify a baseline standard of behavior so 16 | that people with different social values and communication styles can work 17 | together effectively, productively, and respectfully in our open source community. 18 | It also establishes a mechanism for reporting issues and resolving conflicts. 19 | 20 | All questions and reports of abusive, harassing, or otherwise unacceptable behavior 21 | in a Salesforce open-source project may be reported by contacting the Salesforce 22 | Open Source Conduct Committee at ossconduct@salesforce.com. 23 | 24 | ## Our Pledge 25 | 26 | In the interest of fostering an open and welcoming environment, we as 27 | contributors and maintainers pledge to making participation in our project and 28 | our community a harassment-free experience for everyone, regardless of gender 29 | identity and expression, sexual orientation, disability, physical appearance, 30 | body size, ethnicity, nationality, race, age, religion, level of experience, education, 31 | socioeconomic status, or other similar personal characteristics. 32 | 33 | ## Our Standards 34 | 35 | Examples of behavior that contributes to creating a positive environment 36 | include: 37 | 38 | - Using welcoming and inclusive language 39 | - Being respectful of differing viewpoints and experiences 40 | - Gracefully accepting constructive criticism 41 | - Focusing on what is best for the community 42 | - Showing empathy toward other community members 43 | 44 | Examples of unacceptable behavior by participants include: 45 | 46 | - The use of sexualized language or imagery and unwelcome sexual attention or 47 | advances 48 | - Personal attacks, insulting/derogatory comments, or trolling 49 | - Public or private harassment 50 | - Publishing, or threatening to publish, others' private information—such as 51 | a physical or electronic address—without explicit permission 52 | - Other conduct which could reasonably be considered inappropriate in a 53 | professional setting 54 | - Advocating for or encouraging any of the above behaviors 55 | 56 | ## Our Responsibilities 57 | 58 | Project maintainers are responsible for clarifying the standards of acceptable 59 | behavior and are expected to take appropriate and fair corrective action in 60 | response to any instances of unacceptable behavior. 61 | 62 | Project maintainers have the right and responsibility to remove, edit, or 63 | reject comments, commits, code, wiki edits, issues, and other contributions 64 | that are not aligned with this Code of Conduct, or to ban temporarily or 65 | permanently any contributor for other behaviors that they deem inappropriate, 66 | threatening, offensive, or harmful. 67 | 68 | ## Scope 69 | 70 | This Code of Conduct applies both within project spaces and in public spaces 71 | when an individual is representing the project or its community. Examples of 72 | representing a project or community include using an official project email 73 | address, posting via an official social media account, or acting as an appointed 74 | representative at an online or offline event. Representation of a project may be 75 | further defined and clarified by project maintainers. 76 | 77 | ## Enforcement 78 | 79 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 80 | reported by contacting the Salesforce Open Source Conduct Committee 81 | at ossconduct@salesforce.com. All complaints will be reviewed and investigated 82 | and will result in a response that is deemed necessary and appropriate to the 83 | circumstances. The committee is obligated to maintain confidentiality with 84 | regard to the reporter of an incident. Further details of specific enforcement 85 | policies may be posted separately. 86 | 87 | Project maintainers who do not follow or enforce the Code of Conduct in good 88 | faith may face temporary or permanent repercussions as determined by other 89 | members of the project's leadership and the Salesforce Open Source Conduct 90 | Committee. 91 | 92 | ## Attribution 93 | 94 | This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant-home], 95 | version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html. 96 | It includes adaptions and additions from [Go Community Code of Conduct][golang-coc], 97 | [CNCF Code of Conduct][cncf-coc], and [Microsoft Open Source Code of Conduct][microsoft-coc]. 98 | 99 | This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 License][cc-by-3-us]. 100 | 101 | [contributor-covenant-home]: https://www.contributor-covenant.org 'https://www.contributor-covenant.org/' 102 | [golang-coc]: https://golang.org/conduct 103 | [cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md 104 | [microsoft-coc]: https://opensource.microsoft.com/codeofconduct/ 105 | [cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/ 106 | -------------------------------------------------------------------------------- /DEVELOPER.md: -------------------------------------------------------------------------------- 1 | # Salesforce CLI 2 | 3 | This is the latest `sfdx` CLI application, based on the 4 | [oclif](https://oclif.io) CLI engine. By default it comes installed with various plugins. 5 | 6 | ## Installation and Development 7 | 8 | ### Requirements 9 | 10 | To get started, you'll need to install `node` v10 or greater, though we recommend using the active LTS for the best experience. While this can be done using an installer from [nodejs.com](nodejs.com) or via an OS-specific package manager, we recommend using [nvm](https://github.com/creationix/nvm) to easily manage multiple `node` versions. 11 | 12 | If using `nvm`, be sure that you've selected the appropriate version with something like `nvm use v10.x.y`, where `x` and `y` are specific to the version that you installed. If you want to use this version by default run `nvm alias default node` -- otherwise, when you restart your shell `nvm` will revert to whatever version configured prior to installing the latest. 13 | 14 | You'll also need [yarn](https://yarnpkg.com/en/docs/install). If you did decide to use `nvm`, be sure to follow the `nvm`-specific install instructions. 15 | 16 | ### Up and running as a CLI-only developer 17 | 18 | 1. From within this repository's root directory, run `yarn` (short for `yarn install`). 19 | 1. Run `bin/run` to view the CLI's root help. 20 | 21 | When you make changes to this project's `.ts`. sources, you will need to recompile. Use `yarn compile` to rebuild. Linting and tests will run as git hooks before pushing. 22 | 23 | ### Developer CLI flags 24 | 25 | #### `bin/run` flags 26 | 27 | The following flags are supported by the `bin/run` script, and can be combined as desired. 28 | 29 | - _--dev-debug_: Sets the `SFDX_DEBUG=1`, `SFDX_ENV=development`, and `DEBUG=\*` envars for the CLI's `node` process, which enables full debug output from both `sfdx` and the oclif CLI engine. 30 | 31 | #### `bin/run.sh` or `bin\run.cmd` flags 32 | 33 | The following flags are supported by the `bin/run.sh` script, which wraps the `bin/run` script referenced in the rest of this document, and can be combined as desired. They are stripped from the args passed to the CLI application itself. 34 | 35 | - _--dev-suspend_: Starts the `node` binary with the `--inspect-brk` flag to allow a remote debugger to attach before running. _Does not work with npm-based installs. For this case, you can set the environment variable `NODE_OPTIONS='--inspect-brk'`. You may also need to set the variable `OCLIF_TS_NODE=0` for debugger break points to stop on the correct lines._ 36 | - To set other Node executable flags, the use of the `NODE_OPTIONS` environment variable is required. 37 | 38 | ### Developer notes 39 | 40 | - If you are using a locally linked `cli-engine` and making changes, you may want to set up its compile watch with `yarn run watch`. 41 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2023, Salesforce.com, Inc. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 5 | 6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 7 | 8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 9 | 10 | * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 11 | 12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Salesforce CLI 2 | 3 | > **Warning** 4 | > The `sfdx` CLI entered maintenance mode on July 12th, 2023. Use `sf` instead at [salesforce/cli](https://github.com/salesforcecli/cli/). 5 | > 6 | > Check out [this blog post](https://developer.salesforce.com/blogs/2023/07/salesforce-cli-sf-v2-is-here) for information and context about this change. 7 | > See the [Move from sfdx (v7) to sf (v2)](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_move_to_sf_v2.htm) section of the Salesforce CLI Setup Guide for details on how to make the switch. 8 | 9 | --- 10 | 11 | This ~~is~~ was the latest `sfdx` CLI application, based on the 12 | [oclif](https://oclif.io) CLI engine. By default it comes installed with various plugins. 13 | 14 | ## Releases 15 | 16 | We publish the `latest` CLI on Thursdays. At the same time we also publish the `latest-rc` release candidate CLI. The release candidates contain changes that will likely be in the final official version for the next release. 17 | To Install the `latest-rc` version, run `npm install sfdx-cli@latest-rc`. We suggest having your CI/CD pipeline use the `latest-rc` in addition to the `latest` release tags. 18 | 19 | Run `sfdx version` to display the version of Salesforce CLI installed on your computer. Run `sfdx plugins --core` to display the versions of the installed plug-ins. 20 | 21 | Run `sfdx update` to update the CLI to the latest available version. 22 | 23 | ## Installation 24 | 25 | You can install this by either using an OS-specific installer [available here](https://developer.salesforce.com/tools/sfdxcli), by directly installing it with `npm` or `yarn` (see the instructions below). 26 | 27 | ### Installing with `npm` or `yarn` 28 | 29 | To get started, you'll need to install `node` v12 or greater, though we recommend using the latest v14 (LTS) for the best experience. While this can be done using an installer from [nodejs.com](nodejs.com) or via an OS-specific package manager, we recommend using [nvm](https://github.com/creationix/nvm) to easily manage multiple `node` versions. 30 | 31 | If using `nvm`, be sure that you've selected the appropriate version with something like `nvm use v14.x.y`, where `x` and `y` are specific to the version that you installed. If you want to use this version by default run `nvm alias default node` -- otherwise, when you restart your shell `nvm` will revert to whatever version configured prior to installing the latest. 32 | 33 | ### `npm` 34 | 35 | `npm` is installed automatically with Node.js. Install the CLI using `npm` as follows: 36 | 37 | ```bash 38 | > npm install --global sfdx-cli 39 | ``` 40 | 41 | ### `yarn` 42 | 43 | `yarn` is another popular Node.js package manager that can be used to install the CLI, but it needs to be [installed separately](https://yarnpkg.com/en/docs/install) from Node.js if you choose to use it. 44 | 45 | Note that by default `yarn` will attempt to install the binary in a location that may conflict with the location used by the installers, so you may additionally want to run the following command to avoid collision should you want to maintain two separate installations: `yarn config set prefix ~/.yarn` (macOS and Linux). Then, use the following: 46 | 47 | ```bash 48 | > yarn global add sfdx-cli 49 | ``` 50 | 51 | ### Docker Images 52 | 53 | We provide versioned images on dockerhub. They come in 2 flavors 54 | 55 | 1. `slim` is just the CLI installed using the installer for linux and openjdk11 56 | 2. `full` includes other utilities and a full node/npm installation 57 | 58 | Interactive Example 59 | 60 | ```bash 61 | # choose a tag to pull and run 62 | docker pull salesforce/salesforcedx:latest-rc-slim 63 | docker run -it salesforce/salesforcedx:latest-rc-slim 64 | 65 | # then run any sfdx command you like 66 | sfdx version 67 | 68 | # when done, type exit to leave the container 69 | exit 70 | 71 | ``` 72 | 73 | Remote Execution Example 74 | 75 | ```bash 76 | # using the ID of a running container, execute some command like "sfdx version" 77 | docker exec -it 8b1e2696a243 bin/bash sfdx version 78 | 79 | 80 | 81 | ``` 82 | 83 | ## Development 84 | 85 | If you would like to contribute, please see also the internal [developer documentation](./DEVELOPER.md). 86 | -------------------------------------------------------------------------------- /RELEASE.md: -------------------------------------------------------------------------------- 1 | # Building and releasing CLI installers 2 | 3 | Build and release of the CLI platform and standalone installers (which double as updater tarballs) are controlled by the use of `oclif` pack and upload commands. 4 | 5 | ## Build and/or release scripts 6 | 7 | The most useful scripts can be run from `yarn`. Look in the package.json for `pack` commands. 8 | 9 | ## Local build requirements 10 | 11 | In order to run pack locally on macOS, you'll need the following: 12 | 13 | - Xcode 14 | - p7zip (`brew install p7zip`) 15 | - [optional] osslsigncode (`brew install osslsigncode`) 16 | - [optional] makensis (`brew install makensis`) 17 | 18 | ## Build verification checks 19 | 20 | The `script/verify-tarballs` script contains several sanity checks that ensure we don't repeat build errors that have been shipped to customers in the past. These simply check for known regressions and fail the build should any recur, so they are mostly reactive checks rather than proactive ones. The one proactive check built into this script, however, checks for suspected regressions in Windows path lengths in the candidate release artifacts. 21 | 22 | Any known regressions in CLI artifact stability should have verification tests added here to help ensure they don't recur in the future. 23 | 24 | ## Archive and installer Overview 25 | 26 | TODO 27 | 28 | ### Homebrew 29 | 30 | While we'd like to create a Homebrew installer, this work is not currently a priority. 31 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | ## Security 2 | 3 | Please report any security issue to [security@salesforce.com](mailto:security@salesforce.com) 4 | as soon as it is discovered. This library limits its runtime dependencies in 5 | order to reduce the total cost of ownership as much as can be, but all consumers 6 | should remain vigilant and have their security stakeholders review all third-party 7 | products (3PP) like this one and their dependencies. 8 | -------------------------------------------------------------------------------- /bin/dev.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | if [[ -z "${SFDX_ENV:-}" ]]; then export SFDX_ENV=development; fi 5 | if [[ -z "${NODE_ENV:-}" ]]; then export NODE_ENV=development; fi 6 | 7 | DIR="$(cd "$(dirname "$0")" && pwd)" 8 | 9 | "$DIR/run.sh" "$@" 10 | -------------------------------------------------------------------------------- /bin/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Since the CLI is a single process, we can have a larger amount of max listeners since 4 | // the process gets shut down. Don't set it to 0 (no limit) since we should still be aware 5 | // of rouge event listeners 6 | process.setMaxListeners(parseInt(process.env.SFDX_MAX_EVENT_LISTENERS, 10) || 1000); 7 | 8 | // Don't let other plugins override the CLI specified max listener count 9 | process.setMaxListeners = () => {}; 10 | 11 | // Check node version before requiring additional packages 12 | require('../dist/versions').checkNodeVersion(); 13 | 14 | // Pre-process/prune flags before creating or running the actual CLI 15 | require('../dist/flags').preprocessCliFlags(process); 16 | 17 | const cli = require('../dist/cli'); 18 | const pjson = require('../package.json'); 19 | 20 | // OVERRIDES gets replaced with particular values for binary builds, 21 | // but simply use defaults for npm and local invocations 22 | const overrides = { 23 | /* @OVERRIDES@ */ 24 | }; 25 | const version = overrides.version || pjson.version; 26 | const channel = overrides.channel || 'stable'; 27 | 28 | cli 29 | .create(version, channel) 30 | .run() 31 | .then(function (result) { 32 | require('@oclif/core/flush')(); 33 | }) 34 | .catch(function (err) { 35 | require('@oclif/core/handle')(err); 36 | }); 37 | -------------------------------------------------------------------------------- /bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | setlocal enableextensions 3 | 4 | set SFDX_INSTALLER=false&set BIN_NAME=run 5 | REM @OVERRIDES@ 6 | 7 | for %%x in (%*) do ( 8 | if "%%~x"=="--dev-suspend" set DEV_SUSPEND=--inspect-brk 9 | ) 10 | 11 | set SFDX_BINPATH="%~dp0%BIN_NAME%.cmd" 12 | set LATEST_BINPATH="%LOCALAPPDATA%\%BIN_NAME%\client\bin\%BIN_NAME%.cmd" 13 | if "%SFDX_INSTALLER%"=="true" ( 14 | REM installer/update that shipped its own node binary 15 | set "UPDATED=" 16 | REM if redirected from a v7 script 17 | IF "%SFDX_REDIRECTED%" == "1" set UPDATED=1 18 | REM if redirected from a v6 script, or first install of a v7 update 19 | IF /I %LATEST_BINPATH% == %SFDX_BINPATH% set UPDATED=1 20 | IF defined UPDATED ( 21 | REM latest version installed by the autoupdater 22 | "%~dp0node.exe" %DEV_SUSPEND% "%~dp0%BIN_NAME%.js" %* 23 | ) else if exist %LATEST_BINPATH% ( 24 | REM if an autoupdater version exists and this is not it, run that instead 25 | %LATEST_BINPATH% %* 26 | ) else if exist "%~dp0..\client\bin\node.exe" ( 27 | REM installer version 28 | "%~dp0..\client\bin\node.exe" %DEV_SUSPEND% "%~dp0..\client\bin\%BIN_NAME%.js" %* 29 | ) else ( 30 | REM unpacked tarball version 31 | node %DEV_SUSPEND% "%~dp0%BIN_NAME%" %* 32 | ) 33 | ) else ( 34 | REM npm install or local dev 35 | node %DEV_SUSPEND% "%~dp0run" %* 36 | ) 37 | -------------------------------------------------------------------------------- /bin/run.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | echoerr() { echo "$@" 1>&2; } 5 | 6 | export SFDX_INSTALLER="false" BIN_NAME="run" 7 | # @OVERRIDES@ 8 | 9 | NODE_FLAGS=() 10 | 11 | # Process only cli flags that must be handled before invoking node 12 | for arg in "$@"; do 13 | case "$arg" in 14 | --dev-suspend) NODE_FLAGS+=("--inspect-brk");; 15 | --dev-debug) DEV_DEBUG=true;; 16 | esac 17 | done 18 | 19 | get_script_dir () { 20 | SOURCE="${BASH_SOURCE[0]}" 21 | # While $SOURCE is a symlink, resolve it 22 | while [[ -h "$SOURCE" ]]; do 23 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 24 | SOURCE="$( readlink "$SOURCE" )" 25 | # If $SOURCE was a relative symlink (so no "/" as prefix, need to resolve it relative to the symlink base directory 26 | [[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" 27 | done 28 | DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" 29 | echo "$DIR" 30 | } 31 | 32 | DIR=$(get_script_dir) 33 | CLI_HOME=$(cd && pwd) 34 | XDG_DATA_HOME="${XDG_DATA_HOME:="$CLI_HOME/.local/share"}" 35 | BIN_DIR="$XDG_DATA_HOME/$BIN_NAME/client/bin" 36 | 37 | if [[ "$SFDX_REDIRECTED" != "1" && "${SFDX_INSTALLER:-}" == "true" && -x "$BIN_DIR/$BIN_NAME" && ! "$BIN_DIR" -ef "$DIR" ]]; then 38 | if [[ "$DEV_DEBUG" == "true" ]]; then 39 | echoerr "Executing:" "$XDG_DATA_HOME/$BIN_NAME/client/bin/$BIN_NAME" "$@" 40 | fi 41 | "$XDG_DATA_HOME/$BIN_NAME/client/bin/$BIN_NAME" "$@" 42 | else 43 | MAIN_NAME="$BIN_NAME" 44 | NODE_PATH="node" 45 | if [[ "${SFDX_INSTALLER:-}" == "true" ]]; then 46 | MAIN_NAME="$MAIN_NAME.js" 47 | NODE_PATH="$DIR/$NODE_PATH" 48 | elif [[ -x "$(command -v node)" ]]; then 49 | NODE_PATH=node 50 | else 51 | echoerr 'Error: node is not installed.' >&2 52 | exit 1 53 | fi 54 | if [[ "$DEV_DEBUG" == "true" ]]; then 55 | echoerr "Executing:" "SFDX_BINPATH=$DIR/$BIN_NAME" "$NODE_PATH" "${NODE_FLAGS[@]}" "$DIR/$MAIN_NAME" "$@" 56 | fi 57 | SFDX_BINPATH="$DIR/$BIN_NAME" "$NODE_PATH" "${NODE_FLAGS[@]}" "$DIR/$MAIN_NAME" "$@" 58 | fi 59 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { extends: ['@commitlint/config-conventional'] }; 2 | -------------------------------------------------------------------------------- /dockerfiles/Dockerfile_full: -------------------------------------------------------------------------------- 1 | FROM heroku/heroku:20 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | ARG SALESFORCE_CLI_VERSION=nightly 5 | # this will typically be nightly 6 | ARG SF_CLI_VERSION=^1 7 | 8 | RUN echo 'b298a73a9fc07badfa9e4a2e86ed48824fc9201327cdc43e3f3f58b273c535e7 ./nodejs.tar.gz' > node-file-lock.sha \ 9 | && curl -s -o nodejs.tar.gz https://nodejs.org/dist/v18.15.0/node-v18.15.0-linux-x64.tar.gz \ 10 | && shasum --check node-file-lock.sha 11 | RUN mkdir /usr/local/lib/nodejs \ 12 | && tar xf nodejs.tar.gz -C /usr/local/lib/nodejs/ --strip-components 1 \ 13 | && rm nodejs.tar.gz node-file-lock.sha 14 | 15 | ENV PATH=/usr/local/lib/nodejs/bin:$PATH 16 | RUN npm install --global sfdx-cli@${SALESFORCE_CLI_VERSION} --ignore-scripts 17 | RUN npm install --global @salesforce/cli@${SF_CLI_VERSION} 18 | 19 | RUN apt-get update && apt-get install --assume-yes openjdk-11-jdk-headless jq 20 | RUN apt-get autoremove --assume-yes \ 21 | && apt-get clean --assume-yes \ 22 | && rm -rf /var/lib/apt/lists/* 23 | 24 | ENV SFDX_CONTAINER_MODE true 25 | ENV DEBIAN_FRONTEND=dialog 26 | ENV SHELL /bin/bash 27 | -------------------------------------------------------------------------------- /dockerfiles/Dockerfile_slim: -------------------------------------------------------------------------------- 1 | FROM heroku/heroku:20 2 | 3 | ENV DEBIAN_FRONTEND=noninteractive 4 | ARG DOWNLOAD_URL=https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/nightly/sfdx-linux-x64.tar.xz 5 | RUN apt-get update 6 | # install cli from linux tarball with bundled node 7 | RUN curl -s $DOWNLOAD_URL --output sfdx-linux-x64.tar.xz \ 8 | && mkdir -p /usr/local/sfdx \ 9 | && tar xJf sfdx-linux-x64.tar.xz -C /usr/local/sfdx --strip-components 1 \ 10 | && rm sfdx-linux-x64.tar.xz 11 | 12 | RUN apt-get install --assume-yes \ 13 | openjdk-11-jdk-headless 14 | 15 | RUN apt-get autoremove --assume-yes \ 16 | && apt-get clean --assume-yes \ 17 | && rm -rf /var/lib/apt/lists/* 18 | 19 | ENV PATH="/usr/local/sfdx/bin:$PATH" 20 | ENV SFDX_CONTAINER_MODE true 21 | ENV DEBIAN_FRONTEND=dialog 22 | ENV SHELL /bin/bash 23 | -------------------------------------------------------------------------------- /dockerfiles/UpdatingNodeVersion.md: -------------------------------------------------------------------------------- 1 | ## How Do I Create a New Hash for CI Validation? 2 | 3 | > NOTE: This process is now automated in the 'update-docker-node-version.yml' Github Action 4 | 5 | ### Manual steps: 6 | 7 | With NodeJs as an example. 8 | 9 | 1. [Download](https://nodejs.org/dist/) the file you wish to validate 10 | ex `curl -s -o nodejs.tar.gz https://nodejs.org/dist/v12.18.2/node-v12.18.2-linux-x64.tar.gz` 11 | 12 | 1. Use [shasum](https://ss64.com/osx/shasum.html) to generate a hash for the downloaded file. 13 | `shasum -a 256 ./nodejs.tar.gz` 14 | 15 | 1. Replace reference to the hash and file name in the Dockerfile with the output of step 2. Make sure you update all references to the old version of node and the url in the `curl` command. 16 | -------------------------------------------------------------------------------- /dockerfiles/update-docker-node-version.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | const got = require('got'); 9 | const fs = require('fs').promises; 10 | const path = require('path'); 11 | 12 | const { promisify } = require('node:util'); 13 | const { exec: execSync } = require('child_process'); 14 | const execPromise = promisify(execSync); 15 | 16 | (async () => { 17 | // Get the node version from `process.versions` 18 | // Note that in GHA, this can be overwritten with the TARBALL_NODE_VERSION variable 19 | // https://github.com/salesforcecli/sfdx-cli/settings/variables/actions 20 | 21 | // This matches the default for oclif tarball node versions 22 | // https://github.com/oclif/oclif/blob/main/src/tarballs/config.ts#L56 23 | const nodeVersion = process.versions.node; 24 | 25 | // Example url: https://nodejs.org/dist/v18.15.0/ 26 | const url = `https://nodejs.org/dist/v${nodeVersion}/SHASUMS256.txt`; 27 | console.log('Retrieving SHA data from:', url); 28 | 29 | const distData = await got(url).text(); 30 | const distRegex = new RegExp(`^([A-z0-9]+) (node-(v${nodeVersion})-linux-x64.tar.gz)$`, 'm'); 31 | 32 | const [, sha, tar, version] = distRegex.exec(distData); 33 | 34 | console.log('Validating checksum...'); 35 | await validateCheckSum(sha, version, tar); 36 | console.log('Checksum matched.'); 37 | 38 | const filepath = path.join(__dirname, '../dockerfiles/Dockerfile_full'); 39 | let oldDockerfile; 40 | 41 | try { 42 | oldDockerfile = await fs.readFile(filepath, { encoding: 'utf8' }); 43 | } catch (error) { 44 | throw new Error(`Failed to open '${filepath}' while attempting to update NodeJS version.`, { cause: error }); 45 | } 46 | 47 | const runRegex = new RegExp("^RUN echo '[A-z0-9]+ ./nodejs.tar.gz'[\\s\\S]+ --check node-file-lock.sha$", 'm'); 48 | 49 | const runTemplate = `RUN echo '${sha} ./nodejs.tar.gz' > node-file-lock.sha \\ 50 | && curl -s -o nodejs.tar.gz https://nodejs.org/dist/${version}/${tar} \\ 51 | && shasum --check node-file-lock.sha`; 52 | 53 | const newDockerfile = oldDockerfile.replace(runRegex, runTemplate); 54 | 55 | try { 56 | await fs.writeFile(filepath, newDockerfile); 57 | } catch (error) { 58 | throw new Error(`Updating NodeJS version in '${filepath}' failed`, { cause: error }); 59 | } 60 | 61 | console.log('Dockerfile NodeJS version update complete.'); 62 | })(); 63 | 64 | const validateCheckSum = async (sha, version, tar) => { 65 | const exec = async (command) => { 66 | try { 67 | return await ( 68 | await execPromise(command) 69 | ).stdout; 70 | } catch (error) { 71 | console.log(error.stdout); 72 | throw new Error(error.message); 73 | } 74 | }; 75 | 76 | await exec(`curl -s --create-dirs -o tmp/nodejs.tar.gz https://nodejs.org/dist/${version}/${tar}`); 77 | await exec(`echo "${sha} *tmp/nodejs.tar.gz" | shasum -c`); 78 | }; 79 | -------------------------------------------------------------------------------- /messages/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "HelpDefaults": "If not supplied, the apiversion, template, and outputdir use default values.\n", 3 | "HelpOutputDirRelative": "The outputdir can be an absolute path or relative to the current working directory.\n", 4 | "HelpOutputDirRelativeLightning": "If you don’t specify an outputdir, we create a subfolder in your current working directory with the name of your bundle. For example, if the current working directory is force-app and your Lightning bundle is called myBundle, we create force-app/myBundle/ to store the files in the bundle.\n", 5 | "HelpExamplesTitle": "\nExamples:\n", 6 | "OutputDirFlagDescription": "folder for saving the created files", 7 | "OutputDirFlagLongDescription": "The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The default is the current directory.", 8 | "TemplateFlagDescription": "template to use for file creation", 9 | "TemplateFlagLongDescription": "The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.", 10 | "TargetDirOutput": "target dir = %s", 11 | "App": "app", 12 | "Event": "event", 13 | "Interface": "interface", 14 | "Test": "test", 15 | "Component": "component", 16 | "Page": "page", 17 | 18 | "AlphaNumericNameError": "Name must contain only alphanumeric characters.", 19 | "NameMustStartWithLetterError": "Name must start with a letter.", 20 | "EndWithUnderscoreError": "Name can't end with an underscore.", 21 | "DoubleUnderscoreError": "Name can't contain 2 consecutive underscores." 22 | } 23 | -------------------------------------------------------------------------------- /messages/org.json: -------------------------------------------------------------------------------- 1 | { 2 | "commandDescription": "print a greeting and your org IDs", 3 | "nameFlagDescription": "name to print", 4 | "forceFlagDescription": "example boolean flag", 5 | "errorNoOrgResults": "No results found for the org '%s'." 6 | } 7 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sfdx-cli", 3 | "description": "Salesforce CLI", 4 | "version": "7.209.6", 5 | "author": "Salesforce", 6 | "license": "BSD-3-Clause", 7 | "bugs": "https://github.com/forcedotcom/cli/issues", 8 | "homepage": "https://github.com/salesforcecli/sfdx-cli/", 9 | "repository": "salesforcecli/sfdx-cli", 10 | "bin": { 11 | "sfdx": "bin/run" 12 | }, 13 | "engines": { 14 | "node": ">=16.0.0" 15 | }, 16 | "files": [ 17 | "bin", 18 | "oclif.manifest.json", 19 | "dist/**/*.js", 20 | "scripts/include-sf.js", 21 | "scripts/determine-sf-version.js", 22 | "scripts/post-install-release-notes.js", 23 | "!dist/**/*.test.js", 24 | "/npm-shrinkwrap.json" 25 | ], 26 | "oclif": { 27 | "bin": "sfdx", 28 | "scope": "salesforce", 29 | "commands": "./dist/commands", 30 | "topicSeparator": " ", 31 | "flexibleTaxonomy": true, 32 | "helpClass": "./dist/help/sfdxHelp.js", 33 | "dirname": "sfdx", 34 | "additionalVersionFlags": [ 35 | "-v" 36 | ], 37 | "additionalHelpFlags": [ 38 | "-h" 39 | ], 40 | "hooks": { 41 | "command_incomplete": [ 42 | "./dist/hooks/incomplete" 43 | ], 44 | "plugins:preinstall": [ 45 | "./dist/hooks/pluginsPreinstall.js" 46 | ], 47 | "plugins:preinstall:verify:version": [ 48 | "./dist/hooks/verifyPluginVersion.js" 49 | ], 50 | "preupdate": [ 51 | "./dist/hooks/preupdate.js" 52 | ], 53 | "update": [ 54 | "./dist/hooks/postupdate.js", 55 | "./dist/hooks/displayReleaseNotes.js", 56 | "./dist/hooks/salesforcedx-check.js" 57 | ] 58 | }, 59 | "plugins": [ 60 | "@oclif/plugin-autocomplete", 61 | "@oclif/plugin-commands", 62 | "@oclif/plugin-help", 63 | "@oclif/plugin-version", 64 | "@oclif/plugin-not-found", 65 | "@oclif/plugin-plugins", 66 | "@oclif/plugin-search", 67 | "@oclif/plugin-update", 68 | "@oclif/plugin-warn-if-update-available", 69 | "@oclif/plugin-which", 70 | "@salesforce/plugin-apex", 71 | "@salesforce/plugin-auth", 72 | "@salesforce/plugin-community", 73 | "@salesforce/plugin-custom-metadata", 74 | "@salesforce/plugin-data", 75 | "@salesforce/plugin-deploy-retrieve", 76 | "@salesforce/plugin-info", 77 | "@salesforce/plugin-limits", 78 | "@salesforce/plugin-org", 79 | "@salesforce/plugin-packaging", 80 | "@salesforce/plugin-settings", 81 | "@salesforce/plugin-signups", 82 | "@salesforce/plugin-source", 83 | "@salesforce/plugin-schema", 84 | "@salesforce/plugin-telemetry", 85 | "@salesforce/plugin-templates", 86 | "@salesforce/plugin-trust", 87 | "@salesforce/plugin-user" 88 | ], 89 | "jitPlugins": { 90 | "@salesforce/plugin-sobject": "0.1.32", 91 | "@salesforce/plugin-dev": "0.7.13", 92 | "@salesforce/sfdx-plugin-lwc-test": "1.0.2", 93 | "@salesforce/sfdx-scanner": "3.13.0" 94 | }, 95 | "devPlugins": [ 96 | "@oclif/plugin-command-snapshot", 97 | "@salesforce/plugin-release-management" 98 | ], 99 | "update": { 100 | "s3": { 101 | "bucket": "dfc-data-production", 102 | "indexVersionLimit": 140, 103 | "folder": "media/salesforce-cli/sfdx", 104 | "acl": " ", 105 | "host": "https://developer.salesforce.com" 106 | } 107 | }, 108 | "info": { 109 | "releasenotes": { 110 | "distTagUrl": "https://registry.npmjs.org/-/package/sfdx-cli/dist-tags", 111 | "releaseNotesPath": "https://github.com/forcedotcom/cli/tree/main/releasenotes/sfdx", 112 | "releaseNotesFilename": "README.md" 113 | } 114 | }, 115 | "macos": { 116 | "identifier": "com.salesforce.cli" 117 | }, 118 | "windows": { 119 | "name": "Salesforce CLI", 120 | "keypath": "/tmp/windows-signing.pfx" 121 | } 122 | }, 123 | "pinnedDependencies": [ 124 | "@oclif/core", 125 | "@oclif/plugin-autocomplete", 126 | "@oclif/plugin-commands", 127 | "@oclif/plugin-help", 128 | "@oclif/plugin-not-found", 129 | "@oclif/plugin-plugins", 130 | "@oclif/plugin-search", 131 | "@oclif/plugin-update", 132 | "@oclif/plugin-version", 133 | "@oclif/plugin-warn-if-update-available", 134 | "@oclif/plugin-which", 135 | "@salesforce/kit", 136 | "@salesforce/plugin-apex", 137 | "@salesforce/plugin-auth", 138 | "@salesforce/plugin-community", 139 | "@salesforce/plugin-custom-metadata", 140 | "@salesforce/plugin-data", 141 | "@salesforce/plugin-deploy-retrieve", 142 | "@salesforce/plugin-info", 143 | "@salesforce/plugin-limits", 144 | "@salesforce/plugin-org", 145 | "@salesforce/plugin-packaging", 146 | "@salesforce/plugin-schema", 147 | "@salesforce/plugin-settings", 148 | "@salesforce/plugin-signups", 149 | "@salesforce/plugin-source", 150 | "@salesforce/plugin-telemetry", 151 | "@salesforce/plugin-templates", 152 | "@salesforce/plugin-trust", 153 | "@salesforce/plugin-user", 154 | "@salesforce/sf-plugins-core", 155 | "@salesforce/ts-types" 156 | ], 157 | "dependencies": { 158 | "@oclif/core": "2.8.11", 159 | "@oclif/plugin-autocomplete": "2.3.1", 160 | "@oclif/plugin-commands": "2.2.17", 161 | "@oclif/plugin-help": "5.2.11", 162 | "@oclif/plugin-not-found": "2.3.26", 163 | "@oclif/plugin-plugins": "3.1.6", 164 | "@oclif/plugin-search": "0.0.18", 165 | "@oclif/plugin-update": "3.1.22", 166 | "@oclif/plugin-version": "1.3.6", 167 | "@oclif/plugin-warn-if-update-available": "2.0.41", 168 | "@oclif/plugin-which": "2.2.22", 169 | "@salesforce/core": "^4.3.5", 170 | "@salesforce/kit": "3.0.4", 171 | "@salesforce/plugin-apex": "2.3.4", 172 | "@salesforce/plugin-auth": "2.8.4", 173 | "@salesforce/plugin-community": "2.3.5", 174 | "@salesforce/plugin-custom-metadata": "2.1.30", 175 | "@salesforce/plugin-data": "2.4.5", 176 | "@salesforce/plugin-deploy-retrieve": "1.13.5", 177 | "@salesforce/plugin-info": "2.6.30", 178 | "@salesforce/plugin-limits": "2.3.23", 179 | "@salesforce/plugin-org": "2.9.19", 180 | "@salesforce/plugin-packaging": "1.20.1", 181 | "@salesforce/plugin-schema": "2.3.17", 182 | "@salesforce/plugin-settings": "1.4.17", 183 | "@salesforce/plugin-signups": "1.4.22", 184 | "@salesforce/plugin-source": "2.10.22", 185 | "@salesforce/plugin-telemetry": "2.2.1", 186 | "@salesforce/plugin-templates": "55.5.2", 187 | "@salesforce/plugin-trust": "2.4.27", 188 | "@salesforce/plugin-user": "2.3.20", 189 | "@salesforce/sf-plugins-core": "3.1.4", 190 | "@salesforce/ts-types": "2.0.4", 191 | "debug": "^4.3.4", 192 | "tslib": "^2.4.1" 193 | }, 194 | "devDependencies": { 195 | "@oclif/plugin-command-snapshot": "^4.0.2", 196 | "@salesforce/dev-config": "^4.0.1", 197 | "@salesforce/dev-scripts": "^5", 198 | "@salesforce/plugin-release-management": "^3.16.4", 199 | "@salesforce/prettier-config": "^0.0.3", 200 | "@salesforce/ts-sinon": "^1.4.2", 201 | "@types/debug": "^4.1.7", 202 | "@types/fs-extra": "^9.0.13", 203 | "@types/inquirer": "^9.0.3", 204 | "@types/request": "^2.48.8", 205 | "@types/shelljs": "^0.8.11", 206 | "@typescript-eslint/eslint-plugin": "^5.45.0", 207 | "@typescript-eslint/parser": "^5.45.0", 208 | "aws-sdk": "^2.1265.0", 209 | "chai": "^4.3.7", 210 | "check-yarn-lock": "^0.2.1", 211 | "eslint": "^8.41.0", 212 | "eslint-config-airbnb-base": "~5.0.3", 213 | "eslint-config-prettier": "^8.8.0", 214 | "eslint-config-salesforce": "^2.0.1", 215 | "eslint-config-salesforce-license": "^0.2.0", 216 | "eslint-config-salesforce-typescript": "^1.1.1", 217 | "eslint-plugin-header": "^3.1.1", 218 | "eslint-plugin-import": "2.27.5", 219 | "eslint-plugin-jsdoc": "^43.0.5", 220 | "globby": "^11.1.0", 221 | "got": "^11.8.5", 222 | "husky": "^7.0.4", 223 | "mocha": "^9.2.2", 224 | "npm": "^8.19.3", 225 | "nyc": "^15.1.0", 226 | "oclif": "^3.9.0", 227 | "prettier": "^2.8.4", 228 | "pretty-quick": "^3.1.3", 229 | "shelljs": "^0.8.5", 230 | "shx": "^0.3.4", 231 | "sinon": "10.0.0", 232 | "ts-node": "^10.9.1", 233 | "typescript": "^4.9.5", 234 | "wireit": "^0.9.5" 235 | }, 236 | "resolutions": { 237 | "@salesforce/schemas": "1.6.0", 238 | "@salesforce/source-deploy-retrieve": "9.3.0", 239 | "@salesforce/source-tracking": "4.2.4", 240 | "@salesforce/templates": "58.0.1" 241 | }, 242 | "scripts": { 243 | "build": "wireit", 244 | "channel:promote": "sf-release channel:promote", 245 | "clean": "shx rm -rf dist tmp", 246 | "clean-all": "sf-clean all", 247 | "compile": "wireit", 248 | "docs": "sf-docs", 249 | "format": "wireit", 250 | "lint": "wireit", 251 | "oclif-artifacts": "oclif manifest .", 252 | "pack:deb": "oclif pack:deb", 253 | "pack:macos": "oclif pack:macos --additional-cli sf", 254 | "pack:tarballs": "oclif pack:tarballs --xz --parallel", 255 | "pack:tarballs:sequential": "oclif pack:tarballs --xz", 256 | "pack:verify": "sf-release cli:tarballs:verify", 257 | "pack:win": "oclif pack:win --additional-cli sf", 258 | "postinstall": "node ./scripts/post-install-release-notes.js", 259 | "postpack": "shx rm -f oclif.manifest.json npm-shrinkwrap.json", 260 | "prepack": "yarn compile && yarn lint && yarn oclif-artifacts", 261 | "prepare": "sf-install && yarn compile && yarn lint", 262 | "prepublishOnly": "npm shrinkwrap", 263 | "pretarball": "sf-release cli:tarballs:prepare && ./scripts/include-sf.js", 264 | "promote": "oclif promote", 265 | "snapshot-compare": "HOME=./ ./bin/run snapshot:compare", 266 | "snapshot-generate": "HOME=./ ./bin/run snapshot:generate", 267 | "test": "nyc mocha --recursive \"test/**/*.test.ts\" --report lcov --report cobertura -t 240000 --require source-map-support/register", 268 | "test-smoke-unix": "sf-release cli:tarballs:smoke --cli sfdx", 269 | "test:only": "wireit", 270 | "test:smoke-unix": "sf-release cli:tarballs:smoke --cli sfdx", 271 | "trogdor": "yarn clean-all && yarn && yarn compile && yarn uts", 272 | "upload:deb": "oclif upload:deb", 273 | "upload:macos": "oclif upload:macos", 274 | "upload:tarballs": "oclif upload:tarballs --xz", 275 | "upload:win": "oclif upload:win", 276 | "uts": "nyc mocha --require source-map-support/register --recursive \"test/**/*.test.ts\"", 277 | "watch": "tsc -w -p tsconfig.json" 278 | }, 279 | "wireit": { 280 | "build": { 281 | "dependencies": [ 282 | "compile", 283 | "lint" 284 | ] 285 | }, 286 | "compile": { 287 | "command": "tsc -p . --pretty --incremental", 288 | "files": [ 289 | "src/**/*.ts", 290 | "**/tsconfig.json", 291 | "messages/**" 292 | ], 293 | "output": [ 294 | "lib/**", 295 | "*.tsbuildinfo" 296 | ], 297 | "clean": "if-file-deleted" 298 | }, 299 | "format": { 300 | "command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"", 301 | "files": [ 302 | "src/**/*.ts", 303 | "test/**/*.ts", 304 | "schemas/**/*.json", 305 | "command-snapshot.json", 306 | ".prettier*" 307 | ], 308 | "output": [] 309 | }, 310 | "lint": { 311 | "command": "eslint src test --color --cache --cache-location .eslintcache", 312 | "files": [ 313 | "src/**/*.ts", 314 | "test/**/*.ts", 315 | "messages/**", 316 | "**/.eslint*", 317 | "**/tsconfig.json" 318 | ], 319 | "output": [] 320 | }, 321 | "test:compile": { 322 | "command": "tsc -p \"./test\" --pretty", 323 | "files": [ 324 | "test/**/*.ts", 325 | "**/tsconfig.json" 326 | ], 327 | "output": [] 328 | }, 329 | "test": { 330 | "dependencies": [ 331 | "test:compile", 332 | "test:only", 333 | "test:command-reference", 334 | "test:deprecation-policy", 335 | "lint", 336 | "test:json-schema" 337 | ] 338 | }, 339 | "test:only": { 340 | "command": "nyc mocha \"test/**/*.test.ts\"", 341 | "env": { 342 | "FORCE_COLOR": "2" 343 | }, 344 | "files": [ 345 | "test/**/*.ts", 346 | "src/**/*.ts", 347 | "**/tsconfig.json", 348 | ".mocha*", 349 | "!*.nut.ts", 350 | ".nycrc" 351 | ], 352 | "output": [] 353 | }, 354 | "test:command-reference": { 355 | "command": "\"./bin/dev\" commandreference:generate --erroronwarnings", 356 | "files": [ 357 | "src/**/*.ts", 358 | "messages/**", 359 | "package.json" 360 | ], 361 | "output": [ 362 | "tmp/root" 363 | ] 364 | }, 365 | "test:deprecation-policy": { 366 | "command": "\"./bin/dev\" snapshot:compare", 367 | "files": [ 368 | "src/**/*.ts" 369 | ], 370 | "output": [], 371 | "dependencies": [ 372 | "compile" 373 | ] 374 | }, 375 | "test:json-schema": { 376 | "command": "\"./bin/dev\" schema:compare", 377 | "files": [ 378 | "src/**/*.ts", 379 | "schemas" 380 | ], 381 | "output": [] 382 | } 383 | } 384 | } 385 | -------------------------------------------------------------------------------- /schemas/salesforce-alm/schemas/scratchOrgDefinitionSchema.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json-schema.org/draft-04/schema#", 3 | "id": "scratchOrgDefinitionSchema", 4 | "type": "object", 5 | "title": "Scratch Org Definition", 6 | "description": "The properties and shape of the scratch org to be created", 7 | "properties": { 8 | "Company": { 9 | "type": "string", 10 | "title": "Company", 11 | "description": "The org's company name" 12 | }, 13 | "Country": { 14 | "type": "string", 15 | "title": "Country", 16 | "description": "The org's country" 17 | }, 18 | "LastName": { 19 | "type": "string", 20 | "title": "Last Name", 21 | "description": "The org's admin user's last name" 22 | }, 23 | "Email": { 24 | "type": "string", 25 | "title": "Signup Email", 26 | "description": "The org's signup email" 27 | }, 28 | "Username": { 29 | "type": "string", 30 | "title": "Username", 31 | "description": "The org's admin user's username" 32 | }, 33 | "Edition": { 34 | "type": "string", 35 | "title": "Edition", 36 | "description": "The org's edition; i.e. Developer, Enterprise, etc." 37 | }, 38 | "OrgPreferences": { 39 | "type": "object", 40 | "title": "Org Preferences", 41 | "description": "The org's preferences" 42 | }, 43 | "Features": { 44 | "type": "string", 45 | "title": "Features", 46 | "description": "The org's features" 47 | } 48 | }, 49 | "additionalProperties": false 50 | } 51 | -------------------------------------------------------------------------------- /scripts/checkSalesforceDx.ts: -------------------------------------------------------------------------------- 1 | import dxCheck from '../dist/hooks/salesforcedx-check.js'; 2 | 3 | dxCheck(); 4 | -------------------------------------------------------------------------------- /scripts/determine-sf-version.js: -------------------------------------------------------------------------------- 1 | const pjson = require('../package.json'); 2 | const shelljs = require('shelljs'); 3 | 4 | const getVersion = () => { 5 | // Now that `sf@2.x` is released, we will only ever bundle sf@legacy 6 | const sfVersion = shelljs.exec('npm view @salesforce/cli@legacy version --silent', { silent: true }).stdout.trim(); 7 | 8 | // Make sure that sfVersion is set and it does not start with 2 9 | if (!sfVersion) { 10 | throw new Error('Unable to determine the version of @salesforce/cli@legacy'); 11 | } 12 | 13 | if (sfVersion.startsWith('2')) { 14 | throw new Error(`@salesforce/cli@legacy version ${sfVersion} starts with 2. Only bundle 1.x versions.`); 15 | } 16 | 17 | // Leave this console.log so that we can pull this value from stdout when running this script from the command line 18 | console.log(sfVersion); 19 | return sfVersion; 20 | }; 21 | 22 | module.exports = { getVersion }; 23 | -------------------------------------------------------------------------------- /scripts/include-sf.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const path = require('path'); 4 | const shelljs = require('shelljs'); 5 | const fs = require('fs'); 6 | const { getVersion } = require('./determine-sf-version'); 7 | 8 | const sfVersion = getVersion(); 9 | shelljs.exec(`npm install @salesforce/cli@${sfVersion} -g`); 10 | 11 | const npmGlobalInstallPath = shelljs.exec('npm list -g --depth 0 | head -1').stdout.trim(); 12 | const sfGlobalPath = path.join(npmGlobalInstallPath, 'node_modules', '@salesforce', 'cli'); 13 | 14 | console.log(`---- Including SF ----`); 15 | console.log(` Moving sf from ${sfGlobalPath} to ./sf`); 16 | shelljs.mv('-f', sfGlobalPath, 'sf'); 17 | 18 | const sfUnixPath = 'sf/bin/run'; 19 | const sfBin = path.join('bin', 'sf'); 20 | const sfdxBin = path.join('bin', 'sfdx'); 21 | 22 | console.log(` Updating ${sfdxBin} with references to sf`); 23 | const binContents = fs 24 | .readFileSync(sfdxBin, 'UTF-8') 25 | .replace(/sfdx/g, 'sf') 26 | .replace(/sf\/client/g, 'sfdx/client') 27 | .replace(/SFDX/g, 'SF') 28 | .replace(/\$DIR\/run/g, `$(dirname $DIR)/${sfUnixPath}`); 29 | 30 | console.log(` Writing ${sfBin}`); 31 | fs.writeFileSync(sfBin, binContents); 32 | shelljs.chmod('+x', sfBin); 33 | 34 | const sfWinPath = 'sf\\bin\\run'; 35 | const sfCmd = path.join('bin', 'sf.cmd'); 36 | const sfdxCmd = path.join('bin', 'sfdx.cmd'); 37 | 38 | console.log(` Updating ${sfdxCmd} with references to sf`); 39 | const cmdContents = fs 40 | .readFileSync(sfdxCmd, 'UTF-8') 41 | .replace(/sfdx/g, 'sf') 42 | .replace(/sf\\client/g, 'sfdx/client') 43 | .replace(/SFDX/g, 'SF') 44 | .replace(/bin\\run/g, sfWinPath); 45 | 46 | console.log(` Writing ${sfCmd}`); 47 | fs.writeFileSync(sfCmd, cmdContents); 48 | 49 | console.log(`---- Finished ----`); 50 | -------------------------------------------------------------------------------- /scripts/post-install-release-notes.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const { spawn } = require('child_process'); 4 | const { join } = require('path'); 5 | 6 | if (process.env.SFDX_HIDE_RELEASE_NOTES === 'true') process.exit(0); 7 | 8 | const logAndExit = (msg) => { 9 | console.log('NOTE: This error can be ignored in CI and may be silenced in the future'); 10 | console.log('- Set the SFDX_HIDE_RELEASE_NOTES env var to "true" to skip this script\n'); 11 | console.log(msg.toString()); 12 | 13 | process.exit(0); 14 | }; 15 | 16 | /* 17 | * NOTE: Please read "Notes about the hook scripts" in this PR before making changes: 18 | * https://github.com/salesforcecli/sfdx-cli/pull/407 19 | */ 20 | 21 | var executable = process.platform === 'win32' ? 'run.cmd' : 'run'; 22 | 23 | var cmd = spawn(join(__dirname, '..', 'bin', executable), ['whatsnew', '--hook'], { 24 | stdio: ['ignore', 'inherit', 'pipe'], 25 | timeout: 10000, 26 | }); 27 | 28 | cmd.stderr.on('data', (error) => { 29 | logAndExit(error); 30 | }); 31 | 32 | cmd.on('error', (error) => { 33 | logAndExit(error); 34 | }); 35 | 36 | // 'exit' fires whether or not the stream are finished 37 | cmd.on('exit', (code) => { 38 | process.exit(0); 39 | }); 40 | -------------------------------------------------------------------------------- /scripts/promote-stable-rc-mac: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex 4 | 5 | channel="stable-rc" 6 | version=$(node -p -e "require('./package.json').version") 7 | sha=$(git rev-parse --short HEAD) 8 | echo "Promoting $version-$sha to channel $channel" 9 | # 300 = 5 minutes 10 | yarn promote --version $version --sha $sha --channel $channel --max-age 300 --macos 11 | -------------------------------------------------------------------------------- /scripts/promote-stable-rc-tarballs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex 4 | 5 | channel="stable-rc" 6 | version=$(node -p -e "require('./package.json').version") 7 | sha=$(git rev-parse --short HEAD) 8 | echo "Promoting $version-$sha to channel $channel" 9 | # 300 = 5 minutes 10 | yarn promote --version $version --sha $sha --channel $channel --max-age 300 --xz 11 | -------------------------------------------------------------------------------- /scripts/promote-stable-rc-win: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -ex 4 | 5 | channel="stable-rc" 6 | version=$(node -p -e "require('./package.json').version") 7 | sha=$(git rev-parse --short HEAD) 8 | echo "Promoting $version-$sha to channel $channel" 9 | # 300 = 5 minutes 10 | yarn promote --version $version --sha $sha --channel $channel --max-age 300 --win 11 | -------------------------------------------------------------------------------- /scripts/verify-promote: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # This script runs right after a promote when the versions of the two channels should match 4 | 5 | if (( $# != 2 )); then 6 | echo "The 'verify-promote' script requires two args, the 'old channel' and 'new channel'. Example: latest-rc latest" && exit 1; 7 | fi 8 | 9 | OLD_CHANNEL=$1 10 | NEW_CHANNEL=$2 11 | 12 | function banner() { 13 | LENGTH=$(echo -n "$1" | wc -c | sed s/\ //g) 14 | CHAR=$(for (( i = 0; i < "$LENGTH"; ++i )); do echo -n "="; done) 15 | 16 | printf "\n%s\n%s\n%s\n" "$CHAR" "$1" "$CHAR" 17 | } 18 | 19 | # latest-rc to OLD_CHANNEL 20 | # latest to NEW_CHANNEL 21 | # $LATEST to $NEW_VERSION 22 | 23 | # Versions for the old and new channels should match after promotion 24 | banner "Verifying promote of npm dist tags: $OLD_CHANNEL -> $NEW_CHANNEL" 25 | TAGS=$(npm view sfdx-cli --json | jq -cr '."dist-tags"') 26 | 27 | OLD_VERSION=$(echo "$TAGS" | jq -cr ".\"$OLD_CHANNEL\"") 28 | echo "-> Npm dist-tag version for '$OLD_CHANNEL' is: $OLD_VERSION" # was $LATEST_RC 29 | 30 | NEW_VERSION=$(echo "$TAGS" | jq -cr ".\"$NEW_CHANNEL\"") 31 | echo "-> Npm dist-tag version for '$NEW_CHANNEL' is: $NEW_VERSION" # was $LATEST 32 | 33 | if [ "$NEW_VERSION" != "$OLD_VERSION" ]; then 34 | echo "!! Versions for '$OLD_CHANNEL' and '$NEW_CHANNEL' do not match, exiting." 35 | exit 1 36 | fi 37 | 38 | 39 | # S3 artifacts and npm should agree on the new version 40 | # buildmanifest version matches npm dist-tag for the new channel 41 | banner "Verifying promote of aws s3 bucket channels: $OLD_CHANNEL -> $NEW_CHANNEL" 42 | 43 | # Translate 'latest -> stable' and 'latest-rc -> stable-rc' for finding resources in S3 44 | # Otherwise no replacement will be made and we will used what is passed. For example: nightly 45 | S3_OLD_CHANNEL=${OLD_CHANNEL/latest/stable} 46 | echo "-> INFO: Using '$S3_OLD_CHANNEL' channel in S3 url" 47 | 48 | MANIFEST_URL="https://developer.salesforce.com/media/salesforce-cli/sfdx/channels/$S3_OLD_CHANNEL/sfdx-darwin-x64-buildmanifest" 49 | OLD_MANIFEST_VERSION=$(curl -s "$MANIFEST_URL" | jq -cr '.version') 50 | echo "-> S3 manifest version for '$S3_OLD_CHANNEL' is: $OLD_VERSION" 51 | 52 | # Version from NPM 53 | echo "-> Npm dist-tag version for '$NEW_CHANNEL' is: $NEW_VERSION" 54 | 55 | if [ "$NEW_VERSION" != "$OLD_MANIFEST_VERSION" ]; then 56 | echo "!! Versions for '$S3_OLD_CHANNEL' in S3 and '$NEW_CHANNEL' on npm do not match, exiting." 57 | exit 1 58 | fi 59 | 60 | # Uncomment for testing on a M1 Mac 61 | # VERSIONS_URL="https://developer.salesforce.com/media/salesforce-cli/sfdx/versions/sfdx-darwin-arm64-tar-xz.json" 62 | VERSIONS_URL="https://developer.salesforce.com/media/salesforce-cli/sfdx/versions/sfdx-linux-x64-tar-xz.json" 63 | VERSION_CONTENT=$(curl -s "$VERSIONS_URL" | jq -cr) 64 | 65 | 66 | banner "Verify that the versions file contains: $NEW_VERSION" 67 | 68 | GREP_RESULTS=$(echo "$VERSION_CONTENT" | grep "$NEW_VERSION") 69 | 70 | echo "-> Match in verion file: $GREP_RESULTS" 71 | 72 | if [ -z "$GREP_RESULTS" ]; then 73 | echo "!! Versions file does not contain '$NEW_VERSION', exiting." 74 | exit 1 75 | fi 76 | 77 | # In the next few checks, we verify that the new channel's version matches the coresponding channel's npm dist-tag 78 | 79 | banner "Verify npm cli install, smoke, version, and uninstall" 80 | 81 | npm install -g "sfdx-cli@$NEW_CHANNEL" --no-cache 82 | # smoke tests 83 | sfdx version 84 | sfdx help 85 | sfdx plugins --core 86 | 87 | NPM_CLI_VERSION=$(sfdx version --json | jq -cr '.cliVersion' | sed 's/sfdx-cli\///') 88 | echo "-> Npm installed version for '$NEW_CHANNEL' is: $NPM_CLI_VERSION" 89 | 90 | echo "-> Npm dist-tag version for '$NEW_CHANNEL' is: $NEW_VERSION" 91 | 92 | if [ "$NEW_VERSION" != "$NPM_CLI_VERSION" ]; then 93 | echo "!! Npm installed version does not match dist-tag version for '$NEW_CHANNEL', exiting." 94 | exit 1 95 | fi 96 | # cleanup 97 | npm uninstall -g sfdx-cli 98 | 99 | 100 | # install an older version from installer and then upgrade it to the NEW_CHANNEL version 101 | banner "Verify tarball install and that 'sfdx update $NEW_CHANNEL' version matches '$NEW_VERSION'" 102 | 103 | # download and untar 104 | 105 | # ----------------- 106 | # !!! IMPORTANT !!! 107 | # ----------------- 108 | # If you are testing this locally, you'll need to use a tarball built for your OS 109 | # There is a VERSIONS_URL for M1 macs above that you can uncomment 110 | # Other URLs can be found here: https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm#sfdx_setup_install_cli_olderversions 111 | OLDER_VERSION_URL=$(echo "$VERSION_CONTENT" | jq 'to_entries[7]' | jq -r '.value') 112 | echo "Downloading old cli version from: $OLDER_VERSION_URL" 113 | 114 | if [[ -d "$HOME/sfdx" ]]; then 115 | echo "!! $HOME/sfdx directory already exists. Delete it and try again." && exit 1 116 | fi 117 | 118 | curl -s "$OLDER_VERSION_URL" --output sfdx-tarball.tar.xz && mkdir "$HOME/sfdx" && tar xJf sfdx-tarball.tar.xz -C "$HOME/sfdx" --strip-components 1 && rm sfdx-tarball.tar.xz 119 | export PATH="$HOME/sfdx/bin:$PATH" 120 | 121 | # Translate 'latest -> stable' and 'latest-rc -> stable-rc' for finding resources in S3 122 | # Otherwise no replacement will be made and we will used what is passed. For example: nightly 123 | S3_NEW_CHANNEL=${NEW_CHANNEL/latest/stable} 124 | echo "-> INFO: Using '$S3_NEW_CHANNEL' for sfdx update channel" 125 | 126 | # smoke and update 127 | sfdx version 128 | sfdx update "$S3_NEW_CHANNEL" 129 | sfdx help 130 | sfdx plugins --core 131 | sfdx version 132 | 133 | UPDATED_VERSION=$(sfdx version --json | jq -cr '.cliVersion' | sed 's/sfdx-cli\///') 134 | 135 | echo "-> Version after 'sfdx update $S3_NEW_CHANNEL' is: $UPDATED_VERSION" 136 | 137 | echo "-> Npm dist-tag version for '$NEW_CHANNEL' is: $NEW_VERSION" 138 | 139 | if [ "$NEW_VERSION" != "$UPDATED_VERSION" ]; then 140 | echo "!! CLI version after update does not match '$NEW_VERSION', exiting." 141 | exit 1 142 | fi 143 | 144 | # TODO: How could we verify Docker images :thinking-face: 145 | -------------------------------------------------------------------------------- /src/cli.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | import * as os from 'os'; 9 | import * as path from 'path'; 10 | import { run as oclifRun, Config, settings } from '@oclif/core'; 11 | import { set } from '@salesforce/kit'; 12 | import { AnyJson, get } from '@salesforce/ts-types'; 13 | import * as Debug from 'debug'; 14 | import { default as nodeEnv, Env } from './util/env'; 15 | 16 | const debug = Debug('sfdx'); 17 | 18 | export const UPDATE_DISABLED_INSTALLER = 19 | 'Manual and automatic CLI updates have been disabled by setting "SF_AUTOUPDATE_DISABLE=true". ' + 20 | 'To check for a new version, unset that environment variable.'; 21 | 22 | export const UPDATE_DISABLED_NPM = 'Use "npm update --global sfdx-cli" to update npm-based installations.'; 23 | 24 | export const UPDATE_DISABLED_DEMO = 25 | 'Manual and automatic CLI updates have been disabled in DEMO mode. ' + 26 | 'To check for a new version, unset the environment variable SFDX_ENV.'; 27 | 28 | export function configureUpdateSites(config: Config, env = nodeEnv): void { 29 | const npmRegistry = env.getNpmRegistryOverride(); 30 | if (npmRegistry) { 31 | // Override config value if set via envar 32 | set(config, 'pjson.oclif.warn-if-update-available.registry', npmRegistry); 33 | } 34 | } 35 | 36 | export function configureAutoUpdate(envars: Env): void { 37 | if (envars.isDemoMode()) { 38 | // Disable autoupdates in demo mode 39 | envars.setAutoupdateDisabled(true); 40 | envars.setUpdateInstructions(UPDATE_DISABLED_DEMO); 41 | return; 42 | } 43 | 44 | if (envars.isInstaller()) { 45 | envars.normalizeAutoupdateDisabled(); 46 | if (envars.isAutoupdateDisabled()) { 47 | envars.setUpdateInstructions(UPDATE_DISABLED_INSTALLER); 48 | } 49 | return; 50 | } 51 | 52 | // Not an installer, so this must be running from an npm installation 53 | if (!envars.isAutoupdateDisabledSet()) { 54 | // Disable autoupdates if run from an npm install or in local dev, if not explicitly set 55 | envars.setAutoupdateDisabled(true); 56 | } 57 | 58 | if (envars.isAutoupdateDisabled()) { 59 | envars.setUpdateInstructions(UPDATE_DISABLED_NPM); 60 | } 61 | } 62 | 63 | function debugCliInfo(version: string, channel: string, env: Env, config: Config): void { 64 | function debugSection(section: string, items: Array<[string, string]>): void { 65 | const pad = 25; 66 | debug('%s:', section.padStart(pad)); 67 | items.forEach(([name, value]) => debug('%s: %s', name.padStart(pad), value)); 68 | } 69 | 70 | debugSection('OS', [ 71 | ['platform', os.platform()], 72 | ['architecture', os.arch()], 73 | ['release', os.release()], 74 | ['shell', config.shell], 75 | ]); 76 | 77 | debugSection('NODE', [['version', process.versions.node]]); 78 | 79 | debugSection('CLI', [ 80 | ['version', version], 81 | ['channel', channel], 82 | ['bin', config.bin], 83 | ['data', config.dataDir], 84 | ['cache', config.cacheDir], 85 | ['config', config.configDir], 86 | ]); 87 | 88 | debugSection( 89 | 'ENV', 90 | [ 91 | 'NODE_OPTIONS', 92 | Env.DISABLE_AUTOUPDATE_LEGACY, 93 | 'SFDX_BINPATH', 94 | 'SFDX_COMPILE_CACHE', 95 | Env.DISABLE_AUTOUPDATE_OCLIF, 96 | Env.CLI_MODE, 97 | Env.CLI_INSTALLER, 98 | Env.NPM_REGISTRY, 99 | 'SFDX_REDIRECTED', 100 | Env.UPDATE_INSTRUCTIONS, 101 | ].map((key): [string, string] => [key, env.getString(key, '')]) 102 | ); 103 | 104 | debugSection( 105 | 'ARGS', 106 | process.argv.map((arg, i): [string, string] => [i.toString(), arg]) 107 | ); 108 | } 109 | 110 | export function create( 111 | version: string, 112 | channel: string, 113 | run: typeof oclifRun = oclifRun, 114 | env = nodeEnv 115 | ): { run: () => Promise } { 116 | settings.performanceEnabled = true; 117 | const root = path.resolve(__dirname, '..'); 118 | // eslint-disable-next-line @typescript-eslint/no-var-requires 119 | const pjson = require(path.resolve(__dirname, '..', 'package.json')) as AnyJson; 120 | const args = process.argv.slice(2); 121 | 122 | return { 123 | async run(): Promise { 124 | const config = new Config({ name: get(pjson, 'oclif.bin') as string | undefined, root, version, channel }); 125 | await config.load(); 126 | configureUpdateSites(config, env); 127 | configureAutoUpdate(env); 128 | debugCliInfo(version, channel, env, config); 129 | // I think the run method is used in test. 130 | return run(args, config); 131 | }, 132 | }; 133 | } 134 | -------------------------------------------------------------------------------- /src/declaration.d.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | declare module 'salesforce-lightning-cli/commands/lightning/lint'; 8 | -------------------------------------------------------------------------------- /src/flags.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | // ------------------------------------------------------------------------------- 9 | // No requires or imports since this is loaded early in the cli lifecycle and we 10 | // want to minimize the number of packages that load before enabling require 11 | // instrumentation. 12 | // ------------------------------------------------------------------------------- 13 | 14 | export interface ProcessLike { 15 | argv: string[]; 16 | env: { [key: string]: string | undefined }; 17 | } 18 | 19 | export function preprocessCliFlags(process: ProcessLike): void { 20 | process.argv.map((arg) => { 21 | if (arg === '--dev-debug') { 22 | let debug = '*'; 23 | const filterIndex = process.argv.indexOf('--debug-filter'); 24 | if (filterIndex > 0) { 25 | debug = process.argv[filterIndex + 1]; 26 | 27 | process.argv.splice(filterIndex, 2); 28 | } 29 | // convert --dev-debug into a set of environment variables 30 | process.env.DEBUG = debug; 31 | process.env.SFDX_DEBUG = '1'; 32 | process.env.SFDX_ENV = 'development'; 33 | process.env.NODE_ENV = 'development'; 34 | 35 | // need to calculate indexOf --dev-debug here because it might've changed based on --debug-filter 36 | process.argv.splice(process.argv.indexOf('--dev-debug'), 1); 37 | } 38 | 39 | if (arg === '--dev-suspend') { 40 | process.argv.splice(process.argv.indexOf('--dev-suspend'), 1); 41 | } 42 | }); 43 | } 44 | 45 | // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access 46 | module.exports.preprocessCliFlags = preprocessCliFlags; 47 | -------------------------------------------------------------------------------- /src/help/sfdxCommandHelp.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | import { CommandHelp, HelpSection, HelpSectionRenderer, Interfaces, Command } from '@oclif/core'; 8 | import { SfCommandInterface } from '@salesforce/sf-plugins-core'; 9 | 10 | type SectionType = { header: string; generate: HelpSectionRenderer }; 11 | 12 | export class SfdxCommandHelp extends CommandHelp { 13 | private shortHelp = false; 14 | public constructor( 15 | public command: Command.Cached, 16 | public config: Interfaces.Config, 17 | public opts: Interfaces.HelpOptions 18 | ) { 19 | super(command, config, opts); 20 | } 21 | 22 | public get showShortHelp(): boolean { 23 | return this.shortHelp; 24 | } 25 | 26 | public set showShortHelp(shortHelp: boolean) { 27 | this.shortHelp = shortHelp; 28 | } 29 | 30 | protected sections(): SectionType[] { 31 | const sections = super.sections(); 32 | if (this.shortHelp) { 33 | return sections.filter(({ header }) => ['USAGE', 'ARGUMENTS', 'FLAGS'].includes(header)); 34 | } 35 | const additionaSfSections: SectionType[] = [ 36 | { 37 | header: 'CONFIGURATION VARIABLES', 38 | generate: ({ cmd }): HelpSection => { 39 | const sfCommand = cmd as SfCommandInterface; 40 | return sfCommand.configurationVariablesSection; 41 | }, 42 | }, 43 | { 44 | header: 'ENVIRONMENT VARIABLES', 45 | generate: ({ cmd }): HelpSection => { 46 | const sfCommand = cmd as SfCommandInterface; 47 | return sfCommand.envVariablesSection; 48 | }, 49 | }, 50 | { 51 | header: 'ERROR CODES', 52 | generate: ({ cmd }): HelpSection => { 53 | const sfCommand = cmd as SfCommandInterface; 54 | return sfCommand.errorCodes; 55 | }, 56 | }, 57 | ]; 58 | const flagsIndex = 59 | (sections.findIndex((section) => section.header === 'FLAG DESCRIPTIONS') || sections.length - 1) + 1; 60 | sections.splice(flagsIndex, 0, additionaSfSections[0]); 61 | sections.splice(flagsIndex + 1, 0, additionaSfSections[1]); 62 | sections.splice(flagsIndex + 2, 0, additionaSfSections[2]); 63 | return sections; 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/help/sfdxHelp.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | import { CommandHelp, Help, Command } from '@oclif/core'; 8 | import * as chalk from 'chalk'; 9 | import { SfdxCommandHelp } from './sfdxCommandHelp'; 10 | 11 | export default class SfdxHelp extends Help { 12 | protected CommandHelpClass: typeof CommandHelp = SfdxCommandHelp; 13 | protected commandHelpClass: SfdxCommandHelp | undefined; 14 | private showShortHelp = false; 15 | private commands: string[] = []; 16 | private subCommands: Record = {}; 17 | 18 | public async showHelp(argv: string[]): Promise { 19 | this.showShortHelp = argv.includes('-h'); 20 | this.commands = this.config.commandIDs.map( 21 | (c) => `${this.config.bin} ${c.replace(/:/g, this.config.topicSeparator)}` 22 | ); 23 | for (const cmd of this.commands) { 24 | this.subCommands[cmd] = this.commands 25 | .filter((c) => c.startsWith(cmd) && c !== cmd) 26 | .map((c) => `${c.replace(cmd, '')}`); 27 | } 28 | 29 | return super.showHelp(argv); 30 | } 31 | 32 | protected getCommandHelpClass(command: Command.Cached): CommandHelp { 33 | this.commandHelpClass = super.getCommandHelpClass(command) as SfdxCommandHelp; 34 | this.commandHelpClass.showShortHelp = this.showShortHelp; 35 | return this.commandHelpClass; 36 | } 37 | 38 | protected log(...args: string[]): void { 39 | const formatted = args.map((arg) => { 40 | for (const cmd of this.commands) { 41 | const regex = 42 | this.subCommands[cmd].length > 0 43 | ? new RegExp(`(? { 13 | ux.log('NOTE: This error can be ignored in CI and may be silenced in the future'); 14 | ux.log('- Set the SFDX_HIDE_RELEASE_NOTES env var to "true" to skip this script\n'); 15 | ux.log(msg.toString()); 16 | }; 17 | 18 | /* 19 | * NOTE: Please read "Notes about the hook scripts" in this PR before making changes: 20 | * https://github.com/salesforcecli/sfdx-cli/pull/407 21 | */ 22 | 23 | const hook: Hook.Update = async (): Promise => 24 | new Promise((resolve) => { 25 | if (process.env.SFDX_HIDE_RELEASE_NOTES === 'true') { 26 | resolve(); 27 | } 28 | 29 | // NOTE: This is `sfdx.cmd` here and not `run.cmd` because it gets renamed here: 30 | // https://github.com/salesforcecli/sfdx-cli/blob/4428505ab69aa6e21214dba96557e2ce396a82e0/src/hooks/postupdate.ts#L62 31 | const executable = process.platform === 'win32' ? 'sfdx.cmd' : 'run'; 32 | const cmd = spawn(join(__dirname, '..', '..', 'bin', executable), ['whatsnew', '--hook'], { 33 | stdio: ['ignore', 'inherit', 'pipe'], 34 | timeout: 10000, 35 | }); 36 | 37 | cmd.stderr.on('data', (error: Error) => { 38 | logError(error); 39 | resolve(); 40 | }); 41 | 42 | cmd.on('error', (error: Error) => { 43 | logError(error); 44 | resolve(); 45 | }); 46 | 47 | // 'exit' fires whether or not the stream are finished 48 | cmd.on('exit', () => { 49 | resolve(); 50 | }); 51 | 52 | cmd.on('close', () => { 53 | resolve(); 54 | }); 55 | }); 56 | 57 | export default hook; 58 | -------------------------------------------------------------------------------- /src/hooks/incomplete.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2022, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | import * as os from 'os'; 9 | import { Hook, toConfiguredId, toStandardizedId, Interfaces, Command, loadHelpClass } from '@oclif/core'; 10 | import { Prompter } from '@salesforce/sf-plugins-core'; 11 | import { Lifecycle } from '@salesforce/core'; 12 | 13 | function buildChoices( 14 | matches: Command.Loadable[], 15 | config: Interfaces.Config 16 | ): Array<{ name: string; value: Command.Loadable }> { 17 | const configuredIds = matches.map((p) => toConfiguredId(p.id, config)); 18 | const maxCommandLength = configuredIds.reduce((max, id) => Math.max(max, id.length), 0); 19 | return matches.map((p, i) => { 20 | const summary = p.summary ?? p.description?.split(os.EOL)[0] ?? ''; 21 | return { 22 | name: `${configuredIds[i].padEnd(maxCommandLength + 5, ' ')}${summary}`, 23 | value: p, 24 | short: configuredIds[i], 25 | }; 26 | }); 27 | } 28 | 29 | async function determineCommand(config: Interfaces.Config, matches: Command.Loadable[]): Promise { 30 | if (matches.length === 1) return matches[0].id; 31 | const prompter = new Prompter(); 32 | const choices = buildChoices(matches, config); 33 | const { command } = await prompter.timedPrompt<{ command: Command.Loadable }>([ 34 | { 35 | name: 'command', 36 | type: 'list', 37 | message: 'Which of these commands do you mean', 38 | choices, 39 | }, 40 | ]); 41 | 42 | return command.id; 43 | } 44 | 45 | const hook: Hook.CommandIncomplete = async function ({ config, matches, argv }) { 46 | const command = await determineCommand(config, matches); 47 | 48 | if (argv.includes('--help') || argv.includes('-h')) { 49 | const Help = await loadHelpClass(config); 50 | const help = new Help(config, config.pjson.helpOptions as Partial); 51 | return help.showHelp([toStandardizedId(command, config), ...argv]); 52 | } 53 | 54 | if (matches.length === 1) { 55 | await Lifecycle.getInstance().emitWarning( 56 | `One command matches the partial command entered, running command:${os.EOL}${config.bin} ${toConfiguredId( 57 | command, 58 | config 59 | )} ${argv.join(' ')}` 60 | ); 61 | } 62 | 63 | return config.runCommand(toStandardizedId(command, config), argv); 64 | }; 65 | 66 | export default hook; 67 | -------------------------------------------------------------------------------- /src/hooks/pluginsPreinstall.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | import { Hook, Errors } from '@oclif/core'; 9 | 10 | const hook: Hook.PluginsPreinstall = async function (options) { 11 | // Run individual hooks serially since oclif runs hooks in parallel, which causes UX problems in this case 12 | await this.config.runHook('plugins:preinstall:verify:version', options); 13 | 14 | const verifySignHookResult = await this.config.runHook('plugins:preinstall:verify:signature', options); 15 | const pluginTrustFailure = verifySignHookResult.failures.find( 16 | (failure) => failure.plugin.name === '@salesforce/plugin-trust' 17 | ); 18 | 19 | if (pluginTrustFailure !== undefined) { 20 | Errors.handle(pluginTrustFailure.error); 21 | } 22 | }; 23 | 24 | export default hook; 25 | -------------------------------------------------------------------------------- /src/hooks/postupdate.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | import * as os from 'os'; 9 | import * as path from 'path'; 10 | 11 | import { ux } from '@oclif/core'; 12 | import { readFileSync, readJsonSync, writeFileSync } from 'fs-extra'; 13 | 14 | import { TelemetryGlobal } from '@salesforce/plugin-telemetry/lib/telemetryGlobal'; 15 | import { AppInsights } from '@salesforce/telemetry/lib/appInsights'; 16 | import { JsonMap } from '@salesforce/ts-types'; 17 | import { Hook } from '@oclif/core'; 18 | 19 | declare const global: TelemetryGlobal; 20 | 21 | function sendEvent(data: JsonMap): void { 22 | if (global.cliTelemetry?.record) { 23 | global.cliTelemetry.record(data); 24 | } 25 | } 26 | 27 | function suggestAlternatives(): void { 28 | ux.log('Failed to update sf. Try uninstalling the CLI and re-installing it.'); 29 | ux.log( 30 | 'Uninstall instructions: https://developer.salesforce.com/docs/atlas.en-us.234.0.sfdx_setup.meta/sfdx_setup/sfdx_setup_uninstall.htm' 31 | ); 32 | if (process.platform === 'win32') { 33 | ux.log('- installer: https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-x64.exe'); 34 | } else if (process.platform === 'darwin') { 35 | if (process.arch === 'arm64') { 36 | ux.log('- installer: https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-arm64.pkg'); 37 | } else { 38 | ux.log('- installer: https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-x64.pkg'); 39 | } 40 | } else { 41 | ux.log('- download: https://developer.salesforce.com/media/salesforce-cli/sf/channels/stable/sf-linux-x64.tar.gz'); 42 | } 43 | } 44 | 45 | /** 46 | * In order to make the bundled version of `sf` available after 47 | * users run `sfdx update` we've added this hook which will copy 48 | * the sfdx executable and modify it for `sf`. 49 | */ 50 | // eslint-disable-next-line @typescript-eslint/require-await 51 | const hook: Hook.Update = async function (opts): Promise { 52 | let success = false; 53 | 54 | ux.action.start('sfdx-cli: Updating sf'); 55 | 56 | try { 57 | const pjson = readJsonSync(path.join(__dirname, '../../package.json')) as { oclif: { dirname: string } }; 58 | 59 | let dataDirBin; 60 | let sfdxExec; 61 | let sfExec; 62 | if (os.type() === 'Windows_NT') { 63 | dataDirBin = path.join(process.env.LOCALAPPDATA as string, pjson.oclif.dirname, 'client', 'bin'); 64 | sfdxExec = sfExec = path.join(dataDirBin, 'sfdx.cmd'); 65 | sfExec = path.join(dataDirBin, 'sf.cmd'); 66 | } else { 67 | dataDirBin = path.join(process.env.HOME as string, '.local', 'share', pjson.oclif.dirname, 'client', 'bin'); 68 | sfdxExec = path.join(dataDirBin, 'sfdx'); 69 | sfExec = path.join(dataDirBin, 'sf'); 70 | } 71 | 72 | const sfExecContents = readFileSync(sfdxExec, { encoding: 'utf-8' }).replace(/sfdx/g, 'sf').replace(/SFDX/g, 'SF'); 73 | writeFileSync(sfExec, sfExecContents, { mode: 0o755 }); 74 | 75 | success = true; 76 | } catch (error) { 77 | const err = error as Error; 78 | success = false; 79 | sendEvent({ 80 | eventName: 'POST_SFDX_UPDATE_SF_UPDATE_ERROR', 81 | type: 'EVENT', 82 | message: err.message, 83 | stackTrace: err?.stack?.replace(new RegExp(os.homedir(), 'g'), AppInsights.GDPR_HIDDEN), 84 | sfdxVersion: opts.config.version, 85 | }); 86 | return; 87 | } finally { 88 | ux.action.stop(success ? 'done' : 'failed'); 89 | if (!success) suggestAlternatives(); 90 | } 91 | }; 92 | 93 | export default hook; 94 | -------------------------------------------------------------------------------- /src/hooks/preupdate.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | import { Hook } from '@oclif/core'; 9 | 10 | const hook: Hook.Preupdate = async function (options) { 11 | // Run individual hooks serially since oclif runs hooks in parallel, which causes UX problems in this case 12 | await this.config.runHook('preupdate:reachability', options); 13 | }; 14 | 15 | export default hook; 16 | -------------------------------------------------------------------------------- /src/hooks/salesforcedx-check.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | import * as path from 'path'; 8 | import Plugins from '@oclif/plugin-plugins'; 9 | import { Config, ux } from '@oclif/core'; 10 | import { AnyJson, get } from '@salesforce/ts-types'; 11 | import { compareVersions } from '../versions'; 12 | 13 | const salesforcedxError = `You still have the deprecated salesforcedx plugin installed in Salesforce CLI. If you continue using this plugin, you'll be running old and out-of-date versions of sfdx commands. 14 | Uninstall the plugin with this command: 'sfdx plugins:uninstall salesforcedx'. 15 | See https://github.com/forcedotcom/cli/blob/main/releasenotes/sfdx/README.md#71063-june-17-2021 for more information about this change.`; 16 | 17 | const MAX_VERSION = '7.107.0'; 18 | 19 | const hook = async (): Promise => { 20 | // PART 1: is the CLI recent enough that we don't allow salesforcedx? 21 | const root = path.resolve(__dirname, '..', '..'); 22 | // eslint-disable-next-line @typescript-eslint/no-var-requires 23 | const pjson = require(path.resolve(root, 'package.json')) as AnyJson; 24 | const config = new Config({ name: get(pjson, 'oclif.bin') as string | undefined, root }); 25 | await config.load(); 26 | 27 | // early exit for old CLIs that shouldn't bother inspecting their plugins 28 | if (compareVersions(config.version, MAX_VERSION) < 0) { 29 | return; 30 | } 31 | 32 | // PART 2: is the salesforcedx plugin installed? 33 | const plugins = new Plugins(config); 34 | 35 | const installedUserPlugins = (await plugins.list()) 36 | .filter((plugin) => plugin.type === 'user') 37 | .map((plugin) => plugin.name); 38 | ux.log(`user plugins are ${installedUserPlugins.join(', ')}`); 39 | 40 | if (installedUserPlugins.includes('salesforcedx')) { 41 | ux.warn(salesforcedxError); 42 | } 43 | }; 44 | 45 | export default hook; 46 | -------------------------------------------------------------------------------- /src/hooks/verifyPluginVersion.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | import { Hook } from '@oclif/core'; 9 | import { compareVersions, isVersion } from '../versions'; 10 | 11 | const FORCE_PLUGINS = ['salesforce-alm', 'force-language-services']; 12 | export const BANNED_PLUGINS: Record = { 13 | salesforcedx: `The salesforcedx plugin is deprecated. 14 | Installing it manually via 'sfdx plugins:install salesforcedx' is no longer supported and can result in duplicate commands and outdated plugins. 15 | See https://github.com/forcedotcom/cli/issues/1016 for more information about this change.`, 16 | 'sfdx-cli': 17 | "'sfdx-cli' cannot be installed as a plugin. If you are trying to install an older version of the cli, visit https://sfdc.co/install-older-cli-versions for instructions", 18 | }; 19 | const MIN_VERSION = '45.8.0'; 20 | 21 | /** 22 | * A CLI plugin preinstall hook that checks that the plugin's version is v7-compatible, 23 | * if it is recognized as a force namespace plugin. 24 | */ 25 | // eslint-disable-next-line @typescript-eslint/require-await 26 | const hook: Hook.PluginsPreinstall = async function (options): Promise { 27 | if (options.plugin && options.plugin.type === 'npm') { 28 | const plugin = options.plugin; 29 | if (Object.keys(BANNED_PLUGINS).includes(plugin.name)) { 30 | this.error(BANNED_PLUGINS[plugin.name]); 31 | } 32 | if (FORCE_PLUGINS.includes(plugin.name) && isVersion(plugin.tag) && compareVersions(plugin.tag, MIN_VERSION) < 0) { 33 | this.error( 34 | `The ${plugin.name} plugin can only be installed using a specific version when ` + 35 | `the version is greater than or equal to ${MIN_VERSION}.` 36 | ); 37 | } 38 | } 39 | }; 40 | 41 | export default hook; 42 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | export = {}; 9 | -------------------------------------------------------------------------------- /src/util/env.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | import { EnvVars } from '@salesforce/core'; 9 | 10 | export class Env extends EnvVars { 11 | public static readonly CLI_MODE = 'SFDX_ENV'; 12 | public static readonly CLI_INSTALLER = 'SFDX_INSTALLER'; 13 | public static readonly DISABLE_AUTOUPDATE_LEGACY = 'SF_AUTOUPDATE_DISABLE'; 14 | public static readonly DISABLE_AUTOUPDATE_OCLIF = 'SF_DISABLE_AUTOUPDATE'; 15 | public static readonly UPDATE_INSTRUCTIONS = 'SFDX_UPDATE_INSTRUCTIONS'; 16 | public static readonly NPM_REGISTRY = 'SF_NPM_REGISTRY'; 17 | 18 | public constructor(env = process.env) { 19 | super(env); 20 | } 21 | 22 | public normalizeAutoupdateDisabled(): void { 23 | // Ensure that the legacy envar always causes the oclif counterpart to be set 24 | if (this.getBoolean(Env.DISABLE_AUTOUPDATE_LEGACY)) { 25 | this.setBoolean(Env.DISABLE_AUTOUPDATE_OCLIF, true); 26 | } else if (this.getBoolean(Env.DISABLE_AUTOUPDATE_OCLIF)) { 27 | this.setBoolean(Env.DISABLE_AUTOUPDATE_LEGACY, true); 28 | } 29 | } 30 | 31 | public isAutoupdateDisabled(): boolean { 32 | return this.getBoolean(Env.DISABLE_AUTOUPDATE_LEGACY) || this.getBoolean(Env.DISABLE_AUTOUPDATE_OCLIF); 33 | } 34 | 35 | public isAutoupdateDisabledSet(): boolean { 36 | return !!this.getString(Env.DISABLE_AUTOUPDATE_LEGACY) || !!this.getString(Env.DISABLE_AUTOUPDATE_OCLIF); 37 | } 38 | 39 | public setAutoupdateDisabled(value: boolean, updateInstructions?: string): void { 40 | this.setBoolean(Env.DISABLE_AUTOUPDATE_LEGACY, value); 41 | this.setBoolean(Env.DISABLE_AUTOUPDATE_OCLIF, value); 42 | if (updateInstructions) { 43 | this.setUpdateInstructions(updateInstructions); 44 | } 45 | } 46 | 47 | public setUpdateInstructions(value: string): void { 48 | this.setString(Env.UPDATE_INSTRUCTIONS, value); 49 | } 50 | 51 | public isDemoMode(): boolean { 52 | return this.getString(Env.CLI_MODE, 'production').toLowerCase() === 'demo'; 53 | } 54 | 55 | public isInstaller(): boolean { 56 | return this.getBoolean(Env.CLI_INSTALLER); 57 | } 58 | 59 | public getNpmRegistryOverride(): string { 60 | return this.getString(Env.NPM_REGISTRY) as string; 61 | } 62 | 63 | public setNpmRegistryOverride(value: string): void { 64 | return this.setString(Env.NPM_REGISTRY, value); 65 | } 66 | } 67 | 68 | export default new Env(); 69 | -------------------------------------------------------------------------------- /src/versions.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | // Note: Leave this file as ES5 js for compatibility with earlier Node.js versions 9 | 'use strict'; 10 | 11 | const pjson = require('../package.json'); 12 | 13 | /** 14 | * Determines whether or not a tag string is a semantic version. 15 | * 16 | * @param {*} tag The possible version string 17 | * @returns {boolean} True, if the string is recognized as a semantic version 18 | */ 19 | export function isVersion(tag) { 20 | if (!tag) { 21 | return false; 22 | } 23 | // From https://github.com/sindresorhus/semver-regex 24 | const SEMVER_REGEX = 25 | /^v?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?$/gi; 26 | return SEMVER_REGEX.test(tag.toString()); 27 | } 28 | 29 | module.exports.isVersion = isVersion; 30 | 31 | /** 32 | * Compares two semantic version strings. 33 | * 34 | * @param {string} a The first version 35 | * @param {string} b The second version 36 | * @returns {number} < 0 if a < b, 0 if a == b, > 0 if a > b 37 | */ 38 | export function compareVersions(a, b) { 39 | a = a || '0'; 40 | b = b || '0'; 41 | const ignore = /-.*$/; 42 | const partsA = a.replace(ignore, '').split('.'); 43 | const partsB = b.replace(ignore, '').split('.'); 44 | const len = Math.max(partsA.length, partsB.length); 45 | const diffInLength = partsA.length - partsB.length; 46 | if (diffInLength < 0) { 47 | for (let i = partsA.length; i < len; i++) { 48 | partsA[i] = '0'; 49 | } 50 | } else { 51 | for (let i = partsB.length; i < len; i++) { 52 | partsB[i] = '0'; 53 | } 54 | } 55 | let diff; 56 | for (let i = 0; i < len; i++) { 57 | diff = parseInt(partsA[i], 10) - parseInt(partsB[i], 10); 58 | if (diff) { 59 | return diff; 60 | } 61 | } 62 | return 0; 63 | } 64 | 65 | module.exports.compareVersions = compareVersions; 66 | 67 | /** 68 | * Checks the current Node version for compatibility before launching the CLI. 69 | */ 70 | export function checkNodeVersion( 71 | currentVersion = process.versions.node, 72 | requiredVersion = pjson.engines.node.slice(2) 73 | ) { 74 | if (module.exports.compareVersions(currentVersion, requiredVersion) < 0) { 75 | // eslint-disable-next-line no-console 76 | console.error( 77 | 'Unsupported Node.js version ' + currentVersion + ', ' + 'version ' + requiredVersion + ' or later is required.' 78 | ); 79 | process.exit(1); 80 | } 81 | } 82 | 83 | module.exports.checkNodeVersion = checkNodeVersion; 84 | -------------------------------------------------------------------------------- /test/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | module.exports = { 9 | extends: '../.eslintrc.js', 10 | // Allow describe and it 11 | env: { mocha: true }, 12 | rules: { 13 | // Allow assert style expressions. i.e. expect(true).to.be.true 14 | 'no-unused-expressions': 'off', 15 | 16 | // It is common for tests to stub out method. 17 | 18 | // Return types are defined by the source code. Allows for quick overwrites. 19 | '@typescript-eslint/explicit-function-return-type': 'off', 20 | // Mocked out the methods that shouldn't do anything in the tests. 21 | '@typescript-eslint/no-empty-function': 'off', 22 | // Easily return a promise in a mocked method. 23 | '@typescript-eslint/require-await': 'off', 24 | }, 25 | }; 26 | -------------------------------------------------------------------------------- /test/cli.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | // the below, there's lots of un-awaited promises for testing 8 | 9 | import { stubInterface } from '@salesforce/ts-sinon'; 10 | import { getString } from '@salesforce/ts-types'; 11 | import { expect } from 'chai'; 12 | import * as sinon from 'sinon'; 13 | import { Config } from '@oclif/core'; 14 | import { LoadOptions } from '@oclif/core/lib/interfaces'; 15 | import { 16 | configureAutoUpdate, 17 | configureUpdateSites, 18 | create, 19 | UPDATE_DISABLED_DEMO, 20 | UPDATE_DISABLED_INSTALLER, 21 | UPDATE_DISABLED_NPM, 22 | } from '../src/cli'; 23 | import { Env } from '../src/util/env'; 24 | 25 | describe('cli', () => { 26 | let sandbox: sinon.SinonSandbox; 27 | 28 | beforeEach(() => { 29 | sandbox = sinon.createSandbox(); 30 | }); 31 | 32 | afterEach(() => { 33 | sandbox.restore(); 34 | }); 35 | 36 | describe('create', () => { 37 | it('should create a runnable CLI instance', async () => { 38 | sandbox.stub(Config.prototype, 'load').callsFake(() => Promise.resolve()); 39 | let loadOptions: LoadOptions; 40 | const exec = async (argv?: string[], opts?: LoadOptions): Promise => { 41 | loadOptions = opts; 42 | }; 43 | const env = new Env(); 44 | await create('test', 'test', exec, env).run(); 45 | expect(loadOptions).to.exist; 46 | expect(loadOptions).to.have.property('options'); 47 | expect(loadOptions).to.have.nested.property('options.version').and.equal('test'); 48 | expect(loadOptions).to.have.nested.property('options.channel').and.equal('test'); 49 | }); 50 | }); 51 | 52 | describe('env', () => { 53 | let env: Env; 54 | 55 | beforeEach(() => { 56 | env = new Env({}); 57 | }); 58 | 59 | it('should set the s3 host in the oclif config if overridden in an envar', async () => { 60 | const npmRegistry = 'http://example.com:9000/npm'; 61 | const config = stubInterface(sandbox); 62 | env.setNpmRegistryOverride(npmRegistry); 63 | // eslint-disable-next-line @typescript-eslint/ban-ts-comment 64 | // @ts-ignore - you cannot pass a StubInterface as a Config into methods below 65 | configureUpdateSites(config, env); 66 | expect(getString(config, 'pjson.oclif.warn-if-update-available.registry')).to.equal(npmRegistry); 67 | }); 68 | 69 | it('should default to autoupdate disabled for local dev or npm installs', () => { 70 | configureAutoUpdate(env); 71 | 72 | expect(env.getBoolean('SF_AUTOUPDATE_DISABLE')).to.be.true; 73 | expect(env.getString(Env.UPDATE_INSTRUCTIONS)).to.equal(UPDATE_DISABLED_NPM); 74 | }); 75 | 76 | it('should allow autoupdate to be explicitly enabled for local dev (for testing autoupdates)', () => { 77 | env.setBoolean('SF_AUTOUPDATE_DISABLE', false); 78 | configureAutoUpdate(env); 79 | 80 | expect(env.getBoolean('SF_AUTOUPDATE_DISABLE')).to.be.false; 81 | expect(env.getString(Env.UPDATE_INSTRUCTIONS)).to.be.undefined; 82 | }); 83 | 84 | it('should default to autoupdate enabled for binary installs', () => { 85 | env.setBoolean('SFDX_INSTALLER', true); 86 | configureAutoUpdate(env); 87 | 88 | expect(env.getBoolean('SF_AUTOUPDATE_DISABLE')).to.be.false; 89 | expect(env.getString(Env.UPDATE_INSTRUCTIONS)).to.be.undefined; 90 | }); 91 | 92 | it('should have autoupdate disabled for binary installs when SF_AUTOUPDATE_DISABLE is set to true', () => { 93 | env.setBoolean('SFDX_INSTALLER', true); 94 | env.setBoolean('SF_AUTOUPDATE_DISABLE', true); 95 | configureAutoUpdate(env); 96 | 97 | expect(env.getBoolean('SF_AUTOUPDATE_DISABLE')).to.be.true; 98 | expect(env.getString(Env.UPDATE_INSTRUCTIONS)).to.equal(UPDATE_DISABLED_INSTALLER); 99 | }); 100 | 101 | it('should have autoupdate disabled when in demo mode', () => { 102 | env.setString('SFDX_ENV', 'DEMO'); 103 | configureAutoUpdate(env); 104 | 105 | expect(env.getBoolean('SF_AUTOUPDATE_DISABLE')).to.be.true; 106 | expect(env.getString(Env.UPDATE_INSTRUCTIONS)).to.equal(UPDATE_DISABLED_DEMO); 107 | }); 108 | }); 109 | }); 110 | -------------------------------------------------------------------------------- /test/env.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | // the below, there's lots of un-awaited promises for testing 8 | 9 | import { expect } from 'chai'; 10 | import { Env } from '../src/util/env'; 11 | 12 | describe('Env', () => { 13 | let env: Env; 14 | 15 | beforeEach(() => { 16 | env = new Env({}); 17 | }); 18 | 19 | describe('normalizeAutoupdateDisabled', () => { 20 | it('should set the oclif autoupdate disabled envar if the legacy one is set', () => { 21 | env.setBoolean(Env.DISABLE_AUTOUPDATE_LEGACY, true); 22 | env.normalizeAutoupdateDisabled(); 23 | expect(env.getBoolean(Env.DISABLE_AUTOUPDATE_OCLIF)).to.be.true; 24 | }); 25 | 26 | it('should set the legacy autoupdate disabled envar if the oclif one is set', () => { 27 | env.setBoolean(Env.DISABLE_AUTOUPDATE_OCLIF, true); 28 | env.normalizeAutoupdateDisabled(); 29 | expect(env.getBoolean(Env.DISABLE_AUTOUPDATE_LEGACY)).to.be.true; 30 | }); 31 | }); 32 | 33 | describe('isAutoupdateDisabled', () => { 34 | it('should not report autoupdate disabled with no envar', () => { 35 | expect(env.isAutoupdateDisabled()).to.be.false; 36 | }); 37 | 38 | it('should report autoupdate disabled with legacy envar', () => { 39 | env.setBoolean('SF_AUTOUPDATE_DISABLE', true); 40 | expect(env.isAutoupdateDisabled()).to.be.true; 41 | }); 42 | 43 | it('should report autoupdate disabled with oclif envar', () => { 44 | env.setBoolean('SF_DISABLE_AUTOUPDATE', true); 45 | expect(env.isAutoupdateDisabled()).to.be.true; 46 | }); 47 | }); 48 | 49 | describe('isAutoupdateDisabledSet', () => { 50 | it('should not report set with neither envar', () => { 51 | expect(env.isAutoupdateDisabledSet()).to.be.false; 52 | }); 53 | 54 | it('should report set with legacy envar', () => { 55 | env.setBoolean('SF_AUTOUPDATE_DISABLE', true); 56 | expect(env.isAutoupdateDisabledSet()).to.be.true; 57 | }); 58 | 59 | it('should report set with oclif envar', () => { 60 | env.setBoolean('SF_DISABLE_AUTOUPDATE', true); 61 | expect(env.isAutoupdateDisabledSet()).to.be.true; 62 | }); 63 | }); 64 | 65 | describe('isAutoupdateDisabledSet', () => { 66 | it('should set both autoupdate envars', () => { 67 | env.setAutoupdateDisabled(true); 68 | expect(env.getBoolean('SF_AUTOUPDATE_DISABLE')).to.be.true; 69 | expect(env.getBoolean('SF_DISABLE_AUTOUPDATE')).to.be.true; 70 | }); 71 | }); 72 | 73 | describe('setUpdateInstructions', () => { 74 | it('should set update instructions', () => { 75 | env.setUpdateInstructions('update at your own risk!'); 76 | expect(env.getString('SFDX_UPDATE_INSTRUCTIONS')).to.equal('update at your own risk!'); 77 | }); 78 | }); 79 | 80 | describe('isDemoMode', () => { 81 | it('should report if the cli is not in demo mode', () => { 82 | expect(env.isDemoMode()).to.be.false; 83 | }); 84 | 85 | it('should report if the cli is in demo mode', () => { 86 | env.setString('SFDX_ENV', 'demo'); 87 | expect(env.isDemoMode()).to.be.true; 88 | }); 89 | }); 90 | 91 | describe('isInstaller', () => { 92 | it('should report if the cli is not running from an installer', () => { 93 | expect(env.isInstaller()).to.be.false; 94 | }); 95 | 96 | it('should report if the cli is running from an installer', () => { 97 | env.setBoolean('SFDX_INSTALLER', true); 98 | expect(env.isInstaller()).to.be.true; 99 | }); 100 | }); 101 | }); 102 | -------------------------------------------------------------------------------- /test/flags.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | import { expect } from 'chai'; 9 | import { preprocessCliFlags, ProcessLike } from '../src/flags'; 10 | 11 | describe('CLI flags', () => { 12 | it('should pass through args it does not recognize', () => { 13 | const process: ProcessLike = { 14 | argv: ['force:some:command', '--dev-debug', '--foo', '-f', 'bar'], 15 | env: {}, 16 | }; 17 | preprocessCliFlags(process); 18 | expect(process.argv).to.deep.equal(['force:some:command', '--foo', '-f', 'bar']); 19 | }); 20 | 21 | it('should recognize --dev-debug', () => { 22 | const process: ProcessLike = { 23 | argv: ['--dev-debug'], 24 | env: {}, 25 | }; 26 | preprocessCliFlags(process); 27 | expect(process.argv).not.to.include('--dev-debug'); 28 | expect(process.env.DEBUG).to.equal('*'); 29 | expect(process.env.SFDX_DEBUG).to.equal('1'); 30 | expect(process.env.SFDX_ENV).to.equal('development'); 31 | expect(process.env.NODE_ENV).to.equal('development'); 32 | }); 33 | 34 | it('should ignore --dev-suspend', () => { 35 | const process: ProcessLike = { 36 | argv: ['--dev-suspend'], 37 | env: {}, 38 | }; 39 | preprocessCliFlags(process); 40 | expect(process.argv).not.to.include('--dev-suspend'); 41 | }); 42 | }); 43 | -------------------------------------------------------------------------------- /test/node-version.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | import { join } from 'path'; 9 | import { existsSync } from 'fs-extra'; 10 | import { expect } from 'chai'; 11 | 12 | describe('node version', () => { 13 | it('node version file does not exist', () => { 14 | expect(existsSync(join(__dirname, '..', 'NODE_VERSION.md'))).to.be.false; 15 | }); 16 | it('does not have oclif version in the old pjson location', () => { 17 | // eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment 18 | const packageJson = require(join(__dirname, '..', 'package.json')) as { oclif: { node: string } }; 19 | expect(packageJson.oclif.node).to.be.undefined; 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@salesforce/dev-config/tsconfig-test", 3 | "include": ["./**/*.ts"], 4 | "compilerOptions": { 5 | "skipLibCheck": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /test/verifyPluginVersion.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | 8 | import { Hook, Config } from '@oclif/core'; 9 | import { StubbedType, stubInterface } from '@salesforce/ts-sinon'; 10 | import { getString } from '@salesforce/ts-types'; 11 | import { expect } from 'chai'; 12 | import * as sinon from 'sinon'; 13 | import hook, { BANNED_PLUGINS } from '../src/hooks/verifyPluginVersion'; 14 | 15 | describe('verifyPluginVersion preinstall hook', () => { 16 | let sandbox: sinon.SinonSandbox; 17 | let context: StubbedType; 18 | 19 | beforeEach(() => { 20 | sandbox = sinon.createSandbox(); 21 | context = stubInterface(sandbox); 22 | }); 23 | 24 | afterEach(() => { 25 | sandbox.restore(); 26 | }); 27 | 28 | async function testHook(name: string, tag: string): Promise { 29 | await hook.call(context, { 30 | config: stubInterface(sandbox, { version: '6.0.0' }), 31 | plugin: { name, tag, type: 'npm' }, 32 | }); 33 | } 34 | 35 | it('should allow the salesforce-alm plugin with tag "41.2.0" to be installed', async () => { 36 | await testHook('salesforce-alm', '41.2.0'); 37 | }); 38 | 39 | it('should allow the salesforce-alm plugin with tag "latest" to be installed', async () => { 40 | await testHook('salesforce-alm', 'latest'); 41 | }); 42 | 43 | it('should allow the salesforce-alm plugin with tag "pre-release" to be installed', async () => { 44 | await testHook('salesforce-alm', 'pre-release'); 45 | }); 46 | 47 | it('should allow the salesforce-alm plugin with tag "foo" to be installed', async () => { 48 | await testHook('salesforce-alm', 'foo'); 49 | }); 50 | 51 | it('should allow the salesforce-alm plugin with no tag to be installed', async () => { 52 | await testHook('salesforce-alm', ''); 53 | }); 54 | 55 | it('should not allow the salesforce-alm plugin with tag "41.1.0" to be installed', async () => { 56 | await testHook('salesforce-alm', '41.1.0'); 57 | expect(context.error.getCalls().some((call) => getString(call, 'args[0]')?.includes('can only be installed'))).to.be 58 | .true; 59 | }); 60 | 61 | it('should not allow the salesforce-alm plugin with tag "41.1.0" to be installed', async () => { 62 | await testHook('salesforce-alm', '41.1.0'); 63 | expect(context.error.getCalls().some((call) => getString(call, 'args[0]')?.includes('can only be installed'))).to.be 64 | .true; 65 | }); 66 | 67 | it('should not allow installation of sfdx-cli as a plugin regardless of the tag', async () => { 68 | await testHook('sfdx-cli', ''); 69 | expect(context.error.getCalls().some((call) => getString(call, 'args[0]')?.includes(BANNED_PLUGINS['sfdx-cli']))).to 70 | .be.true; 71 | }); 72 | }); 73 | -------------------------------------------------------------------------------- /test/versions.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, salesforce.com, inc. 3 | * All rights reserved. 4 | * Licensed under the BSD 3-Clause license. 5 | * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause 6 | */ 7 | // the below, there's lots of un-awaited promises for testing 8 | 9 | import { assert, expect } from 'chai'; 10 | import * as sinon from 'sinon'; 11 | import { checkNodeVersion, compareVersions, isVersion } from '../src/versions'; 12 | 13 | describe('versions', () => { 14 | describe('isVersion', () => { 15 | it('should recognize valid semantic versions', () => { 16 | const versions = [ 17 | '0.0.0', 18 | '0.10.0', 19 | 'v1.0.0', 20 | '0.0.0-foo', 21 | '1.2.3-4', 22 | '2.7.2+bar', 23 | '1.2.3-a.b.c.10.d.5', 24 | '2.7.2-foo+bar', 25 | '1.2.3-alpha.10.beta.0', 26 | '1.2.3-alpha.10.beta.0+build.unicorn.rainbow', 27 | ]; 28 | 29 | versions.forEach((v) => { 30 | assert(isVersion(v), v); 31 | }); 32 | }); 33 | 34 | it('should reject invalid semantic versions', () => { 35 | const versions = ['', '0.88', '1.0.08', '1.08.0', '01.8.0', 'foo 0.0.0 bar 0.0.0']; 36 | 37 | versions.forEach((v) => { 38 | assert(!isVersion(v), String(v)); 39 | }); 40 | }); 41 | }); 42 | 43 | describe('compareVersions', () => { 44 | it('should handle empty args', () => { 45 | expect(compareVersions('', '')).to.equal(0); 46 | }); 47 | 48 | it('should return 0 when a and b are both 1.1.1', () => { 49 | expect(compareVersions('1.1.1', '1.1.1')).to.equal(0); 50 | }); 51 | 52 | it('should show .0 to be the same as the integer value.', () => { 53 | expect(compareVersions('41', '41.0')).to.be.equal(0); 54 | }); 55 | 56 | it('should show .0 to be the same as the integer value.', () => { 57 | expect(compareVersions('41.0', '41')).to.be.equal(0); 58 | }); 59 | 60 | it('should return < 0 when a is 41.0 and b is 41.0.1', () => { 61 | expect(compareVersions('41.0', '41.0.1')).to.be.lessThan(0); 62 | }); 63 | 64 | it('should return <0 when a is 41.0.0.1 and b is 41.0.1', () => { 65 | expect(compareVersions('41.0.0.1', '41.0.1')).to.be.lessThan(0); 66 | }); 67 | 68 | it('should return < 0 when a is 1.0.1 and b is 1.1.1', () => { 69 | expect(compareVersions('1.0.1', '1.1.1')).to.be.lessThan(0); 70 | }); 71 | 72 | it('should return > 0 when a is 1.1.1 and b is 1.0.1', () => { 73 | expect(compareVersions('1.1.1', '1.0.1')).to.be.greaterThan(0); 74 | }); 75 | 76 | it('should return > 0 when a is 2 and b is 1.1.1', () => { 77 | expect(compareVersions('2', '1.1.1')).to.be.greaterThan(0); 78 | }); 79 | 80 | it('should return > 0 when a is 1.1.1 and b is 2', () => { 81 | expect(compareVersions('1.1.1', '2')).to.be.lessThan(0); 82 | }); 83 | 84 | it('should ignore dash suffixes', () => { 85 | expect(compareVersions('1.1.1-2', '2-1.1.1')).to.be.lessThan(0); 86 | }); 87 | }); 88 | 89 | describe('checkNodeVersion', () => { 90 | let sandbox: sinon.SinonSandbox; 91 | let exit: sinon.SinonStub; 92 | 93 | beforeEach(() => { 94 | sandbox = sinon.createSandbox(); 95 | exit = sandbox.stub(process, 'exit'); 96 | }); 97 | 98 | afterEach(() => { 99 | sandbox.restore(); 100 | }); 101 | 102 | it('should exit on older versions', () => { 103 | checkNodeVersion('8.0.0', '8.4.0'); 104 | expect(exit.calledOnce).to.be.true; 105 | expect(exit.getCall(0).args[0]).to.equal(1); 106 | }); 107 | 108 | it('should not exit on the same version', () => { 109 | checkNodeVersion('8.4.0', '8.4.0'); 110 | expect(exit.calledOnce).to.be.false; 111 | }); 112 | 113 | it('should not exit on newer versions', () => { 114 | checkNodeVersion('10.0.0', '8.4.0'); 115 | expect(exit.calledOnce).to.be.false; 116 | }); 117 | }); 118 | }); 119 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./node_modules/@salesforce/dev-config/tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "dist", 5 | "typeRoots": ["./node_modules/@types"], 6 | "baseUrl": "./", 7 | "strict": true, 8 | "declaration": false, 9 | "allowJs": true, 10 | "importHelpers": true, 11 | "skipLibCheck": true 12 | }, 13 | "include": ["src/**/*.ts", "src/**/*.js"] 14 | } 15 | --------------------------------------------------------------------------------