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

feat!: migrate to plugin v2 #924

Open
wants to merge 76 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
70da8aa
build: upgrade yarn
scolladon Sep 7, 2024
7b9b0da
build: fix commitlint compilation issue
scolladon Sep 7, 2024
fb9b65a
build: fix jest config compilation issue
scolladon Sep 7, 2024
d04d447
feat: convert messages
scolladon Sep 7, 2024
adc1400
feat(migrate-v2): update dependencies
scolladon Sep 7, 2024
e498cd9
feat(migrate-v2): convert command
scolladon Sep 7, 2024
8bc5625
feat(migrate-v2): fix module compilation issue
scolladon Sep 7, 2024
dacf213
refactor: use node prefix
scolladon Sep 10, 2024
db7c578
build: convert bin
scolladon Sep 11, 2024
fe08cfe
fix: fs-extra and lodash esm import
scolladon Sep 11, 2024
316cf68
docs: convert command explanation
scolladon Sep 11, 2024
3571a9d
build: upgrade dependencies
scolladon Sep 11, 2024
91c9f07
build: update script oclif
scolladon Sep 11, 2024
50c571e
test: fix jest test with esm
scolladon Sep 11, 2024
9a71cfa
test: fix nut test with esm
scolladon Sep 11, 2024
e920a19
build: fix dependency linting issues
scolladon Sep 11, 2024
d113b6a
feat: migrate to sf space topic separator style
scolladon Sep 12, 2024
6920415
build: add plugin linting
scolladon Sep 12, 2024
87403f0
build: add node 22 check
scolladon Sep 13, 2024
507351d
build: fix formatting
scolladon Sep 13, 2024
63f9702
docs: fix link
scolladon Sep 13, 2024
a4f1621
refactor: use `exists` on flags and remove obsolete code
scolladon Sep 16, 2024
632ff78
refactor: use Message for every errors and warnings
scolladon Sep 16, 2024
2997be0
build: upgrade dependencies
scolladon Sep 29, 2024
c291807
fix: ignore esm compatibility
scolladon Sep 29, 2024
33701bc
refactor: improve readibility
scolladon Sep 29, 2024
8ca9483
fix: build cache
scolladon Sep 29, 2024
db6f06d
feat: add npm shrinkwrap file to speed up installation time
scolladon Sep 29, 2024
e316fa3
fix: script dependencies
scolladon Sep 29, 2024
5586ce0
feat: add spinner
scolladon Sep 29, 2024
8f69f1a
fix: relax plugin linting issues
scolladon Sep 29, 2024
2562399
revert: ignore type workaround
scolladon Sep 29, 2024
4420d3b
build: override ignore type
scolladon Oct 5, 2024
a1b44de
feat: convert to esm dependencies
scolladon Oct 1, 2024
9b4e559
chore: fix jest weird esm compilation
scolladon Oct 5, 2024
afbdc07
fix: dev script with ts-node
scolladon Oct 5, 2024
da6f189
fix: dependencies linting with lodash
scolladon Oct 5, 2024
ab4d45d
docs: update sf command line references
scolladon Oct 5, 2024
75981e1
build: update ci to node lts
scolladon Oct 5, 2024
eaf1816
build: upgrade yarn
scolladon Oct 5, 2024
1af81f8
fix: invisible char
scolladon Oct 5, 2024
07602ae
revert: does not change sfdx format for e2e
scolladon Oct 5, 2024
10256d2
build: upgrade dependencies
scolladon Oct 5, 2024
3581d40
build: fix matrix testing
scolladon Oct 6, 2024
19865eb
build: configure gitleaks
scolladon Oct 6, 2024
566982b
build: fix dependency linting config file format issue
scolladon Oct 6, 2024
cc1ca6a
feat: implement compliant cli parameters
scolladon Oct 6, 2024
3046d8a
docs: update contributing toolbelt
scolladon Oct 6, 2024
ea05f74
refactor: migrate back from `yarn` to `npm`
scolladon Oct 18, 2024
354f3c2
build: add branch name checking
scolladon Oct 11, 2024
9f0d6eb
build: include incremental mutation testing
scolladon Oct 12, 2024
d3e73b8
build: upgrade dependencies
scolladon Oct 12, 2024
122b92b
docs: write migration to v6 instructions
scolladon Oct 13, 2024
0780d2c
docs: fix typos and rephrase
Oct 15, 2024
de74bf7
docs: fix minor typo in migration guide
scolladon Oct 15, 2024
8272a90
build: upgrade dependencies
scolladon Oct 15, 2024
e3a2e57
Revert "build: update ci to node lts"
scolladon Oct 18, 2024
52afc6e
refactor: use dynamic import to get metadata definition
scolladon Oct 18, 2024
225c109
revert: plugin linting
scolladon Oct 18, 2024
e9de025
build: upgrade dependencies
scolladon Oct 18, 2024
20f51e8
fix: biome indentation check
scolladon Oct 18, 2024
c818c8d
docs: fix relative links in migration guide
scolladon Oct 18, 2024
8287d47
chore: add funding
scolladon Oct 18, 2024
4582364
docs: add installation details and channel information
scolladon Oct 19, 2024
3708bd4
chore: upgrade package-lock.json to latest version as well
scolladon Oct 19, 2024
cb48f85
docs: update readme link
scolladon Oct 19, 2024
59049a3
test: do not ignore static when mutation testing
scolladon Oct 19, 2024
0ec9b27
docs: update migration guide
scolladon Oct 19, 2024
d3a7605
build: upgrade dependencies
scolladon Oct 20, 2024
fb7af48
docs: update long commands
Oct 21, 2024
302cfaf
docs: update supported version
Oct 21, 2024
8aca003
docs: update message and usage
scolladon Oct 21, 2024
1205e42
docs: add sfdx-hardis reference in used by section
scolladon Oct 27, 2024
9aef5fe
docs: reorder badges and remove gitter
scolladon Oct 27, 2024
f1240e4
docs: add "Become a Sponsor" button
scolladon Oct 27, 2024
5944ed3
feat: add donating call to action in logs
scolladon Oct 27, 2024
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
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/issue.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,26 @@ Issue verification check:
Ex:
https://github.com/scolladon/sfdx-git-delta-reproduction-playground
sgd -d -r . -f HEAD^
sfdx sgd:source:delta -d -f HEAD^
sf sgd source delta -d -f HEAD^
-->

