Skip to content

Commit f4148e8

Browse files
authored
Update project.json packages and examples (#2658)
1 parent 4ee90d8 commit f4148e8

File tree

31 files changed

+3329
-21388
lines changed

31 files changed

+3329
-21388
lines changed

examples/Browser/Server/Server.csproj

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,8 @@
1313
<PackageReference Include="Grpc.AspNetCore.Web" />
1414
</ItemGroup>
1515

16-
<Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
17-
<!-- Ensure Node.js is installed -->
18-
<Exec Command="node --version" ContinueOnError="true">
19-
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
20-
</Exec>
21-
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
22-
<Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
23-
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
24-
<!-- Include source map for debugging (for other source map options see https://webpack.js.org/configuration/devtool/ ) -->
25-
<Exec WorkingDirectory="$(SpaRoot)" Command="npx webpack --debug --devtool inline-source-map scripts/index.js" />
26-
</Target>
27-
28-
<Target Name="PublishRunWebpack" AfterTargets="ComputeFilesToPublish">
29-
<!-- As part of publishing, ensure the JS resources are freshly built in production mode -->
30-
<Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
31-
<Exec WorkingDirectory="$(SpaRoot)" Command="npx webpack scripts/index.js" />
32-
33-
<!-- Include the newly-built files in the publish output -->
34-
<ItemGroup>
35-
<DistFiles Include="$(SpaRoot)dist\**" />
36-
<ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
37-
<RelativePath>%(DistFiles.Identity)</RelativePath>
38-
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
39-
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
40-
</ResolvedFileToPublish>
41-
</ItemGroup>
16+
<Target Name="DebugEnsureJavaScriptDep" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)dist/main.js') ">
17+
<Error Text="Run 'npm install' and 'npm run build' in the wwwroot directory to build the required JavaScript dependencies." />
4218
</Target>
4319

4420
</Project>

examples/Browser/Server/wwwroot/Scripts/greet_grpc_web_pb.js

Lines changed: 20 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
* @public
55
*/
66

7-
// GENERATED CODE -- DO NOT EDIT!
7+
// Code generated by protoc-gen-grpc-web. DO NOT EDIT.
8+
// versions:
9+
// protoc-gen-grpc-web v1.5.0
10+
// protoc v6.31.1
11+
// source: greet.proto
12+
13+
14+
/* eslint-disable */
15+
// @ts-nocheck
816

917

1018

@@ -17,15 +25,15 @@ proto.greet = require('./greet_pb.js');
1725
/**
1826
* @param {string} hostname
1927
* @param {?Object} credentials
20-
* @param {?Object} options
28+
* @param {?grpc.web.ClientOptions} options
2129
* @constructor
2230
* @struct
2331
* @final
2432
*/
2533
proto.greet.GreeterClient =
2634
function(hostname, credentials, options) {
2735
if (!options) options = {};
28-
options['format'] = 'text';
36+
options.format = 'text';
2937

3038
/**
3139
* @private @const {!grpc.web.GrpcWebClientBase} The client
@@ -35,23 +43,23 @@ proto.greet.GreeterClient =
3543
/**
3644
* @private @const {string} The hostname
3745
*/
38-
this.hostname_ = hostname;
46+
this.hostname_ = hostname.replace(/\/+$/, '');
3947

4048
};
4149

4250

4351
/**
4452
* @param {string} hostname
4553
* @param {?Object} credentials
46-
* @param {?Object} options
54+
* @param {?grpc.web.ClientOptions} options
4755
* @constructor
4856
* @struct
4957
* @final
5058
*/
5159
proto.greet.GreeterPromiseClient =
5260
function(hostname, credentials, options) {
5361
if (!options) options = {};
54-
options['format'] = 'text';
62+
options.format = 'text';
5563

5664
/**
5765
* @private @const {!grpc.web.GrpcWebClientBase} The client
@@ -61,7 +69,7 @@ proto.greet.GreeterPromiseClient =
6169
/**
6270
* @private @const {string} The hostname
6371
*/
64-
this.hostname_ = hostname;
72+
this.hostname_ = hostname.replace(/\/+$/, '');
6573

6674
};
6775

@@ -88,31 +96,12 @@ const methodDescriptor_Greeter_SayHello = new grpc.web.MethodDescriptor(
8896
);
8997

9098

91-
/**
92-
* @const
93-
* @type {!grpc.web.AbstractClientBase.MethodInfo<
94-
* !proto.greet.HelloRequest,
95-
* !proto.greet.HelloReply>}
96-
*/
97-
const methodInfo_Greeter_SayHello = new grpc.web.AbstractClientBase.MethodInfo(
98-
proto.greet.HelloReply,
99-
/**
100-
* @param {!proto.greet.HelloRequest} request
101-
* @return {!Uint8Array}
102-
*/
103-
function(request) {
104-
return request.serializeBinary();
105-
},
106-
proto.greet.HelloReply.deserializeBinary
107-
);
108-
109-
11099
/**
111100
* @param {!proto.greet.HelloRequest} request The
112101
* request proto
113102
* @param {?Object<string, string>} metadata User defined
114103
* call metadata
115-
* @param {function(?grpc.web.Error, ?proto.greet.HelloReply)}
104+
* @param {function(?grpc.web.RpcError, ?proto.greet.HelloReply)}
116105
* callback The callback function(error, response)
117106
* @return {!grpc.web.ClientReadableStream<!proto.greet.HelloReply>|undefined}
118107
* The XHR Node Readable Stream
@@ -131,10 +120,10 @@ proto.greet.GreeterClient.prototype.sayHello =
131120
/**
132121
* @param {!proto.greet.HelloRequest} request The
133122
* request proto
134-
* @param {?Object<string, string>} metadata User defined
123+
* @param {?Object<string, string>=} metadata User defined
135124
* call metadata
136125
* @return {!Promise<!proto.greet.HelloReply>}
137-
* A native promise that resolves to the response
126+
* Promise that resolves to the response
138127
*/
139128
proto.greet.GreeterPromiseClient.prototype.sayHello =
140129
function(request, metadata) {
@@ -168,28 +157,9 @@ const methodDescriptor_Greeter_SayHellos = new grpc.web.MethodDescriptor(
168157
);
169158

170159

171-
/**
172-
* @const
173-
* @type {!grpc.web.AbstractClientBase.MethodInfo<
174-
* !proto.greet.HelloRequest,
175-
* !proto.greet.HelloReply>}
176-
*/
177-
const methodInfo_Greeter_SayHellos = new grpc.web.AbstractClientBase.MethodInfo(
178-
proto.greet.HelloReply,
179-
/**
180-
* @param {!proto.greet.HelloRequest} request
181-
* @return {!Uint8Array}
182-
*/
183-
function(request) {
184-
return request.serializeBinary();
185-
},
186-
proto.greet.HelloReply.deserializeBinary
187-
);
188-
189-
190160
/**
191161
* @param {!proto.greet.HelloRequest} request The request proto
192-
* @param {?Object<string, string>} metadata User defined
162+
* @param {?Object<string, string>=} metadata User defined
193163
* call metadata
194164
* @return {!grpc.web.ClientReadableStream<!proto.greet.HelloReply>}
195165
* The XHR Node Readable Stream
@@ -206,7 +176,7 @@ proto.greet.GreeterClient.prototype.sayHellos =
206176

207177
/**
208178
* @param {!proto.greet.HelloRequest} request The request proto
209-
* @param {?Object<string, string>} metadata User defined
179+
* @param {?Object<string, string>=} metadata User defined
210180
* call metadata
211181
* @return {!grpc.web.ClientReadableStream<!proto.greet.HelloReply>}
212182
* The XHR Node Readable Stream

examples/Browser/Server/wwwroot/Scripts/greet_pb.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,24 @@
22
/**
33
* @fileoverview
44
* @enhanceable
5+
* @suppress {missingRequire} reports error on implicit type usages.
56
* @suppress {messageConventions} JS Compiler reports an error if a variable or
67
* field starts with 'MSG_' and isn't a translatable message.
78
* @public
89
*/
910
// GENERATED CODE -- DO NOT EDIT!
11+
/* eslint-disable */
12+
// @ts-nocheck
1013

1114
var jspb = require('google-protobuf');
1215
var goog = jspb;
13-
var global = Function('return this')();
16+
var global =
17+
(typeof globalThis !== 'undefined' && globalThis) ||
18+
(typeof window !== 'undefined' && window) ||
19+
(typeof global !== 'undefined' && global) ||
20+
(typeof self !== 'undefined' && self) ||
21+
(function () { return this; }).call(null) ||
22+
Function('return this')();
1423

1524
goog.exportSymbol('proto.greet.HelloReply', null, global);
1625
goog.exportSymbol('proto.greet.HelloRequest', null, global);
@@ -88,7 +97,7 @@ proto.greet.HelloRequest.prototype.toObject = function(opt_includeInstance) {
8897
*/
8998
proto.greet.HelloRequest.toObject = function(includeInstance, msg) {
9099
var f, obj = {
91-
name: jspb.Message.getFieldWithDefault(msg, 1, "")
100+
name: jspb.Message.getFieldWithDefault(msg, 1, "")
92101
};
93102

94103
if (includeInstance) {
@@ -218,7 +227,7 @@ proto.greet.HelloReply.prototype.toObject = function(opt_includeInstance) {
218227
*/
219228
proto.greet.HelloReply.toObject = function(includeInstance, msg) {
220229
var f, obj = {
221-
message: jspb.Message.getFieldWithDefault(msg, 1, "")
230+
message: jspb.Message.getFieldWithDefault(msg, 1, "")
222231
};
223232

224233
if (includeInstance) {

0 commit comments

Comments
 (0)