Skip to content

Commit

Permalink
Updated all scripts to use sf CLI instead of sfdx CLI (#532 - closes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
JMercie authored Aug 7, 2023
1 parent c4d3987 commit 7603057
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 68 deletions.
34 changes: 17 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
shell: bash
run: |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx auth jwt grant --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
env:
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
Expand All @@ -82,7 +82,7 @@ jobs:

- name: 'Verify Apex with SFDX Scanner'
run: |
npm run sfdx:plugins:link:scanner
npm run sf:plugins:link:scanner
npm run scan:apex
# TODO - uncomment - temporarily commented-out due to an issue with apexdocs in the pipeline
Expand Down Expand Up @@ -150,24 +150,24 @@ jobs:
shell: bash
run: |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx auth jwt grant --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
env:
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}

- name: 'Create Base Scratch Org'
run: npx sfdx force:org:create --nonamespace --durationdays 1 --definitionfile ./config/scratch-orgs/base-scratch-def.json --wait 20 --setdefaultusername --json
run: npx sf org create scratch --no-namespace --duration-days 1 --definition-file ./config/scratch-orgs/base-scratch-def.json --wait 20 --set-default --json

- name: 'Deploy Source to Scratch Org'
run: npx sfdx force:source:deploy --sourcepath ./nebula-logger/
run: npx sf project deploy start --source-dir ./nebula-logger/

- name: 'Assign Logger Admin Permission Set'
run: npm run permset:assign:admin

- name: 'Validate Custom Metadata Records'
run: npx sfdx force:apex:execute --apexcodefile ./scripts/build/validate-custom-metadata-records.apex
run: npx sf apex run --file ./scripts/build/validate-custom-metadata-records.apex

# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session.
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously.
Expand Down Expand Up @@ -211,27 +211,27 @@ jobs:
shell: bash
run: |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx auth jwt grant --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
env:
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
DEV_HUB_CONSUMER_KEY: ${{ secrets.DEV_HUB_CONSUMER_KEY }}
DEV_HUB_JWT_SERVER_KEY: ${{ secrets.DEV_HUB_JWT_SERVER_KEY }}

- name: 'Create Experience Cloud Scratch Org'
run: npx sfdx force:org:create --nonamespace --durationdays 1 --definitionfile ./config/scratch-orgs/experience-cloud-scratch-def.json --wait 20 --setdefaultusername --json
run: npx sf org create scratch --no-namespace --duration-days 1 --definition-file ./config/scratch-orgs/experience-cloud-scratch-def.json --wait 20 --set-default --json

- name: 'Deploy Test Experience Site Metadata'
run: npm run experience:deploy

- name: 'Deploy Source to Scratch Org'
run: npx sfdx force:source:deploy --sourcepath ./nebula-logger/
run: npx sf project deploy start --source-dir ./nebula-logger/

- name: 'Assign Logger Admin Permission Set'
run: npm run permset:assign:admin

- name: 'Validate Custom Metadata Records'
run: npx sfdx force:apex:execute --apexcodefile ./scripts/build/validate-custom-metadata-records.apex
run: npx sf apex run --file ./scripts/build/validate-custom-metadata-records.apex

# Nebula Logger has functionality that queries the AuthSession object when the current user has an active session.
# The code should work with or without an active session, so the pipeline runs the tests twice - asynchronously and synchronously.
Expand Down Expand Up @@ -284,7 +284,7 @@ jobs:
shell: bash
run: |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx auth jwt grant --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
env:
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
Expand Down Expand Up @@ -324,7 +324,7 @@ jobs:
shell: bash
run: |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx auth jwt grant --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
env:
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
Expand All @@ -335,7 +335,7 @@ jobs:
shell: bash
run: |
echo ${{ env.PKG_DEMO_ORG_SFDX_URL }} > ./PKG_DEMO_ORG_SFDX_URL.txt
npx sfdx auth sfdxurl store --sfdx-url-file ./PKG_DEMO_ORG_SFDX_URL.txt --alias nebula-logger-package-demo
npx sf org login sfdx-url --sfdx-url-file ./PKG_DEMO_ORG_SFDX_URL.txt --alias nebula-logger-package-demo
env:
PKG_DEMO_ORG_SFDX_URL: ${{ secrets.NEBULA_PKG_DEMO_SANDBOX_SFDX_URL }}

