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

chore: dependency cleanup [skip-validate-pr] #500

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 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
12 changes: 9 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,19 @@ updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'monthly'
interval: 'weekly'
day: 'saturday'
versioning-strategy: 'increase'
labels:
- 'dependencies'
open-pull-requests-limit: 100
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: 'typescript'
- dependency-name: '*'
update-types: ['version-update:semver-major']
12 changes: 12 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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
with:
mergeMethod: squash
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:
- version, tag and github release
- publish
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: |
{
"text": "${{ github.event.workflow_run.name }} failed: ${{ github.event.workflow_run.repository.name }}",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "${{ github.event.workflow_run.name }} failed: ${{ github.event.workflow_run.repository.name }}"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "repo: ${{ github.event.workflow_run.repository.html_url }}\nworkflow name:${{ github.event.workflow_run.name }}\njob url: ${{ github.event.workflow_run.html_url }}"
}
}
]
}
36 changes: 36 additions & 0 deletions .github/workflows/manualRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: manual release

on:
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.SF_CLI_BOT_GITHUB_TOKEN }}
- name: Conventional Changelog Action
id: changelog
uses: TriPSs/conventional-changelog-action@d360fad3a42feca6462f72c97c165d60a02d4bf2
# overriding some of the basic behaviors to just get the changelog
with:
git-user-name: SF-CLI-BOT
git-user-email: [email protected]
github-token: ${{ secrets.SF_CLI_BOT_GITHUB_TOKEN }}
output-file: false
# always do the release, even if there are no semantic commits
skip-on-empty: false
tag-prefix: ''
- uses: notiz-dev/github-action-json-property@2192e246737701f108a4571462b76c75e7376216
id: packageVersion
with:
path: 'package.json'
prop_path: 'version'
- name: Create Github Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.SF_CLI_BOT_GITHUB_TOKEN }}
with:
tag_name: ${{ steps.packageVersion.outputs.prop }}
release_name: ${{ steps.packageVersion.outputs.prop }}
18 changes: 18 additions & 0 deletions .github/workflows/onPushToMain.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# test
name: version, tag and github release

on:
push:
branches: [main]

jobs:
release:
uses: salesforcecli/github-workflows/.github/workflows/githubRelease.yml@main
secrets: inherit

# most repos won't use this
# depends on previous job to avoid git collisions, not for any functionality reason
# docs:
# uses: salesforcecli/github-workflows/.github/workflows/publishTypedoc.yml@main
# secrets: inherit
# needs: release
55 changes: 55 additions & 0 deletions .github/workflows/onRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: publish

on:
release:
types: [released]
# support manual release in case something goes wrong and needs to be repeated or tested
workflow_dispatch:
inputs:
tag:
description: tag that needs to publish
type: string
required: true
jobs:
npm:
uses: salesforcecli/github-workflows/.github/workflows/npmPublish.yml@main
with:
ctc: true
sign: true
tag: prerelease
githubTag: ${{ github.event.release.tag_name || inputs.tag }}
secrets: inherit
canaries:
needs: [npm]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# switched this from a docker container. GHA could probably use a Go image, but this may be more performant
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.14
- name: Run canaries
run: |
TOKEN=$(curl -f -X POST ${{ secrets.RUNTIME_ID_SERVICETOKEN_ENDPOINT }} -d "{\"username\":\"${{ secrets.RUNTIME_ID_SERVICE_USERNAME }}\", \"password\":\"${{ secrets.RUNTIME_ID_SERVICE_PASSWORD }}\"}" -s --retry 3 | jq -r ".raw_id_token")
echo "$TOKEN" | docker login ${{ secrets.RUNTIME_REGISTRY }} -u x-runtime-id --password-stdin

