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

plugins:link fails to compile plugins that have typescript as a dependency #1984

Closed
Daniel-Webster opened this issue Mar 6, 2023 · 4 comments
Labels
investigating We're actively investigating this issue

Comments

@Daniel-Webster
Copy link

Daniel-Webster commented Mar 6, 2023

Summary

Since oclif/plugin-plugins#517 the plugins:link command will always try to run tsc on plugins that contain a dependency of typescript. This breaks linking plugins that have a dependency of typescript installed via NPM or Yarn, since modules published to NPM will in most cases not contain their typescript source code nor their tsconfig.

Steps To Reproduce:

Repository to reproduce: dreamhouse-lwc

NOTE: If your issue is not reproducable by dreamhouse-lwc, i.e. requires specific metadata or files, we require a link to a simple Salesforce project repository with a script to setup a scratch org that reproduces your problem.

  1. yarn add --dev sfdx-cli sfdmu
  2. yarn sfdx plugins:link ./node_modules/sfdmu

Expected result

SFDX links the sfdmu plugin and I am able to call

sfdx sfdmu

Actual result

sfdx tries to compile the source code in the sfdmu module and fails because there is no tsconfig and no typescript code to compile.

yarn run v1.22.17
$ /Users/klink/Tingle/sfdx-action-container/node_modules/.bin/sfdx plugins:link ./node_modules/sfdmu
sfdx-cli: linking plugin sfdmu... ⣻
sfdx-cli: linking plugin sfdmu... !
    Error: yarn run tsc -p . --incremental --skipLibCheck exited with code 1
error Command failed with exit code 1.

System Information

  • Which shell/terminal are you using? (e.g. bash, zsh, powershell 5, powershell 7, cmd.exe, etc.)
    bash
  • If you are using sfdx
    • Run sfdx version --verbose --json
  • If you are using sf
    • Run sf version --verbose --json
  • Paste the output here

Additional information

see
oclif/plugin-plugins#559
and
oclif/plugin-plugins#517

@Daniel-Webster Daniel-Webster added the investigating We're actively investigating this issue label Mar 6, 2023
@github-actions
Copy link

github-actions bot commented Mar 6, 2023

Thank you for filing this issue. We appreciate your feedback and will review the issue as soon as possible. Remember, however, that GitHub isn't a mechanism for receiving support under any agreement or SLA. If you require immediate assistance, contact Salesforce Customer Support.

@peternhale
Copy link
Contributor

@Daniel-Webster the plugins:link is meant to be used as a developer tool when working on a plugin, not a means to register a plugin add via yarn.

Why not just install sfdmu?

@Daniel-Webster
Copy link
Author

Daniel-Webster commented Mar 6, 2023

We are using plugins:link to install the plugin in a Docker container build. The container is being built by x86 architecture for both x86 and ARM images. During that build using plugins:install results in extremely poor build times (hours) when executing in ARM emulation mode. To get around this we are installing plugins via yarn and copying over the node_modules into the container that we wish to use for sfdx plugin commands executed by the container. Installing in this way also allows us to cache the node_modules folder using our internal build tool.

Anecdotally, plugins:link used in this way has been much more reliable for me for many years since when I first started using this was back when there was no support to install plugins from internal NPM repositories / proxy configuration problems back in the day.

@peternhale
Copy link
Contributor

Let's use oclif/plugins#559 to track this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigating We're actively investigating this issue
Projects
None yet
Development

No branches or pull requests

2 participants