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

Enable using globally installed plugins #1930

Merged
merged 1 commit into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"parse-author": "^2.0.0",
"parse-github-url": "1.0.2",
"pretty-ms": "^7.0.0",
"requireg": "^0.2.2",
"semver": "^7.0.0",
"signale": "^1.4.0",
"tapable": "^2.0.0-beta.2",
Expand Down
5 changes: 3 additions & 2 deletions packages/core/src/utils/try-require.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import importCwd from "import-cwd";
import requireg from "requireg";
import importFrom from "import-from";
import createLog from "./logger";

Expand All @@ -22,8 +23,8 @@ export default function tryRequire(tryPath: string, from?: string) {
}

try {
// Require from __dirname. Needed for npx and global installs
return require(tryPath);
// Require from __dirname and then common global package places. Needed for npx and global installs
return requireg(tryPath);
} catch (error) {
logger.veryVerbose.warn(error.message);
}
Expand Down
2 changes: 2 additions & 0 deletions scripts/jest-setup.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
require("mock-fs");

jest.mock('requireg', () => require);
5 changes: 5 additions & 0 deletions typings/requireg.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare module "requireg" {
function requireg(path: string, onlyGlobal?: boolean): void;

export default requireg;
}
35 changes: 28 additions & 7 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
integrity sha512-TYiuOxy5Pf9ORn94X/ujl7PY9opIh+l6NzRAV8EBLpIv3IC9gmEoev4wmmyP7Q33J0/nGjqxAaZcq/n2SZrYaQ==

"@auto-it/bot-list@link:packages/bot-list":
version "10.21.2"
version "10.23.0"

"@auto-it/core@link:packages/core":
version "10.21.2"
version "10.23.0"
dependencies:
"@auto-it/bot-list" "link:packages/bot-list"
"@endemolshinegroup/cosmiconfig-typescript-loader" "^3.0.2"
Expand Down Expand Up @@ -114,7 +114,7 @@
url-join "^4.0.0"

"@auto-it/npm@link:plugins/npm":
version "10.21.2"
version "10.23.0"
dependencies:
"@auto-it/core" "link:packages/core"
"@auto-it/package-json-utils" "link:packages/package-json-utils"
Expand All @@ -132,13 +132,13 @@
user-home "^2.0.0"

"@auto-it/package-json-utils@link:packages/package-json-utils":
version "10.21.2"
version "10.23.0"
dependencies:
parse-author "^2.0.0"
parse-github-url "1.0.2"

"@auto-it/released@link:plugins/released":
version "10.21.2"
version "10.23.0"
dependencies:
"@auto-it/bot-list" "link:packages/bot-list"
"@auto-it/core" "link:packages/core"
Expand Down Expand Up @@ -10823,6 +10823,11 @@ neo-async@^2.6.2:
resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==

nested-error-stacks@~2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/nested-error-stacks/-/nested-error-stacks-2.0.1.tgz#d2cc9fc5235ddb371fc44d506234339c8e4b0a4b"
integrity sha512-SrQrok4CATudVzBS7coSz26QRSmlK9TzzoFbeKfcPBUFPjcQM9Rqvr/DlJkOrwI/0KcgvMub1n1g5Jt9EgRn4A==

next-ignite@^0.10.11:
version "0.10.11"
resolved "https://registry.yarnpkg.com/next-ignite/-/next-ignite-0.10.11.tgz#a122a776604c861eb6efe6b8589532ad77e56967"
Expand Down Expand Up @@ -11883,7 +11888,7 @@ path-key@^3.0.0, path-key@^3.1.0:
resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.0.tgz#99a10d870a803bdd5ee6f0470e58dfcd2f9a54d3"
integrity sha512-8cChqz0RP6SHJkMt48FW0A7+qUOn+OsnOsVtzI59tZ8m+5bCSk7hzwET0pulwOM2YMn9J1efb07KB9l9f30SGg==

path-parse@^1.0.6:
path-parse@^1.0.5, path-parse@^1.0.6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c"
integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==
Expand Down Expand Up @@ -12651,7 +12656,7 @@ raw-body@2.4.1:
iconv-lite "0.4.24"
unpipe "1.0.0"

rc@^1.2.7, rc@^1.2.8:
rc@^1.2.7, rc@^1.2.8, rc@~1.2.7:
version "1.2.8"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"
integrity sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==
Expand Down Expand Up @@ -13266,6 +13271,15 @@ require-main-filename@^2.0.0:
resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b"
integrity sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==

requireg@^0.2.2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/requireg/-/requireg-0.2.2.tgz#437e77a5316a54c9bcdbbf5d1f755fe093089830"
integrity sha512-nYzyjnFcPNGR3lx9lwPPPnuQxv6JWEZd2Ci0u9opN7N5zUEPIhY/GbL3vMGOr2UXwEg9WwSyV9X9Y/kLFgPsOg==
dependencies:
nested-error-stacks "~2.0.1"
rc "~1.2.7"
resolve "~1.7.1"

resize-observer-polyfill@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464"
Expand Down Expand Up @@ -13342,6 +13356,13 @@ resolve@^1.18.1, resolve@^1.19.0:
is-core-module "^2.1.0"
path-parse "^1.0.6"

resolve@~1.7.1:
version "1.7.1"
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.7.1.tgz#aadd656374fd298aee895bc026b8297418677fd3"
integrity sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==
dependencies:
path-parse "^1.0.5"

responselike@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/responselike/-/responselike-2.0.0.tgz#26391bcc3174f750f9a79eacc40a12a5c42d7723"
Expand Down