Skip to content

Commit

Permalink
feat: init release
Browse files Browse the repository at this point in the history
  • Loading branch information
mcarvin8 committed Nov 9, 2024
0 parents commit c18b562
Show file tree
Hide file tree
Showing 43 changed files with 8,592 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.cjs/
7 changes: 7 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: ['eslint-config-salesforce-typescript', 'plugin:sf-plugin/recommended'],
root: true,
rules: {
header: 'off',
},
};
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
day: 'saturday'
versioning-strategy: 'increase'
labels:
- 'dependencies'
open-pull-requests-limit: 5
pull-request-branch-name:
separator: '-'
commit-message:
# cause a release for non-dev-deps
prefix: fix(deps)
# no release for dev-deps
prefix-development: chore(dev-deps)
ignore:
- dependency-name: '@salesforce/dev-scripts'
- dependency-name: '*'
update-types: ['version-update:semver-major']
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Release
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write

jobs:
unit-tests:
uses: salesforcecli/github-workflows/.github/workflows/unitTest.yml@main
nuts:
needs: unit-tests
uses: salesforcecli/github-workflows/.github/workflows/nut.yml@main
secrets: inherit
strategy:
matrix:
os: [windows-latest]
fail-fast: false
with:
os: ${{ matrix.os }}
release:
needs: [unit-tests, nuts]
name: Release
runs-on: ubuntu-latest
steps:
- name: Release Please
id: release
uses: googleapis/release-please-action@v4
with:
release-type: node

- name: Checkout
uses: actions/checkout@v4.1.1
if: ${{ steps.release.outputs.release_created == 'true' }}

- name: Setup Node
uses: actions/setup-node@v4.0.1
with:
node-version: 18
cache: yarn
registry-url: 'https://registry.npmjs.org'
if: ${{ steps.release.outputs.release_created == 'true' }}

- name: Install Dependencies
run: yarn install
if: ${{ steps.release.outputs.release_created == 'true' }}

- name: Build
run: yarn build
if: ${{ steps.release.outputs.release_created == 'true' }}

- name: Publish to NPM
run: npm publish --access public --tag latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
if: ${{ steps.release.outputs.release_created == 'true' }}
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: tests
on:
push:
branches-ignore: [main]
workflow_dispatch:

jobs:
unit-tests:
uses: salesforcecli/github-workflows/.github/workflows/unitTest.yml@main
nuts:
needs: unit-tests
uses: salesforcecli/github-workflows/.github/workflows/nut.yml@main
secrets: inherit
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
fail-fast: false
with:
os: ${{ matrix.os }}
51 changes: 51 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# -- CLEAN
tmp/
# use yarn by default, so ignore npm
package-lock.json

# never checkin npm config
.npmrc

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


# compile source
lib

# test artifacts
*xunit.xml
*checkstyle.xml
*unitcoverage
.nyc_output
coverage
test_session*
stderr*.txt
stdout*.txt

# generated docs
docs

# ignore sfdx-trust files
*.tgz
*.sig
package.json.bak.


npm-shrinkwrap.json
oclif.manifest.json
oclif.lock

# -- CLEAN ALL
*.tsbuildinfo
.eslintcache
.wireit
node_modules

# --
# put files here you don't want cleaned with sf-clean