echo "running canary"
docker run -e HEROKU_API_TOKEN=${{ secrets.HEROKU_API_TOKEN }} \
-e CIRCLECI_API_TOKEN=$CIRCLECI_API_TOKEN \
runtime-registry.herokai.com/s/heroku/evergreen-canary-keeper/cli:v1.7.0 \
evergreen-canary-keeper -run \
-name eg-canary-function-cli \
sfdx-cli-plugins="@salesforce/plugin-functions@prerelease"
npm-promote:
needs: [canaries]
runs-on:
ubuntu-latest
# if you try to use yarn here, it will attempt to use the wrong registry and throw 401s
steps:
- uses: actions/setup-node@v3
with:
node-version: latest
- run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm run promote-dist-tags
11 changes: 11 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: tests
on:
push:
branches-ignore: [main]
workflow_dispatch:

jobs:
unit-tests:
uses: salesforcecli/github-workflows/.github/workflows/unitTest.yml@main
inclusion:
uses: salesforcecli/github-workflows/.github/workflows/inclusionTest.yml@main
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Functions plugin for the SF CLI

# Usage

1. Install the SF CLI: [Install instructions](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_cli.htm)
1. Install the SF CLI: [Install instructions](https://developer.salesforce.com/docs/atlas.en-us.sfdx_setup.meta/sfdx_setup/sfdx_setup_install_CliUx.uxhtm)
2. Then run `sf plugins:install @salesforce/plugin-functions`:

```sh-session
Expand Down
10 changes: 1 addition & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,18 @@
"@hk/functions-core": "npm:@heroku/[email protected]",
"@oclif/core": "^1.6.0",
"@salesforce/core": "^3.19.4",
"@salesforce/plugin-org": "^1.11.2",
"@salesforce/sf-plugins-core": "^1.7.2",
"@salesforce/ts-sinon": "^1.3.21",
"@salesforce/ts-types": "^1.5.20",
"axios": "^0.27.2",
"axios-debug-log": "^0.8.4",
"chalk": "^4.1.2",
"cli-ux": "^5.6.7",
"cloudevents": "^4.0.3",
"date-fns": "^2.28.0",
"execa": "^5.1.1",
"fs-extra": "^10.0.1",
"global-agent": "^3.0.0",
"handlebars": "^4.7.7",
"jsforce": "^1.11.0",
"kbpgp": "^2.1.15",
"lodash": "^4.17.21",
"netrc-parser": "^3.1.6",
"node-fetch": "^3.2.3",
"sha256-file": "^1.0.0",
"uuid": "^8.3.2"
},
"devDependencies": {
Expand All @@ -47,8 +39,8 @@
"@salesforce/dev-scripts": "^2.0.3",
"@salesforce/plugin-command-reference": "^1.3.18",
"@salesforce/prettier-config": "^0.0.2",
"@salesforce/ts-sinon": "^1.3.21",
"@types/fs-extra": "^9.0.13",
"@types/node-fetch": "^3.0.3",
"@types/nodegit": "^0.27.10",
"@types/semver": "^7.3.9",
"@types/sha256-file": "^1.0.1",
Expand Down
9 changes: 4 additions & 5 deletions src/commands/deploy/functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*/
import herokuColor from '@heroku-cli/color';
import { Messages } from '@salesforce/core';
import { Flags } from '@oclif/core';
import { cli } from 'cli-ux';
import { Flags, CliUx } from '@oclif/core';
import debugFactory from 'debug';
import { UpsertResult } from 'jsforce';
import Command from '../../lib/base';
Expand Down Expand Up @@ -73,7 +72,7 @@ export default class DeployFunctions extends Command {
}

// Heroku side: Fetch git remote URL and push working branch to Heroku git server
cli.action.start('Pushing changes to functions');
CliUx.ux.action.start('Pushing changes to functions');
const org = await fetchOrg(flags['connected-org']);
const project = await fetchSfdxProject();

Expand Down Expand Up @@ -144,7 +143,7 @@ export default class DeployFunctions extends Command {
results.forEach((result) => {
if (!result.success) {
shouldExitNonZero = true;
cli.error(`Unable to deploy FunctionReference for ${result.fullName}.`, { exit: false });
CliUx.ux.error(`Unable to deploy FunctionReference for ${result.fullName}.`, { exit: false });
}

if (!flags.quiet && !flags.json) {
Expand Down Expand Up @@ -183,7 +182,7 @@ export default class DeployFunctions extends Command {
await batchCall(referencesToRemove, (chunk) => connection.metadata.delete('FunctionReference', chunk));
}

cli.action.stop();
CliUx.ux.action.stop();

if (shouldExitNonZero) {
this.exit(1);
Expand Down
7 changes: 3 additions & 4 deletions src/commands/env/compute/collaborator/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
*/
import herokuColor from '@heroku-cli/color';
import * as Heroku from '@heroku-cli/schema';
import { Errors } from '@oclif/core';
import { cli } from 'cli-ux';
import { Errors, CliUx } from '@oclif/core';
import { Messages } from '@salesforce/core';
import { FunctionsFlagBuilder } from '../../../../lib/flags';
import Command from '../../../../lib/base';
Expand Down Expand Up @@ -42,7 +41,7 @@ export default class ComputeCollaboratorAdd extends Command {
);
}

cli.action.start(
CliUx.ux.action.start(
`Adding Heroku user ${herokuColor.heroku(herokuUser)} as a collaborator on this Functions account`
);

Expand Down Expand Up @@ -70,7 +69,7 @@ export default class ComputeCollaboratorAdd extends Command {
this.error(error.message);
}

cli.action.stop();
CliUx.ux.action.stop();
this.log(
'For more information about attaching Heroku add-ons to your compute environments, run $ heroku addons:attach --help.'
);
Expand Down
13 changes: 6 additions & 7 deletions src/commands/env/create/compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
*/
import herokuColor from '@heroku-cli/color';
import * as Heroku from '@heroku-cli/schema';
import { Flags } from '@oclif/core';
import { Flags, CliUx } from '@oclif/core';
import { Messages } from '@salesforce/core';
import { QueryResult } from 'jsforce';
import { cli } from 'cli-ux';
import Command from '../../../lib/base';
import { FunctionsFlagBuilder } from '../../../lib/flags';
import pollForResult from '../../../lib/poll-for-result';
Expand Down Expand Up @@ -63,7 +62,7 @@ export default class EnvCreateCompute extends Command {
)} to the "features" list in your scratch org definition JSON file, e.g. "features": ["Functions"]`
);
}
cli.action.start(`Creating compute environment for org ID ${orgId}`);
CliUx.ux.action.start(`Creating compute environment for org ID ${orgId}`);
const project = await fetchSfdxProject();
const projectName = project.name;

Expand Down Expand Up @@ -135,18 +134,18 @@ export default class EnvCreateCompute extends Command {
},
});

cli.action.stop();
CliUx.ux.action.stop();

this.log(`New compute environment created with ID ${app.name}`);

cli.action.start('Connecting environments');
CliUx.ux.action.start('Connecting environments');

if (alias) {
this.stateAggregator.aliases.set(alias, app.id!);
await this.stateAggregator.aliases.write();
}

cli.action.stop();
CliUx.ux.action.stop();
this.log(
alias
? `Your compute environment with local alias ${herokuColor.cyan(alias)} is ready.`
Expand All @@ -158,7 +157,7 @@ export default class EnvCreateCompute extends Command {
const INVALID_PROJECT_NAME =
"Sfdx project name may only contain numbers (0-9), letters (a-z A-Z) and non-consecutive underscores ('_'). It must begin with a letter and end with either a number or letter.";
const error = err as { data: { message?: string } };
cli.action.stop('error!');
CliUx.ux.action.stop('error!');

if (error.data?.message?.includes(INVALID_PROJECT_NAME)) {
this.error(
Expand Down
Loading