Make updates to imports after bumping local-dev-lib version#281
Closed
kemmerle wants to merge 1 commit intoadd/schema-validationfrom
Closed
Make updates to imports after bumping local-dev-lib version#281kemmerle wants to merge 1 commit intoadd/schema-validationfrom
kemmerle wants to merge 1 commit intoadd/schema-validationfrom
Conversation
kemmerle
commented
May 7, 2025
| const config = getConfig(); | ||
| let invalidReason = ''; | ||
| if (config) { | ||
| // @ts-expect-error TODO: Fix this when updating local-dev-lib |
Contributor
Author
There was a problem hiding this comment.
The deprecated config and new config types are simply incompatible with one another. We can remove this error, once we account for the new global config in the extension.
kemmerle
commented
May 7, 2025
| commands.registerCommand( | ||
| COMMANDS.REMOTE_FS.FETCH, | ||
| async (clickedFileLink) => { | ||
| showMissingAccountError(); |
Contributor
Author
There was a problem hiding this comment.
If no account is specified, we throw an error to the user and exit the command. This guarantees that getAccountId() is not undefined.
kemmerle
commented
May 7, 2025
| const decodedFilePath = decodeURIComponent(filepath); | ||
| try { | ||
| const file = await download(getAccountId(), decodedFilePath); | ||
| const { data: file } = await download(getAccountId()!, decodedFilePath); |
Contributor
Author
There was a problem hiding this comment.
This accounts for changes to the http module in LDL versions 3 and above.
| async () => { | ||
| const config = getConfig(); | ||
| // @ts-expect-error TODO: Fix this when updating local-dev-lib | ||
| if (config && config.portals) { |
Contributor
There was a problem hiding this comment.
Are there any utils we could leverage from LDL to get around some of these issues? Would getConfigAccounts help here?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description and Context
This PR needs to be merged into the PR to add JSON schema validation to the extension: #280
In the schema validation PR, we need to bump the
@hubspot/local-dev-libpackage version to^3.1.0to be compatible with the new dependency@hubspot/project-parsing-liblibrary which also contains LDL as a dependency.There are significant differences between the two versions of LDL, and so I've made updates to the code where needed.
IMPORTANT NOTE PLEASE READ:
Some imports from
@hubspot/local-dev-libmust keep CommonJS syntax. This is because:@hubspot/local-dev-lib, theexportsfield in thepackage.jsonfile exports thelibfolder like this:Only ES modules can read the
exportsfield.VSCode extensions don't support ES Modules. I'm not joking, this is a very active issue.
Ergo, imports from the
/libfolder must keep CommonJS syntax.We could mess with the
tsconfig.jsonfile to try to changecompilerOptions.moduletonodenextornode16and override any issues, but Microsoft specifically warns against any hacks. They're brittle and prone to breakage.TODO
Who to Notify
@TanyaScales @brandenrodgers @camden11 @joe-yeager