-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Plugin Repo: Partially resolves #9280: Allow marking specific NPM packages as superseded #9302
Plugin Repo: Partially resolves #9280: Allow marking specific NPM packages as superseded #9302
Conversation
It would be good if we didn't need this extra When changing |
You don't have to. The following package is still tried to be added to the plugin list, even though it is in the |
|
I've tested this in a Windows VM by:
repoApi_ = new RepositoryApi('/Users/User/Documents/plugins', Setting.value('tempDir'));and commenting out the previous line.
"joplin.plugin.benji.favorites": {
"_superseded_package": "joplin-plugin-benji-favorites"
}to the end of diff --git a/packages/plugin-repo-cli/index.ts b/packages/plugin-repo-cli/index.ts
index 65e8b281c..3b512468e 100644
--- a/packages/plugin-repo-cli/index.ts
+++ b/packages/plugin-repo-cli/index.ts
@@ -241,7 +241,7 @@ async function commandBuild(args: CommandBuildArgs) {
chdir(previousDir);
- const searchResults = (await execCommand('npm search joplin-plugin --searchlimit 5000 --json', { showStdout: false, showStderr: false })).trim();
+ const searchResults = (await execCommand('npm search "joplin-plugin favorite" --searchlimit 5000 --json', { showStdout: false, showStderr: false })).trim();
const npmPackages = pluginInfoFromSearchResults(JSON.parse(searchResults));
for (const npmPackage of npmPackages) {
I think this is ready for review/merge! Related (proof of concept) pull request. |
|
btw, any way you can find out why the |
Currently joplin/packages/plugin-repo-cli/index.ts Lines 168 to 174 in 1af46b0
The |
|
Ah, I see. Thanks a bunch. |
|
Looks like it's ready to merge. @personalizedrefrigerator, if you could also add a readme on the plugin repo to document this process that would be great. |
It would be good to clear this warning actually. Maybe we could have a check - if the plugin is marked as obsolete, we don't print an error related to the invalid plugin ID? |
Summary
This pull request allows changing the NPM package associated with a plugin by creating a list of ignored NPM packages.
A plugin can now be overridden by
_superseded_packagekey tomanifestOverrides.json. The_superseded_packageis ignored._npm_package_namevalue in manifests.json to the new NPM package, andNotes
A note on the approach taken by this pull request
My original approach involved adding a map from original package names to updated package names. However, this approach would involve adding a special case for plugin overrides to
checkIfPluginCanBeAdded.ts, while this approach does not.Additionally, given the check that verifies that previous versions of a plugin have the same name as the latest, the new
_superseded_packagekey shouldn't be necessary, if_npm_package_nameis updated inmanifests.json. However, this change should provide a more informative message when a plugin is moved and creates an easily-accessible list of all moved packages.A note on overriding the NPM package name for the first time
A follow-up pull request should document this process in a file in the plugin repository's
readmedirectory.With this pull request, it involves updating
manifests.jsonmanually once and adding the package name tomanifestOverrides.json. For example,Testing
Testing done so far
Testing to do
_npm_package_nameinmanifests.jsonallows updating the plugin from the new NPM package.