Skip to content

Commit

Permalink
Rename openapi-converter to compiler-rs
Browse files Browse the repository at this point in the history
  • Loading branch information
swallez committed Oct 23, 2023
1 parent 1efe7d4 commit 5efdd1c
Show file tree
Hide file tree
Showing 52 changed files with 61 additions and 54 deletions.
4 changes: 2 additions & 2 deletions .github/check-license-headers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ function check_license_header {

cd "$TOP"
nErrors=0
for f in $(git ls-files | grep -v schema-wasm-lib/pkg | grep '\.ts$'); do
for f in $(git ls-files | grep -v compiler-wasm-lib/pkg | grep '\.ts$'); do
if ! check_license_header $f; then
nErrors=$((nErrors+1))
fi
done

for f in $(git ls-files | grep -v schema-wasm-lib/pkg |grep '\.js$'); do
for f in $(git ls-files | grep -v compiler-wasm-lib/pkg |grep '\.js$'); do
if ! check_license_header $f; then
nErrors=$((nErrors+1))
fi
Expand Down
File renamed without changes.
28 changes: 14 additions & 14 deletions openapi-converter/Cargo.lock → compiler-rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion openapi-converter/Cargo.toml → compiler-rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = [
"clients_schema",
"openapi_to_clients_schema",
"clients_schema_to_openapi",
"schema-wasm-lib",
"compiler-wasm-lib",
]

[profile.release]
Expand Down
17 changes: 17 additions & 0 deletions compiler-rs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
REQUIRED_BINS := wasm-pack cargo
$(foreach bin,$(REQUIRED_BINS),\
$(if $(shell command -v $(bin) 2> /dev/null),,$(error Please install `$(bin)`)))

.PHONY: compiler-wasm-lib

compiler-wasm-lib: ## Compile the WASM library
wasm-pack build --release -t nodejs compiler-wasm-lib
# we do commit the result in git
rm compiler-wasm-lib/pkg/.gitignore


help: ## Display help
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
#------------- <https://suva.sh/posts/well-documented-makefiles> --------------

.DEFAULT_GOAL := help
4 changes: 2 additions & 2 deletions openapi-converter/README.md → compiler-rs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ This directory contains a set of Rust crates to manipulate and transform the API

* [`clients_schema`](./clients_schema/): a Rust implementation of the [Elasticsearch specification schema](https://github.com/elastic/elasticsearch-specification/blob/main/compiler/src/model/metamodel.ts) metamodel.
* [`clients_schema_to_openapi`](./clients_schema_to_openapi): conversion of the `schema.json` format to OpenAPI. Supersedes [elasticsearch-openapi](https://github.com/elastic/elasticsearch-openapi).
* [`schema-wasm-lib`](./schema-wasm-lib): a WebAssembly library that exposes features of this workspace, to allow its use from the larger [schema toolchain](../compiler).
* [`compiler-wasm-lib`](./schema-wasm-lib): a WebAssembly library that exposes features of this workspace, to allow its use from the larger [schema toolchain](../compiler).
* [`openapi_to_clients_schema`](./openapi_to_clients_schema): experimental, incomplete, work in progress: translate an OpenAPI specification to an Elasticsearch schema that can be used as input for code generation.

## Building

The output of this directory is the `schema-wasm-lib` WebAssembly library. It must be built and committed in this repository every time the Rust code is changed. Use `make schema-wasm-lib` to build it.
The output of this directory is the `compiler-wasm-lib` WebAssembly library. It must be built and committed in this repository every time the Rust code is changed. Use `make compiler-wasm-lib` to build it.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "schema-wasm-lib"
name = "compiler-wasm-lib"
version = "0.1.0"
edition = "2021"
description = "WASM library to manipulate and convert schema.json files"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ module.exports.__wbindgen_object_drop_ref = function(arg0) {
takeObject(arg0);
};

const path = require('path').join(__dirname, 'schema_wasm_lib_bg.wasm');
const path = require('path').join(__dirname, 'compiler_wasm_lib_bg.wasm');
const bytes = require('fs').readFileSync(path);

const wasmModule = new WebAssembly.Module(bytes);
Expand Down
Binary file not shown.
12 changes: 12 additions & 0 deletions compiler-rs/compiler-wasm-lib/pkg/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "compiler-wasm-lib",
"description": "WASM library to manipulate and convert schema.json files",
"version": "0.1.0",
"files": [
"compiler_wasm_lib_bg.wasm",
"compiler_wasm_lib.js",
"compiler_wasm_lib.d.ts"
],
"main": "compiler_wasm_lib.js",
"types": "compiler_wasm_lib.d.ts"
}
File renamed without changes.
18 changes: 9 additions & 9 deletions compiler/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"fastest-levenshtein": "^1.0.12",
"ora": "^5.4.1",
"safe-stable-stringify": "^2.3.1",
"schema-wasm-lib": "file:../openapi-converter/schema-wasm-lib/pkg",
"compiler-wasm-lib": "file:../compiler-rs/compiler-wasm-lib/pkg",
"semver": "^7.5.2",
"ts-morph": "^13.0.3",
"zx": "^4.3.0"
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/transform/schema-to-openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { convert_schema_to_openapi } from 'schema-wasm-lib'
import { convert_schema_to_openapi } from 'compiler-wasm-lib'
import { argv } from 'zx'
import { join } from 'path'
import { readFileSync, writeFileSync } from 'fs'
Expand Down
10 changes: 0 additions & 10 deletions openapi-converter/Makefile

This file was deleted.

12 changes: 0 additions & 12 deletions openapi-converter/schema-wasm-lib/pkg/package.json

This file was deleted.

0 comments on commit 5efdd1c

Please sign in to comment.