Expand All @@ -357,9 +357,9 @@ jobs:
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action Bot"
# npm run sfdx:plugins:link:bummer
echo y | npx sfdx plugins:install @jongpie/sfdx-bummer-plugin --force
npx sfdx bummer:package:aliases:sort
# npm run sf:plugins:link:bummer
echo y | npx sf plugins install @jongpie/sfdx-bummer-plugin --force
npx sf bummer:package:aliases:sort
npx prettier --write ./sfdx-project.json
git add ./sfdx-project.json
git commit -m "Created new core unlocked package version"
Expand Down Expand Up @@ -392,7 +392,7 @@ jobs:
shell: bash
run: |
echo "${{ env.DEV_HUB_JWT_SERVER_KEY }}" > ./jwt-server.key
npx sfdx auth jwt grant --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
npx sf org login jwt --instance-url ${{ env.DEV_HUB_AUTH_URL }} --client-id ${{ env.DEV_HUB_CONSUMER_KEY }} --username ${{ env.DEV_HUB_BOT_USERNAME }} --jwt-key-file ./jwt-server.key --set-default-dev-hub
env:
DEV_HUB_AUTH_URL: ${{ secrets.DEV_HUB_AUTH_URL }}
DEV_HUB_BOT_USERNAME: ${{ secrets.DEV_HUB_BOT_USERNAME }}
Expand Down
65 changes: 33 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,52 +39,52 @@
"docs:fix:apex": "pwsh ./scripts/build/generate-apex-docs.ps1 && git add ./docs/apex",
"docs:fix:lwc": "pwsh ./scripts/build/generate-lwc-docs.ps1 && git add ./docs/lightning-components",
"docs:verify": "pwsh ./scripts/build/verify-docs-up-to-date.ps1",
"experience:create": "sfdx force:community:create --name \"Logger Test Site\" --templatename \"Customer Service\" --urlpathprefix logger --description \"Logger Test Site\"",
"experience:deploy": "sfdx force:source:deploy --sourcepath ./config/experience-cloud --wait 30",
"experience:create": "sf community create --name \"Logger Test Site\" --template-name \"Customer Service\" --url-path-prefix logger --description \"Logger Test Site\"",
"experience:deploy": "sf project deploy start --source-dir ./config/experience-cloud --wait 30",
"husky:pre-commit": "lint-staged --config ./config/linters/lint-staged.config.js",
"org:create:base": "pwsh ./scripts/build/create-scratch-org.ps1 -definitionfile ./config/scratch-orgs/base-scratch-def.json && npm run org:debug:enable",
"org:create:experience-cloud": "pwsh ./scripts/build/create-scratch-org.ps1 -definitionfile ./config/scratch-orgs/experience-cloud-scratch-def.json && sfdx force:apex:execute --apexcodefile ./scripts/build/enable-debug-mode.apex",
"org:delete": "sfdx force:org:delete --json",
"org:debug:enable": "sfdx apex run --file ./scripts/build/enable-debug-mode.apex",
"org:delete:noprompt": "sfdx force:org:delete --json --noprompt",
"org:details": "sfdx force:org:display --json --verbose",
"org:open": "sfdx force:org:open",
"org:open:chrome": "sfdx force:org:open -b chrome",
"org:open:firefox": "sfdx force:org:open -b firefox",
"org:delete": "sf org delete scratch --json",
"org:debug:enable": "sf apex run --file ./scripts/build/enable-debug-mode.apex",
"org:delete:noprompt": "sf org delete scratch --json --no-prompt",
"org:details": "sf org display --json --verbose",
"org:open": "sf org open",
"org:open:chrome": "sf org open --browser chrome",
"org:open:firefox": "sf org open --browser firefox",
"package:version:create:managed": "pwsh ./scripts/build/create-managed-package-beta-version.ps1",
"package:version:create:unlocked": "sfdx package version create --json --package \"Nebula Logger - Core\" --skipancestorcheck --code-coverage --installation-key-bypass --wait 30",
"package:version:create:unlocked": "sf package version create --json --package \"Nebula Logger - Core\" --skip-ancestor-check --code-coverage --installation-key-bypass --wait 30",
"package:version:number:fix": "pwsh ./scripts/build/sync-package-version-number.ps1",
"package:version:number:verify": "pwsh ./scripts/build/validate-current-package-version-number.ps1",
"permset:assign": "npm run permset:assign:admin && npm run permset:assign:big-object-admin && npm run permset:assign:recipes-admin && npm run permset:assign:slack-admin",
"permset:assign:admin": "sfdx force user permset assign --perm-set-name LoggerAdmin",
"permset:assign:big-object-admin": "sfdx force user permset assign --perm-set-name LoggerLogEntryArchiveAdmin",
"permset:assign:recipes-admin": "sfdx force user permset assign --perm-set-name LoggerRecipesAdmin",
"permset:assign:slack-admin": "sfdx force user permset assign --perm-set-name LoggerSlackPluginAdmin",
"plugin:version:create:async-failure-additions": "sfdx package version create --json --package \"Nebula Logger - Core Plugin - Async Failure Additions\" --code-coverage --installation-key-bypass --wait 30",
"plugin:version:create:big-object": "sfdx package version create --json --package \"Nebula Logger - Core Plugin - Big Object Archiving\" --code-coverage --installation-key-bypass --wait 30",
"plugin:version:create:log-retention-rules": "sfdx package version create --json --package \"Nebula Logger - Core Plugin - Log Retention Rules\" --code-coverage --installation-key-bypass --wait 30",
"plugin:version:create:logger-admin-dashboard": "sfdx package version create --json --package \"Nebula Logger - Core Plugin - Logger Admin Dashboard\" --code-coverage --installation-key-bypass --wait 30",
"plugin:version:create:slack": "sfdx package version create --json --package \"Nebula Logger - Core Plugin - Slack\" --code-coverage --installation-key-bypass --wait 30",
"permset:assign:admin": "sf org assign permset --name LoggerAdmin",
"permset:assign:big-object-admin": "sf org assign permset --name LoggerLogEntryArchiveAdmin",
"permset:assign:recipes-admin": "sf org assign permset --name LoggerRecipesAdmin",
"permset:assign:slack-admin": "sf org assign permset --name LoggerSlackPluginAdmin",
"plugin:version:create:async-failure-additions": "sf package version create --json --package \"Nebula Logger - Core Plugin - Async Failure Additions\" --skip-ancestor-check --code-coverage --installation-key-bypass --wait 30",
"plugin:version:create:big-object": "sf package version create --json --package \"Nebula Logger - Core Plugin - Big Object Archiving\" --skip-ancestor-check --code-coverage --installation-key-bypass --wait 30",
"plugin:version:create:log-retention-rules": "sf package version create --json --package \"Nebula Logger - Core Plugin - Log Retention Rules\" --skip-ancestor-check --code-coverage --installation-key-bypass --wait 30",
"plugin:version:create:logger-admin-dashboard": "sf package version create --json --package \"Nebula Logger - Core Plugin - Logger Admin Dashboard\" --skip-ancestor-check --code-coverage --installation-key-bypass --wait 30",
"plugin:version:create:slack": "sf package version create --json --package \"Nebula Logger - Core Plugin - Slack\" --skip-ancestor-check --code-coverage -k --wait 30",
"prepare": "husky install && chmod +x ./.husky/pre-commit",
"prettier:fix": "prettier --write \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
"prettier:verify": "prettier --list-different \"**/*.{cls,cmp,component,css,html,js,json,md,page,trigger,xml,yaml,yml}\"",
"scan:fix:lwc": "eslint --config ./config/linters/.eslintrc.json **/lwc/** --fix",
"scan": "npm run scan:apex && npm run scan:lwc",
"scan:apex": "sfdx scanner:run --pmdconfig ./config/linters/pmd-ruleset.xml --target ./nebula-logger/ --engine pmd --severity-threshold 3",
"scan:apex": "sf scanner:run --pmdconfig ./config/linters/pmd-ruleset.xml --target ./nebula-logger/ --engine pmd --severity-threshold 3",
"scan:lwc": "eslint --config ./config/linters/.eslintrc.json **/lwc/**",
"sfdx:plugins:link:bummer": "npx sfdx plugins:link ./node_modules/@jongpie/sfdx-bummer-plugin",
"sfdx:plugins:link:prettier": "npx sfdx plugins:link ./node_modules/@jayree/sfdx-plugin-prettier",
"sfdx:plugins:link:scanner": "npx sfdx plugins:link ./node_modules/@salesforce/sfdx-scanner",
"source:deploy": "sfdx force:source:deploy --sourcepath ./nebula-logger/ --wait 30",
"source:deploy:core": "sfdx force:source:deploy --sourcepath ./nebula-logger/core --wait 30",
"source:push": "sfdx force:source:push --forceoverwrite",
"sf:plugins:link:bummer": "npx sf plugins link ./node_modules/@jongpie/sfdx-bummer-plugin",
"sf:plugins:link:prettier": "npx sf plugins link ./node_modules/@jayree/sfdx-plugin-prettier",
"sf:plugins:link:scanner": "npx sf plugins link ./node_modules/@salesforce/sfdx-scanner",
"source:deploy": "sf project deploy start --source-dir ./nebula-logger/ --wait 30",
"source:deploy:core": "sf project deploy start --source-dir ./nebula-logger/core --wait 30",
"source:push": "sf project deploy start --ignore-conflicts",
"source:push:test": "npm run source:push && npm run test:apex",
"test": "npm run test:lwc && npm run test:apex",
"test:apex": "npm run test:apex:nocoverage -- --code-coverage --detailed-coverage",
"test:apex:nocoverage": "npx sfdx apex test run --test-level RunLocalTests --wait 30 --result-format human --output-dir ./test-coverage/apex",
"test:apex:suites": "npx sfdx apex test run --suitenames LoggerCore,LoggerExtraTests --wait 30 --resultformat human --codecoverage --detailedcoverage --outputdir ./tests/apex",
"test:lwc": "sfdx-lwc-jest --coverage --skipApiVersionCheck --verbose",
"test:lwc:nocoverage": "sfdx-lwc-jest --skipApiVersionCheck --verbose",
"test:apex:nocoverage": "npx sf apex run test --test-level RunLocalTests --wait 30 --result-format human --output-dir ./test-coverage/apex",
"test:apex:suites": "npx sf apex run test --suite-names LoggerCore,LoggerExtraTests --wait 30 --result-format human --code-coverage --detailed-coverage --output-dir ./tests/apex",
"test:lwc": "sf force lightning lwc test run --coverage",
"test:lwc:nocoverage": "sf force lightning lwc test run",
"test:nocoverage": "npm run test:lwc && npm run test:apex"
},
"dependencies": {
Expand Down Expand Up @@ -118,6 +118,7 @@
"@ljharb/eslint-config": "latest",
"@lwc/eslint-plugin-lwc": "latest",
"@prettier/plugin-xml": "latest",
"@salesforce/cli": "1.87.0",
"@salesforce/eslint-config-lwc": "latest",
"@salesforce/eslint-plugin-lightning": "latest",
"@salesforce/sfdx-lwc-jest": "^1.3.0",
Expand All @@ -133,7 +134,7 @@
"lint-staged": "latest",
"prettier": "latest",
"prettier-plugin-apex": "latest",
"pwsh": "^0.3.0",
"sfdx-cli": "^7.191.1"
"sfdx-cli": "^7.209.6",
"pwsh": "^0.3.0"
}
}
Loading

0 comments on commit 7603057

Please sign in to comment.