Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update template files #8

Merged
merged 5 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 0 additions & 43 deletions .circleci/config.yml

This file was deleted.

9 changes: 9 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2024, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
module.exports = {
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license', 'plugin:sf-plugin/library'],
};
23 changes: 0 additions & 23 deletions .eslintrc.js

This file was deleted.

4 changes: 2 additions & 2 deletions .git2gus/config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"productTag": "a1aAH00000004XFYAY",
"defaultBuild": "sf.r1.preprod"
"productTag": "ADD_YOUR_PRODUCT_TAG",
"defaultBuild": "offcore.tooling.54"
}
3 changes: 3 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### What does this PR do?

### What issues does this PR fix or reference?
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']
10 changes: 10 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: automerge
on:
workflow_dispatch:
schedule:
- cron: '42 2,5,8,11 * * *'

jobs:
automerge:
uses: salesforcecli/github-workflows/.github/workflows/automerge.yml@main
secrets: inherit
32 changes: 32 additions & 0 deletions .github/workflows/create-github-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: create-github-release

on:
push:
branches:
- main
- prerelease/**
tags-ignore:
- '*'
workflow_dispatch:
inputs:
prerelease:
type: string
description: 'Name to use for the prerelease: beta, dev, etc. NOTE: If this is already set in the package.json, it does not need to be passed in here.'

jobs:
release:
uses: salesforcecli/github-workflows/.github/workflows/create-github-release.yml@main
secrets: inherit
with:
prerelease: ${{ inputs.prerelease }}
# If this is a push event, we want to skip the release if there are no semantic commits
# However, if this is a manual release (workflow_dispatch), then we want to disable skip-on-empty
# This helps recover from forgetting to add semantic commits ('fix:', 'feat:', etc.)
skip-on-empty: ${{ github.event_name == 'push' }}
# docs:
# # Most repos won't use this
# # Depends on the 'release' job to avoid git collisions, not for any functionality reason
# needs: release
# secrets: inherit
# if: ${{ github.ref_name == 'main' }}
# uses: salesforcecli/github-workflows/.github/workflows/publishTypedoc.yml@main
10 changes: 10 additions & 0 deletions .github/workflows/devScripts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: devScripts
on:
workflow_dispatch:
schedule:
- cron: '50 6 * * 0'

jobs:
update:
uses: salesforcecli/github-workflows/.github/workflows/devScriptsUpdate.yml@main
secrets: inherit
43 changes: 43 additions & 0 deletions .github/workflows/failureNotifications.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: failureNotifications
on:
workflow_run:
workflows:
- publish
- create-github-release
types:
- completed
jobs:
failure-notify:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Announce Failure
id: slack
uses: slackapi/[email protected]
env:
# for non-CLI-team-owned plugins, you can send this anywhere you like
SLACK_WEBHOOK_URL: ${{ secrets.CLI_ALERTS_SLACK_WEBHOOK }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
with:
# Payload can be visually tested here: https://app.slack.com/block-kit-builder/T01GST6QY0G#%7B%22blocks%22:%5B%5D%7D
# Only copy over the "blocks" array to the Block Kit Builder
payload: |
{
"text": "Workflow \"${{ github.event.workflow_run.name }}\" failed in ${{ github.event.workflow_run.repository.name }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":bh-alert: Workflow \"${{ github.event.workflow_run.name }}\" failed in ${{ github.event.workflow_run.repository.name }} :bh-alert:"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"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 }}"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Slack pull request open notification
name: Pull Request Slack Notification

on:
pull_request:
Expand All @@ -8,7 +8,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Notify slack pr open
- name: Notify Slack on PR open
env:
WEBHOOK_URL: ${{ secrets.CLI_TEAM_SLACK_WEBHOOK_URL }}
PULL_REQUEST_AUTHOR_ICON_URL: ${{ github.event.pull_request.user.avatar_url }}
Expand All @@ -20,4 +20,4 @@ jobs:
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
uses: salesforcecli/github-workflows/.github/actions/prNotification@main
31 changes: 31 additions & 0 deletions .github/workflows/onRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: publish
on:
release:
# both release and prereleases
types: [published]
# support manual release in case something goes wrong and needs to be repeated or tested
workflow_dispatch:
inputs:
tag:
description: github tag that needs to publish
type: string
required: true
jobs:
getDistTag:
outputs:
tag: ${{ steps.distTag.outputs.tag }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}
- uses: salesforcecli/github-workflows/.github/actions/getPreReleaseTag@main
id: distTag
npm:
uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main
needs: [getDistTag]
with:
tag: ${{ needs.getDistTag.outputs.tag || 'latest' }}
githubTag: ${{ github.event.release.tag_name || inputs.tag }}

secrets: inherit
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: tests
on:
push:
branches-ignore: [main]
workflow_dispatch:

jobs:
yarn-lockfile-check:
uses: salesforcecli/github-workflows/.github/workflows/lockFileCheck.yml@main
# 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
linux-unit-tests:
needs: yarn-lockfile-check
uses: salesforcecli/github-workflows/.github/workflows/unitTestsLinux.yml@main
windows-unit-tests:
needs: linux-unit-tests
uses: salesforcecli/github-workflows/.github/workflows/unitTestsWindows.yml@main

# Uncomment to enable NUT testing in Github Actions
# nuts:
# needs: linux-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 }}
11 changes: 11 additions & 0 deletions .github/workflows/validate-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: pr-validation

on:
pull_request:
types: [opened, reopened, edited]
# only applies to PRs that want to merge to main
branches: [main]

jobs:
pr-validation:
uses: salesforcecli/github-workflows/.github/workflows/validatePR.yml@main
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ docs
# -- CLEAN ALL
node_modules


.eslintcache
.wireit
*.tsbuildinfo

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

Expand Down
1 change: 1 addition & 0 deletions .mocharc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"require": "test/init.js, ts-node/register, source-map-support/register",
"watch-extensions": "ts",
"watch-files": ["src", "test"],
"recursive": true,
"reporter": "spec",
"timeout": 5000
Expand Down
7 changes: 1 addition & 6 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
{
"nyc": {
"extends": "@salesforce/dev-config/nyc",
"lines": 87,
"statements": 87,
"functions": 89,
"branches": 74,
"exclude": ["**/*.d.ts", "test/**/*.ts"]
"extends": "@salesforce/dev-config/nyc"
}
}
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022, Salesforce.com, Inc.
Copyright (c) 2024, 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:
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@

