Skip to content

Commit

Permalink
Renamed items to osd-ace
Browse files Browse the repository at this point in the history
Signed-off-by: Kawika Avilla <kavilla414@gmail.com>
  • Loading branch information
kavilla committed Mar 3, 2021
1 parent 93327d2 commit 876edf8
Show file tree
Hide file tree
Showing 17 changed files with 23 additions and 23 deletions.
30 changes: 15 additions & 15 deletions packages/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Kibana-related packages
# OpenSearch Dashboards-related packages

This folder contains packages that are intended for use in Kibana and Kibana
This folder contains packages that are intended for use in OpenSearch Dashboards and OpenSearch Dashboards
plugins.

tl;dr:

- Don't publish to npm registry
- Always use the `@kbn` namespace
- Always use the `@osd` namespace
- Always set `"private": true` in `package.json`

## Using these packages
Expand All @@ -15,31 +15,31 @@ We no longer publish these packages to the npm registry. Now, instead of
specifying a version when including these packages, we rely on yarn workspaces,
which sets up a symlink to the package.

For example if you want to use the `@kbn/i18n` package in Kibana itself, you
For example if you want to use the `@osd/i18n` package in OpenSearch Dashboards itself, you
can specify the dependency like this:

```
"@kbn/i18n": "1.0.0"
"@osd/i18n": "1.0.0"
```

However, if you want to use this from a Kibana plugin, you need to use a `link:`
dependency and account for the relative location of the Kibana repo, so it would
However, if you want to use this from a OpenSearch Dashboards plugin, you need to use a `link:`
dependency and account for the relative location of the OpenSearch Dashboards repo, so it would
instead be:

```
"@kbn/i18n": "link:../../kibana/packages/kbn-i18n"
"@osd/i18n": "link:../../opensearch-dashboards/packages/osd-i18n"
```

How all of this works is described in more detail in the
[`@kbn/pm` docs](./kbn-pm#how-it-works).
[`@osd/pm` docs](./osd-pm#how-it-works).

## Creating a new package

Create a new sub-folder. The name of the folder should mirror the `name` in the
package's `package.json`. E.g. if the name is `@kbn/i18n` the folder name
should be `kbn-i18n`.
package's `package.json`. E.g. if the name is `@osd/i18n` the folder name
should be `osd-i18n`.

All new packages should use the `@kbn` namespace, and should be marked with
All new packages should use the `@osd` namespace, and should be marked with
`"private": true`.

## Unit tests for a package
Expand All @@ -49,18 +49,18 @@ Currently there are two patterns used to test packages, one using Mocha and one
### 1. Mocha
Today a package can follow the pattern of having a `__tests__` directory in each source code directory of a package which contains the tests for that module. These are usually run by Mocha.

If a package's tests should be run with Mocha, you'll have to opt-in to run them by appending the package's test file pattern(s) to Kibana's `src/dev/mocha/run_mocha_cli.js` file. These will then be run by the unit test runner.
If a package's tests should be run with Mocha, you'll have to opt-in to run them by appending the package's test file pattern(s) to OpenSearch Dashboards' `src/dev/mocha/run_mocha_cli.js` file. These will then be run by the unit test runner.

* `yarn test` or `yarn grunt test` runs all unit tests.
* `node scripts/mocha` runs all Mocha tests.

### 2. Jest
A package can also follow the pattern of having `.test.js` files as siblings of the source code files, and these run by Jest.

A package using the `.test.js` naming convention will have those tests automatically picked up by Jest and run by the unit test runner, currently mapped to the Kibana `test` script in the root `package.json`.
A package using the `.test.js` naming convention will have those tests automatically picked up by Jest and run by the unit test runner, currently mapped to the OpenSearch Dashboards `test` script in the root `package.json`.

* `yarn test` or `yarn grunt test` runs all unit tests.
* `node scripts/jest` runs all Jest tests in Kibana.
* `node scripts/jest` runs all Jest tests in OpenSearch Dashboards.

----
Each package can also specify its own `test` script in the package's `package.json`, for cases where you'd prefer to run the tests from the local package directory.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

export {
ElasticsearchSqlHighlightRules,
OpenSearchSqlHighlightRules,
ScriptHighlightRules,
XJsonHighlightRules,
addXJsonToRules,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* under the License.
*/

export { ElasticsearchSqlHighlightRules } from './elasticsearch_sql_highlight_rules';
export { OpenSearchSqlHighlightRules } from './opensearch_sql_highlight_rules';
export { ScriptHighlightRules } from './script_highlight_rules';
export { XJsonHighlightRules, addToRules as addXJsonToRules } from './x_json_highlight_rules';
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import ace from 'brace';
const { TextHighlightRules } = ace.acequire('ace/mode/text_highlight_rules');
const oop = ace.acequire('ace/lib/oop');

export const ElasticsearchSqlHighlightRules = function (this: any) {
export const OpenSearchSqlHighlightRules = function (this: any) {
// See https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-commands.html
const keywords =
'describe|between|in|like|not|and|or|desc|select|from|where|having|group|by|order' +
Expand Down Expand Up @@ -110,4 +110,4 @@ export const ElasticsearchSqlHighlightRules = function (this: any) {
this.normalizeRules();
};

oop.inherits(ElasticsearchSqlHighlightRules, TextHighlightRules);
oop.inherits(OpenSearchSqlHighlightRules, TextHighlightRules);
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { defaultsDeep } from 'lodash';
import ace from 'brace';
import 'brace/mode/json';

import { ElasticsearchSqlHighlightRules } from './elasticsearch_sql_highlight_rules';
import { OpenSearchSqlHighlightRules } from './opensearch_sql_highlight_rules';
import { ScriptHighlightRules } from './script_highlight_rules';

const { JsonHighlightRules } = ace.acequire('ace/mode/json_highlight_rules');
Expand Down Expand Up @@ -164,7 +164,7 @@ export function XJsonHighlightRules(this: any) {
},
]);

this.embedRules(ElasticsearchSqlHighlightRules, 'sql-', [
this.embedRules(OpenSearchSqlHighlightRules, 'sql-', [
{
token: 'punctuation.end_triple_quote',
regex: '"""',
Expand All @@ -184,7 +184,7 @@ export function addToRules(otherRules: any, embedUnder: any) {
next: 'pop',
},
]);
otherRules.embedRules(ElasticsearchSqlHighlightRules, 'sql-', [
otherRules.embedRules(OpenSearchSqlHighlightRules, 'sql-', [
{
token: 'punctuation.end_triple_quote',
regex: '"""',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

export {
ElasticsearchSqlHighlightRules,
OpenSearchSqlHighlightRules,
ScriptHighlightRules,
XJsonHighlightRules,
addXJsonToRules,
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 876edf8

Please sign in to comment.