Repository: netlify/build
Pull request #1588 (2020-06-26 19:00:14)

Remove deprecation warning about `@netlify/plugin-local-install-core`
After GA, we've been printed a warning for users who had not been migrating to using `@netlify/plugin-local-install-core` (when needed). According to Humio, users have now migrated, so this can be removed.


Patch:
diff --git a/packages/build/src/install/local.js b/packages/build/src/install/local.js
index 1caa9d696..e39a620e1 100644
--- a/packages/build/src/install/local.js
+++ b/packages/build/src/install/local.js
@@ -1,12 +1,18 @@
 const pkgDir = require('pkg-dir')
 
-const { addErrorInfo } = require('../error/info')
 const { logInstallLocalPluginsDeps } = require('../log/main')
 
 const { installDependencies } = require('./main')
 
 // Install dependencies of local plugins.
+// Users must add this plugin to their `netlify.toml` `plugins` to use this
+// feature. We don't want to provide it by default because this makes build
+// slow and buggy.
 const installLocalPluginsDependencies = async function({ plugins, pluginsOptions, buildDir, mode, logs }) {
+  if (!plugins.some(isLocalInstallOptIn)) {
+    return
+  }
+
   const localPluginsOptions = getLocalPluginsOptions(pluginsOptions)
   if (localPluginsOptions.length === 0) {
     return
@@ -17,8 +23,6 @@ const installLocalPluginsDependencies = async function({ plugins, pluginsOptions
     return
   }
 
-  checkLocalPluginsInstall(plugins)
-
   logInstallLocalPluginsDeps(logs, localPluginsOptionsA)
   await Promise.all(
     localPluginsOptionsA.map(({ packageDir }) =>
@@ -27,24 +31,6 @@ const installLocalPluginsDependencies = async function({ plugins, pluginsOptions
   )
 }
 
-// Users must add this plugin to their `netlify.toml` `plugins` to use this
-// feature. We don't want to provide it by default because this makes build
-// slow and buggy.
-// TODO: remove once users all added this plugin to their `netlify.toml`
-const checkLocalPluginsInstall = function(plugins) {
-  if (plugins.some(isLocalInstallOptIn)) {
-    return
-  }
-
-  const error = new Error(`Please use the plugin "@netlify/plugin-local-install-core" to install dependencies from the "package.json" inside your local plugins.
-Example "netlify.toml":
-
-  [[plugins]]
-  package = "@netlify/plugin-local-install-core"`)
-  addErrorInfo(error, { type: 'resolveConfig' })
-  throw error
-}
-
 const isLocalInstallOptIn = function({ package }) {
   return package === LOCAL_INSTALL_NAME
 }


Test patch:
diff --git a/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/index.js b/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/index.js
deleted file mode 100644
index 59367cef6..000000000
--- a/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/index.js
+++ /dev/null
@@ -1,13 +0,0 @@
-'use strict';
-module.exports = function (x) {
-	x = Array.isArray(x) ? x : arguments;
-
-	var sum = 0;
-	var len = x.length;
-
-	for (var i = 0; i < len; i++) {
-		sum += x[i];
-	}
-
-	return sum / len;
-};
diff --git a/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/license b/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/license
deleted file mode 100644
index 654d0bfe9..000000000
--- a/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/license
+++ /dev/null
@@ -1,21 +0,0 @@
-The MIT License (MIT)
-
-Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/package.json b/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/package.json
deleted file mode 100644
index b1935539c..000000000
--- a/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/package.json
+++ /dev/null
@@ -1,70 +0,0 @@
-{
-  "_args": [
-    [
-      "math-avg@1.0.0",
-      "/home/ether/netlify/build/packages/build/tests/install/local/fixtures/missing/plugin"
-    ]
-  ],
-  "_from": "math-avg@1.0.0",
-  "_id": "math-avg@1.0.0",
-  "_inBundle": false,
-  "_integrity": "sha1-p40xxYsrlRB41REkRA99gbbNhGA=",
-  "_location": "/math-avg",
-  "_phantomChildren": {},
-  "_requested": {
-    "type": "version",
-    "registry": true,
-    "raw": "math-avg@1.0.0",
-    "name": "math-avg",
-    "escapedName": "math-avg",
-    "rawSpec": "1.0.0",
-    "saveSpec": null,
-    "fetchSpec": "1.0.0"
-  },
-  "_requiredBy": [
-    "/"
-  ],
-  "_resolved": "https://registry.npmjs.org/math-avg/-/math-avg-1.0.0.tgz",
-  "_spec": "1.0.0",
-  "_where": "/home/ether/netlify/build/packages/build/tests/install/local/fixtures/missing/plugin",
-  "author": {
-    "name": "Sindre Sorhus",
-    "email": "sindresorhus@gmail.com",
-    "url": "sindresorhus.com"
-  },
-  "bugs": {
-    "url": "https://github.com/sindresorhus/math-avg/issues"
-  },
-  "description": "Get the average of numbers",
-  "devDependencies": {
-    "ava": "0.0.4"
-  },
-  "engines": {
-    "node": ">=0.10.0"
-  },
-  "files": [
-    "index.js"
-  ],
-  "homepage": "https://github.com/sindresorhus/math-avg#readme",
-  "keywords": [
-    "math",
-    "avg",
-    "average",
-    "number",
-    "numbers",
-    "num",
-    "add",
-    "count",
-    "array"
-  ],
-  "license": "MIT",
-  "name": "math-avg",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/sindresorhus/math-avg.git"
-  },
-  "scripts": {
-    "test": "node test.js"
-  },
-  "version": "1.0.0"
-}
diff --git a/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/readme.md b/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/readme.md
deleted file mode 100644
index d8a943c6c..000000000
--- a/packages/build/tests/install/fixtures/local_missing/plugin/node_modules/math-avg/readme.md
+++ /dev/null
@@ -1,33 +0,0 @@
-# math-avg [![Build Status](https://travis-ci.org/sindresorhus/math-avg.svg?branch=master)](https://travis-ci.org/sindresorhus/math-avg)
-
-> Get the average of numbers
-
-
-## Install
-
-```
-$ npm install --save math-avg
-```
-
-
-## Usage
-
-```js
-var mathAvg = require('math-avg');
-
-mathAvg(1, 3);
-//=> 2
-
-mathAvg([1, 3]);
-//=> 2
-```
-
-
-## Related
-
-- [math-sum](https://github.com/sindresorhus/math-sum) - Sum numbers
-
-
-## License
-
-MIT © [Sindre Sorhus](http://sindresorhus.com)
diff --git a/packages/build/tests/install/snapshots/tests.js.md b/packages/build/tests/install/snapshots/tests.js.md
index c4438ecb1..19f465370 100644
--- a/packages/build/tests/install/snapshots/tests.js.md
+++ b/packages/build/tests/install/snapshots/tests.js.md
@@ -723,16 +723,29 @@ Generated by [AVA](https://ava.li).
     > Context␊
       production␊
     ␊
-    ┌─────────────────────────────┐␊
-    │     Configuration error     │␊
-    └─────────────────────────────┘␊
+    > Loading plugins␊
+       - /file/path from netlify.toml␊
+    ␊
+    ┌──────────────────────────────────────────┐␊
+    │ Plugin "/file/path" internal error │␊
+    └──────────────────────────────────────────┘␊
     ␊
       Error message␊
-      Please use the plugin "@netlify/plugin-local-install-core" to install dependencies from the "package.json" inside your local plugins.␊
-      Example "netlify.toml":␊
+      Error: Could not import plugin:␊
+    ␊
     ␊
-        [[plugins]]␊
-        package = "@netlify/plugin-local-install-core"␊
+      Plugin details␊
+      Package:        /file/path␊
+      Version:        1.0.0␊
+      Repository:     test␊
+      npm link:       https://www.npmjs.com/package/plugin_deps_plugin␊
+    ␊
+      Error location␊
+      While loading "/file/path" from netlify.toml␊
+    STACK TRACE␊
+    ␊
+      Error properties␊
+      { code: 'MODULE_NOT_FOUND' }␊
     ␊
       Resolved config␊
       plugins:␊