From d9ec7a7a567f2d50b337c84a44243d99065bfa62 Mon Sep 17 00:00:00 2001 From: Joshua Feingold Date: Fri, 13 Dec 2024 13:35:51 -0600 Subject: [PATCH 1/5] @W-17330636@ Fixing errors in release process --- .github/workflows/publish-package-to-npm.yml | 10 +++--- ...pdate-dependencies-on-released-packages.js | 32 ++++++++++++++++--- .../update-versions-in-released-packages.js | 9 ++++++ .../validate-packages-as-releasable.js | 1 + .../validate-package-interdependencies.js | 7 ++++ packages/T-E-M-P-L-A-T-E/package.json | 4 +-- packages/code-analyzer-core/package.json | 4 +-- .../code-analyzer-engine-api/package.json | 2 +- .../code-analyzer-eslint-engine/package.json | 4 +-- .../package.json | 4 +-- .../code-analyzer-pmd-engine/package.json | 4 +-- .../code-analyzer-regex-engine/package.json | 4 +-- .../package.json | 4 +-- 13 files changed, 64 insertions(+), 25 deletions(-) diff --git a/.github/workflows/publish-package-to-npm.yml b/.github/workflows/publish-package-to-npm.yml index 0047a0e9..dff98248 100644 --- a/.github/workflows/publish-package-to-npm.yml +++ b/.github/workflows/publish-package-to-npm.yml @@ -111,15 +111,15 @@ jobs: echo "branch_name=release/$NOW_TIMESTAMP" >> "$GITHUB_OUTPUT" - name: Strip '-SNAPSHOT' from to-be-released package versions run: | - PACKAGE_LIST=(${{ needs.validate-packages-as-releasable.outputs.packages-to-release }}) - node ./.github/workflows/publish-package-to-npm/update-versions-in-released-packages.js "$PACKAGE_LIST" + PACKAGE_NAMES_STRING="${{ needs.validate-packages-as-releasable.outputs.packages-to-release }}" + node ./.github/workflows/publish-package-to-npm/update-versions-in-released-packages.js "$PACKAGE_NAMES_STRING" - name: Update inter-package dependencies run: | - RELEASABLE_PACKAGES=(${{ needs.validate-packages-as-releasable.outputs.packages-to-release }}) + PACKAGES_TO_RELEASE_STRING="${{ needs.validate-packages-as-releasable.outputs.packages-to-release }}" cd packages ALL_PACKAGES=`ls` cd .. - node ./.github/workflows/publish-package-to-npm/update-dependencies-on-released-packages.js "$RELEASABLE_PACKAGES" "$ALL_PACKAGES" + node ./.github/workflows/publish-package-to-npm/update-dependencies-on-released-packages.js "$PACKAGES_TO_RELEASE_STRING" "$ALL_PACKAGES" - name: Build run: | npm install @@ -228,7 +228,7 @@ jobs: # We need the NPM token to publish. echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc PUBLISHED_VERSION=$(jq -r ".version" package.json) - if [ "${{ inputs.dryrun }}" == "true" ]]; then + if [[ "${{ inputs.dryrun }}" == "true" ]]; then npm publish --tag latest-alpha --access public --verbose --dry-run echo "Fake-published ${PACKAGE_NAME}@${PUBLISHED_VERSION}" else diff --git a/.github/workflows/publish-package-to-npm/update-dependencies-on-released-packages.js b/.github/workflows/publish-package-to-npm/update-dependencies-on-released-packages.js index ba4cab58..ce34add9 100644 --- a/.github/workflows/publish-package-to-npm/update-dependencies-on-released-packages.js +++ b/.github/workflows/publish-package-to-npm/update-dependencies-on-released-packages.js @@ -3,8 +3,26 @@ const fs = require('fs'); function main() { const packagesToRelease = process.argv[2].split(" "); + + console.log('====== RUNNING update-dependencies-on-released-packages.js ======='); + if (packagesToRelease.length > 0) { + displayList('THESE PACKAGES ARE BEING RELEASED:', packagesToRelease); + } else { + console.log('NO PACKAGES ARE BEING RELEASED. THAT SEEMS INCORRECT.'); + // If we received no package names, that indicates problem in the release process. + process.exit(1); + } + + // Split on `\n` instead of ` ` because this argument comes from $(ls). const allPackages = process.argv[3].split("\n"); + if (allPackages.length > 0) { + displayList('WILL CHECK DEPENDENCIES IN THESE PACKAGES:', allPackages); + } else { + console.log('NO PACKAGES TO CHECK FOR DEPENDENCIES. THAT SEEMS INCORRECT.'); + process.exit(1); + } + const packageJsonsToRelease = getPackageJsons(packagesToRelease); const allPackageJsons = getPackageJsons(allPackages); @@ -20,15 +38,19 @@ function main() { function displayMapOfLists(header, mapOfLists) { console.log(header); for (const [key, innerList] of mapOfLists.entries()) { - console.log(`IN ${key}:`); - for (const innerListItem of innerList) { - console.log(`* ${innerListItem}`); - } - console.log(''); + displayList(`IN ${key}:`, innerList); } console.log('\n'); } +function displayList(header, list) { + console.log(header); + for (const item of list) { + console.log(`* ${listItem}`); + } + console.log(''); +} + function getPackageJsons(packageNames) { return packageNames.map(getPackageJson); } diff --git a/.github/workflows/publish-package-to-npm/update-versions-in-released-packages.js b/.github/workflows/publish-package-to-npm/update-versions-in-released-packages.js index dce241a0..dca5f107 100644 --- a/.github/workflows/publish-package-to-npm/update-versions-in-released-packages.js +++ b/.github/workflows/publish-package-to-npm/update-versions-in-released-packages.js @@ -4,6 +4,15 @@ const fs = require('fs'); function main() { const packagesToRelease = process.argv[2].split(" "); + console.log('====== RUNNING update-versions-in-released-packages.js ======='); + if (packagesToRelease.length > 0) { + displayList('RECEIVED THE FOLLOWING PACKAGE NAMES:', packagesToRelease); + } else { + console.log('RECEIVED NO PACKAGE NAMES'); + // If we received no package names, that indicates problem in the release process. + process.exit(1); + } + const packageJsonsToRelease = getPackageJsons(packagesToRelease); const packageChangesMade = updatePackageVersionsAndDescribeChanges(packageJsonsToRelease); diff --git a/.github/workflows/publish-package-to-npm/validate-packages-as-releasable.js b/.github/workflows/publish-package-to-npm/validate-packages-as-releasable.js index 4ae29025..23f900b2 100644 --- a/.github/workflows/publish-package-to-npm/validate-packages-as-releasable.js +++ b/.github/workflows/publish-package-to-npm/validate-packages-as-releasable.js @@ -4,6 +4,7 @@ const fs = require('fs'); function main() { const packagesToRelease = process.argv[2].split(' '); + console.log('====== RUNNING validate-packages-as-releasable.js ======='); if (packagesToRelease.length === 0) { console.log('Error: No packages selected for release'); process.exit(1); diff --git a/.github/workflows/verify-pr/validate-package-interdependencies.js b/.github/workflows/verify-pr/validate-package-interdependencies.js index faf7c1cb..ff7cdab7 100644 --- a/.github/workflows/verify-pr/validate-package-interdependencies.js +++ b/.github/workflows/verify-pr/validate-package-interdependencies.js @@ -4,6 +4,13 @@ const fs = require('fs'); function main() { const packageNames = process.argv[2].split('\n'); + if (packageNames.length > 0) { + displayList('WILL ATTEMPT TO VALIDATE THESE PACKAGES:', packageNames); + } else { + console.log('NO PACKAGES PROVIDED FOR VALIDATION'); + process.exit(0); + } + const packageJsons = getAllPackageJsons(packageNames); const incorrectPackageInterdependencies = identifyIncorrectlyInterdependentPackages(packageJsons); diff --git a/packages/T-E-M-P-L-A-T-E/package.json b/packages/T-E-M-P-L-A-T-E/package.json index b22ea742..7d98f64e 100644 --- a/packages/T-E-M-P-L-A-T-E/package.json +++ b/packages/T-E-M-P-L-A-T-E/package.json @@ -1,7 +1,7 @@ { "name": "@salesforce/t-e-m-p-l-a-t-e", "description": "T-E-M-P-L-A-T-E", - "version": "0.16.0-SNAPSHOT", + "version": "0.16.1-SNAPSHOT", "author": "The Salesforce Code Analyzer Team", "license": "BSD-3-Clause", "homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview", @@ -14,7 +14,7 @@ "types": "dist/index.d.ts", "dependencies": { "@types/node": "^20.0.0", - "@salesforce/code-analyzer-engine-api": "0.16.0-SNAPSHOT" + "@salesforce/code-analyzer-engine-api": "0.16.1-SNAPSHOT" }, "devDependencies": { "@eslint/js": "^8.57.1", diff --git a/packages/code-analyzer-core/package.json b/packages/code-analyzer-core/package.json index a2278993..830efc71 100644 --- a/packages/code-analyzer-core/package.json +++ b/packages/code-analyzer-core/package.json @@ -1,7 +1,7 @@ { "name": "@salesforce/code-analyzer-core", "description": "Core Package for the Salesforce Code Analyzer", - "version": "0.19.0-SNAPSHOT", + "version": "0.19.1-SNAPSHOT", "author": "The Salesforce Code Analyzer Team", "license": "BSD-3-Clause", "homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview", @@ -13,7 +13,7 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "dependencies": { - "@salesforce/code-analyzer-engine-api": "0.16.0-SNAPSHOT", + "@salesforce/code-analyzer-engine-api": "0.16.1-SNAPSHOT", "@types/js-yaml": "^4.0.9", "@types/node": "^20.0.0", "@types/sarif": "^2.1.7", diff --git a/packages/code-analyzer-engine-api/package.json b/packages/code-analyzer-engine-api/package.json index 0bcb8693..7455edf4 100644 --- a/packages/code-analyzer-engine-api/package.json +++ b/packages/code-analyzer-engine-api/package.json @@ -1,7 +1,7 @@ { "name": "@salesforce/code-analyzer-engine-api", "description": "Engine API Package for the Salesforce Code Analyzer", - "version": "0.16.0-SNAPSHOT", + "version": "0.16.1-SNAPSHOT", "author": "The Salesforce Code Analyzer Team", "license": "BSD-3-Clause", "homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview", diff --git a/packages/code-analyzer-eslint-engine/package.json b/packages/code-analyzer-eslint-engine/package.json index b74b25bd..b1f63e7c 100644 --- a/packages/code-analyzer-eslint-engine/package.json +++ b/packages/code-analyzer-eslint-engine/package.json @@ -1,7 +1,7 @@ { "name": "@salesforce/code-analyzer-eslint-engine", "description": "Plugin package that adds 'eslint' as an engine into Salesforce Code Analyzer", - "version": "0.16.0-SNAPSHOT", + "version": "0.16.1-SNAPSHOT", "author": "The Salesforce Code Analyzer Team", "license": "BSD-3-Clause", "homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview", @@ -17,7 +17,7 @@ "@babel/eslint-parser": "^7.25.9", "@eslint/js": "^8.57.1", "@lwc/eslint-plugin-lwc": "^1.8.2", - "@salesforce/code-analyzer-engine-api": "0.16.0-SNAPSHOT", + "@salesforce/code-analyzer-engine-api": "0.16.1-SNAPSHOT", "@salesforce/eslint-config-lwc": "^3.6.0", "@salesforce/eslint-plugin-lightning": "^1.0.0", "@types/eslint": "^8.56.10", diff --git a/packages/code-analyzer-flowtest-engine/package.json b/packages/code-analyzer-flowtest-engine/package.json index 6af26a99..b44aeb51 100644 --- a/packages/code-analyzer-flowtest-engine/package.json +++ b/packages/code-analyzer-flowtest-engine/package.json @@ -1,7 +1,7 @@ { "name": "@salesforce/code-analyzer-flowtest-engine", "description": "Plugin package that adds 'flowtest' as an engine into Salesforce Code Analyzer", - "version": "0.16.0-SNAPSHOT", + "version": "0.16.1-SNAPSHOT", "author": "The Salesforce Code Analyzer Team", "license": "BSD-3-Clause", "homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview", @@ -13,7 +13,7 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "dependencies": { - "@salesforce/code-analyzer-engine-api": "0.16.0-SNAPSHOT", + "@salesforce/code-analyzer-engine-api": "0.16.1-SNAPSHOT", "@types/node": "^20.0.0", "@types/semver": "^7.5.8", "@types/tmp": "^0.2.6", diff --git a/packages/code-analyzer-pmd-engine/package.json b/packages/code-analyzer-pmd-engine/package.json index fe061551..b3a99ea1 100644 --- a/packages/code-analyzer-pmd-engine/package.json +++ b/packages/code-analyzer-pmd-engine/package.json @@ -1,7 +1,7 @@ { "name": "@salesforce/code-analyzer-pmd-engine", "description": "Plugin package that adds 'pmd' and 'cpd' as engines into Salesforce Code Analyzer", - "version": "0.16.0-SNAPSHOT", + "version": "0.16.1-SNAPSHOT", "author": "The Salesforce Code Analyzer Team", "license": "BSD-3-Clause", "homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview", @@ -14,7 +14,7 @@ "types": "dist/index.d.ts", "dependencies": { "@types/node": "^20.0.0", - "@salesforce/code-analyzer-engine-api": "0.16.0-SNAPSHOT", + "@salesforce/code-analyzer-engine-api": "0.16.1-SNAPSHOT", "@types/tmp": "^0.2.6", "tmp": "^0.2.3", "@types/semver": "^7.5.8", diff --git a/packages/code-analyzer-regex-engine/package.json b/packages/code-analyzer-regex-engine/package.json index be74007d..c9288aae 100644 --- a/packages/code-analyzer-regex-engine/package.json +++ b/packages/code-analyzer-regex-engine/package.json @@ -1,7 +1,7 @@ { "name": "@salesforce/code-analyzer-regex-engine", "description": "Plugin package that adds 'regex' as an engine into Salesforce Code Analyzer", - "version": "0.16.0-SNAPSHOT", + "version": "0.16.1-SNAPSHOT", "author": "The Salesforce Code Analyzer Team", "license": "BSD-3-Clause", "homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview", @@ -13,7 +13,7 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "dependencies": { - "@salesforce/code-analyzer-engine-api": "0.16.0-SNAPSHOT", + "@salesforce/code-analyzer-engine-api": "0.16.1-SNAPSHOT", "@types/node": "^20.0.0", "isbinaryfile": "^5.0.4" }, diff --git a/packages/code-analyzer-retirejs-engine/package.json b/packages/code-analyzer-retirejs-engine/package.json index b0ae555d..b6df1e00 100644 --- a/packages/code-analyzer-retirejs-engine/package.json +++ b/packages/code-analyzer-retirejs-engine/package.json @@ -1,7 +1,7 @@ { "name": "@salesforce/code-analyzer-retirejs-engine", "description": "Plugin package that adds 'retire-js' as an engine into Salesforce Code Analyzer", - "version": "0.16.0-SNAPSHOT", + "version": "0.16.1-SNAPSHOT", "author": "The Salesforce Code Analyzer Team", "license": "BSD-3-Clause", "homepage": "https://developer.salesforce.com/docs/platform/salesforce-code-analyzer/overview", @@ -13,7 +13,7 @@ "main": "dist/index.js", "types": "dist/index.d.ts", "dependencies": { - "@salesforce/code-analyzer-engine-api": "0.16.0-SNAPSHOT", + "@salesforce/code-analyzer-engine-api": "0.16.1-SNAPSHOT", "@types/node": "^20.0.0", "@types/tmp": "^0.2.6", "isbinaryfile": "^5.0.4", From c2f7a17b388e3ee97b9c12e6f9cfc920e1f54a6d Mon Sep 17 00:00:00 2001 From: Joshua Feingold Date: Fri, 13 Dec 2024 13:43:19 -0600 Subject: [PATCH 2/5] Experimenting --- .github/workflows/verify-pr.yml | 19 +++++++++++++++++++ .../workflows/verify-pr/experiment-script.js | 8 ++++++++ 2 files changed, 27 insertions(+) create mode 100644 .github/workflows/verify-pr/experiment-script.js diff --git a/.github/workflows/verify-pr.yml b/.github/workflows/verify-pr.yml index 3568e10e..ee8f4582 100644 --- a/.github/workflows/verify-pr.yml +++ b/.github/workflows/verify-pr.yml @@ -8,6 +8,25 @@ defaults: shell: bash jobs: + run_experiment_part_1: + runs-on: macos-latest + outputs: + output-thing: ${{ steps.main.outputs.output_thing }} + steps: + - id: main + run: | + OUTPUT_THING=$(abcd cdef efgh) + echo "output_thing=$OUTPUT_THING" >> "$GITHUB_OUTPUT" + + run_experiment_part_2: + runs-on: macos-latest + needs: run_experiment_part_1 + steps: + - run: | + LIST_TYPE_VARIABLE=(${{ needs.run_experiment_part_1.outputs.output-thing }}) + STRING_TYPE_VARIABLE="${{ needs.run_experiment_part_1.outputs.output-thing }}" + node ./.github/workflows/verify-pr/experiment-script.js "$LIST_TYPE_VARIABLE" + node ./.github/workflows/verify-pr/experiment-script.js "$STRING_TYPE_VARIABLE" validate_pr_title: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/verify-pr/experiment-script.js b/.github/workflows/verify-pr/experiment-script.js new file mode 100644 index 00000000..9d598867 --- /dev/null +++ b/.github/workflows/verify-pr/experiment-script.js @@ -0,0 +1,8 @@ + +function main() { + const inputs = process.argv[2].split(" "); + + console.log(`RECEIVED THESE INPUTS: ${JSON.stringify(inputs)}`); +} + +main(); \ No newline at end of file From 4f39b450b5829f9eee6e9c7493e4e13ea3aadde0 Mon Sep 17 00:00:00 2001 From: Joshua Feingold Date: Fri, 13 Dec 2024 13:44:22 -0600 Subject: [PATCH 3/5] Typo --- .github/workflows/verify-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify-pr.yml b/.github/workflows/verify-pr.yml index ee8f4582..4946c054 100644 --- a/.github/workflows/verify-pr.yml +++ b/.github/workflows/verify-pr.yml @@ -15,7 +15,7 @@ jobs: steps: - id: main run: | - OUTPUT_THING=$(abcd cdef efgh) + OUTPUT_THING=(abcd cdef efgh) echo "output_thing=$OUTPUT_THING" >> "$GITHUB_OUTPUT" run_experiment_part_2: From 7e6fbac71a506d5ac87cd509b959b5df4a18e56c Mon Sep 17 00:00:00 2001 From: Joshua Feingold Date: Fri, 13 Dec 2024 13:47:17 -0600 Subject: [PATCH 4/5] typo again --- .github/workflows/verify-pr.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verify-pr.yml b/.github/workflows/verify-pr.yml index 4946c054..0a5a35bb 100644 --- a/.github/workflows/verify-pr.yml +++ b/.github/workflows/verify-pr.yml @@ -15,8 +15,13 @@ jobs: steps: - id: main run: | - OUTPUT_THING=(abcd cdef efgh) - echo "output_thing=$OUTPUT_THING" >> "$GITHUB_OUTPUT" + OUTPUT_THING=() + OUTPUT_THING+=('abcd') + OUTPUT_THING+=('bcde') + OUTPUT_THING+=('cdef') + OUTPUT_THING+=('defg') + OUTPUT_THING_STR=$(IFS=' '; echo "${OUTPUT_THING[*]}") + echo "output_thing=$OUTPUT_THING_STR" >> "$GITHUB_OUTPUT" run_experiment_part_2: runs-on: macos-latest From 28089e72337922d889514800ae6fafc20e0c9c12 Mon Sep 17 00:00:00 2001 From: Joshua Feingold Date: Fri, 13 Dec 2024 13:48:40 -0600 Subject: [PATCH 5/5] asdfasdfasdf --- .github/workflows/verify-pr.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/verify-pr.yml b/.github/workflows/verify-pr.yml index 0a5a35bb..79134057 100644 --- a/.github/workflows/verify-pr.yml +++ b/.github/workflows/verify-pr.yml @@ -27,6 +27,7 @@ jobs: runs-on: macos-latest needs: run_experiment_part_1 steps: + - uses: actions/checkout@v4 - run: | LIST_TYPE_VARIABLE=(${{ needs.run_experiment_part_1.outputs.output-thing }}) STRING_TYPE_VARIABLE="${{ needs.run_experiment_part_1.outputs.output-thing }}"