Skip to content

Commit

Permalink
FIX @W-17330636@ Fixing errors in release process (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfeingold35 authored Dec 13, 2024
1 parent 43af659 commit 1c63387
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 25 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/publish-package-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions packages/T-E-M-P-L-A-T-E/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/code-analyzer-core/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/code-analyzer-engine-api/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/code-analyzer-eslint-engine/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/code-analyzer-flowtest-engine/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/code-analyzer-pmd-engine/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions packages/code-analyzer-regex-engine/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/code-analyzer-retirejs-engine/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down

0 comments on commit 1c63387

Please sign in to comment.