├── .editorconfig ├── .eslintrc.js ├── .git2gus └── config.json ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── Bug_report.md │ └── Feature_request.md ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── automerge.yml │ ├── devScripts.yml │ ├── failureNotifications.yml │ ├── manualRelease.yml │ ├── notify-slack-on-pr-open.yml │ ├── onPushToMain.yml │ ├── onRelease.yml │ ├── test.yml │ └── validate-pr.yml ├── .gitignore ├── .husky ├── commit-msg ├── pre-commit └── pre-push ├── .images └── vscodeScreenshot.png ├── .lintstagedrc.js ├── .mocharc.json ├── .nycrc ├── .prettierrc.json ├── .vscode ├── launch.json ├── settings.json └── tasks.json ├── CODE_OF_CONDUCT.md ├── LICENSE.txt ├── README.md ├── SECURITY.md ├── bin ├── dev ├── dev.cmd ├── run └── run.cmd ├── command-snapshot.json ├── commitlint.config.js ├── messages ├── messages.json └── org.json ├── package.json ├── src ├── commands │ └── hello │ │ └── org.ts └── index.ts ├── test ├── .eslintrc.js ├── commands │ └── hello │ │ ├── org.nut.ts │ │ └── org.test.ts └── tsconfig.json ├── tsconfig.json └── yarn.lock /.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) 2021, 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/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: 'npm' 4 | directory: '/' 5 | schedule: 6 | interval: 'weekly' 7 | day: 'saturday' 8 | versioning-strategy: 'increase' 9 | labels: 10 | - 'dependencies' 11 | open-pull-requests-limit: 5 12 | pull-request-branch-name: 13 | separator: '-' 14 | commit-message: 15 | # cause a release for non-dev-deps 16 | prefix: fix(deps) 17 | # no release for dev-deps 18 | prefix-development: chore(dev-deps) 19 | ignore: 20 | - dependency-name: '@salesforce/dev-scripts' 21 | - dependency-name: '*' 22 | update-types: ['version-update:semver-major'] 23 | -------------------------------------------------------------------------------- /.github/workflows/automerge.yml: -------------------------------------------------------------------------------- 1 | name: automerge 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: '42 2,5,8,11 * * *' 6 | 7 | jobs: 8 | automerge: 9 | uses: salesforcecli/github-workflows/.github/workflows/automerge.yml@main 10 | secrets: inherit 11 | -------------------------------------------------------------------------------- /.github/workflows/devScripts.yml: -------------------------------------------------------------------------------- 1 | name: devScripts 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: '50 6 * * 0' 6 | 7 | jobs: 8 | update: 9 | uses: salesforcecli/github-workflows/.github/workflows/devScriptsUpdate.yml@main 10 | secrets: inherit 11 | -------------------------------------------------------------------------------- /.github/workflows/failureNotifications.yml: -------------------------------------------------------------------------------- 1 | name: failureNotifications 2 | 3 | on: 4 | workflow_run: 5 | workflows: 6 | - version, tag and github release 7 | - publish 8 | types: 9 | - completed 10 | 11 | jobs: 12 | failure-notify: 13 | runs-on: ubuntu-latest 14 | if: ${{ github.event.workflow_run.conclusion == 'failure' }} 15 | steps: 16 | - name: Announce Failure 17 | id: slack 18 | uses: slackapi/slack-github-action@v1.21.0 19 | env: 20 | # for non-CLI-team-owned plugins, you can send this anywhere you like 21 | SLACK_WEBHOOK_URL: ${{ secrets.CLI_ALERTS_SLACK_WEBHOOK }} 22 | SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK 23 | with: 24 | # Payload can be visually tested here: https://app.slack.com/block-kit-builder/T01GST6QY0G#%7B%22blocks%22:%5B%5D%7D 25 | # Only copy over the "blocks" array to the Block Kit Builder 26 | payload: | 27 | { 28 | "text": "Workflow \"${{ github.event.workflow_run.name }}\" failed in ${{ github.event.workflow_run.repository.name }}", 29 | "blocks": [ 30 | { 31 | "type": "header", 32 | "text": { 33 | "type": "plain_text", 34 | "text": ":bh-alert: Workflow \"${{ github.event.workflow_run.name }}\" failed in ${{ github.event.workflow_run.repository.name }} :bh-alert:" 35 | } 36 | }, 37 | { 38 | "type": "section", 39 | "text": { 40 | "type": "mrkdwn", 41 | "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 }}" 42 | } 43 | } 44 | ] 45 | } 46 | -------------------------------------------------------------------------------- /.github/workflows/manualRelease.yml: -------------------------------------------------------------------------------- 1 | name: manual release 2 | 3 | on: 4 | workflow_dispatch: 5 | 6 | jobs: 7 | release: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v3 11 | with: 12 | token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 13 | - name: Conventional Changelog Action 14 | id: changelog 15 | uses: TriPSs/conventional-changelog-action@d360fad3a42feca6462f72c97c165d60a02d4bf2 16 | # overriding some of the basic behaviors to just get the changelog 17 | with: 18 | git-user-name: svc-cli-bot 19 | git-user-email: svc_cli_bot@salesforce.com 20 | github-token: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 21 | output-file: false 22 | # always do the release, even if there are no semantic commits 23 | skip-on-empty: false 24 | tag-prefix: '' 25 | - uses: notiz-dev/github-action-json-property@2192e246737701f108a4571462b76c75e7376216 26 | id: packageVersion 27 | with: 28 | path: 'package.json' 29 | prop_path: 'version' 30 | - name: Create Github Release 31 | uses: actions/create-release@v1 32 | env: 33 | GITHUB_TOKEN: ${{ secrets.SVC_CLI_BOT_GITHUB_TOKEN }} 34 | with: 35 | tag_name: ${{ steps.packageVersion.outputs.prop }} 36 | release_name: ${{ steps.packageVersion.outputs.prop }} 37 | -------------------------------------------------------------------------------- /.github/workflows/notify-slack-on-pr-open.yml: -------------------------------------------------------------------------------- 1 | name: Pull Request Slack Notification 2 | 3 | on: 4 | pull_request: 5 | types: [opened, reopened] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Notify Slack on PR open 12 | env: 13 | WEBHOOK_URL : ${{ secrets.CLI_TEAM_SLACK_WEBHOOK_URL }} 14 | PULL_REQUEST_AUTHOR_ICON_URL : ${{ github.event.pull_request.user.avatar_url }} 15 | PULL_REQUEST_AUTHOR_NAME : ${{ github.event.pull_request.user.login }} 16 | PULL_REQUEST_AUTHOR_PROFILE_URL: ${{ github.event.pull_request.user.html_url }} 17 | PULL_REQUEST_BASE_BRANCH_NAME : ${{ github.event.pull_request.base.ref }} 18 | PULL_REQUEST_COMPARE_BRANCH_NAME : ${{ github.event.pull_request.head.ref }} 19 | PULL_REQUEST_NUMBER : ${{ github.event.pull_request.number }} 20 | PULL_REQUEST_REPO: ${{ github.event.pull_request.head.repo.name }} 21 | PULL_REQUEST_TITLE : ${{ github.event.pull_request.title }} 22 | PULL_REQUEST_URL : ${{ github.event.pull_request.html_url }} 23 | uses: salesforcecli/github-workflows/.github/actions/prNotification@main 24 | -------------------------------------------------------------------------------- /.github/workflows/onPushToMain.yml: -------------------------------------------------------------------------------- 1 | # test 2 | name: version, tag and github release 3 | 4 | on: 5 | push: 6 | branches: [main] 7 | 8 | jobs: 9 | release: 10 | uses: salesforcecli/github-workflows/.github/workflows/githubRelease.yml@main 11 | secrets: inherit 12 | 13 | # most repos won't use this 14 | # depends on previous job to avoid git collisions, not for any functionality reason 15 | # docs: 16 | # uses: salesforcecli/github-workflows/.github/workflows/publishTypedoc.yml@main 17 | # secrets: inherit 18 | # needs: release 19 | -------------------------------------------------------------------------------- /.github/workflows/onRelease.yml: -------------------------------------------------------------------------------- 1 | name: publish 2 | 3 | on: 4 | release: 5 | types: [released] 6 | # support manual release in case something goes wrong and needs to be repeated or tested 7 | workflow_dispatch: 8 | inputs: 9 | tag: 10 | description: tag that needs to publish 11 | type: string 12 | required: true 13 | jobs: 14 | npm: 15 | uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main 16 | with: 17 | sign: true 18 | tag: latest 19 | githubTag: ${{ github.event.release.tag_name || inputs.tag }} 20 | secrets: inherit 21 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: tests 2 | on: 3 | push: 4 | branches-ignore: [main] 5 | workflow_dispatch: 6 | 7 | jobs: 8 | yarn-lockfile-check: 9 | uses: salesforcecli/github-workflows/.github/workflows/lockFileCheck.yml@main 10 | # Since the Windows unit tests take much longer, we run the linux unit tests first and then run the windows unit tests in parallel with NUTs 11 | linux-unit-tests: 12 | needs: yarn-lockfile-check 13 | uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main 14 | windows-unit-tests: 15 | needs: linux-unit-tests 16 | uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main 17 | nuts: 18 | needs: linux-unit-tests 19 | uses: salesforcecli/github-workflows/.github/workflows/nut.yml@main 20 | secrets: inherit 21 | strategy: 22 | matrix: 23 | os: [ubuntu-latest, windows-latest] 24 | fail-fast: false 25 | with: 26 | os: ${{ matrix.os }} 27 | -------------------------------------------------------------------------------- /.github/workflows/validate-pr.yml: -------------------------------------------------------------------------------- 1 | name: pr-validation 2 | 3 | on: 4 | pull_request: 5 | types: [opened, reopened, edited] 6 | # only applies to PRs that want to merge to main 7 | branches: [main] 8 | 9 | jobs: 10 | pr-validation: 11 | uses: salesforcecli/github-workflows/.github/workflows/validatePR.yml@main 12 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # -- CLEAN 2 | tmp/ 3 | # use yarn by default, so ignore npm 4 | package-lock.json 5 | 6 | # never checkin npm config 7 | .npmrc 8 | 9 | # debug logs 10 | npm-error.log 11 | yarn-error.log 12 | 13 | 14 | # compile source 15 | lib 16 | 17 | # test artifacts 18 | *xunit.xml 19 | *checkstyle.xml 20 | *unitcoverage 21 | .nyc_output 22 | coverage 23 | test_session* 24 | 25 | # generated docs 26 | docs 27 | 28 | # ignore sfdx-trust files 29 | *.tgz 30 | *.sig 31 | package.json.bak. 32 | 33 | # -- CLEAN ALL 34 | *.tsbuildinfo 35 | .eslintcache 36 | .wireit 37 | node_modules 38 | 39 | # -- 40 | # put files here you don't want cleaned with sf-clean 41 | 42 | # os specific files 43 | .DS_Store 44 | .idea 45 | 46 | oclif.manifest.json 47 | -------------------------------------------------------------------------------- /.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/plugin-template/5325e709e15d4fdda9e61d7133c2e571960f0d78/.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 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible 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 | "type": "node", 9 | "request": "attach", 10 | "name": "Attach", 11 | "port": 9229, 12 | "skipFiles": ["/**"] 13 | }, 14 | { 15 | "name": "Run All Tests", 16 | "type": "node", 17 | "request": "launch", 18 | "protocol": "inspector", 19 | "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", 20 | "args": ["--inspect", "--no-timeouts", "--colors", "test/**/*.test.ts"], 21 | "env": { 22 | "NODE_ENV": "development", 23 | "SFDX_ENV": "development" 24 | }, 25 | "sourceMaps": true, 26 | "smartStep": true, 27 | "internalConsoleOptions": "openOnSessionStart", 28 | "preLaunchTask": "Compile" 29 | }, 30 | { 31 | "type": "node", 32 | "request": "launch", 33 | "name": "Run Current Test", 34 | "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", 35 | "args": ["--inspect", "--no-timeouts", "--colors", "${file}"], 36 | "env": { 37 | "NODE_ENV": "development", 38 | "SFDX_ENV": "development" 39 | }, 40 | "sourceMaps": true, 41 | "smartStep": true, 42 | "internalConsoleOptions": "openOnSessionStart", 43 | "preLaunchTask": "Compile" 44 | } 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.exclude": { 3 | "**/.git": true, 4 | "**/.svn": true, 5 | "**/.hg": true, 6 | "**/CVS": true, 7 | "**/.DS_Store": true 8 | }, 9 | "search.exclude": { 10 | "**/lib": true, 11 | "**/bin": true 12 | }, 13 | "editor.tabSize": 2, 14 | "editor.formatOnSave": true, 15 | "rewrap.wrappingColumn": 80 16 | } 17 | -------------------------------------------------------------------------------- /.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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | # 🛑 Deprecated 2 | 3 | This template used the deprecated SfdxCommand. 4 | 5 | For new plugins, we recommend the generation commands found in plugin-dev. https://github.com/salesforcecli/cli/wiki/Get-Started-And-Create-Your-First-Plug-In#generate-a-plugin-and-run-the-hello-world-command 6 | 7 | If you really want to start from a github template, use 8 | https://github.com/salesforcecli/plugin-template-sf-external (general use) 9 | https://github.com/salesforcecli/plugin-template-sf (a more opiniated template designed for Salesforce-owned plugins) 10 | -------------------------------------------------------------------------------- /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: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const oclif = require('@oclif/core'); 4 | 5 | const path = require('path'); 6 | const project = path.join(__dirname, '..', 'tsconfig.json'); 7 | 8 | // In dev mode -> use ts-node and dev plugins 9 | process.env.NODE_ENV = 'development'; 10 | 11 | // Enable SWC for faster typescript compiling 12 | require('ts-node').register({ project, swc: true }); 13 | 14 | // In dev mode, always show stack traces 15 | const g = (global.oclif = global.oclif || {}); 16 | 17 | // In dev mode, always show stack traces 18 | global.oclif.debug = true; 19 | 20 | // Start the CLI 21 | oclif.run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle')); 22 | -------------------------------------------------------------------------------- /bin/dev.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | node "%~dp0\dev" %* -------------------------------------------------------------------------------- /bin/run: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('@oclif/core').run().then(require('@oclif/core/flush')).catch(require('@oclif/core/handle')); 4 | -------------------------------------------------------------------------------- /bin/run.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | node "%~dp0\run" %* -------------------------------------------------------------------------------- /command-snapshot.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "command": "hello:org", 4 | "plugin": "@salesforce/plugin-template", 5 | "flags": ["apiversion", "force", "json", "location", "loglevel", "name", "targetdevhubusername", "targetusername"], 6 | "alias": [] 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /commitlint.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { extends: ['@commitlint/config-conventional'] }; 2 | -------------------------------------------------------------------------------- /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 | "flags": { 4 | "name": "name to print", 5 | "force": "example boolean flag", 6 | "location": "location to print" 7 | }, 8 | "examples": [ 9 | "sfdx hello:org --targetusername myOrg@example.com --targetdevhubusername devhub@org.com\n Hello world! This is org: MyOrg and I will be around until Tue Mar 20 2018!\n My hub org id is: 00Dxx000000001234\n", 10 | "sfdx hello:org --name myname --targetusername myOrg@example.com\n Hello myname! This is org: MyOrg and I will be around until Tue Mar 20 2018!" 11 | ], 12 | "errorNoOrgResults": "No results found for the org '%s'." 13 | } 14 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@salesforce/plugin-template", 3 | "description": "A template repository for sfdx plugins", 4 | "version": "2.1.0", 5 | "main": "lib/index.js", 6 | "author": "Salesforce", 7 | "bugs": "https://github.com/forcedotcom/cli/issues", 8 | "dependencies": { 9 | "@oclif/core": "^2.8.0", 10 | "@salesforce/command": "^5.3.7", 11 | "@salesforce/core": "^3.34.6", 12 | "tslib": "^2" 13 | }, 14 | "devDependencies": { 15 | "@oclif/plugin-command-snapshot": "^3.3.12", 16 | "@salesforce/cli-plugins-testkit": "^3.3.6", 17 | "@salesforce/dev-config": "^3.0.1", 18 | "@salesforce/dev-scripts": "^4.3.1", 19 | "@salesforce/plugin-command-reference": "^1.6.14", 20 | "@salesforce/prettier-config": "^0.0.2", 21 | "@salesforce/ts-sinon": "1.4.6", 22 | "@swc/core": "^1.3.55", 23 | "@typescript-eslint/eslint-plugin": "^5.44.0", 24 | "@typescript-eslint/parser": "^5.59.1", 25 | "chai": "^4.3.7", 26 | "eslint": "^8.38.0", 27 | "eslint-config-prettier": "^8.8.0", 28 | "eslint-config-salesforce": "^1.2.0", 29 | "eslint-config-salesforce-license": "^0.2.0", 30 | "eslint-config-salesforce-typescript": "^1.1.1", 31 | "eslint-plugin-header": "^3.1.1", 32 | "eslint-plugin-import": "^2.27.5", 33 | "eslint-plugin-jsdoc": "^39.9.1", 34 | "husky": "^7.0.4", 35 | "mocha": "^9.1.3", 36 | "nyc": "^15.1.0", 37 | "oclif": "^3.8.1", 38 | "prettier": "^2.8.8", 39 | "pretty-quick": "^3.1.0", 40 | "shx": "0.2.2", 41 | "sinon": "^11.1.1", 42 | "ts-node": "^10.2.1", 43 | "typescript": "^4.9.5", 44 | "wireit": "^0.9.5" 45 | }, 46 | "config": {}, 47 | "engines": { 48 | "node": ">=14.0.0" 49 | }, 50 | "files": [ 51 | "/lib", 52 | "/messages", 53 | "/oclif.manifest.json" 54 | ], 55 | "homepage": "https://github.com/salesforcecli/plugin-template", 56 | "keywords": [ 57 | "force", 58 | "salesforce", 59 | "sfdx", 60 | "salesforcedx", 61 | "sfdx-plugin" 62 | ], 63 | "license": "BSD-3-Clause", 64 | "oclif": { 65 | "commands": "./lib/commands", 66 | "bin": "sfdx", 67 | "devPlugins": [ 68 | "@oclif/plugin-help", 69 | "@oclif/plugin-command-snapshot", 70 | "@salesforce/plugin-command-reference" 71 | ], 72 | "topics": { 73 | "hello": { 74 | "description": "Commands to say hello." 75 | } 76 | } 77 | }, 78 | "repository": "salesforcecli/plugin-template", 79 | "scripts": { 80 | "build": "wireit", 81 | "clean": "sf-clean", 82 | "clean-all": "sf-clean all", 83 | "clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json", 84 | "compile": "wireit", 85 | "docs": "sf-docs", 86 | "format": "wireit", 87 | "lint": "wireit", 88 | "postpack": "shx rm -f oclif.manifest.json", 89 | "prepack": "sf-prepack", 90 | "prepare": "sf-install", 91 | "test": "wireit", 92 | "test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel", 93 | "test:only": "wireit", 94 | "version": "oclif readme" 95 | }, 96 | "publishConfig": { 97 | "access": "public" 98 | }, 99 | "wireit": { 100 | "build": { 101 | "dependencies": [ 102 | "compile", 103 | "lint" 104 | ] 105 | }, 106 | "compile": { 107 | "command": "tsc -p . --pretty --incremental", 108 | "files": [ 109 | "src/**/*.ts", 110 | "**/tsconfig.json", 111 | "messages/**" 112 | ], 113 | "output": [ 114 | "lib/**", 115 | "*.tsbuildinfo" 116 | ], 117 | "clean": "if-file-deleted" 118 | }, 119 | "format": { 120 | "command": "prettier --write \"+(src|test|schemas)/**/*.+(ts|js|json)|command-snapshot.json\"", 121 | "files": [ 122 | "src/**/*.ts", 123 | "test/**/*.ts", 124 | "schemas/**/*.json", 125 | "command-snapshot.json", 126 | ".prettier*" 127 | ], 128 | "output": [] 129 | }, 130 | "lint": { 131 | "command": "eslint src test --color --cache --cache-location .eslintcache", 132 | "files": [ 133 | "src/**/*.ts", 134 | "test/**/*.ts", 135 | "messages/**", 136 | "**/.eslint*", 137 | "**/tsconfig.json" 138 | ], 139 | "output": [] 140 | }, 141 | "test:compile": { 142 | "command": "tsc -p \"./test\" --pretty", 143 | "files": [ 144 | "test/**/*.ts", 145 | "**/tsconfig.json" 146 | ], 147 | "output": [] 148 | }, 149 | "test": { 150 | "dependencies": [ 151 | "test:compile", 152 | "test:only", 153 | "test:command-reference", 154 | "test:deprecation-policy", 155 | "lint", 156 | "test:json-schema" 157 | ] 158 | }, 159 | "test:only": { 160 | "command": "nyc mocha \"test/**/*.test.ts\"", 161 | "env": { 162 | "FORCE_COLOR": "2" 163 | }, 164 | "files": [ 165 | "test/**/*.ts", 166 | "src/**/*.ts", 167 | "**/tsconfig.json", 168 | ".mocha*", 169 | "!*.nut.ts", 170 | ".nycrc" 171 | ], 172 | "output": [] 173 | }, 174 | "test:command-reference": { 175 | "command": "\"./bin/dev\" commandreference:generate --erroronwarnings", 176 | "files": [ 177 | "src/**/*.ts", 178 | "messages/**", 179 | "package.json" 180 | ], 181 | "output": [ 182 | "tmp/root" 183 | ] 184 | }, 185 | "test:deprecation-policy": { 186 | "command": "\"./bin/dev\" snapshot:compare", 187 | "files": [ 188 | "src/**/*.ts" 189 | ], 190 | "output": [], 191 | "dependencies": [ 192 | "compile" 193 | ] 194 | }, 195 | "test:json-schema": { 196 | "command": "\"./bin/dev\" schema:compare", 197 | "files": [ 198 | "src/**/*.ts", 199 | "schemas" 200 | ], 201 | "output": [] 202 | } 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /src/commands/hello/org.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 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 { flags, SfdxCommand } from '@salesforce/command'; 10 | import { Messages, SfError } from '@salesforce/core'; 11 | import { AnyJson } from '@salesforce/ts-types'; 12 | 13 | // Initialize Messages with the current plugin directory 14 | Messages.importMessagesDirectory(__dirname); 15 | 16 | // Load the specific messages for this file. Messages from @salesforce/command, @salesforce/core, 17 | // or any library that is using the messages framework can also be loaded this way. 18 | // TODO: replace the package name with your new package's name 19 | const messages = Messages.loadMessages('@salesforce/plugin-template', 'org'); 20 | 21 | export default class Org extends SfdxCommand { 22 | public static description = messages.getMessage('commandDescription'); 23 | 24 | public static examples = messages.getMessage('examples').split(os.EOL); 25 | 26 | public static args = [{ name: 'file' }]; 27 | 28 | protected static flagsConfig = { 29 | // flag with a value (-n, --name=VALUE) 30 | name: flags.string({ 31 | char: 'n', 32 | description: messages.getMessage('flags.name'), 33 | }), 34 | force: flags.boolean({ 35 | char: 'f', 36 | description: messages.getMessage('flags.force'), 37 | }), 38 | location: flags.string({ 39 | char: 'l', 40 | description: messages.getMessage('flags.location'), 41 | }), 42 | }; 43 | 44 | // Comment this out if your command does not require an org username 45 | protected static requiresUsername = true; 46 | 47 | // Comment this out if your command does not support a hub org username 48 | protected static supportsDevhubUsername = true; 49 | 50 | // Set this to true if your command requires a project workspace; 'requiresProject' is false by default 51 | protected static requiresProject = false; 52 | 53 | public async run(): Promise { 54 | const name = (this.flags.name as string) ?? 'world'; 55 | const location = (this.flags.location as string) ?? 'a hidden location'; 56 | // this.org is guaranteed because requiresUsername=true, as opposed to supportsUsername 57 | const conn = this.org.getConnection(); 58 | const query = 'Select Name, TrialExpirationDate from Organization'; 59 | 60 | // The type we are querying for 61 | interface Organization { 62 | Name: string; 63 | TrialExpirationDate: string; 64 | } 65 | 66 | // Query the org 67 | const result = await conn.query(query); 68 | 69 | // Organization will always return one result, but this is an example of throwing an error 70 | // The output and --json will automatically be handled for you. 71 | if (!result.records || result.records.length <= 0) { 72 | throw new SfError(messages.getMessage('errorNoOrgResults', [this.org.getOrgId()])); 73 | } 74 | 75 | // Organization always only returns one result 76 | const orgName: string = result.records[0].Name; 77 | const trialExpirationDate = result.records[0].TrialExpirationDate; 78 | 79 | let outputString = `Hello ${name} from ${location}! This is org: ${orgName}`; 80 | if (trialExpirationDate) { 81 | const date = new Date(trialExpirationDate).toDateString(); 82 | outputString = `${outputString} and I will be around until ${date}!`; 83 | } 84 | this.ux.log(outputString); 85 | 86 | // this.hubOrg is NOT guaranteed because supportsHubOrgUsername=true, as opposed to requiresHubOrgUsername. 87 | if (this.hubOrg) { 88 | const hubOrgId = this.hubOrg.getOrgId(); 89 | this.ux.log(`My hub org id is: ${hubOrgId}`); 90 | } 91 | 92 | if (this.flags.force && this.args.file) { 93 | this.ux.log(`You input --force and a file: ${this.args.file as string}`); 94 | } 95 | 96 | // Return an object to be displayed with --json 97 | return { orgId: this.org?.getOrgId(), outputString }; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 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 | -------------------------------------------------------------------------------- /test/.eslintrc.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 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/commands/hello/org.nut.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 | import { expect } from 'chai'; 9 | import { execCmd, TestSession } from '@salesforce/cli-plugins-testkit'; 10 | 11 | export interface Organization { 12 | orgId: string; 13 | outputString: string; 14 | } 15 | 16 | describe('Limits display', () => { 17 | let testSession: TestSession; 18 | 19 | before('prepare session and ensure environment variables', async () => { 20 | testSession = await TestSession.create({ 21 | devhubAuthStrategy: 'AUTO', 22 | scratchOrgs: [ 23 | { 24 | executable: 'sfdx', 25 | edition: 'developer', 26 | alias: 'MyScratchOrg', 27 | setDefault: true, 28 | }, 29 | ], 30 | }); 31 | }); 32 | 33 | after(async () => { 34 | await testSession?.clean(); 35 | }); 36 | 37 | it('tests the name flag', () => { 38 | const username = testSession.orgs.get('default').username; 39 | const output = execCmd(`hello:org --name ${username} --json`, { ensureExitCode: 0 }).jsonOutput; 40 | expect(output.result.orgId).length.greaterThan(0); 41 | expect(output.status).to.equal(0); 42 | }); 43 | 44 | it('tests the location flag', () => { 45 | const output = execCmd('hello:org --location "San Francisco" --json', { 46 | ensureExitCode: 0, 47 | }).jsonOutput; 48 | expect(output.result.outputString).contains('San Francisco'); 49 | expect(output.status).to.equal(0); 50 | }); 51 | 52 | it('tests the location flag default', () => { 53 | const output = execCmd('hello:org --json', { ensureExitCode: 0 }).jsonOutput; 54 | expect(output.result.outputString).contains('a hidden location'); 55 | expect(output.status).to.equal(0); 56 | }); 57 | }); 58 | -------------------------------------------------------------------------------- /test/commands/hello/org.test.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2021, 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 { expect, test } from '@salesforce/command/lib/test'; 8 | import { ensureJsonMap, ensureString } from '@salesforce/ts-types'; 9 | 10 | describe('hello:org', () => { 11 | test 12 | .withOrg({ username: 'test@org.com' }, true) 13 | .withConnectionRequest((request) => { 14 | const requestMap = ensureJsonMap(request); 15 | if (ensureString(requestMap.url).includes('Organization')) { 16 | return Promise.resolve({ 17 | records: [ 18 | { 19 | Name: 'Super Awesome Org', 20 | TrialExpirationDate: '2018-03-20T23:24:11.000+0000', 21 | }, 22 | ], 23 | }); 24 | } 25 | return Promise.resolve({ records: [] }); 26 | }) 27 | .stdout() 28 | .command(['hello:org', '--targetusername', 'test@org.com']) 29 | .it('runs hello:org --targetusername test@org.com', (ctx) => { 30 | expect(ctx.stdout).to.contain( 31 | 'Hello world from a hidden location! This is org: Super Awesome Org and I will be around until Tue Mar 20 2018!' 32 | ); 33 | }); 34 | }); 35 | -------------------------------------------------------------------------------- /test/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@salesforce/dev-config/tsconfig-test", 3 | "include": ["./**/*.ts"], 4 | "compilerOptions": { 5 | "skipLibCheck": true 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@salesforce/dev-config/tsconfig", 3 | "compilerOptions": { 4 | "outDir": "lib", 5 | "rootDir": "src" 6 | }, 7 | "include": ["./src/**/*.ts"] 8 | } 9 | --------------------------------------------------------------------------------