Skip to content

Commit

Permalink
initial commit of sf project, metadata, GitHub Actions...
Browse files Browse the repository at this point in the history
  • Loading branch information
hmayerhutte committed Aug 9, 2024
0 parents commit b3a4fa9
Show file tree
Hide file tree
Showing 223 changed files with 15,376 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .forceignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# List files or directories below to ignore them when running force:source:push, force:source:pull, and force:source:status
# More information: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_exclude_source.htm
#

package.xml

# LWC configuration files
**/jsconfig.json
**/.eslintrc.json

# LWC Jest
**/__tests__/**
**/tsconfig.json

**/*.ts
79 changes: 79 additions & 0 deletions .github/workflows/code-analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Salesforce Code Quality

on:
workflow_dispatch:
workflow_call:

jobs:
PMD:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- name: Setup Salesforce CLI
run: |
npm i --global @salesforce/cli
sf plugins:install @salesforce/sfdx-scanner
- name: SF Code Analyzer - PMD - Report findings as comments
uses: mitchspano/[email protected]
with:
report-mode: comments
engine: pmd
pmdconfig: config/pmd/ruleset.xml
severity-threshold: 4
strictly-enforced-rules: '[{ "engine": "pmd", "category": "Performance", "rule": "AvoidDebugStatements" }]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

RetireJS:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- name: Setup Salesforce CLI
run: |
npm i --global @salesforce/cli
sf plugins:install @salesforce/sfdx-scanner
- name: SF Code Analyzer - RetireJS - Report findings as comments
uses: mitchspano/[email protected]
with:
report-mode: comments
engine: retire-js
severity-threshold: 4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

ESLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- name: Setup Salesforce CLI
run: |
npm i --global @salesforce/cli
sf plugins:install @salesforce/sfdx-scanner
- name: Install deps
run: |
yarn install
- name: SF Code Analyzer - ESLint - Report findings as comments
uses: mitchspano/[email protected]
with:
report-mode: comments
engine: eslint
eslintconfig: .eslintrc.json
severity-threshold: 4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

GraphEngine:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
- name: Setup Salesforce CLI
run: |
npm i --global @salesforce/cli
sf plugins:install @salesforce/sfdx-scanner
- name: SF Code Analyzer - Data Flow Analysis
run: |
sf scanner:run:dfa --target force-app --projectdir force-app --format table --severity-threshold 3
28 changes: 28 additions & 0 deletions .github/workflows/create-package-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Create Package Beta

on:
workflow_dispatch:
workflow_call:

jobs:
default:
name: Create Package Beta
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup Salesforce CLI
run: |
npm install --global @salesforce/cli
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate Dev Hub org
run: |
echo "${{ secrets.SFDX_AUTH_URL_DEVHUB }}" | sf org login sfdx-url --set-default-dev-hub --sfdx-url-stdin
- name: Create package beta
run: |
# increment minor version, fallback to 0.1.0
nextReleaseVersion="$(sf package version list --packages "ISVShowcase" --released --order-by MajorVersion,MinorVersion,PatchVersion --json | yq '.result[-1] | ( .MajorVersion + "." + ( .MinorVersion + 1 ) + "." + .PatchVersion )' || echo "0.1.0")"
sf package version create --package ISVShowcase --version-number "${nextReleaseVersion}.NEXT" --installation-key-bypass --code-coverage --wait 30
40 changes: 40 additions & 0 deletions .github/workflows/create-package-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Create Package Version

on:
workflow_dispatch:
workflow_call:
outputs:
packageVersionId:
description: 'If a package version has been published, this is the package version id (04t)'
value: ${{ jobs.default.outputs.packageVersionId }}
version:
description: 'If a package version has been published, this is the package version number (major.minor.patch.build)'
value: ${{ jobs.default.outputs.version }}

jobs:
default:
name: Create Package Version
runs-on: ubuntu-latest
outputs:
packageVersionId: ${{ steps.create-package-version.outputs.packageVersionId }}
version: ${{ steps.create-package-version.outputs.version }}
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup Salesforce CLI
run: |
npm install --global @salesforce/cli
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Authenticate Dev Hub org
run: |
echo "${{ secrets.SFDX_AUTH_URL_DEVHUB }}" | sf org login sfdx-url --set-default-dev-hub --sfdx-url-stdin
- id: create-package-version
name: Create package version
run: |
npx -y -p @semantic-release/exec -p semantic-release semantic-release
# packageVersionId and version will be set as output for the GH action (see release.config.mjs)
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/install-package-version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Install Package Version

on:
workflow_dispatch:
inputs:
packageVersion:
description: 'ID (starts with 04t) or alias of the package version to install'
required: true
workflow_call:
inputs:
packageVersion:
type: string
description: 'ID (starts with 04t) or alias of the package version to install'
required: true

jobs:
default:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Setup Salesforce CLI
run: |
npm install --global @salesforce/cli
- name: Authenticate target org
run: |
echo "${{ secrets.AUTH_URL_TRIAL_DEMO }}" | sf org login sfdx-url --set-default --sfdx-url-stdin
- name: Install package version in target org
run: |
sf package install --no-prompt --publish-wait 20 --wait 60 --package "${{ inputs.packageVersion }}"
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Main

on:
push:
branches:
- main
paths:
- force-app/**

jobs:
create-package-version:
name: Run Create Package Version Workflow
uses: ./.github/workflows/create-package-version.yml
secrets: inherit
install-package-version:
name: Run Install Package Version Workflow
uses: ./.github/workflows/install-package-version.yml
needs: create-package-version
if: ${{ needs.create-package-version.outputs.packageVersionId != '' }}
with:
packageVersion: ${{ needs.create-package-version.outputs.packageVersionId }}
secrets: inherit
18 changes: 18 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Pull Request

on:
pull_request:
branches:
- main
paths:
- force-app/**

jobs:
code-analyze:
name: Run Salesforce Code Analyzer
uses: ./.github/workflows/code-analyze.yml
secrets: inherit
create-package-beta:
name: Run Create Package Beta Workflow
uses: ./.github/workflows/create-package-beta.yml
secrets: inherit
61 changes: 61 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This file is used for Git repositories to specify intentionally untracked files that Git should ignore.
# If you are not using git, you can delete this file. For more information see: https://git-scm.com/docs/gitignore
# For useful gitignore templates see: https://github.com/github/gitignore

# Salesforce cache
.sf/
.sfdx/
.localdevserver/
deploy-options.json

# LWC VSCode autocomplete
**/lwc/jsconfig.json

