This repository has been archived by the owner on Sep 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 94
Update to latest rules_nodejs & cleanup #204
Closed
gregmagolan
wants to merge
1
commit into
bazelbuild:master
from
gregmagolan:update-rules-nodejs-20150815
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,13 +52,50 @@ ts_devserver( | |
deps = [":app"], | ||
entry_module = "build_bazel_rules_typescript/examples/protocol_buffers/app", | ||
bootstrap = ["@build_bazel_rules_typescript//:protobufjs_bootstrap_scripts"], | ||
port = 8080, | ||
) | ||
|
||
# Test for production mode | ||
load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle") | ||
load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle", "nodejs_binary") | ||
|
||
rollup_bundle( | ||
name = "bundle", | ||
deps = [":app"], | ||
entry_point = "examples/protocol_buffers/app", | ||
globals = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this map is already defined in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. agreed. we should be able to make this easier for users. but I think it needs some thought first about the best way to go about it. this works for now IMO. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. okay let's not wait too long :) |
||
"long": "Long", | ||
"protobufjs/minimal": "protobuf", | ||
}, | ||
) | ||
|
||
# Needed because the prodserver only loads static files that appear under this | ||
# package. | ||
genrule( | ||
name = "protobufjs", | ||
srcs = [ | ||
"@build_bazel_rules_typescript_protobufs_compiletime_deps//:node_modules/protobufjs/dist/minimal/protobuf.min.js", | ||
"@build_bazel_rules_typescript_protobufs_compiletime_deps//:node_modules/long/dist/long.js", | ||
], | ||
outs = [ | ||
"protobuf.min.js", | ||
"long.js" | ||
], | ||
cmd = "outs=($(OUTS)); d=$$(dirname $${outs[0]}); for s in $(SRCS); do cp $$s $$d; done", | ||
) | ||
|
||
nodejs_binary( | ||
name = "prodserver", | ||
args = ["./examples/protocol_buffers"], | ||
data = [ | ||
"index.html", | ||
":protobufjs", | ||
":bundle", | ||
], | ||
entry_point = "http-server/bin/http-server", | ||
) | ||
|
||
ts_library( | ||
name = "e2e", | ||
testonly = 1, | ||
srcs = ["app_e2e_test.ts"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {browser, by, element, ExpectedConditions} from 'protractor'; | ||
|
||
// This test uses Protractor without Angular, so disable Angular features | ||
browser.waitForAngularEnabled(false); | ||
|
||
// Since we don't have a protractor bazel rule yet, the test is brought up in | ||
// parallel with building the service under test. So the timeout must include | ||
// compiling the application as well as starting the server. | ||
const timeoutMs = 90 * 1000; | ||
|
||
describe('protocol_buffers', () => { | ||
beforeAll(() => { | ||
browser.get(''); | ||
// Don't run any specs until we see a <div> on the page. | ||
browser.wait( | ||
ExpectedConditions.presenceOf(element(by.css('div.ts1'))), | ||
timeoutMs); | ||
}, timeoutMs); | ||
|
||
it('should display: Car from server: Porsche', (done) => { | ||
const div = element(by.css('div.ts1')); | ||
div.getText().then(t => expect(t).toEqual(`Car from server: Porsche`)); | ||
done(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<html> | ||
<head> | ||
<title>protocol_buffers example</title> | ||
</head> | ||
<body> | ||
<script src="/protobuf.min.js"></script> | ||
<script src="/long.js"></script> | ||
<script src="/bundle.min.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
exports.config = { | ||
specs: ['bazel-bin/examples/app/*_e2e_test.js'], | ||
capabilities: | ||
{browserName: 'chrome', chromeOptions: {args: ['--no-sandbox']}}, | ||
suites: { | ||
app: 'bazel-bin/examples/app/*_e2e_test.js', | ||
protocol_buffers: 'bazel-bin/examples/protocol_buffers/*_e2e_test.js', | ||
}, | ||
capabilities: { | ||
browserName: 'chrome', | ||
chromeOptions: {args: ['--no-sandbox']} | ||
}, | ||
directConnect: true, | ||
baseUrl: 'http://localhost:5432/', | ||
baseUrl: 'http://localhost:8080/', | ||
framework: 'jasmine', | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's a nicer pipe syntax; switch this to
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks