Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Input hashes for repository rule npm_translate_lock(name = "npm", pnpm_lock = "//:pnpm-lock.yaml").
# This file should be checked into version control along with the pnpm-lock.yaml file.
.npmrc=-592547263
pnpm-lock.yaml=-1668408384
package.json=-56549297
8 changes: 8 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,11 @@ build --incompatible_py3_is_default=false
# build:remote-cache --remote_timeout=3600
# build:remote-cache --auth_enabled=true
# build:remote-cache --google_default_credentials=true

# passes an argument `--skipLibCheck` to *every* spawn of tsc
# Bazel 6.4 or greater: 'common' means 'any command that supports this flag'
common --@aspect_rules_ts//ts:skipLibCheck=always

# Between Bazel 6.0 and 6.3, you need all of this, to avoid discarding the analysis cache:
build --@aspect_rules_ts//ts:skipLibCheck=always
fetch --@aspect_rules_ts//ts:skipLibCheck=always
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.4.0
7.2.0
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hoist=false
72 changes: 18 additions & 54 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,68 +1,32 @@
load("@aspect_rules_js//js:defs.bzl", "js_binary", "js_library")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@aspect_rules_ts//ts:defs.bzl", "ts_config")

package(default_visibility = ["//visibility:public"])

load("@build_bazel_rules_nodejs//:index.bzl", "nodejs_binary")
npm_link_all_packages(name = "node_modules")

exports_files([
"tsconfig.json",
"package.json",
"readme.md",
"version.bzl",
"jsconfig.json"
])

PROTOBUF_DEPS = [
"@npm//protobufjs",
"@npm//protobufjs-cli",
# these deps are needed even though they are not automatic transitive deps of
# protobufjs since if they are not in the runfiles then protobufjs attempts to
# run `npm install` at runtime to get thhem which fails as it tries to access
# the npm cache outside of the sandbox
"@npm//semver",
"@npm//chalk",
"@npm//glob",
"@npm//jsdoc",
"@npm//minimist",
"@npm//tmp",
"@npm//uglify-js",
"@npm//uglify-es",
"@npm//espree",
"@npm//escodegen",
"@npm//estraverse",
]

nodejs_binary(
name = "pbjs",
data = PROTOBUF_DEPS,
entry_point = "@npm//:node_modules/protobufjs-cli/bin/pbjs",
)

