Skip to content

Commit

Permalink
build: remove node 14 and add node 20 support (#614)
Browse files Browse the repository at this point in the history
  • Loading branch information
scolladon committed Jun 1, 2023
1 parent b2e36e6 commit 9c5c8ee
Show file tree
Hide file tree
Showing 12 changed files with 968 additions and 706 deletions.
1 change: 1 addition & 0 deletions .github/linters/.cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"Flexi",
"hardlinks",
"Iframe",
"knip",
"METAFILE",
"Mehdi",
"Nimn",
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/manual-deprecate-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Change version
run: npm deprecate sfdx-git-delta@$"${{ github.event.inputs.version-expression }}" "${{ github.event.inputs.rationale }}"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/manual-manage-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/

- name: Change version
run: npm dist-tag add sfdx-git-delta@${{ github.event.inputs.version-number }} ${{ github.event.inputs.version-alias }}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/on-main-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,12 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/

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

- name: Publish to npm
run: yarn publish --access public --tag latest-rc --new-version ${{ needs.prepare-release.outputs.version }}
run: yarn npm publish --access public --tag latest-rc
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

Expand All @@ -56,7 +55,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
node: [14, 16, 18]
node: [16, 18, 20]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
Expand All @@ -69,7 +68,6 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
registry-url: https://registry.npmjs.org/

- name: Install sfdx-cli
run: npm install -g sfdx-cli
Expand Down
15 changes: 7 additions & 8 deletions .github/workflows/on-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,17 @@ jobs:
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/

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

- name: Check outdated dependencies
run: npm outdated

- name: Check unused dependencies
run: yarn lint:dependencies
continue-on-error: true

- name: Audit dependencies
run: yarn npm audit

Expand All @@ -73,22 +76,18 @@ jobs:
# Git Checkout
- name: Checkout Code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}

# MegaLinter
- name: MegaLinter
id: ml
# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/flavors/
uses: oxsecurity/megalinter/flavors/javascript@v6
env:
# All available variables are described in documentation
# https://megalinter.io/configuration/
APPLY_FIXES: all
VALIDATE_ALL_CODEBASE: true # Set ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} to validate only diff with main branch
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ADD YOUR CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
VALIDATE_ALL_CODEBASE: true
# ADD CUSTOM ENV VARIABLES HERE TO OVERRIDE VALUES OF .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY

- uses: actions/upload-artifact@v3
if: always()
Expand Down Expand Up @@ -133,7 +132,7 @@ jobs:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
node: [14, 16, 18]
node: [16, 18, 20]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout sources
Expand Down
2 changes: 2 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ yarn test:unit:coverage
yarn test:nut
yarn analysis force-app
npm outdated || true
yarn npm audit || true
yarn lint:dependencies || true
4 changes: 4 additions & 0 deletions .knip.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"entry": ["src/main.js"],
"project": ["src/**/*.ts", "src/**/*.js", "__tests__/**/*.js", "__tests__/**/*.ts"]
}
3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
nodeLinker: node-modules

