From 3cd2777321107256947cbb88ea230b6af27892eb Mon Sep 17 00:00:00 2001 From: Vamsi-Mundra-Salesforce Date: Thu, 12 Aug 2021 10:22:12 -0700 Subject: [PATCH] feat: configurations --- .circleci/config.yml | 31 +++++++ .git2gus/config.json | 4 + .github/dependabot.yml | 14 +++ .github/workflows/slackprnotification.yml | 23 +++++ .gitignore | 35 ++++++++ .mocharc.json | 7 ++ .nycrc | 5 ++ .prettierignore | 2 + .prettierrc.json | 1 + .vscode/launch.json | 15 ++++ .vscode/settings.json | 10 +++ .yarnrc | 3 + CODE_OF_CONDUCT.md | 105 ++++++++++++++++++++++ CONTRIBUTING.md | 52 +++++++++++ DEVELOPING.md | 63 +++++++++++++ LICENSE.txt | 12 +++ SECURITY.md | 7 ++ commitlint.config.js | 1 + 18 files changed, 390 insertions(+) create mode 100644 .circleci/config.yml create mode 100644 .git2gus/config.json create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/slackprnotification.yml create mode 100644 .gitignore create mode 100644 .mocharc.json create mode 100644 .nycrc create mode 100644 .prettierignore create mode 100644 .prettierrc.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/settings.json create mode 100644 .yarnrc create mode 100644 CODE_OF_CONDUCT.md create mode 100644 CONTRIBUTING.md create mode 100644 DEVELOPING.md create mode 100644 LICENSE.txt create mode 100644 SECURITY.md create mode 100644 commitlint.config.js diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..b136eea --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,31 @@ +version: 2.1 + +orbs: + release-management: salesforce/npm-release-management@4 + +workflows: + version: 2 + test-and-release: + jobs: + - release-management/validate-pr: + filters: + branches: + ignore: main + - release-management/test-package: + matrix: + parameters: + os: + - linux + node_version: + - latest + - lts + - maintenance + - release-management/release-lerna-packages: + github-release: true + requires: + - release-management/test-package + filters: + branches: + only: main + post-job-steps: + - run: yarn ci-docs diff --git a/.git2gus/config.json b/.git2gus/config.json new file mode 100644 index 0000000..84b6ce7 --- /dev/null +++ b/.git2gus/config.json @@ -0,0 +1,4 @@ +{ + "productTag": "a1aB00000004Bx8IAE", + "defaultBuild": "offcore.tooling.52" +} \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..4d3f6b3 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: + - package-ecosystem: 'npm' + directory: '/' + schedule: + interval: 'monthly' + labels: + - 'dependencies' + open-pull-requests-limit: 100 + pull-request-branch-name: + separator: '-' + ignore: + - dependency-name: 'typescript' + - dependency-name: 'sinon' diff --git a/.github/workflows/slackprnotification.yml b/.github/workflows/slackprnotification.yml new file mode 100644 index 0000000..7ea0796 --- /dev/null +++ b/.github/workflows/slackprnotification.yml @@ -0,0 +1,23 @@ +name: Slack pull request open notification + +on: + pull_request: + types: [opened, reopened] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Notify slack pr open + env: + WEBHOOK_URL : ${{ secrets.CLI_TEAM_SLACK_WEBHOOK_URL }} + PULL_REQUEST_AUTHOR_ICON_URL : ${{ github.event.pull_request.user.avatar_url }} + PULL_REQUEST_AUTHOR_NAME : ${{ github.event.pull_request.user.login }} + PULL_REQUEST_AUTHOR_PROFILE_URL: ${{ github.event.pull_request.user.html_url }} + PULL_REQUEST_BASE_BRANCH_NAME : ${{ github.event.pull_request.base.ref }} + PULL_REQUEST_COMPARE_BRANCH_NAME : ${{ github.event.pull_request.head.ref }} + PULL_REQUEST_NUMBER : ${{ github.event.pull_request.number }} + PULL_REQUEST_REPO: ${{ github.event.pull_request.head.repo.name }} + PULL_REQUEST_TITLE : ${{ github.event.pull_request.title }} + PULL_REQUEST_URL : ${{ github.event.pull_request.html_url }} + uses: salesforcecli/pr-notification-action@main diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8d60c7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# -- CLEAN + +# use yarn by default, so ignore npm +package-lock.json + +# never checkin npm config +.npmrc + +# debug logs +npm-error.log +yarn-error.log +lerna-debug.log + +# compile source +lib + +# test artifacts +*xunit.xml +*checkstyle.xml +*unitcoverage +.nyc_output +coverage + +# generated docs +docs + +# -- CLEAN ALL +node_modules + +# -- +# put files here you don't want cleaned with sf-clean + +# os specific files +.DS_Store +.idea \ No newline at end of file diff --git a/.mocharc.json b/.mocharc.json new file mode 100644 index 0000000..2e6bae4 --- /dev/null +++ b/.mocharc.json @@ -0,0 +1,7 @@ +{ + "require": "ts-node/register,source-map-support/register", + "watch-extensions": "ts", + "recursive": true, + "reporter": "spec", + "timeout": 5000 +} diff --git a/.nycrc b/.nycrc new file mode 100644 index 0000000..698313e --- /dev/null +++ b/.nycrc @@ -0,0 +1,5 @@ +{ + "nyc": { + "extends": "@salesforce/dev-config/nyc" + } +} \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..34df909 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +docs/ +packages/kit/vendor/lodash.js \ No newline at end of file diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 0000000..514ba17 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1 @@ +"@salesforce/prettier-config" diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..ff1a2d2 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Attach", + "port": 9229, + "request": "attach", + "skipFiles": ["/**"], + "type": "pwa-node" + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..0009c56 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,10 @@ +{ + "typescript.tsdk": "node_modules/typescript/lib", + "npm.packageManager": "yarn", + "json.schemas": [ + { + "fileMatch": ["/**/.sfdevrc.json"], + "url": "./packages/dev-scripts/sfdevrc.schema.json" + } + ] +} diff --git a/.yarnrc b/.yarnrc new file mode 100644 index 0000000..2c7b362 --- /dev/null +++ b/.yarnrc @@ -0,0 +1,3 @@ +registry "https://registry.npmjs.org" +save-exact false +workspaces-experimental true diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..7f547bd --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,105 @@ +# Salesforce Open Source Community Code of Conduct + +## About the Code of Conduct + +Equality is a core value at Salesforce. We believe a diverse and inclusive +community fosters innovation and creativity, and are committed to building a +culture where everyone feels included. + +Salesforce open-source projects are committed to providing a friendly, safe, and +welcoming environment for all, regardless of gender identity and expression, +sexual orientation, disability, physical appearance, body size, ethnicity, nationality, +race, age, religion, level of experience, education, socioeconomic status, or +other similar personal characteristics. + +The goal of this code of conduct is to specify a baseline standard of behavior so +that people with different social values and communication styles can work +together effectively, productively, and respectfully in our open source community. +It also establishes a mechanism for reporting issues and resolving conflicts. + +All questions and reports of abusive, harassing, or otherwise unacceptable behavior +in a Salesforce open-source project may be reported by contacting the Salesforce +Open Source Conduct Committee at ossconduct@salesforce.com. + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of gender +identity and expression, sexual orientation, disability, physical appearance, +body size, ethnicity, nationality, race, age, religion, level of experience, education, +socioeconomic status, or other similar personal characteristics. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy toward other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Personal attacks, insulting/derogatory comments, or trolling +- Public or private harassment +- Publishing, or threatening to publish, others' private information—such as + a physical or electronic address—without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting +- Advocating for or encouraging any of the above behaviors + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned with this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project email +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the Salesforce Open Source Conduct Committee +at ossconduct@salesforce.com. All complaints will be reviewed and investigated +and will result in a response that is deemed necessary and appropriate to the +circumstances. The committee is obligated to maintain confidentiality with +regard to the reporter of an incident. Further details of specific enforcement +policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership and the Salesforce Open Source Conduct +Committee. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][contributor-covenant-home], +version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html. +It includes adaptions and additions from [Go Community Code of Conduct][golang-coc], +[CNCF Code of Conduct][cncf-coc], and [Microsoft Open Source Code of Conduct][microsoft-coc]. + +This Code of Conduct is licensed under the [Creative Commons Attribution 3.0 License][cc-by-3-us]. + +[contributor-covenant-home]: https://www.contributor-covenant.org 'https://www.contributor-covenant.org/' +[golang-coc]: https://golang.org/conduct +[cncf-coc]: https://github.com/cncf/foundation/blob/master/code-of-conduct.md +[microsoft-coc]: https://opensource.microsoft.com/codeofconduct/ +[cc-by-3-us]: https://creativecommons.org/licenses/by/3.0/us/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b745c0c --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,52 @@ +# Contributing + +1. Familiarize yourself with the codebase and the [development](DEVELOPING.md) doc. +1. Create a new issue before starting your project so that we can keep track of + what you are trying to add/fix. That way, we can also offer suggestions or + let you know if there is already an effort in progress. +1. Fork this repository. +1. Create a _topic_ branch in your fork based on the correct branch (usually the **main** branch, see [Branches section](#branches) below). Note, this step is recommended but technically not required if contributing using a fork. +1. Edit the code in your fork. +1. Write appropriate tests for your changes. Try to achieve at least 95% code coverage on any new code. No pull request will be accepted without unit tests. +1. Sign CLA (see [CLA](#cla) below) +1. Send us a pull request when you are done. We'll review your code, suggest any + needed changes, and merge it in. + +## CLA + +External contributors will be required to sign a Contributor's License +Agreement. You can do so by going to https://cla.salesforce.com/sign-cla. + +## Branches + +- We work in branches off of `main`. +- Our released (aka. _production_) branch is `main`. +- Our work happens in _topic_ branches (feature and/or bug-fix). + - feature as well as bug-fix branches are based on `main` + - branches _should_ be kept up-to-date using `rebase` + - see below for further merge instructions + +### Merging between branches + +- We try to limit merge commits as much as possible. + + - They are usually only ok when done by our release automation. + +- _Topic_ branches are: + + 1. based on `main` and will be + 1. squash-merged into `main`. + +### Releasing + +- A new version of this library will be published upon merging PRs to `main`, with the version number increment based on commitizen. + +## Pull Requests + +- Develop features and bug fixes in _topic_ branches. +- _Topic_ branches can live in forks (external contributors) or within this repository (committers). + \*\* When creating _topic_ branches in this repository please prefix with `/`. + +### Merging Pull Requests + +- Pull request merging is restricted to squash & merge only. diff --git a/DEVELOPING.md b/DEVELOPING.md new file mode 100644 index 0000000..b8ea1b7 --- /dev/null +++ b/DEVELOPING.md @@ -0,0 +1,63 @@ +# Developing + +## Pre-requisites + +1. We use the active NodeJS LTS. If you need to work with multiple versions of Node, you + might consider using [nvm](https://github.com/creationix/nvm). +1. This repository uses [yarn](https://yarnpkg.com/) to manage node dependencies. Please install yarn globally using `npm install --global yarn`. +1. Tests are executed on the latest NodeJS as well as all active and maintained NodeJS LTS versions. + +## Structure + +### Packages + +The packages directory contains the different npm packages. + +## Typical workflow + +You would only do this once after you cloned the repository. + +1. Clone this repository from git. +1. `cd` into `sfdx-dev-packages`. +1. We develop using feature brances off `main` and release from the `main` branch. At + this point, it should be set to `main` by default. If not, run `git checkout -t origin/main`. +1. `yarn` to bring in all the top-level dependencies and bootstrap. +1. Open the project in your editor of choice. + +## When you are ready to commit + +1. We enforce commit message format. We recommend using [commitizen](https://github.com/commitizen/cz-cli) by installing it with `yarn global add commitizen` then commit using `git cz` which will prompt you questions to format the commit message. +1. Before commit and push, husky will run several hooks to ensure the message and that everything lints and compiles properly. + +## List of Useful commands + +_These commands assume that they are executed from the top-level directory. +Internally, they delegate to `lerna` to call them on each npm module in the +packages directory._ + +### `yarn bootstrap` + +This bootstraps the packages by issuing a `yarn install` on each package and +also symlinking any package that are part of the packages folder. + +You would want do this as the first step after you have made changes in the +modules. + +If you change the dependencies in your package.json, you will also need to run +this command. + +### `yarn compile` + +This runs `yarn compile` on each of the package in packages. + +### `yarn clean` + +This run `yarn clean` on each of the package in packages. Running `yarn cleal-all` will also clean up the node_module directories. + +### `yarn test` + +This runs `yarn test` on each of the packages. + +### `yarn lint` + +This runs `yarn lint` on each of the packages. diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..9b64188 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,12 @@ +Copyright (c) 2018, Salesforce.com, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +* 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. + +* 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. + +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. \ No newline at end of file diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..8249025 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,7 @@ +## Security + +Please report any security issue to [security@salesforce.com](mailto:security@salesforce.com) +as soon as it is discovered. This library limits its runtime dependencies in +order to reduce the total cost of ownership as much as can be, but all consumers +should remain vigilant and have their security stakeholders review all third-party +products (3PP) like this one and their dependencies. diff --git a/commitlint.config.js b/commitlint.config.js new file mode 100644 index 0000000..422b194 --- /dev/null +++ b/commitlint.config.js @@ -0,0 +1 @@ +module.exports = { extends: ['@commitlint/config-conventional'] };