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

[PURIFY] Removes remaining x-pack references and condition #210

Merged
merged 2 commits into from
Mar 22, 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
520 changes: 17 additions & 503 deletions .eslintrc.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ npm-debug.log*
.gradle

# apm plugin
/x-pack/plugins/apm/tsconfig.json
apm.tsconfig.json

## @cypress/snapshot from apm plugin that could be added by mistake
Expand Down
11 changes: 0 additions & 11 deletions .sass-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,6 @@ files:
- 'src/plugins/vis_type_vislib/**/*.s+(a|c)ss'
- 'src/plugins/vis_type_vega/**/*.s+(a|c)ss'
- 'src/plugins/vis_type_xy/**/*.s+(a|c)ss'
- 'x-pack/plugins/canvas/**/*.s+(a|c)ss'
- 'x-pack/plugins/triggers_actions_ui/**/*.s+(a|c)ss'
- 'x-pack/plugins/lens/**/*.s+(a|c)ss'
- 'x-pack/plugins/cross_cluster_replication/**/*.s+(a|c)ss'
- 'x-pack/legacy/plugins/maps/**/*.s+(a|c)ss'
- 'x-pack/plugins/maps/**/*.s+(a|c)ss'
- 'x-pack/plugins/spaces/**/*.s+(a|c)ss'
- 'x-pack/plugins/security/**/*.s+(a|c)ss'
- 'x-pack/plugins/monitoring/**/*.s+(a|c)ss'
ignore:
- 'x-pack/plugins/canvas/shareable_runtime/**/*.s+(a|c)ss'
rules:
quotes:
- 2
Expand Down
2 changes: 1 addition & 1 deletion TYPESCRIPT.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ If that happens, just pick the closest one.
If yarn doesn't find the module it may not have types. For example, our `rison_node` package doesn't have types. In this case you have a few options:

1. Contribute types into the DefinitelyTyped repo itself, or
2. Create a top level `types` folder and point to that in the tsconfig. For example, Infra team already handled this for `rison_node` and added: `x-pack/legacy/plugins/infra/types/rison_node.d.ts`. Other code uses it too so we will need to pull it up. Or,
2. Create a top level `types` folder and point to that in the tsconfig.
3. Add a `// @ts-ignore` line above the import. This should be used minimally, the above options are better. However, sometimes you have to resort to this method.