# os specific files
.DS_Store
.idea
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint && yarn pretty-quick --staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn build && yarn test
3 changes: 3 additions & 0 deletions .lintstagedrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
'**/*.{js,json,md}?(x)': () => 'npm run reformat',
};
8 changes: 8 additions & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"require": ["ts-node/register"],
"watch-extensions": "ts",
"recursive": true,
"reporter": "spec",
"timeout": 600000,
"node-option": ["loader=ts-node/esm"]
}
7 changes: 7 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"check-coverage": true,
"lines": 90,
"statements": 90,
"functions": 90,
"branches": 90
}
1 change: 1 addition & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"@salesforce/prettier-config"
10 changes: 10 additions & 0 deletions .sfdevrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"test": {
"testsPath": "test/**/*.test.ts"
},
"wireit": {
"test": {
"dependencies": ["test:compile", "test:only", "lint"]
}
}
}
45 changes: 45 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
// 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": [
{
"type": "node",
"request": "attach",
"name": "Attach",
"port": 9229,
"skipFiles": ["<node_internals>/**"]
},
{
"name": "Run All Tests",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/mocha/bin/mocha",
"args": ["--inspect", "--colors", "test/**/*.test.ts"],
"env": {
"NODE_ENV": "development",
"SFDX_ENV": "development"
},
"sourceMaps": true,
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "Compile tests"
},
{
"type": "node",
"request": "launch",
"name": "Run Current Test",
"program": "${workspaceFolder}/node_modules/mocha/bin/mocha",
"args": ["--inspect", "--colors", "${file}"],
"env": {
"NODE_ENV": "development",
"SFDX_ENV": "development"
},
"sourceMaps": true,
"smartStep": true,
"internalConsoleOptions": "openOnSessionStart",
"preLaunchTask": "Compile tests"
}
]
}
16 changes: 16 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true
},
"search.exclude": {
"**/lib": true,
"**/bin": true
},
"editor.tabSize": 2,
"editor.formatOnSave": true,
"rewrap.wrappingColumn": 80
}
21 changes: 21 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "2.0.0",
"problemMatcher": "$tsc",
"tasks": [
{
"label": "Compile tests",
"group": {
"kind": "build",
"isDefault": true
},
"command": "yarn",
"type": "shell",
"presentation": {
"focus": false,
"panel": "dedicated"
},
"args": ["run", "pretest"],
"isBackground": false
}
]
}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<!-- markdownlint-disable MD024 MD025 -->
<!-- markdown-link-check-disable -->

# Changelog

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.
9 changes: 9 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) 2024 Matthew Carvin

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.
47 changes: 47 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# sf-package-combiner

[![NPM](https://img.shields.io/npm/v/sf-package-combiner.svg?label=sf-package-combiner)](https://www.npmjs.com/package/sf-package-combiner) [![Downloads/week](https://img.shields.io/npm/dw/sf-package-combiner.svg)](https://npmjs.org/package/sf-package-combiner) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/salesforcecli/sf-package-combiner/main/LICENSE.txt)

A Salesforce CLI plugin to combine multiple manifest files (package.xml) into 1 file that can be used for deployments.

**NOTE:** When the packages are combined, the `<name>` tags with the metadata name will be converted to lower-case, ex: `<name>customobject</name>`. This ensures that multiple members of the same metadata name are grouped together in the combined package. The `<name>` tags are case insensitive when read by the Salesforce CLI. However, the `<members>` tags are case sensitive and must match the cases to match their API names in Salesforce. This tool will not convert the `<members>` cases, just the `<name`> tags.

The combined package.xml will use the maximum `<version>` tag found in all packages. If none of the packages provided have `<version>`, it will omit this from the combined package.xml. When you deploy a package.xml without an API version, it will check the `sfdx-project.json` file for the `sourceApiVersion`. If both files do not have an API version, it will default to the max API version available in the target org.

## Install

```bash
sf plugins install sf-package-combiner@x.y.z
```

## Commands

<!-- commands -->

- [`sf sfpc combine`](#sf-sfpc-combine)

## `sf sfpc combine`

Combine Salesforce manifest files together.

```
USAGE
$ sf sfpc combine [--json] [-f <value>]
FLAGS
-f, --package-file=<value> The path to an existing package.xml file. This flag can be specified multiple times.
-c, --combined-package=<value> The path to save the combined package.xml to.
GLOBAL FLAGS
--json Format output as json.
DESCRIPTION
Combine multiple package files into 1 singular package file.
EXAMPLES
Combine pack1.xml and pack2.xml into package.xml
$ sf sfpc combine -f pack1.xml -f pack2.xml -c package.xml
```

<!-- commandsstop -->
3 changes: 3 additions & 0 deletions bin/dev.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
8 changes: 8 additions & 0 deletions bin/dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env -S node --loader ts-node/esm --no-warnings=ExperimentalWarning
// eslint-disable-next-line node/shebang
async function main() {
const { execute } = await import('@oclif/core');
await execute({ development: true, dir: import.meta.url });
}

await main();
3 changes: 3 additions & 0 deletions bin/run.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

node "%~dp0\run" %*
Loading

0 comments on commit c18b562

Please sign in to comment.