pw_status: Refactor TS build to use ts_project
Testing done:
- bazel build //pw_status/ts:pw_status
No-Docs-Update-Reason: build system refactor
Change-Id: I8b228773f0872c7c75af5eda2bff01e064d5dc60
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/62980
Reviewed-by: Jared Weinstein <jaredweinstein@google.com>
Commit-Queue: Paul Mathieu <paulmathieu@google.com>
diff --git a/pw_rpc/ts/call.ts b/pw_rpc/ts/call.ts
index ffde6d6..6bb7b69 100644
--- a/pw_rpc/ts/call.ts
+++ b/pw_rpc/ts/call.ts
@@ -13,7 +13,7 @@
// the License.
import {Message} from 'google-protobuf';
-import {Status} from 'pigweed/pw_status/ts/status';
+import {Status} from '@pigweed/pw_status';
import WaitQueue = require('wait-queue')
import {PendingCalls, Rpc} from './rpc_classes';
diff --git a/pw_rpc/ts/client.ts b/pw_rpc/ts/client.ts
index 6655d4a..9ccbdaf 100644
--- a/pw_rpc/ts/client.ts
+++ b/pw_rpc/ts/client.ts
@@ -17,7 +17,7 @@
import {Message} from 'google-protobuf';
import {PacketType, RpcPacket} from 'packet_proto_tspb/packet_proto_tspb_pb/pw_rpc/internal/packet_pb'
import {Library} from 'pigweed/pw_protobuf_compiler/ts/proto_lib';
-import {Status} from 'pigweed/pw_status/ts/status';
+import {Status} from '@pigweed/pw_status';
import {Channel, Service} from './descriptors';
import {MethodStub, methodStubFactory} from './method';
diff --git a/pw_rpc/ts/client_test.ts b/pw_rpc/ts/client_test.ts
index 1858c6a..e32e275 100644
--- a/pw_rpc/ts/client_test.ts
+++ b/pw_rpc/ts/client_test.ts
@@ -18,7 +18,7 @@
import {Message} from 'google-protobuf';
import {PacketType, RpcPacket} from 'packet_proto_tspb/packet_proto_tspb_pb/pw_rpc/internal/packet_pb'
import {Library, MessageCreator} from 'pigweed/pw_protobuf_compiler/ts/proto_lib';
-import {Status} from 'pigweed/pw_status/ts/status';
+import {Status} from '@pigweed/pw_status';
import {Request, Response} from 'test_protos_tspb/test_protos_tspb_pb/pw_rpc/ts/test_pb'
import {Client} from './client';
diff --git a/pw_rpc/ts/packets.ts b/pw_rpc/ts/packets.ts
index b9dd7e0..6f86a03 100644
--- a/pw_rpc/ts/packets.ts
+++ b/pw_rpc/ts/packets.ts
@@ -17,7 +17,7 @@
import {Message} from 'google-protobuf';
import {MethodDescriptorProto} from 'google-protobuf/google/protobuf/descriptor_pb';
import * as packetPb from 'packet_proto_tspb/packet_proto_tspb_pb/pw_rpc/internal/packet_pb'
-import {Status} from 'pigweed/pw_status/ts/status';
+import {Status} from '@pigweed/pw_status';
// Channel, Service, Method
type idSet = [number, number, number];
diff --git a/pw_rpc/ts/packets_test.ts b/pw_rpc/ts/packets_test.ts
index 3fcd639..f7d34f5 100644
--- a/pw_rpc/ts/packets_test.ts
+++ b/pw_rpc/ts/packets_test.ts
@@ -16,7 +16,7 @@
import 'jasmine';
import {PacketType, RpcPacket} from 'packet_proto_tspb/packet_proto_tspb_pb/pw_rpc/internal/packet_pb'
-import {Status} from 'pigweed/pw_status/ts/status';
+import {Status} from '@pigweed/pw_status';
import * as packets from './packets';
diff --git a/pw_rpc/ts/rpc_classes.ts b/pw_rpc/ts/rpc_classes.ts
index c637ec3..ad345af 100644
--- a/pw_rpc/ts/rpc_classes.ts
+++ b/pw_rpc/ts/rpc_classes.ts
@@ -13,7 +13,7 @@
// the License.
import {Message} from 'google-protobuf';
-import {Status} from 'pigweed/pw_status/ts/status';
+import {Status} from '@pigweed/pw_status';
import {Call} from './call';
import {Channel, Method, Service} from './descriptors';
diff --git a/pw_status/ts/BUILD.bazel b/pw_status/ts/BUILD.bazel
index f7dc08b..fe368da 100644
--- a/pw_status/ts/BUILD.bazel
+++ b/pw_status/ts/BUILD.bazel
@@ -12,14 +12,25 @@
# License for the specific language governing permissions and limitations under
# the License.
-load("@npm//@bazel/typescript:index.bzl", "ts_library")
+load("@build_bazel_rules_nodejs//:index.bzl", "js_library")
+load("@npm//@bazel/typescript:index.bzl", "ts_project")
package(default_visibility = ["//visibility:public"])
-ts_library(
- name = "pw_status",
- package_name = "pigweed/pw_status/ts",
+ts_project(
+ name = "lib",
srcs = [
+ "index.ts",
"status.ts",
],
+ declaration = True,
+ source_map = True,
+ deps = ["@npm//:node_modules"], # can't use fine-grained deps
+)
+
+js_library(
+ name = "pw_status",
+ package_name = "@pigweed/pw_status",
+ srcs = ["package.json"],
+ deps = [":lib"],
)
diff --git a/pw_status/ts/index.ts b/pw_status/ts/index.ts
new file mode 100644
index 0000000..8352b77
--- /dev/null
+++ b/pw_status/ts/index.ts
@@ -0,0 +1,15 @@
+// Copyright 2021 The Pigweed Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+export * from './status';
diff --git a/pw_status/ts/package.json b/pw_status/ts/package.json
new file mode 100644
index 0000000..37cedac
--- /dev/null
+++ b/pw_status/ts/package.json
@@ -0,0 +1,8 @@
+{
+ "name": "@pigweed/pw_status",
+ "version": "1.0.0",
+ "main": "index.js",
+ "license": "Apache-2.0",
+ "dependencies": {
+ }
+}
diff --git a/pw_status/ts/tsconfig.json b/pw_status/ts/tsconfig.json
new file mode 100644
index 0000000..4ddd637
--- /dev/null
+++ b/pw_status/ts/tsconfig.json
@@ -0,0 +1,34 @@
+{
+ "compilerOptions": {
+ "allowUnreachableCode": false,
+ "allowUnusedLabels": false,
+ "declaration": true,
+ "forceConsistentCasingInFileNames": true,
+ "lib": [
+ "es2018",
+ "dom",
+ "dom.iterable",
+ "esnext"
+ ],
+ "module": "commonjs",
+ "noEmitOnError": true,
+ "noFallthroughCasesInSwitch": true,
+ "noImplicitReturns": true,
+ "pretty": true,
+ "sourceMap": true,
+ "strict": true,
+ "target": "es2018",
+ "jsx": "react",
+ "plugins": [
+ {
+ "name": "@bazel/tsetse",
+ "disabledRules": [
+ "must-use-promises"
+ ]
+ }
+ ]
+ },
+ "exclude": [
+ "node_modules"
+ ]
+}
diff --git a/pw_status/ts/yarn.lock b/pw_status/ts/yarn.lock
new file mode 100644
index 0000000..fb57ccd
--- /dev/null
+++ b/pw_status/ts/yarn.lock
@@ -0,0 +1,4 @@
+# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
+# yarn lockfile v1
+
+