## Execution context

---

<!--
$ uname -v ; yarn -v ; node -v ; git --version ; sfdx --version ; sfdx plugins
$ uname -v; npm -v ; node -v ; git --version ; sf --version ; sf plugins
-->

**Operating System:** …

**yarn version:** …
**npm version:** …

**node version:** …

**git version:** …

**sfdx version:** …
**sf version:** …

**sgd plugin version:** …

Expand Down
12 changes: 6 additions & 6 deletions .github/actions/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ description: Install dependencies
runs:
using: composite
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "yarn-cache=$(yarn config get cacheFolder)" >> "$GITHUB_OUTPUT"
- name: Get cache directory
id: cache-dir
run: echo "dir=$(npm config get cache)" >> "$GITHUB_OUTPUT"
shell: bash

- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.yarn-cache }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}

- name: Install dependencies
run: yarn install --immutable --check-cache
run: npm ci
shell: bash
env:
HUSKY: '0' # By default do not run HUSKY install
8 changes: 3 additions & 5 deletions .github/linters/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
"ignorePaths": [
"**/CHANGELOG.md",
"**/.git/**",
"**/.yarnrc.yml",
"**/megalinter.yml",
"**/node_modules/**",
"**/src/metadata/**",
"**/src/service/typeHandlerFactory.ts",
"**/yarn.lock"
"**/src/service/typeHandlerFactory.ts"
],
"language": "en",
"noConfigSearch": true,
Expand Down Expand Up @@ -90,6 +88,7 @@
"mutingpermissionset",
"mutingpermissionsets",
"myexperiencebundle",
"namerc",
"nimn",
"nonblock",
"nonoctal",
Expand Down Expand Up @@ -167,7 +166,6 @@
"weblinks",
"wireit",
"wlens",
"xmlbuilder",
"yarnrc"
"xmlbuilder"
]
}
2 changes: 1 addition & 1 deletion .github/workflows/manual-deprecate-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
- name: Change version
run: npm deprecate sfdx-git-delta@$"${{ github.event.inputs.version-expression }}" "${{ github.event.inputs.rationale }}"
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/manual-manage-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ jobs:
- name: Change version
run: npm dist-tag add sfdx-git-delta@${{ github.event.inputs.version-number }} ${{ github.event.inputs.version-alias }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
13 changes: 6 additions & 7 deletions .github/workflows/on-main-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ jobs:
uses: ./.github/actions/install

- name: Publish to npm
run: yarn npm publish --access public --tag latest-rc
run: npm publish --access public --tag latest-rc
env:
YARN_NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

test-release:
uses: ./.github/workflows/run-e2e-tests.yml
Expand Down Expand Up @@ -76,16 +76,15 @@ jobs:
- uses: google/wireit@setup-github-actions-caching/v2

- name: Build plugin
run: yarn pack
run: npm pack

- name: Install salesforce CLI
run: npm install -g @salesforce/cli

- name: Install plugin
run: |
yarn set version classic
sfdx plugins:link .
sfdx plugins
sf plugins link .
sf plugins

- name: Checkout e2e test subject
uses: actions/checkout@v4
Expand All @@ -96,7 +95,7 @@ jobs:

- name: Run benchmark
run: |
yarn test:perf
npm run test:perf
git reset --hard

- name: Store benchmark result
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/on-merged-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,22 @@ jobs:
- name: Remove dist-tag
run: npm dist-tag rm sfdx-git-delta ${{ env.DEV_CHANNEL }}
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Deprecate related dev versions
run: |
DEV_VERSIONS=$(npm view sfdx-git-delta versions --json | jq -r '.[]' | grep -E "${{env.CURRENT_VERSION}}-${{ env.DEV_CHANNEL }}")
DEV_VERSIONS=$(npm view sfdx-git-delta versions --json | jq -r '.[]' | grep -E "${{ env.CURRENT_VERSION}}-${{ env.DEV_CHANNEL }}")
[ -n "$DEV_VERSIONS" ] && for DEV_VERSION in ${DEV_VERSIONS}; do npm deprecate "sfdx-git-delta@${DEV_VERSION}" "Deprecated dev version"; done
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Delete package dev channel PR comment
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Published under `${{ env.DEV_CHANNEL }}` npm channel.
```sh
$ sfdx plugins:install sfdx-git-delta@${{ env.DEV_CHANNEL }}
$ sf plugins install sfdx-git-delta@${{ env.DEV_CHANNEL }}
```
comment_tag: dev-publish
mode: delete
4 changes: 2 additions & 2 deletions .github/workflows/on-published-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
Shipped in [release `{release_tag}`]({release_link}).
You can install the new version using the version number or the `latest-rc` channel
```sh
$ sfdx plugins:install sfdx-git-delta@latest-rc
$ sfdx plugins:install sfdx-git-delta@{release_tag}
$ sf plugins install sfdx-git-delta@latest-rc
$ sf plugins install sfdx-git-delta@{release_tag}
```
Happy incremental deployment!
36 changes: 30 additions & 6 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ jobs:
run: npm outdated

- name: Check unused dependencies
run: yarn lint:dependencies
run: npm run lint:dependencies

- name: Audit dependencies
run: yarn npm audit
run: npm audit

megalinter:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -96,6 +96,30 @@ jobs:
megalinter-reports
mega-linter.log

incremental-mutation-testing:
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18

- name: Setup dependencies, cache and install
uses: ./.github/actions/install

- name: Incremental Mutation testing
run: npm run test:mutation:incremental

- uses: actions/upload-artifact@v4
with:
name: mutation-testing-reports
path: reports/mutation

build:
uses: ./.github/workflows/reusable-build.yml
secrets: inherit
Expand Down Expand Up @@ -133,19 +157,19 @@ jobs:
- name: NPM Publish dev channel
run: |
CURRENT_VERSION=$(jq -r '.version' package.json)
DEV_TAG="${{ env.DEV_CHANNEL }}.${{ github.run_id }}-${{github.run_attempt}}"
DEV_TAG="${{ env.DEV_CHANNEL }}.${{ github.run_id }}-${{ github.run_attempt }}"
npm version "${CURRENT_VERSION}-${DEV_TAG}"
yarn npm publish --access public --tag "${{ env.DEV_CHANNEL }}"
npm publish --access public --tag "${{ env.DEV_CHANNEL }}"
env:
YARN_NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Comment PR dev channel
uses: thollander/actions-comment-pull-request@v2
with:
message: |
Published under `${{ env.DEV_CHANNEL }}` npm channel.
```sh
$ sfdx plugins:install sfdx-git-delta@${{ env.DEV_CHANNEL }}
$ sf plugins install sfdx-git-delta@${{ env.DEV_CHANNEL }}
```
comment_tag: dev-publish
mode: recreate
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ jobs:
- uses: google/wireit@setup-github-actions-caching/v2

- name: Lint plugin
run: yarn lint
run: npm run lint

- name: Build plugin
run: yarn pack
run: npm pack

- name: Unit test
run: yarn test:unit -- --runInBand
run: npm run test:unit -- --runInBand

- name: Upload coverage
uses: codecov/codecov-action@v4
Expand All @@ -43,7 +43,7 @@ jobs:
path: ./e2e

- name: Functional test
run: yarn test:nut
run: npm run test:nut

- uses: actions/upload-artifact@v4
with:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
node: [18, 20]
cli: [sfdx-cli, '@salesforce/cli']
node: [18, 20, 22]
cli: ['@salesforce/cli']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
Expand All @@ -29,15 +29,15 @@ jobs:
node-version: ${{ matrix.node }}

- name: Install cli
run: npm install -g ${{matrix.cli}}
run: npm install -g ${{ matrix.cli }}

- name: Install new plugin version
run: echo y | sfdx plugins:install sfdx-git-delta@${{ inputs.channel }}
run: echo y | sf plugins install sfdx-git-delta@${{ inputs.channel }}

- name: Test new plugin version
run: sfdx sgd:source:delta --help
run: sf sgd source delta --help

- name: E2E Tests
run: |
yarn
yarn test:e2e
npm install
npm run test:e2e
22 changes: 10 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
.stryker-tmp
.wireit
*-debug.log
*-error.log
/.nyc_output
/e2e
/lib
/node_modules
/reports
/lib
/.nyc_output
/.yarn/cache
install-state.gz
*-debug.log
*-error.log
sfdx-git-delta-*.tgz
megalinter-reports/
package.tgz
perf-result.txt
sfdx-git-delta-*.tgz
stderr*.txt
stdout*.txt
perf-result.txt
# stryker temp files
.stryker-tmp

megalinter-reports/
.wireit
tsconfig.tsbuildinfo
2 changes: 1 addition & 1 deletion .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

yarn commitlint --edit
npx commitlint --edit
2 changes: 1 addition & 1 deletion .husky/post-checkout
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

yarn dependencies:reinstall
npm run dependencies:reinstall
2 changes: 1 addition & 1 deletion .husky/post-merge
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

yarn dependencies:reinstall
npm run dependencies:reinstall
2 changes: 1 addition & 1 deletion .husky/post-rewrite
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/sh

yarn dependencies:reinstall
npm run dependencies:reinstall
3 changes: 2 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/sh

yarn lint-staged
npx validate-branch-name
npx lint-staged
10 changes: 5 additions & 5 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/sh

yarn lint
yarn pack
yarn test
npm run lint
npm pack
npm run test
npm outdated || true
yarn npm audit || true
yarn lint:dependencies || true
npm audit || true
npm run lint:dependencies || true
Loading