Skip to content

Commit

Permalink
chore: Simplify enclave-manager-sdk typescript dependencies (#1595)
Browse files Browse the repository at this point in the history
## Description:

The enclave manager sdk has a large number of (I think) unnecessary
dependencies, this PR removes a lot of them and tidies up package.json.

Additionally, specify `yarn --frozen-lockfile` in the
`enclave-manager/api/typescript/scripts/build.sh` so that builds will
fail if dependencies are not committed properly.

This change removes the dependency in the enclave manager from the
general typescript `kurtosis-sdk` - I'm not sure why this dependency is
present as it's not required by any code generated by the
enclave-manager-sdk.

## Is this change user facing?
NO

## References (if applicable):
N/A
  • Loading branch information
Dartoxian committed Oct 26, 2023
1 parent 772e15d commit 73b8c62
Show file tree
Hide file tree
Showing 8 changed files with 2,592 additions and 771 deletions.
2 changes: 1 addition & 1 deletion enclave-manager/api/scripts/regenerate-proto-bindings.sh
Expand Up @@ -53,4 +53,4 @@ protoc \
--plugin=protoc-gen-connect-es="${api_typescript_abs_dir}/node_modules/.bin/protoc-gen-connect-es" \
--connect-es_out="${api_typescript_abs_dir}/src/" \
--connect-es_opt=target=ts \
"${api_proto_abs_dir}"/*.proto
"${api_proto_abs_dir}"/*.proto
1 change: 1 addition & 0 deletions enclave-manager/api/typescript/babel.config.cjs
@@ -0,0 +1 @@
module.exports = {presets: ['@babel/preset-env']}
48 changes: 15 additions & 33 deletions enclave-manager/api/typescript/package.json
@@ -1,11 +1,15 @@
{
"version": "0.0.0",
"name": "enclave-manager-sdk",
"main": "./build/index",
"description": "This repo contains a Typescript client for communicating with the Enclave Manager API server.",
"types": "./build/index",
"scripts": {
"build": "tsc && cp -R src/ build/ && cp -R node_modules/kurtosis-sdk/src/core/kurtosis_core_rpc_api_bindings/connect/* build/ && cp -R node_modules/kurtosis-sdk/src/engine/kurtosis_engine_rpc_api_bindings/connect/* build/",
"test": "ts-mocha -p tsconfig.json 'test/**/*.ts'"
"clean": "rm -rf build src/api_container* src/engine_service*",
"prebuild": "cp -R ../../../api/typescript/src/core/kurtosis_core_rpc_api_bindings/connect/* ../../../api/typescript/src/engine/kurtosis_engine_rpc_api_bindings/connect/* ./src",
"build": "tsc",
"postbuild": "cp -R ../../../api/typescript/src/core/kurtosis_core_rpc_api_bindings/connect/* ../../../api/typescript/src/engine/kurtosis_engine_rpc_api_bindings/connect/* ./build/ && rm src/api_container* src/engine_service*",
"test": "jest"
},
"files": [
"build"
Expand All @@ -30,39 +34,17 @@
"node": ">=16.13.0"
},
"dependencies": {
"@bufbuild/connect": "^0.12.0",
"@bufbuild/connect-web": "^0.12.0",
"@bufbuild/protobuf": "^1.3.0",
"@grpc/grpc-js": "^1.4.4",
"@types/google-protobuf": "^3.15.5",
"@types/js-yaml": "^4.0.5",
"@types/path-browserify": "^1.0.0",
"@types/semver": "^7.3.9",
"browser-or-node": "^2.0.0",
"google-protobuf": "^3.17.3",
"grpc-web": "^1.3.0",
"js-yaml": "^4.1.0",
"loglevel": "^1.7.1",
"neverthrow": "^4.2.2",
"path-browserify": "^1.0.1",
"semver": "^7.3.5",
"tar": "^6.1.11",
"@bufbuild/protoc-gen-connect-es": "^0.12.0",
"@bufbuild/protoc-gen-es": "^1.3.0",
"kurtosis-sdk": "../../../api/typescript/"
"@bufbuild/protobuf": "^1.3.3"
},
"devDependencies": {
"@bufbuild/buf": "^1.26.1",
"@bufbuild/protoc-gen-connect-es": "^0.12.0",
"@bufbuild/protoc-gen-es": "^1.3.0",
"@types/chai": "^4.2.21",
"@types/google-protobuf": "^3.15.5",
"@types/mocha": "^9.0.0",
"@types/tar": "^6.1.1",
"@types/targz": "^1.0.1",
"chai": "^4.3.4",
"mocha": "^9.0.3",
"ts-mocha": "^8.0.0",
"@babel/core": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@bufbuild/protoc-gen-es": "^1.3.3",
"@connectrpc/connect": "^0.13.0",
"@connectrpc/connect-web": "^0.13.0",
"@connectrpc/protoc-gen-connect-es": "^0.13.0",
"@types/jest": "^29.5.6",
"jest": "^29.7.0",
"typescript": "^4.3.5"
}
}
3 changes: 2 additions & 1 deletion enclave-manager/api/typescript/scripts/build.sh
Expand Up @@ -10,7 +10,8 @@ lang_root_dirpath="$(dirname "${script_dirpath}")"
# Main Logic
# ==================================================================================================
cd "${lang_root_dirpath}"
yarn install
yarn install --frozen-lockfile
# There are no unit tests currently
# CGO_ENABLED=0 yarn test
yarn clean
yarn build
11 changes: 11 additions & 0 deletions enclave-manager/api/typescript/src/__tests__/api_test.js
@@ -0,0 +1,11 @@
import { createConnectTransport } from "@connectrpc/connect-web";
import { createPromiseClient } from "@connectrpc/connect";
import { KurtosisEnclaveManagerServer } from "../../build/kurtosis_enclave_manager_api_connect.js";

describe("Enclave manager SDK", () => {
it("Should be able to be instantiated", () => {
const transport = createConnectTransport({baseUrl: "someUrl"});
const client = createPromiseClient(KurtosisEnclaveManagerServer, transport);
expect(client).toBeDefined();
})
})
2 changes: 1 addition & 1 deletion enclave-manager/api/typescript/tsconfig.json
Expand Up @@ -5,7 +5,7 @@
"downlevelIteration": true,
"declaration": true,
"strict": true,
"target": "ES2015"
"target": "es2018"
},
"include": [
"src/**/*"
Expand Down
3,226 changes: 2,550 additions & 676 deletions enclave-manager/api/typescript/yarn.lock

Large diffs are not rendered by default.

70 changes: 11 additions & 59 deletions engine/frontend/package-lock.json

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

0 comments on commit 73b8c62

Please sign in to comment.