### TypeScripting react files
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@
"**/@types/*/**",
"**/grunt-*",
"**/grunt-*/**",
"x-pack/typescript",
"@elastic/eui/rehype-react",
"@elastic/eui/remark-rehype",
"@elastic/eui/remark-rehype/**"
Expand Down
4 changes: 0 additions & 4 deletions packages/elastic-eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ module.exports = {
to: false,
disallowedMessage: `Don't use idx(), use optional chaining syntax instead https://ela.st/optchain`
},
{
from: 'x-pack',
toRelative: 'x-pack',
},
{
from: 'react-router',
to: 'react-router-dom',
Expand Down
59 changes: 0 additions & 59 deletions packages/osd-config/src/env.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,29 +150,6 @@ test('correctly creates environment with constructor.', () => {
expect(env).toMatchSnapshot('env properties');
});

test('pluginSearchPaths contains x-pack plugins path if --oss flag is false', () => {
const env = new Env(
'/some/home/dir',
packageInfos,
getEnvOptions({
cliArgs: { oss: false },
})
);

expect(env.pluginSearchPaths).toContain('/some/home/dir/x-pack/plugins');
});

test('pluginSearchPaths does not contains x-pack plugins path if --oss flag is true', () => {
const env = new Env(
'/some/home/dir',
packageInfos,
getEnvOptions({
cliArgs: { oss: true },
})
);

expect(env.pluginSearchPaths).not.toContain('/some/home/dir/x-pack/plugins');
});

test('pluginSearchPaths contains examples plugins path if --run-examples flag is true', () => {
const env = new Env(
Expand All @@ -186,30 +163,6 @@ test('pluginSearchPaths contains examples plugins path if --run-examples flag is
expect(env.pluginSearchPaths).toContain('/some/home/dir/examples');
});

test('pluginSearchPaths contains x-pack/examples plugins path if --run-examples flag is true', () => {
const env = new Env(
'/some/home/dir',
packageInfos,
getEnvOptions({
cliArgs: { runExamples: true },
})
);

expect(env.pluginSearchPaths).toContain('/some/home/dir/x-pack/examples');
});

test('pluginSearchPaths does not contain x-pack/examples plugins path if --oss flag is true', () => {
const env = new Env(
'/some/home/dir',
packageInfos,
getEnvOptions({
cliArgs: { runExamples: true, oss: true },
})
);

expect(env.pluginSearchPaths).not.toContain('/some/home/dir/x-pack/examples');
});

test('pluginSearchPaths does not contains examples plugins path if --run-examples flag is false', () => {
const env = new Env(
'/some/home/dir',
Expand All @@ -221,15 +174,3 @@ test('pluginSearchPaths does not contains examples plugins path if --run-example

expect(env.pluginSearchPaths).not.toContain('/some/home/dir/examples');
});

test('pluginSearchPaths does not contains x-pack/examples plugins path if --run-examples flag is false', () => {
const env = new Env(
'/some/home/dir',
packageInfos,
getEnvOptions({
cliArgs: { runExamples: false },
})
);

expect(env.pluginSearchPaths).not.toContain('/some/home/dir/x-pack/examples');
});
4 changes: 0 additions & 4 deletions packages/osd-config/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,8 @@ export class Env {
*/
this.pluginSearchPaths = [
resolve(this.homeDir, 'src', 'plugins'),
...(options.cliArgs.oss ? [] : [resolve(this.homeDir, 'x-pack', 'plugins')]),
resolve(this.homeDir, 'plugins'),
...(options.cliArgs.runExamples ? [resolve(this.homeDir, 'examples')] : []),
...(options.cliArgs.runExamples && !options.cliArgs.oss
? [resolve(this.homeDir, 'x-pack', 'examples')]
: []),
resolve(this.homeDir, '..', 'opensearch-dashboards-extra'),
];

Expand Down
16 changes: 1 addition & 15 deletions packages/osd-dev-utils/src/plugin_list/generate_plugin_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function* printPlugins(plugins: Plugins, includes: string[]) {
}
}

export function generatePluginList(ossPlugins: Plugins, xpackPlugins: Plugins) {
export function generatePluginList(ossPlugins: Plugins) {
const includes: string[] = [];

return `////
Expand Down Expand Up @@ -76,20 +76,6 @@ NOTE:

${Array.from(printPlugins(ossPlugins, includes)).join('\n')}

|===

[discrete]
=== x-pack/plugins

[%header,cols=2*]
|===
|Name
|Description

${Array.from(printPlugins(xpackPlugins, includes)).join('\n')}

|===

${Array.from(includes).join('\n')}
`;
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { discoverPlugins } from './discover_plugins';
import { generatePluginList } from './generate_plugin_list';

const OSS_PLUGIN_DIR = Path.resolve(REPO_ROOT, 'src/plugins');
const XPACK_PLUGIN_DIR = Path.resolve(REPO_ROOT, 'x-pack/plugins');
const OUTPUT_PATH = Path.resolve(REPO_ROOT, 'docs/developer/plugin-list.asciidoc');

export function runPluginListCli() {
Expand All @@ -35,11 +34,7 @@ export function runPluginListCli() {
const ossPlugins = discoverPlugins(OSS_PLUGIN_DIR);
log.success(`found ${ossPlugins.length} plugins`);

log.info('looking for x-pack plugins');
const xpackPlugins = discoverPlugins(XPACK_PLUGIN_DIR);
log.success(`found ${xpackPlugins.length} plugins`);

log.info('writing plugin list to', OUTPUT_PATH);
Fs.writeFileSync(OUTPUT_PATH, generatePluginList(ossPlugins, xpackPlugins));
Fs.writeFileSync(OUTPUT_PATH, generatePluginList(ossPlugins));
});
}
2 changes: 1 addition & 1 deletion packages/osd-i18n/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ For example:
src/legacy/core_plugins/opensearch-dashboards/translations/fr.json
```

The engine scans `x-pack/legacy/plugins/*/translations`, `src/core_plugins/*/translations`, `plugins/*/translations` and `src/legacy/ui/translations` folders on initialization, so there is no need to register translation files.
The engine scans `src/core_plugins/*/translations`, `plugins/*/translations` and `src/legacy/ui/translations` folders on initialization, so there is no need to register translation files.

The engine uses a `config/opensearch_dashboards.yml` file for locale resolution process. If locale is
defined via `i18n.locale` option in `config/opensearch_dashboards.yml` then it will be used as a base
Expand Down

This file was deleted.

8 changes: 0 additions & 8 deletions packages/osd-plugin-generator/src/ask_questions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@ export const INTERNAL_PLUGIN_LOCATIONS: Array<{ name: string; value: string }> =
name: 'OpenSearch Dashboards OSS Functional Testing',
value: Path.resolve(REPO_ROOT, 'test/plugin_functional/plugins'),
},
{
name: 'X-Pack',
value: Path.resolve(REPO_ROOT, 'x-pack/plugins'),
},
{
name: 'X-Pack Functional Testing',
value: Path.resolve(REPO_ROOT, 'x-pack/test/plugin_functional/plugins'),
},
];

export const QUESTIONS = [
Expand Down
11 changes: 0 additions & 11 deletions packages/osd-plugin-generator/src/plugin_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,4 @@ export const PLUGIN_TYPE_OPTIONS: Array<{ name: string; value: PluginType }> = [
installDir: Path.resolve(REPO_ROOT, 'test/plugin_functional/plugins'),
},
},
{
name: 'X-Pack',
value: { thirdParty: false, installDir: Path.resolve(REPO_ROOT, 'x-pack/plugins') },
},
{
name: 'X-Pack Functional Testing',
value: {
thirdParty: false,
installDir: Path.resolve(REPO_ROOT, 'x-pack/test/plugin_functional/plugins'),
},
},
];
8 changes: 3 additions & 5 deletions packages/osd-pm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To run `@osd/pm`, go to OpenSearch Dashboards root and run `yarn osd`.
Long-term we want to get rid of Webpack from production (basically, it's causing
a lot of problems, using a lot of memory and adding a lot of complexity).
Ideally we want each plugin to build its own separate production bundles for
both server and UI. To get there all OpenSearch Dashboards plugins (including x-pack) need to
both server and UI. To get there all OpenSearch Dashboards plugins need to
be able to build their production bundles separately from OpenSearch Dashboards , which means
they need to be able to depend on code from OpenSearch Dashboards without `import`-ing random
files directly from the OpenSearch Dashboards source code.
Expand Down Expand Up @@ -54,8 +54,7 @@ scripts, while still having a nice developer experience.

### Internal usage

For packages that are referenced within the OpenSearch Dashboards repo itself (for example,
using the `@osd/i18n` package from an `x-pack` plugin), we are leveraging
For packages that are referenced within the OpenSearch Dashboards repo itself, we are leveraging
Yarn's workspaces feature. This allows yarn to optimize node_modules within
the entire repo to avoid duplicate modules by hoisting common packages as high
in the dependency tree as possible.
Expand Down Expand Up @@ -96,8 +95,7 @@ that looks like this:
opensearch
└── opensearch-dashboards
└── plugins
├── opensearch-dashboards-canvas
└── x-pack-opensearch-dashboards
├── opensearch-dashboards-example
```

Relying on `link:` style dependencies means we no longer need to `npm publish`
Expand Down
5 changes: 2 additions & 3 deletions packages/osd-pm/src/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To run `@osd/pm`, go to OpenSearch Dashboards root and run `yarn osd`.
Long-term we want to get rid of Webpack from production (basically, it's causing
a lot of problems, using a lot of memory and adding a lot of complexity).
Ideally we want each plugin to build its own separate production bundles for
both server and UI. To get there all OpenSearch Dashboards plugins (including x-pack) need to
both server and UI. To get there all OpenSearch Dashboards plugins need to
be able to build their production bundles separately from OpenSearch Dashboards , which means
they need to be able to depend on code from OpenSearch Dashboards without `import`-ing random
files directly from the OpenSearch Dashboards source code.
Expand Down Expand Up @@ -96,8 +96,7 @@ that looks like this:
opensearch
└── opensearch-dashboards
└── plugins
├── opensearch-dashboards-canvas
└── x-pack-opensearch-dashboards
├── opensearch-dashboards-example
```

Relying on `link:` style dependencies means we no longer need to `npm publish`
Expand Down
7 changes: 0 additions & 7 deletions packages/osd-pm/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,6 @@ export function getProjectPaths({ rootPath, ossOnly, skipOpenSearchDashboardsPlu
projectPaths.push(resolve(rootPath, 'test/interpreter_functional/plugins/*'));
projectPaths.push(resolve(rootPath, 'examples/*'));

if (!ossOnly) {
projectPaths.push(resolve(rootPath, 'x-pack'));
projectPaths.push(resolve(rootPath, 'x-pack/plugins/*'));
projectPaths.push(resolve(rootPath, 'x-pack/legacy/plugins/*'));
projectPaths.push(resolve(rootPath, 'x-pack/test/functional_with_es_ssl/fixtures/plugins/*'));
}

if (!skipOpenSearchDashboardsPlugins) {
projectPaths.push(resolve(rootPath, '../opensearch-dashboards-extra/*'));
projectPaths.push(resolve(rootPath, '../opensearch-dashboards-extra/*/packages/*'));
Expand Down
4 changes: 0 additions & 4 deletions packages/osd-pm/src/production/build_production_projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@ async function getProductionProjects(rootPath: string, onlyOSS?: boolean) {
const projects = await getProjects(rootPath, projectPaths);
const projectsSubset = [projects.get('opensearch-dashboards')!];

if (projects.has('x-pack')) {
projectsSubset.push(projects.get('x-pack')!);
}

const productionProjects = includeTransitiveProjects(projectsSubset, projects, {
onlyProductionDependencies: true,
});
Expand Down
2 changes: 0 additions & 2 deletions packages/osd-spec-to-console/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ At the root of the OpenSearch Dashboards repository, run the following commands:
# OSS
yarn spec_to_console -g "<OPENSEARCH-REPO-FOLDER>/rest-api-spec/src/main/resources/rest-api-spec/api/*" -d "src/plugins/console/server/lib/spec_definitions/json/generated"

# X-pack
yarn spec_to_console -g "<OPENSEARCH-REPO-FOLDER>/x-pack/plugin/src/test/resources/rest-api-spec/api/*" -d "x-pack/plugins/console_extensions/server/lib/spec_definitions/json/generated"
```

### Information used in Console that is not available in the REST spec
Expand Down
2 changes: 1 addition & 1 deletion packages/osd-telemetry-tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Description

The tool is used to extract telemetry collectors schema from all `*.{ts}` files in provided plugins directories to JSON files. The tool looks for `.telemetryrc.json` files in the root of the project and in the `x-pack` dir for its runtime configurations.
The tool is used to extract telemetry collectors schema from all `*.{ts}` files in provided plugins directories to JSON files. The tool looks for `.telemetryrc.json` files in the root of the project.

It uses typescript parser to build an AST for each file. The tool is able to validate, extract and match collector schemas.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,7 @@ const { REPO_ROOT } = require('@osd/dev-utils');
// compile the required source with babel
require('@babel/register')({
ignore: [/[\/\\](node_modules|target|dist)[\/\\]/],
only: [
Path.resolve(REPO_ROOT, 'test'),
Path.resolve(REPO_ROOT, 'x-pack/test'),
Path.resolve(REPO_ROOT, 'examples'),
Path.resolve(REPO_ROOT, 'x-pack/examples'),
// TODO: should should probably remove this link back to the source
Path.resolve(REPO_ROOT, 'x-pack/plugins/task_manager/server/config.ts'),
],
only: [Path.resolve(REPO_ROOT, 'test'), Path.resolve(REPO_ROOT, 'examples')],
babelrc: false,
presets: [require.resolve('@osd/babel-preset/node_preset')],
extensions: ['.js', '.ts', '.tsx'],
Expand Down
2 changes: 0 additions & 2 deletions renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
],
includePaths: [
'package.json',
'x-pack/package.json',
'x-pack/legacy/plugins/*/package.json',
'packages/*/package.json',
'examples/*/package.json',
'test/plugin_functional/plugins/*/package.json',
Expand Down
10 changes: 0 additions & 10 deletions src/cli/cluster/cluster_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,16 +226,6 @@ export class ClusterManager {
/\.md$/,
/debug\.log$/,
...pluginInternalDirsIgnore,
fromRoot('x-pack/plugins/reporting/chromium'),
fromRoot('x-pack/plugins/security_solution/cypress'),
fromRoot('x-pack/plugins/apm/e2e'),
fromRoot('x-pack/plugins/apm/scripts'),
fromRoot('x-pack/plugins/canvas/canvas_plugin_src'), // prevents server from restarting twice for Canvas plugin changes,
fromRoot('x-pack/plugins/case/server/scripts'),
fromRoot('x-pack/plugins/lists/scripts'),
fromRoot('x-pack/plugins/lists/server/scripts'),
fromRoot('x-pack/plugins/security_solution/scripts'),
fromRoot('x-pack/plugins/security_solution/server/lib/detection_engine/scripts'),
];

this.watcher = chokidar.watch(watchPaths, {
Expand Down
Loading