diff --git a/WORKSPACE b/WORKSPACE index 67bdd0e..050f1c6 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -26,8 +26,8 @@ http_archive( http_archive( name = "build_bazel_rules_nodejs", - sha256 = "1134ec9b7baee008f1d54f0483049a97e53a57cd3913ec9d6db625549c98395a", - urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.0/rules_nodejs-3.4.0.tar.gz"], + sha256 = "a160d9ac88f2aebda2aa995de3fa3171300c076f06ad1d7c2e1385728b8442fa", + urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.1/rules_nodejs-3.4.1.tar.gz"], ) http_archive( diff --git a/library/js/BUILD.bazel b/library/js/BUILD.bazel index 075ac22..406cc66 100644 --- a/library/js/BUILD.bazel +++ b/library/js/BUILD.bazel @@ -1,20 +1,22 @@ -load("//rules/nodejs:common.bzl", "js_library") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") js_library( name = "base-client", + package_name = "base-client", srcs = ["base-client.js"], - data = [ + visibility = ["//visibility:public"], + deps = [ "//library/js:utils", "@npm//axios", ], - visibility = ["//visibility:public"], ) js_library( name = "utils", + package_name = "utils", srcs = ["utils.js"], - data = [ + visibility = ["//visibility:public"], + deps = [ "@npm//lodash", ], - visibility = ["//visibility:public"], ) diff --git a/library/js/base-client.js b/library/js/base-client.js index 218c205..4e196e5 100644 --- a/library/js/base-client.js +++ b/library/js/base-client.js @@ -1,4 +1,4 @@ -import { removeUndefined, toCamel, toSnake } from '~/library/js/utils' +import { removeUndefined, toCamel, toSnake } from 'utils' import Axios from 'axios' export default class BaseClient { diff --git a/library/js/components/BUILD.bazel b/library/js/components/BUILD.bazel deleted file mode 100644 index 78e7531..0000000 --- a/library/js/components/BUILD.bazel +++ /dev/null @@ -1,7 +0,0 @@ -load("//rules/nodejs:common.bzl", "js_library") - -js_library( - name = "components", - srcs = glob(["**/*.vue"]), - visibility = ["//visibility:public"], -) diff --git a/library/js/components/BadgeList.vue b/library/js/components/BadgeList.vue deleted file mode 100644 index 98961cb..0000000 --- a/library/js/components/BadgeList.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/library/js/components/BaseList.vue b/library/js/components/BaseList.vue deleted file mode 100644 index 10ae90a..0000000 --- a/library/js/components/BaseList.vue +++ /dev/null @@ -1,56 +0,0 @@ - diff --git a/library/js/components/CommonList.vue b/library/js/components/CommonList.vue deleted file mode 100644 index 6bed5d7..0000000 --- a/library/js/components/CommonList.vue +++ /dev/null @@ -1,21 +0,0 @@ - - - diff --git a/library/js/components/Loader.vue b/library/js/components/Loader.vue deleted file mode 100644 index feb75ab..0000000 --- a/library/js/components/Loader.vue +++ /dev/null @@ -1,45 +0,0 @@ - - - - - diff --git a/nexus/cognitron/docker-compose.yml b/nexus/cognitron/docker-compose.yml index 358ccb0..6d120a5 100644 --- a/nexus/cognitron/docker-compose.yml +++ b/nexus/cognitron/docker-compose.yml @@ -2,14 +2,14 @@ services: nexus-cognitron-web: depends_on: - - summa + - nexus-meta-api-envoy environment: ENV_TYPE: production NEXUS_COGNITRON_WEB_ipfs.gateway.url: https://cloudflare-ipfs.com - NEXUS_COGNITRON_WEB_meta_api.url: http://nexus-meta-api:8080 + NEXUS_COGNITRON_WEB_meta_api.url: http://localhost:8080 image: thesuperpirate/cognitron-web:latest ports: - - '3000:80' + - '3000:3000' nexus-meta-api: depends_on: - summa @@ -19,15 +19,12 @@ services: NEXUS_META_API_grpc.port: 9090 NEXUS_META_API_summa.url: 'http://summa:8082' image: thesuperpirate/meta-api:latest - ports: - - '9090:9090' nexus-meta-api-envoy: depends_on: - nexus-meta-api image: envoyproxy/envoy-dev:latest ports: - '8080:8080' - - '9901:9901' volumes: - './nexus-meta-api-envoy.yaml:/etc/envoy/envoy.yaml' summa: @@ -37,8 +34,6 @@ services: SUMMA_http.address: '0.0.0.0' SUMMA_http.port: '8082' image: izihawa/summa:latest - ports: - - '8082:8082' volumes: - '${DATA_PATH}:/summa/data' version: "3" diff --git a/nexus/cognitron/web/BUILD.bazel b/nexus/cognitron/web/BUILD.bazel index c226627..cbba83e 100644 --- a/nexus/cognitron/web/BUILD.bazel +++ b/nexus/cognitron/web/BUILD.bazel @@ -1,7 +1,18 @@ +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") load("@io_bazel_rules_docker//container:container.bzl", "container_push") load("@io_bazel_rules_docker//nodejs:image.bzl", "nodejs_image") load("@npm//nuxt:index.bzl", "nuxt") -load("//rules/nodejs:common.bzl", "js_library") + +files = ["nuxt.config.js"] + glob([ + "assets/**", + "components/**/*.vue", + "layouts/*.vue", + "middleware/*.js", + "pages/**/*.vue", + "plugins/*.js", + "static/*", + "store/*.js", +]) deps = [ "@npm//@nuxtjs/axios", @@ -18,27 +29,20 @@ deps = [ ] js_library( - name = "nuxt-srcs", - srcs = ["nuxt.config.js"] + glob([ - "assets/**", - "components/**/*.vue", - "layouts/*.vue", - "middleware/*.js", - "pages/**/*.vue", - "plugins/*.js", - "static/*", - "store/*.js", - ]), + name = "nexus-cognitron-web", + package_name = "nexus-cognitron-web", + srcs = files, + deps = deps, ) nuxt( - name = "web_dev", + name = "web-dev", args = [ "-c", "nexus/cognitron/web/nuxt.config.js", "--watch-poll", ], - data = [":nuxt-srcs"] + deps, + data = [":nexus-cognitron-web"], ) nuxt( @@ -50,7 +54,8 @@ nuxt( "nexus/cognitron/web/nuxt.config.js", "--buildDir=$(@D)", ], - data = [":nuxt-srcs"] + deps, + data = files + deps, + link_workspace_root = True, output_dir = True, ) diff --git a/nexus/cognitron/web/nuxt.config.js b/nexus/cognitron/web/nuxt.config.js index a2b8985..0252a6a 100644 --- a/nexus/cognitron/web/nuxt.config.js +++ b/nexus/cognitron/web/nuxt.config.js @@ -5,10 +5,10 @@ if (buildDir) { buildDir = 'nexus/cognitron/web/.nuxt' } -export default { +module.exports = { server: { host: '0.0.0.0', - port: 8082 + port: 3000 }, buildDir: buildDir, srcDir: 'nexus/cognitron/web', @@ -40,11 +40,11 @@ export default { publicRuntimeConfig: { meta_api: { - url: process.env.NEXUS_COGNITRON_WEB_meta_api.url || 'http://nexus-meta-api:8080' + url: process.env['NEXUS_COGNITRON_WEB_meta_api.url'] || 'http://localhost:8080' }, ipfs: { gateway: { - url: process.env.NEXUS_COGNITRON_WEB_ipfs.gateway.url || 'https://ipfs.io' + url: process.env['NEXUS_COGNITRON_WEB_ipfs.gateway.url'] || 'https://ipfs.io' } } }, @@ -80,6 +80,7 @@ export default { build: { extend (config) { config.resolve.alias['~'] = process.cwd() - } + }, + transpile: ['nexus-meta-api-js-client'], } } diff --git a/nexus/cognitron/web/plugins/meta-api.js b/nexus/cognitron/web/plugins/meta-api.js index 2070417..12dbe60 100755 --- a/nexus/cognitron/web/plugins/meta-api.js +++ b/nexus/cognitron/web/plugins/meta-api.js @@ -1,6 +1,6 @@ -import MetaApi from '~/nexus/meta_api/js/client' +import MetaApi from 'nexus-meta-api-js-client' export default ({ $config }, inject) => { - const metaApi = new MetaApi($config.metaApi) + const metaApi = new MetaApi($config.meta_api) inject('meta_api', metaApi) } diff --git a/nexus/meta_api/BUILD.bazel b/nexus/meta_api/BUILD.bazel index 014ea26..f8bd58f 100644 --- a/nexus/meta_api/BUILD.bazel +++ b/nexus/meta_api/BUILD.bazel @@ -38,7 +38,7 @@ py3_image( "//library/aiopostgres", "//library/configurator", "//library/logging", - "//nexus/meta_api/proto:meta_api_grpc_py", + "//nexus/meta_api/proto:meta-api-grpc-py", "//nexus/meta_api/query_extensionner", "//nexus/models/proto:models_proto_py", "//nexus/nlptools", diff --git a/nexus/meta_api/aioclient/BUILD.bazel b/nexus/meta_api/aioclient/BUILD.bazel index 7824d29..55d2296 100644 --- a/nexus/meta_api/aioclient/BUILD.bazel +++ b/nexus/meta_api/aioclient/BUILD.bazel @@ -11,8 +11,8 @@ py_library( requirement("tenacity"), requirement("aiogrpcclient"), requirement("aiokit"), - "//nexus/meta_api/proto:meta_api_grpc_py", - "//nexus/meta_api/proto:meta_api_proto_py", + "//nexus/meta_api/proto:meta-api-grpc-py", + "//nexus/meta_api/proto:meta-api-proto-py", "//nexus/models/proto:models_proto_py", ], ) diff --git a/nexus/meta_api/js/client/BUILD.bazel b/nexus/meta_api/js/client/BUILD.bazel index 1079947..11dcde6 100644 --- a/nexus/meta_api/js/client/BUILD.bazel +++ b/nexus/meta_api/js/client/BUILD.bazel @@ -1,12 +1,11 @@ -load("//rules/nodejs:common.bzl", "js_library") +load("@build_bazel_rules_nodejs//:index.bzl", "js_library") js_library( name = "client", + package_name = "nexus-meta-api-js-client", srcs = glob(["*.js"]), - data = [ - "//library/js:base-client", - "//library/js:utils", - "//nexus/meta_api/proto:meta_api_grpc_web_js", - ], visibility = ["//visibility:public"], + deps = [ + "//nexus/meta_api/proto:meta-api-grpc-web-js", + ], ) diff --git a/nexus/meta_api/js/client/index.js b/nexus/meta_api/js/client/index.js index a9c306b..5827eb0 100644 --- a/nexus/meta_api/js/client/index.js +++ b/nexus/meta_api/js/client/index.js @@ -1,5 +1,5 @@ -import documentsProto from '~/nexus/meta_api/proto/documents_service_grpc_web_pb' -import searchProto from '~/nexus/meta_api/proto/search_service_grpc_web_pb' +import documentsProto from 'meta-api-grpc-web-js/meta-api-grpc-web-js_pb/nexus/meta_api/proto/documents_service_grpc_web_pb' +import searchProto from 'meta-api-grpc-web-js/meta-api-grpc-web-js_pb/nexus/meta_api/proto/search_service_grpc_web_pb' export default class MetaApi { constructor (config) { diff --git a/nexus/meta_api/proto/BUILD.bazel b/nexus/meta_api/proto/BUILD.bazel index a20103c..0c08227 100644 --- a/nexus/meta_api/proto/BUILD.bazel +++ b/nexus/meta_api/proto/BUILD.bazel @@ -6,7 +6,7 @@ load("@rules_proto_grpc//js:defs.bzl", "js_grpc_web_library") package(default_visibility = ["//visibility:public"]) proto_library( - name = "meta_api_proto", + name = "meta-api-proto", srcs = glob([ "*.proto", ]), @@ -17,27 +17,29 @@ proto_library( ) py_proto_library( - name = "meta_api_proto_py", - deps = [":meta_api_proto"], + name = "meta-api-proto-py", + deps = [":meta-api-proto"], ) py_grpc_library( - name = "meta_api_grpc_py", - srcs = [":meta_api_proto"], - deps = [":meta_api_proto_py"], + name = "meta-api-grpc-py", + srcs = [":meta-api-proto"], + deps = [":meta-api-proto-py"], ) rust_proto_library( - name = "meta_api_proto_rust", + name = "meta-api-proto-rust", rust_deps = ["//rules/rust/cargo:protobuf"], visibility = ["//visibility:public"], - deps = [":meta_api_proto"], + deps = [":meta-api-proto"], ) js_grpc_web_library( - name = "meta_api_grpc_web_js", - prefix_path = "../../../../", - protos = [":meta_api_proto"], + name = "meta-api-grpc-web-js", + protos = [ + ":meta-api-proto", + "//nexus/models/proto:models_proto", + ], visibility = ["//visibility:public"], deps = ["//nexus/models/proto:models_proto_js"], ) diff --git a/nexus/models/proto/BUILD.bazel b/nexus/models/proto/BUILD.bazel index 9846112..3637f06 100644 --- a/nexus/models/proto/BUILD.bazel +++ b/nexus/models/proto/BUILD.bazel @@ -26,7 +26,6 @@ rust_proto_library( js_proto_library( name = "models_proto_js", - prefix_path = "../../../../", protos = [":models_proto"], visibility = ["//visibility:public"], )