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

fix: Resolve input sourceDir to absolute path #3024

Merged
merged 3 commits into from
Aug 1, 2024

Conversation

sbeesm
Copy link
Contributor

@sbeesm sbeesm commented Jan 22, 2024

Fixes #2993.

Add a patch that turns the run.js sourceDir into an absolute path.

Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

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

With the path normalization moved into cmd/run.js, the normalization at the arg parser level can be dropped:

coerce: (arg) => (arg != null ? path.resolve(arg) : undefined),

Could you also add a unit test to https://github.com/mozilla/web-ext/blob/eae8d7374238254c90e8e10d0395ca24923c8c13/tests/unit/test-cmd/test.run.js ? Input a relative path and verify that sourceDir is an absolute path.

@sbeesm
Copy link
Contributor Author

sbeesm commented Jan 23, 2024

Thanks for the review and comments, I've pushed the suggested changes.

One build step is failing currently related to prettier formatting. I tried to run npm run prettier-dev but it throws this error:

.../web-ext/node_modules/pretty-quick/dist/isSupportedExtension.js:12
  ..._prettier.resolveConfig.sync(file, {
                             ^
TypeError: _prettier.resolveConfig.sync is not a function

I referred to some docs and downgrading to version 2.8.8 fixed the issue, but build still fails after the latest push. I'm not sure if this is due to an older version of prettier doing some additional formatting changes which were not required. Please could you suggest on this.

@willdurand
Copy link
Member

Thanks for the review and comments, I've pushed the suggested changes.

One build step is failing currently related to prettier formatting. I tried to run npm run prettier-dev but it throws this error:

.../web-ext/node_modules/pretty-quick/dist/isSupportedExtension.js:12
  ..._prettier.resolveConfig.sync(file, {
                             ^
TypeError: _prettier.resolveConfig.sync is not a function

I referred to some docs and downgrading to version 2.8.8 fixed the issue, but build still fails after the latest push. I'm not sure if this is due to an older version of prettier doing some additional formatting changes which were not required. Please could you suggest on this.

Gah, that's my fault probably. We don't seem to have CI checks for prettier/pretty-quick and looks like there is some kind of incompatibilities.

@willdurand
Copy link
Member

Ha. Weird, it doesn't fail for me locally. Could you please rebase your PR on top of latest master? Thanks

@sbeesm sbeesm force-pushed the resolve-absolute-sourcedir-2993 branch from 5f01fe7 to 13af82f Compare January 23, 2024 15:24
@sbeesm
Copy link
Contributor Author

sbeesm commented Jan 23, 2024

Yes, pulling the latest from master fixed the issues. I can run the prettier-dev command and build checks are also passing now. Thanks a lot! :)

Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

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

Thanks for the patch!

@Rob--W Rob--W merged commit 244aeb3 into mozilla:master Aug 1, 2024
4 checks passed
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.

Firefox fails to launch when using webExt.cmd.run in NodeJS
3 participants