# LWC Jest coverage reports
coverage/

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Dependency directories
node_modules/

# Eslint cache
.eslintcache

# MacOS system files
.DS_Store

# Windows system files
Thumbs.db
ehthumbs.db
[Dd]esktop.ini
$RECYCLE.BIN/

# Local environment variables
.env

# Python Salesforce Functions
**/__pycache__/
**/.venv/
**/venv/

# SFDMU
/data/source/
/data/target/
/data/logs/

# SGD
deltas*

# package xml
package.xml

# SFDMU
/data/sfdmu/source/
/data/sfdmu/target/
/data/sfdmu/logs/
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npm run precommit
3 changes: 3 additions & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'**/*.{auradoc,cls,cmp,component,css,design,html,js,json,md,page,trigger,xml,yaml,yml}': 'prettier --write'
};
9 changes: 9 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# List files or directories below to ignore them when running prettier
# More information: https://prettier.io/docs/en/ignore.html
#

**/staticresources/**
.localdevserver
.sfdx
*.md
coverage/
23 changes: 23 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"singleQuote": true,
"printWidth": 120,
"requireConfig": false,
"useTabs": false,
"trailingComma": "none",
"bracketSpacing": true,
"jsxBracketSameLine": false,
"semi": true,
"tabWidth": 4,
"editor.formatOnSave": true,
"overrides": [
{
"files": "**/lwc/**/*.html",
"options": { "parser": "lwc" }
},
{
"files": "*.{cmp,page,component}",
"options": { "parser": "html" }
}
],
"plugins": ["prettier-plugin-apex", "@prettier/plugin-xml"]
}
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Hutte

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This repository contains

## Skeleton SF Project
Based on [Hutte Project Template](https://github.com/hutte-recipes/hutte-project-template)

## Sample source and GitHub Actions to build/promote/install package versions

Check [Creating a 2GP for AppExchange](https://hutte-io.notion.site/Creating-a-2GP-for-AppExchange-c3a92c93261d4cb1a658fff696622bdb) for learning more about generating your first 2GP

When using this template, please make sure to replace the namespace Hutte in all files inside the force-app directory (replace Hutte__ with YourNamespace__) as well as in sfdx-project.json (property "namespace").
Loading

0 comments on commit b3a4fa9

Please sign in to comment.