npmRegistryServer: "https://registry.npmjs.org/"
npmPublishRegistry: "https://registry.npmjs.org/"

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
Expand Down
24 changes: 7 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"sfdx-plugin"
],
"engines": {
"node": ">=14.6.0"
"node": ">=16.20.0"
},
"files": [
"/bin",
Expand All @@ -25,18 +25,12 @@
},
"author": "Sebastien Colladon <[email protected]>",
"dependencies": {
"@oclif/command": "^1.8.26",
"@oclif/config": "^1.18.9",
"@oclif/core": "^2.8.5",
"@oclif/errors": "^1.3.6",
"@salesforce/command": "^5.3.9",
"@salesforce/core": "^3.36.2",
"fast-xml-parser": "^4.2.2",
"fs-extra": "^11.1.1",
"ignore": "^5.2.4",
"lodash": "^4.17.21",
"micromatch": "^4.0.5",
"tslib": "^2.5.2",
"xmlbuilder2": "^3.1.1"
},
"license": "MIT",
Expand All @@ -46,14 +40,14 @@
"homepage": "https://github.com/scolladon/sfdx-git-delta#readme",
"scripts": {
"analysis": "codeclimate analyze",
"audit:fix": "npm i --package-lock-only && npm audit fix && shx rm yarn.lock && yarn import && shx rm package-lock.json",
"clean": "shx rm -rf lib && shx rm -rf reports/* && shx rm -rf .stryker-tmp/* && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json && shx rm -rf sfdx-git-delta-v*.tgz && shx rm -rf stderr*.txt && shx rm -rf stdout*.txt",
"clean": "shx rm -rf lib 'reports/*' .nyc_output oclif.manifest.json package.tgz 'sfdx-git-delta-v*.tgz' 'stderr*.txt' 'stdout*.txt' '.stryker-tmp/*'",
"commit": "commit",
"increment:apiversion": "filename=`ls src/metadata/v*.json | tail -1` && version=${filename//[!0-9]/} && ((version++)) && targetname=\"src/metadata/v${version}.json\" && \\cp $filename $targetname",
"lint": "eslint src/",
"lint:dependencies": "knip",
"lint:fix": "eslint --fix src/",
"test": "yarn test:unit && yarn test:nut",
"test:build:local": "shx rm -rf node_modules && yarn && yarn pack && yarn test",
"test:build:local": "shx rm -rf node_modules ; yarn && yarn pack && yarn test",
"test:mutation": "stryker run",
"test:nut": "nyc mocha **/*.nut.ts",
"test:unit": "jest",
Expand All @@ -67,42 +61,38 @@
"prebuild": "yarn clean",
"prepack": "yarn build && oclif-dev manifest && oclif-dev readme",
"prepare": "husky install",
"upgrade:dependencies": "yarn yarn-upgrade-all"
"upgrade:dependencies": "yarn-upgrade-all ; yarn-audit-fix"
},
"devDependencies": {
"@commitlint/cli": "^17.6.5",
"@commitlint/config-conventional": "^17.6.5",
"@commitlint/prompt-cli": "^17.6.5",
"@oclif/dev-cli": "^1.26.10",
"@oclif/plugin-help": "^5.2.9",
"@oclif/test": "^2.3.21",
"@salesforce/cli-plugins-testkit": "^3.4.0",
"@salesforce/dev-config": "^4.0.1",
"@salesforce/ts-sinon": "^1.4.7",
"@stryker-mutator/core": "^6.4.2",
"@stryker-mutator/jest-runner": "^6.4.2",
"@swc/core": "^1.3.61",
"@types/chai": "^4.3.5",
"@types/mocha": "^10.0.1",
"@types/node": "^20.2.5",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"chai": "^4.3.7",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-salesforce-typescript": "^1.1.1",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"jest": "^29.5.0",
"knip": "^2.13.0",
"lint-staged": "^13.2.2",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"prettier": "^2.8.8",
"prettier-eslint": "^15.0.1",
"shx": "^0.3.4",
"sinon": "^15.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"yarn-audit-fix": "^9.3.10",
"yarn-upgrade-all": "^0.7.2"
},
"oclif": {
Expand Down
2 changes: 0 additions & 2 deletions src/utils/gitConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ module.exports.POINTER_REF_TYPES = [COMMIT_REF_TYPE, TAG_REF_TYPE]
module.exports.GIT_DIFF_TYPE_REGEX = /^.\s+/u
module.exports.GIT_FOLDER = '.git'
module.exports.GIT_PATH_SEP = '/'
module.exports.MINUS = '-'
module.exports.IGNORE_WHITESPACE_PARAMS = [
'--ignore-all-space',
'--ignore-blank-lines',
'--ignore-cr-at-eol',
'--word-diff-regex=|[^[:space:]]',
]
module.exports.PLUS = '+'
module.exports.UTF8_ENCODING = 'utf8'
7 changes: 0 additions & 7 deletions src/utils/metadataConstants.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
'use strict'
const { MINUS, PLUS } = require('../utils/gitConstants')

const FIELD_DIRECTORY_NAME = 'fields'
const FLOW_XML_NAME = 'Flow'
const FULLNAME = 'fullName'
const FULLNAME_XML_TAG = new RegExp(`<${FULLNAME}>(.*)</${FULLNAME}>`)
const INFOLDER_SUFFIX = `Folder`
const LABEL_EXTENSION = 'labels'
const LABEL_XML_NAME = 'CustomLabel'
Expand Down Expand Up @@ -33,13 +30,10 @@ const SUB_OBJECT_TYPES = [
const TERRITORY_MODEL_TYPE = 'territory2Models'
const TRANSLATION_EXTENSION = 'translation'
const TRANSLATION_TYPE = 'Translations'
const XML_TAG = new RegExp(`^[${MINUS}${PLUS}]?\\s*<([^(/><.)]+)>\\s*$`)
const XML_HEADER_TAG_END = '?>'

module.exports.FIELD_DIRECTORY_NAME = FIELD_DIRECTORY_NAME
module.exports.FLOW_XML_NAME = FLOW_XML_NAME
module.exports.FULLNAME = FULLNAME
module.exports.FULLNAME_XML_TAG = FULLNAME_XML_TAG
module.exports.INFOLDER_SUFFIX = INFOLDER_SUFFIX
module.exports.LABEL_EXTENSION = LABEL_EXTENSION
module.exports.LABEL_XML_NAME = LABEL_XML_NAME
Expand All @@ -56,5 +50,4 @@ module.exports.SUB_OBJECT_TYPES = SUB_OBJECT_TYPES
module.exports.TERRITORY_MODEL_TYPE = TERRITORY_MODEL_TYPE
module.exports.TRANSLATION_EXTENSION = TRANSLATION_EXTENSION
module.exports.TRANSLATION_TYPE = TRANSLATION_TYPE
module.exports.XML_TAG = XML_TAG
module.exports.XML_HEADER_TAG_END = XML_HEADER_TAG_END
Loading

0 comments on commit 9c5c8ee

Please sign in to comment.