Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for transitive npm dependencies #675

Merged
merged 6 commits into from
Apr 9, 2019
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -54,7 +54,6 @@ npm_package(
"//internal/js_library:package_contents",
# TODO(alexeagle): distribute separately as @bazel/rollup
"//internal/rollup:package_contents",
"//internal/ng_apf_library:package_contents",
"//internal/node:package_contents",
"//internal/npm_install:package_contents",
"//internal/npm_package:package_contents",
47 changes: 47 additions & 0 deletions e2e/typescript_3.1/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -12,12 +12,25 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@build_bazel_rules_nodejs//:defs.bzl", "nodejs_binary", "rollup_bundle")
load("@npm_bazel_jasmine//:index.bzl", "jasmine_node_test")
load("@npm_bazel_typescript//:index.bzl", "ts_library")

ts_library(
name = "lib",
srcs = ["lib.ts"],
deps = [
"@npm//@types/node",
"@npm//date-fns",
],
)

ts_library(
name = "main",
srcs = ["main.ts"],
deps = [
":lib",
],
)

ts_library(
@@ -42,3 +55,37 @@ jasmine_node_test(
":test_lib",
],
)

nodejs_binary(
name = "main_js",
data = [
":main",
],
entry_point = "e2e_typescript_3_1/main.js",
)

nodejs_binary(
name = "main_js_sm",
data = [
":main",
"@npm//source-map-support",
],
entry_point = "e2e_typescript_3_1/main.js",
)

rollup_bundle(
name = "bundle",
entry_point = "main",
deps = [
":main",
],
)

rollup_bundle(
name = "bundle_sm",
entry_point = "main",
deps = [
":main",
"@npm//source-map-support",
],
)
5 changes: 5 additions & 0 deletions e2e/typescript_3.1/lib.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {format} from 'date-fns'

export function sayDate() {
return 'hello ' + format(new Date(2014, 1, 11), 'MM/dd/YYYY');
}
2 changes: 1 addition & 1 deletion e2e/typescript_3.1/main.spec.ts
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import * as main from './main';

describe('main', () => {
it('should compile and run with @bazel/typescript npm package', () => {
expect(main.test()).toEqual('test');
expect(main.test()).toEqual('test hello 02/Tu/2014');
});

it('should successfully require @bazel/typescript', () => {
6 changes: 5 additions & 1 deletion e2e/typescript_3.1/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import {sayDate} from './lib';

console.log(sayDate());

export function test() {
return 'test';
return `test ${sayDate()}`;
}
2 changes: 2 additions & 0 deletions e2e/typescript_3.1/package.json
Original file line number Diff line number Diff line change
@@ -4,6 +4,8 @@
"@bazel/typescript": "bazel://@npm_bazel_typescript//:npm_package",
"@types/jasmine": "2.8.2",
"@types/node": "7.0.18",
"date-fns": "^1.30.1",
"source-map-support": "^0.5.10",
"typescript": "3.1.x"
},
"scripts": {
Loading