From a68802cae304e85db4cee37e3d21b3699a945d0d Mon Sep 17 00:00:00 2001 From: Thomas Cooper Date: Sat, 30 Nov 2024 20:20:54 -0500 Subject: [PATCH] fix: ERR_MODULE_NOT_FOUND when sample plugins ran - move plugin sample README into the package so its viewable on npm - fix bad imports from ESM plugin (index.js) - bump @finos/git-proxy-plugin-samples to 0.1.1 - update docs with simpler setup instructions Signed-off-by: Thomas Cooper --- packages/git-proxy-notify-hello/package.json | 18 ------------------ plugins/README.md | 10 ---------- plugins/git-proxy-plugin-samples/README.md | 14 ++++++++++++++ plugins/git-proxy-plugin-samples/index.js | 4 ++-- plugins/git-proxy-plugin-samples/package.json | 2 +- website/docs/development/plugins.mdx | 7 ++++--- 6 files changed, 21 insertions(+), 34 deletions(-) delete mode 100644 packages/git-proxy-notify-hello/package.json delete mode 100644 plugins/README.md create mode 100644 plugins/git-proxy-plugin-samples/README.md diff --git a/packages/git-proxy-notify-hello/package.json b/packages/git-proxy-notify-hello/package.json deleted file mode 100644 index 846407069..000000000 --- a/packages/git-proxy-notify-hello/package.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "name": "git-proxy-notify-hello", - "version": "1.0.0", - "description": "A simple notification plugin to display a message on push via git-proxy", - "scripts": { - "test": "mocha --exit" - }, - "author": "Thomas Cooper", - "license": "Apache-2.0", - "repository": { - "type": "git", - "url": "https://github.com/finos/git-proxy", - "path": "packages/git-proxy-notify-hello" - }, - "dependencies": { - "@finos/git-proxy": "file:../.." - } -} diff --git a/plugins/README.md b/plugins/README.md deleted file mode 100644 index 667722870..000000000 --- a/plugins/README.md +++ /dev/null @@ -1,10 +0,0 @@ -# GitProxy plugins & samples -GitProxy supports extensibility in the form of plugins. These plugins are specified via [configuration](/docs/category/configuration) as NPM packages or JavaScript code on disk. For each plugin configured, GitProxy will attempt to load each package or file as a standard [Node module](https://nodejs.org/api/modules.html). Plugin authors will create instances of the extension classes exposed by GitProxy and use these objects to implement custom functionality. - -For detailed documentation, please refer to the [GitProxy development resources on the project's site](https://git-proxy.finos.org/docs/development/plugins) - -## Included plugins -These plugins are maintained by the core GitProxy team. As a future roadmap item, organizations can choose to omit -certain features of GitProxy by simply removing the dependency from a deployed version of the application. - -- `git-proxy-plugin-samples`: "hello world" examples of the GitProxy plugin system diff --git a/plugins/git-proxy-plugin-samples/README.md b/plugins/git-proxy-plugin-samples/README.md new file mode 100644 index 000000000..66b3ef07e --- /dev/null +++ b/plugins/git-proxy-plugin-samples/README.md @@ -0,0 +1,14 @@ +# GitProxy plugins & samples +GitProxy supports extensibility in the form of plugins. These plugins are specified via [configuration](https://git-proxy.finos.org/docs/category/configuration) as NPM packages or JavaScript code on disk. For each plugin configured, GitProxy will attempt to load each package or file as a standard [Node module](https://nodejs.org/api/modules.html). Plugin authors will create instances of the extension classes exposed by GitProxy and use these objects to implement custom functionality. + +For detailed documentation, please refer to the [GitProxy development resources on the project's site](https://git-proxy.finos.org/docs/development/plugins) + +## Included plugins +These plugins are maintained by the core GitProxy team. As a future roadmap item, organizations can choose to omit +certain features of GitProxy by simply removing the dependency from a deployed version of the application. + +- `git-proxy-plugin-samples`: "hello world" examples of the GitProxy plugin system + +## Contributing + +Please refer to the [CONTRIBUTING.md](https://git-proxy.finos.org/docs/development/contributing) file for information on how to contribute to the GitProxy project. diff --git a/plugins/git-proxy-plugin-samples/index.js b/plugins/git-proxy-plugin-samples/index.js index 190799c8a..f8a4f6cda 100644 --- a/plugins/git-proxy-plugin-samples/index.js +++ b/plugins/git-proxy-plugin-samples/index.js @@ -4,8 +4,8 @@ */ // Peer dependencies; its expected that these deps exist on Node module path if you've installed @finos/git-proxy -import { PullActionPlugin } from "@finos/git-proxy/src/plugin"; -import { Step } from "@finos/git-proxy/src/proxy/actions"; +import { PullActionPlugin } from "@finos/git-proxy/src/plugin.js"; +import { Step } from "@finos/git-proxy/src/proxy/actions/index.js"; class RunOnPullPlugin extends PullActionPlugin { constructor() { diff --git a/plugins/git-proxy-plugin-samples/package.json b/plugins/git-proxy-plugin-samples/package.json index a3c11caa1..501518e0b 100644 --- a/plugins/git-proxy-plugin-samples/package.json +++ b/plugins/git-proxy-plugin-samples/package.json @@ -1,6 +1,6 @@ { "name": "@finos/git-proxy-plugin-samples", - "version": "0.1.0", + "version": "0.1.1", "description": "A set of sample (dummy) plugins for GitProxy to demonstrate how plugins are authored.", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/website/docs/development/plugins.mdx b/website/docs/development/plugins.mdx index 2f24d0bb6..11d04fdd0 100644 --- a/website/docs/development/plugins.mdx +++ b/website/docs/development/plugins.mdx @@ -32,7 +32,7 @@ The below instructions are using the [`@finos/git-proxy-plugin-samples`](https:/ 1. Install both `@finos/git-proxy` and the `@finos/git-proxy-plugin-samples` package to the local `node_modules/` directory using the following command: ```bash -$ npm install -g @finos/git-proxy@latest @finos/git-proxy-plugin-samples@0.1.0 +$ npm install -g @finos/git-proxy @finos/git-proxy-plugin-samples ``` Alternatively, you can create local packages from source and install those instead. @@ -40,9 +40,10 @@ Alternatively, you can create local packages from source and install those inste $ git clone https://github.com/finos/git-proxy $ cd git-proxy $ npm pack -$ npm install -g ./finos-git-proxy-1.3.5.tgz $ (cd plugins/git-proxy-plugin-samples && npm pack) -$ npm install -g plugins/git-proxy-plugin-samples/finos-git-proxy-plugin-samples-0.1.0.tgz +$ npm install -g \ + ./finos-git-proxy-1.7.0.tgz \ + ./plugins/git-proxy-plugin-samples/finos-git-proxy-plugin-samples-0.1.1.tgz ``` 2. Create or edit an existing `proxy.config.json` file to configure the plugin(s) to load. You must include the full import path that would typically be used in a `import {}` (ESM) or `require()` (CJS) statement: