From 0e55b248d37ada7fbd751e2d4bfd3e8b4d411ae8 Mon Sep 17 00:00:00 2001 From: Brandon Kobel Date: Wed, 20 May 2020 12:11:02 -0700 Subject: [PATCH] Revert "Integration of a static filesystem for the node_modules (#47998)" (#67124) This reverts commit 33376fc368116f5a42278a231c28f4d8862a758d. --- package.json | 1 - scripts/kibana.js | 2 +- src/cli/index.js | 2 +- src/dev/build/build_distributables.js | 2 - ...create_static_fs_with_node_modules_task.js | 64 ------------------- src/dev/build/tasks/index.js | 1 - yarn.lock | 5 -- 7 files changed, 2 insertions(+), 75 deletions(-) delete mode 100644 src/dev/build/tasks/create_static_fs_with_node_modules_task.js diff --git a/package.json b/package.json index 7ff3ea6dc35545..634720d6d3a2f4 100644 --- a/package.json +++ b/package.json @@ -298,7 +298,6 @@ "@elastic/eslint-plugin-eui": "0.0.2", "@elastic/github-checks-reporter": "0.0.20b3", "@elastic/makelogs": "^5.0.1", - "@elastic/static-fs": "1.0.2", "@kbn/dev-utils": "1.0.0", "@kbn/es": "1.0.0", "@kbn/eslint-import-resolver-kibana": "2.0.0", diff --git a/scripts/kibana.js b/scripts/kibana.js index 4da739469ffb1a..f5a63e6c07dd60 100644 --- a/scripts/kibana.js +++ b/scripts/kibana.js @@ -17,6 +17,6 @@ * under the License. */ -require('../src/setup_node_env'); require('../src/apm')(process.env.ELASTIC_APM_PROXY_SERVICE_NAME || 'kibana-proxy'); +require('../src/setup_node_env'); require('../src/cli/cli'); diff --git a/src/cli/index.js b/src/cli/index.js index 6dbdd800268a9b..45f88eaf82a5b8 100644 --- a/src/cli/index.js +++ b/src/cli/index.js @@ -17,6 +17,6 @@ * under the License. */ -require('../setup_node_env'); require('../apm')(); +require('../setup_node_env'); require('./cli'); diff --git a/src/dev/build/build_distributables.js b/src/dev/build/build_distributables.js index 910313ac870598..6c2efeebc60c32 100644 --- a/src/dev/build/build_distributables.js +++ b/src/dev/build/build_distributables.js @@ -40,7 +40,6 @@ import { CreatePackageJsonTask, CreateReadmeTask, CreateRpmPackageTask, - CreateStaticFsWithNodeModulesTask, DownloadNodeBuildsTask, ExtractNodeBuildsTask, InstallDependenciesTask, @@ -127,7 +126,6 @@ export async function buildDistributables(options) { await run(CleanTypescriptTask); await run(CleanExtraFilesFromModulesTask); await run(CleanEmptyFoldersTask); - await run(CreateStaticFsWithNodeModulesTask); /** * copy generic build outputs into platform-specific build diff --git a/src/dev/build/tasks/create_static_fs_with_node_modules_task.js b/src/dev/build/tasks/create_static_fs_with_node_modules_task.js deleted file mode 100644 index 0ab296fc5c1639..00000000000000 --- a/src/dev/build/tasks/create_static_fs_with_node_modules_task.js +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -import del from 'del'; -import globby from 'globby'; -import { resolve } from 'path'; -import { generateStaticFsVolume } from '@elastic/static-fs'; - -async function deletePathsList(list) { - for (const path of list) { - await del(path); - } -} - -async function getTopLevelNodeModulesFolders(rootDir) { - const nodeModulesFoldersForCwd = await globby(['**/node_modules', '!**/node_modules/**/*'], { - cwd: rootDir, - onlyDirectories: true, - }); - - return nodeModulesFoldersForCwd.map(folder => resolve(rootDir, folder)); -} - -export const CreateStaticFsWithNodeModulesTask = { - description: - 'Creating static filesystem with node_modules, patching entryPoints and deleting node_modules folder', - - async run(config, log, build) { - const rootDir = build.resolvePath('.'); - - // Get all the top node_modules folders - const nodeModulesFolders = await getTopLevelNodeModulesFolders(rootDir); - - // Define root entry points - const rootEntryPoints = [build.resolvePath('src/setup_node_env/index.js')]; - - // Creates the static filesystem with - // every node_module we have - const staticFsAddedPaths = await generateStaticFsVolume( - rootDir, - nodeModulesFolders, - rootEntryPoints - ); - - // Delete node_modules folder - await deletePathsList(staticFsAddedPaths); - }, -}; diff --git a/src/dev/build/tasks/index.js b/src/dev/build/tasks/index.js index 0232ac4b1b5f37..8105fa8a7d5d47 100644 --- a/src/dev/build/tasks/index.js +++ b/src/dev/build/tasks/index.js @@ -25,7 +25,6 @@ export * from './create_archives_task'; export * from './create_empty_dirs_and_files_task'; export * from './create_package_json_task'; export * from './create_readme_task'; -export * from './create_static_fs_with_node_modules_task'; export * from './install_dependencies_task'; export * from './license_file_task'; export * from './nodejs'; diff --git a/yarn.lock b/yarn.lock index b5b093f779cdea..278649a971a943 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1427,11 +1427,6 @@ "@types/node-jose" "1.1.0" node-jose "1.1.0" -"@elastic/static-fs@1.0.2": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@elastic/static-fs/-/static-fs-1.0.2.tgz#c1e5fea6a1b35abcd005cecf7880156ed0f273ae" - integrity sha512-0cZc5D9Wg6pJsc8Sa2ns1eOuxtXEidE7GBb2B0KZdJq9nZzUCxMyplURqT0Nr3i5XpoHb6ZEmxWsji86j1KjDw== - "@elastic/ui-ace@0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@elastic/ui-ace/-/ui-ace-0.2.3.tgz#5281aed47a79b7216c55542b0675e435692f20cd"