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

chore: esbuild artifacts #1030

Merged
merged 2 commits into from
Feb 22, 2024
Merged

chore: esbuild artifacts #1030

merged 2 commits into from
Feb 22, 2024

Conversation

mingxuanzhangsfdx
Copy link
Member

@mingxuanzhangsfdx mingxuanzhangsfdx commented Feb 19, 2024

What does this PR do?

This PR creates a github workflow to make esbuild transpile the project and then publish a package @salesforce/core-bundle to npm.

It should be merged after #1026

W-15022848

What issues does this PR fix or reference?

@W-15022848@

with:
node-version: ${{ inputs.nodeVersion }}
registry-url: 'https://registry.npmjs.org'
- name: Install esbuild Dependencies
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These dependencies are required by esbuild

}

// Remove 'prepack' and 'prepare' scripts
if (packageJson.scripts) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two fields are deleted because it will block the publishing process of esbuild.


// Update package name if necessary
if (packageJson.name && packageJson.name === '@salesforce/core') {
packageJson.name = '@salesforce/core-bundle';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

produce a separate package called core-bundle.

mshanemc
mshanemc previously approved these changes Feb 20, 2024
.github/workflows/esbuild-publish.yml Outdated Show resolved Hide resolved
yarn add esbuild-plugin-tsc@^0.4.0 -D
- name: Install All Dependencies
run: |
yarn install --network-timeout 600000
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

within our actions we have https://github.com/salesforcecli/github-workflows/blob/main/.github/actions/yarnInstallWithRetries/action.yml which has retry logic wrapped around it. That reduces network/cache errors from yarn

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I just polish it according to your suggestion!

node scripts/build.js
- name: Publish a Package
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will work, but if it does make sure the token isn't included in the logs.

IIRC, we use actions/setup-node which writes NODE_AUTH_TOKEN to the npmrc file.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried the .npmrc method first but it did not work properly. I am sure it won't display in the logs. Here is an example in my forked repo. https://github.com/mingxuanzhangsfdx/sfdx-core/actions/runs/7955097070/job/21713519127#step:10:1

@mshanemc mshanemc merged commit 757a4b0 into main Feb 22, 2024
66 checks passed
@mshanemc mshanemc deleted the mz/esbuild-workflow branch February 22, 2024 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants