From 0a25cfd58f7c8f73d55c9cd8e79fd3f7e3500399 Mon Sep 17 00:00:00 2001 From: Jonathan Cammisuli Date: Fri, 6 Mar 2020 15:05:46 -0500 Subject: [PATCH] docs(docs): update nx plugin docs with info on how to submit plugin This also includes a `submit-plugin` utility that will automatically open the browser with the correct PR template --- docs/shared/nx-plugin.md | 8 +++++++- package.json | 3 ++- scripts/submit-plugin.js | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 scripts/submit-plugin.js diff --git a/docs/shared/nx-plugin.md b/docs/shared/nx-plugin.md index 880d7c18da..a64cbf3089 100644 --- a/docs/shared/nx-plugin.md +++ b/docs/shared/nx-plugin.md @@ -253,4 +253,10 @@ After that, you can then install your plugin like any other npm package, ### Listing your Nx Plugin -If you would like your plugin to be included with the `nx list` command, open up an issue on the [Nrwl/nx repo](https://github.com/nrwl/nx/issues/new) and let's discuss! +Nx provides a utility (`nx list`) that lists all approved plugins. + +To add your plugin modify the `community/approved-plugins.json` file in the [Nrwl/nx](https://github.com/nrwl/nx/blob/master/community/approved-plugins.json) repo and create a pull request with `yarn submit-plugin`. + +The `yarn submit-plugin` command automatically opens the Github pull request process with the correct template. + +We will then verify the plugin, offer suggestions or merge the pull request! diff --git a/package.json b/package.json index 5198e86b5c..0297cf8991 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,8 @@ "checkimports": "node ./scripts/check-imports.js", "checkversions": "ts-node ./scripts/check-versions.ts", "local-registry": "./scripts/local-registry.sh", - "documentation": "./scripts/documentation/documentation.sh && ./scripts/documentation/check-documentation.sh" + "documentation": "./scripts/documentation/documentation.sh && ./scripts/documentation/check-documentation.sh", + "submit-plugin": "node ./scripts/submit-plugin.js" }, "devDependencies": { "@angular-devkit/architect": "~0.900.1", diff --git a/scripts/submit-plugin.js b/scripts/submit-plugin.js new file mode 100644 index 0000000000..79f3c48c67 --- /dev/null +++ b/scripts/submit-plugin.js @@ -0,0 +1,18 @@ +const open = require('open'); +const childProcess = require('child_process'); + +function createPullRequest() { + const remoteUrl = childProcess + .execSync(`git ls-remote --get-url origin`) + .toString('utf-8') + .trim(); + const remoteName = remoteUrl.match(/[\/|:](\w+?)\//)[1]; + const branchName = childProcess + .execSync('git rev-parse --abbrev-ref HEAD') + .toString('utf-8') + .trim(); + const prUrl = `https://github.com/nrwl/nx/compare/master...${remoteName}:${branchName}?expand=1&template=COMMUNITY_PLUGIN.md`; + open(prUrl); +} + +createPullRequest();