File
Blob: src/workerd/api/tests/opennextjs/src/BUILD.bazel
| 1 | load("@aspect_rules_js//js:defs.bzl", "js_run_binary") |
| 2 | load("@npm//:defs.bzl", "npm_link_all_packages") |
| 3 | load("@npm//src/workerd/api/tests/opennextjs/src:@opennextjs/cloudflare/package_json.bzl", opennext_bin = "bin") |
| 4 | load("@npm//src/workerd/api/tests/opennextjs/src:wrangler/package_json.bzl", wrangler_bin = "bin") |
| 5 | |
| 6 | npm_link_all_packages(name = "node_modules") |
| 7 | |
| 8 | opennext_bin.opennextjs_cloudflare_binary( |
| 9 | name = "opennextjs_cloudflare_bin", |
| 10 | ) |
| 11 | |
| 12 | wrangler_bin.wrangler_binary( |
| 13 | name = "wrangler_bin", |
| 14 | ) |
| 15 | |
| 16 | js_run_binary( |
| 17 | name = "opennextjs-build", |
| 18 | srcs = [ |
| 19 | "jsconfig.json", |
| 20 | "next.config.mjs", |
| 21 | "open-next.config.mjs", |
| 22 | "package.json", |
| 23 | "wrangler.jsonc", |
| 24 | ":node_modules/@opennextjs/cloudflare", |
| 25 | ":node_modules/esbuild", |
| 26 | ":node_modules/next", |
| 27 | ":node_modules/react", |
| 28 | ":node_modules/react-dom", |
| 29 | ] + glob([ |
| 30 | "app/**/*.js", |
| 31 | "app/**/*.jsx", |
| 32 | ]), |
| 33 | args = [ |
| 34 | "build", |
| 35 | "--openNextConfigPath", |
| 36 | "open-next.config.mjs", |
| 37 | ], |
| 38 | chdir = package_name(), |
| 39 | execution_requirements = {"no-sandbox": "1"}, |
| 40 | out_dirs = [".open-next"], |
| 41 | patch_node_fs = False, |
| 42 | tags = ["no-downstream"], |
| 43 | target_compatible_with = ["@platforms//os:linux"], |
| 44 | tool = ":opennextjs_cloudflare_bin", |
| 45 | visibility = ["//visibility:public"], |
| 46 | ) |
| 47 | |
| 48 | # wrangler deploy --dry-run --outdir=dist |
| 49 | js_run_binary( |
| 50 | name = "opennextjs-worker", |
| 51 | srcs = [ |
| 52 | "wrangler.jsonc", |
| 53 | ":node_modules/@opennextjs/cloudflare", |
| 54 | ":node_modules/esbuild", |
| 55 | ":node_modules/wrangler", |
| 56 | ":opennextjs-build", |
| 57 | ], |
| 58 | outs = [ |
| 59 | "dist/README.md", |
| 60 | "dist/worker.js", |
| 61 | "dist/worker.js.map", |
| 62 | ], |
| 63 | args = [ |
| 64 | "deploy", |
| 65 | "--dry-run", |
| 66 | "--outdir=dist", |
| 67 | ], |
| 68 | chdir = package_name(), |
| 69 | execution_requirements = {"no-sandbox": "1"}, |
| 70 | patch_node_fs = False, |
| 71 | tags = ["no-downstream"], |
| 72 | target_compatible_with = ["@platforms//os:linux"], |
| 73 | tool = ":wrangler_bin", |
| 74 | visibility = ["//visibility:public"], |
| 75 | ) |