You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bootstrap issue when pulling @bazel/typescript from npm #275
I think the idea of using a yarn/npm-ed version of @bazel/typescript is not good for exactly the reason you have described: you have to run yarn locally before running bazel run @nodejs//:yarn.
I believe the 'correct' solution is to use yarn_install, loaded from rules_nodejs and have everything else (such as nodejs_binary) depend on it via the node_modules keyword.
@qzmfranklin There's an issue with using yarn_install to pull down the rules_typescript external repository in that yarn install puts the node_modules in an external repository and there is no way to point a local_repository with a path inside of an external repository.
The other option @alexeagle tried was to have node_repositories() run yarn and create the node_modules but because the node_module filegroup glob is eagerly evaluated when you run a bazel target, it is evaluated before node_repositories() runs and before the node_modules folder was created.
We're working on an idiomatic install solution where the rules_typescript bazel repository will be pulled down in the WORKSPACE via http_archive and but there will still be an npm package with a name like @bazel/typescript that contains just the compiled .js files needed for its actions. This is more idiomatic since we are not shipping typescript files in an npm package, it improves the initial build time slightly since tsc_wrapped.js is already compiled and available to the ts_library rule, and it still allows for @bazel/typescript to pull down any transitive npm dependencies that are required to run ts_library and other rules. We'll have a version check to ensure that the npm package and the external repository versions match.
I'll be working more on this this week. Stay tuned.
FInally resolved this with the release of npm fine grained deps and idiomatic install of rules_typescript. The @bazel/typescript npm package is now a .js only distribution and the build_bazel_rules_typescript is fetched via http_archive in your WORKSPACE.
Activity
qzmfranklin commentedon Aug 21, 2018
@gregmagolan 👍
I think the idea of using a
yarn/npm-ed version of@bazel/typescriptis not good for exactly the reason you have described: you have to runyarnlocally before runningbazel run @nodejs//:yarn.I believe the 'correct' solution is to use
yarn_install, loaded fromrules_nodejsand have everything else (such asnodejs_binary) depend on it via thenode_moduleskeyword.Any thoughts?
gregmagolan commentedon Sep 6, 2018
@qzmfranklin There's an issue with using yarn_install to pull down the rules_typescript external repository in that yarn install puts the node_modules in an external repository and there is no way to point a local_repository with a path inside of an external repository.
The other option @alexeagle tried was to have
node_repositories()run yarn and create the node_modules but because the node_module filegroup glob is eagerly evaluated when you run a bazel target, it is evaluated beforenode_repositories()runs and before the node_modules folder was created.We're working on an idiomatic install solution where the rules_typescript bazel repository will be pulled down in the WORKSPACE via
http_archiveand but there will still be an npm package with a name like@bazel/typescriptthat contains just the compiled .js files needed for its actions. This is more idiomatic since we are not shipping typescript files in an npm package, it improves the initial build time slightly since tsc_wrapped.js is already compiled and available to the ts_library rule, and it still allows for@bazel/typescriptto pull down any transitive npm dependencies that are required to runts_libraryand other rules. We'll have a version check to ensure that the npm package and the external repository versions match.I'll be working more on this this week. Stay tuned.
gregmagolan commentedon Oct 5, 2018
FInally resolved this with the release of npm fine grained deps and idiomatic install of rules_typescript. The @bazel/typescript npm package is now a .js only distribution and the build_bazel_rules_typescript is fetched via http_archive in your WORKSPACE.
See https://github.com/alexeagle/angular-bazel-example as an example. In this example, build_bazel_rules_typescript is fetched in the
rules_angular_dependencies()function which comes form the angular rules and@bazel/typescriptand@bazel/karmawhich are both published from https://github.com/bazelbuild/rules_typescript are fetched in the package.json file.A simple example that doesn't include angular is here: https://github.com/bazelbuild/rules_typescript/tree/master/internal/e2e/package_typescript_karma
Update to rules_nodejs 0.13.4
Update to rules_nodejs 0.13.4