Template npm library for Salesforce CLI and VSCode Extensions

[![NPM](https://img.shields.io/npm/v/@salesforce/library-template.svg?label=@salesforce/library-template)](https://www.npmjs.com/package/@salesforce/library-template) [![CircleCI](https://circleci.com/gh/forcedotcom/library-template/tree/main.svg?style=shield)](https://circleci.com/gh/forcedotcom/library-template/tree/main) [![Downloads/week](https://img.shields.io/npm/dw/@salesforce/library-template.svg)](https://npmjs.org/package/@salesforce/library-template) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/forcedotcom/library-template/main/LICENSE.txt)
[![NPM](https://img.shields.io/npm/v/@salesforce/library-template.svg?label=@salesforce/library-template)](https://www.npmjs.com/package/@salesforce/library-template) [![Downloads/week](https://img.shields.io/npm/dw/@salesforce/library-template.svg)](https://npmjs.org/package/@salesforce/library-template) [![License](https://img.shields.io/badge/License-BSD%203--Clause-brightgreen.svg)](https://raw.githubusercontent.com/forcedotcom/library-template/main/LICENSE.txt)

## Using the template

This repository provides a template for an npm library that will be consumed primarily by the Salesforce CLI and VSCode Extensions.
This repository provides an opinionated template for an npm library that will be consumed primarily by the Salesforce CLI and VSCode Extensions.

This was created for internal use, but could be modified for use outside of Salesforce.

1. Please get in touch with the Platform CLI team. We want to help you develop your library.
2. Generate your library:

```
sf plugins install dev
sf dev generate library
# Answer prompts

git init -b main
git add . && git commit -m "chore: initial commit"
Expand Down
3 changes: 3 additions & 0 deletions messages/hello.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Greeting

Hello, %s
Loading
Loading