Skip to content

Commit b6541fe

Browse files
author
spalger
committed
use the entire basename in config file paths
1 parent 0214607 commit b6541fe

File tree

6 files changed

+4
-12
lines changed

6 files changed

+4
-12
lines changed

packages/kbn-es-query/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ PKG_REQUIRE_NAME = "@kbn/es-query"
88
SOURCE_FILES = glob(
99
[
1010
"**/*.ts",
11-
"**/grammar.config.json",
11+
"**/grammar.peggy.config.json",
1212
"**/grammar.peggy",
1313
],
1414
exclude = [

packages/kbn-interpreter/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SOURCE_FILES = glob(
99
[
1010
"**/*.ts",
1111
"**/*.js",
12-
"**/grammar.config.json",
12+
"**/grammar.peggy.config.json",
1313
"**/grammar.peggy",
1414
],
1515
exclude = [

packages/kbn-peggy/README.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tags: ['kibana', 'dev', 'contributor', 'operations', 'peggy']
99

1010
This package wraps the peggy package, exposing a synchronous and async version of the generator which includes two modifications:
1111

12-
1. When a `path` is provided a `${basename}.config.json` file will be loaded if it exists and it expected to include peggy config options as defined in [the peggy docs](https://peggyjs.org/documentation.html#generating-a-parser-javascript-api). This config will be used when compiling this file
12+
1. When a `path` is provided a `${basename}.config.json` file will be loaded if it exists and is expected to include peggy config options as defined in [the peggy docs](https://peggyjs.org/documentation.html#generating-a-parser-javascript-api). This config will be used when compiling this file
1313

1414
## Plugins
1515
These types will automatically be included for plugins.

packages/kbn-peggy/index.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,7 @@ export interface Result {
6565
}
6666

6767
export function findConfigFile(grammarPath: string): Config | undefined {
68-
const extname = Path.extname(grammarPath);
69-
if (extname !== '.peggy') {
70-
throw new Error(`unexpected extension [${extname}], expected ".peggy"`);
71-
}
72-
73-
const path = Path.resolve(
74-
Path.dirname(grammarPath),
75-
`${Path.basename(grammarPath, extname)}.config.json`
76-
);
68+
const path = Path.resolve(Path.dirname(grammarPath), `${Path.basename(grammarPath)}.config.json`);
7769

7870
let source;
7971
let parsed;

0 commit comments

Comments
 (0)