Skip to content

Commit

Permalink
fix: ERR_MODULE_NOT_FOUND when sample plugins ran
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
coopernetes committed Dec 1, 2024
1 parent a8f5677 commit a68802c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 34 deletions.
18 changes: 0 additions & 18 deletions packages/git-proxy-notify-hello/package.json

This file was deleted.

10 changes: 0 additions & 10 deletions plugins/README.md

This file was deleted.

14 changes: 14 additions & 0 deletions plugins/git-proxy-plugin-samples/README.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 2 additions & 2 deletions plugins/git-proxy-plugin-samples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion plugins/git-proxy-plugin-samples/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 4 additions & 3 deletions website/docs/development/plugins.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@ 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.
```bash
$ 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:
Expand Down

0 comments on commit a68802c

Please sign in to comment.