nodejs_binary(
name = "pbts",
data = PROTOBUF_DEPS,
entry_point = "@npm//:node_modules/protobufjs-cli/bin/pbts",
js_library(
name = "package_json",
srcs = ["package.json"],
visibility = ["//visibility:public"],
)

nodejs_binary(
name = "tslint",
data = [
"@npm//tslint",
],
entry_point = "@npm//:node_modules/tslint/bin/tslint",
templated_args = ["--node_options=--preserve-symlinks"],
ts_config(
name = "tsconfig",
src = "tsconfig.json",
)

load("@bazel_gazelle//:def.bzl", "gazelle")

# gazelle:prefix github.com/dataform-co/dataform
# gazelle:proto package
# gazelle:proto_group go_package
gazelle(name = "gazelle")

load("//tools:ts_library.bzl", "ts_library")

# TODO: This is only here in order to workaround a bug in the way bazel resolves
# workspace imports when in nested repositories, and can be removed once that is fixed.
ts_library(
name = "modules-fix",
srcs = [],
module_name = "df",
js_binary(
name = "run_tslint",
entry_point = "//:node_modules/tslint/bin/tslint",
node_options = ["--preserve-symlinks"],
# install_source_map_support = False,
)
38 changes: 38 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module(
name = "df",
version = "3.0.2", # TODO: update automatically.
repo_name = "dataform",
)

####### rules_js #########

bazel_dep(name = "aspect_rules_js", version = "2.0.0")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)

npm.npm_translate_lock(
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
npmrc = "@@//:.npmrc",
)

use_repo(npm, "npm")

pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")

use_repo(pnpm, "pnpm")

############## rules_ts ###############

bazel_dep(name = "aspect_rules_ts", version = "3.0.0")

rules_ts_ext = use_extension("@aspect_rules_ts//ts:extensions.bzl", "ext", dev_dependency = True)

rules_ts_ext.deps(
ts_version_from = "//:package.json",
)

use_repo(rules_ts_ext, "npm_typescript")

##################################
866 changes: 866 additions & 0 deletions MODULE.bazel.lock

Large diffs are not rendered by default.

122 changes: 0 additions & 122 deletions WORKSPACE

This file was deleted.

40 changes: 19 additions & 21 deletions cli/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
load("//tools:ts_library.bzl", "ts_library")
load("//tools:ts_library.bzl", "ts_library", "ts_test_suite")
load("//tools/common:copy.bzl", "copy_file")
load("//:version.bzl", "DF_VERSION")
load("//testing:index.bzl", "ts_test_suite")
load("//tools:node_modules.bzl", "node_modules")

package(default_visibility = ["//visibility:public"])
Expand All @@ -21,17 +20,17 @@ ts_library(
"//core",
"//protos:ts",
"//sqlx:format",
"@npm//@types/glob",
"@npm//@types/long",
"@npm//@types/node",
"@npm//@types/readline-sync",
"@npm//@types/yargs",
"@npm//chokidar",
"@npm//glob",
"@npm//parse-duration",
"@npm//readline-sync",
"@npm//untildify",
"@npm//yargs",
"//:node_modules/@types/glob",
"//:node_modules/@types/long",
"//:node_modules/@types/node",
"//:node_modules/@types/readline-sync",
"//:node_modules/@types/yargs",
"//:node_modules/chokidar",
"//:node_modules/glob",
"//:node_modules/parse-duration",
"//:node_modules/readline-sync",
"//:node_modules/untildify",
"//:node_modules/yargs",
],
)

Expand All @@ -43,7 +42,6 @@ node_modules(
)

ts_test_suite(
name = "tests",
srcs = ["index_test.ts"],
data = [
":node_modules",
Expand All @@ -56,13 +54,13 @@ ts_test_suite(
"//core",
"//protos:ts",
"//testing",
"@npm//@types/chai",
"@npm//@types/fs-extra",
"@npm//@types/js-yaml",
"@npm//@types/node",
"@npm//chai",
"@npm//fs-extra",
"@npm//js-yaml",
"//:node_modules/@types/chai",
"//:node_modules/@types/fs-extra",
"//:node_modules/@types/js-yaml",
"//:node_modules/@types/node",
"//:node_modules/chai",
"//:node_modules/fs-extra",
"//:node_modules/js-yaml",
],
)

Expand Down
38 changes: 19 additions & 19 deletions cli/api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,24 @@ ts_library(
"//cli/vm:compile_loader",
"//sqlx:lexer",
"//cli/vm:vm",
"@npm//@google-cloud/bigquery",
"@npm//@types/fs-extra",
"@npm//@types/glob",
"@npm//@types/js-beautify",
"@npm//@types/js-yaml",
"@npm//@types/long",
"@npm//@types/node",
"@npm//@types/semver",
"@npm//@types/tmp",
"@npm//deepmerge",
"@npm//fs-extra",
"@npm//glob",
"@npm//google-sql-syntax-ts",
"@npm//js-beautify",
"@npm//js-yaml",
"@npm//promise-pool-executor",
"@npm//protobufjs",
"@npm//semver",
"@npm//tmp",
"//:node_modules/@google-cloud/bigquery",
"//:node_modules/@types/fs-extra",
"//:node_modules/@types/glob",
"//:node_modules/@types/js-beautify",
"//:node_modules/@types/js-yaml",
"//:node_modules/@types/long",
"//:node_modules/@types/node",
"//:node_modules/@types/semver",
"//:node_modules/@types/tmp",
"//:node_modules/deepmerge",
"//:node_modules/fs-extra",
"//:node_modules/glob",
"//:node_modules/google-sql-syntax-ts",
"//:node_modules/js-beautify",
"//:node_modules/js-yaml",
"//:node_modules/promise-pool-executor",
"//:node_modules/protobufjs",
"//:node_modules/semver",
"//:node_modules/tmp",
],
)
Loading