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

Persist relative paths on disk #942

Merged
merged 1 commit into from
Dec 17, 2024
Merged

Conversation

aidant
Copy link
Contributor

@aidant aidant commented Dec 16, 2024

Platforms affected

Motivation and Context

We have a monorepo that contains a cordova application and a Cordova plugin. When adding the plugin to the applicatoin the fetch.json contains an absolute directory which does not work on other computers.

Description

Persist a relative directory on disk instead of an absolute directory.

Testing

We have had the following patch in production for the last 2 months.

Patch
diff --git a/node_modules/cordova-lib/src/plugman/fetch.js b/node_modules/cordova-lib/src/plugman/fetch.js
index ec73836..2e4d1e2 100644
--- a/node_modules/cordova-lib/src/plugman/fetch.js
+++ b/node_modules/cordova-lib/src/plugman/fetch.js
@@ -84,7 +84,7 @@ function fetchPlugin (plugin_src, plugins_dir, options) {
                             pinfo: pluginInfoProvider.get(directory),
                             fetchJsonSource: {
                                 type: 'local',
-                                path: directory
+                                path: path.relative(projectRoot, directory)
                             }
                         };
                     }).catch(function (error) {

Checklist

  • I've run the tests to see all new and existing tests pass
  • I added automated test coverage as appropriate for this change
  • Commit is prefixed with (platform) if this change only applies to one platform (e.g. (android))
  • If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct keyword to close issues using keywords)
  • I've updated the documentation if necessary

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.91%. Comparing base (db5c8c0) to head (6bd81fb).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #942   +/-   ##
=======================================
  Coverage   87.91%   87.91%           
=======================================
  Files          46       46           
  Lines        2134     2134           
=======================================
  Hits         1876     1876           
  Misses        258      258           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@breautek breautek left a comment

Choose a reason for hiding this comment

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

Lgtm

@aidant
Copy link
Contributor Author

aidant commented Dec 17, 2024

Feel free to merge when appropriate as I don't have permissions to merge.

@dpogue dpogue merged commit 75c4047 into apache:master Dec 17, 2024
11 checks passed
@aidant aidant deleted the feat-relative-path branch December 17, 2024 01:35
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