8000 feat: add contrib/nextjs rules for building and running nextjs applications by jbedard · Pull Request #2150 · aspect-build/rules_js · GitHub
[go: up one dir, main page]

Skip to content

feat: add contrib/nextjs rules for building and running nextjs applications #2150

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

Merged
merged 1 commit into from
Apr 4, 2025

Conversation

jbedard
Copy link
Member
@jbedard jbedard commented Apr 2, 2025

Ref #1292
Close #1126


Changes are visible to end-users: yes

  • Searched for relevant documentation and updated as needed: yes
  • Breaking change (forces users to change their own code or config): no
  • Suggested release notes appear below: yes

Provide @aspect_rules_js//contrib/nextjs:defs.bzl for convenience macros for NextJs applications built using next.

Primary API:

  • next() wrapper of the 3 primary build, start and dev macros - aligning with package.json bin entries created by create-next-app
  • nextjs_build() - the npm next build
  • nextjs_start() - the npm next start (where the build is a dependency)
  • nextjs_dev() - the npm next dev

Standalone server API, where custom pnpm+bazel logic is required:

  • nextjs_standalone_build() is the standard next build but with some workarounds or output: standalone
  • nextjs_standalone_server() follows the standalone mode instructions for rearranging the directory structure, then defines a js_binary to run the server.js within that directory

Test plan

  • New test cases added

8000
@jbedard jbedard requested a review from alexeagle April 2, 2025 00:03
Copy link
aspect-workflows bot commented Apr 2, 2025

Test

1 test target passed

Targets
//docs:update_11_test [k8-fastbuild] 27ms

Total test execution time was 27ms. 236 tests (99.6%) were fully cached saving 33s.


Test

e2e/bzlmod

All tests were cache hits

5 tests (100.0%) were fully cached saving 502ms.


Test

e2e/gyp_no_install_script

All tests were cache hits

2 tests (100.0%) were fully cached saving 169ms.


Test

e2e/js_image_oci

All tests were cache hits

1 test (100.0%) was fully cached saving 2s.


Test

e2e/npm_link_package

All tests were cache hits

3 tests (100.0%) were fully cached saving 448ms.


Test

e2e/npm_link_package-esm

All tests were cache hits

3 tests (100.0%) were fully cached saving 533ms.


Test

e2e/npm_translate_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Test

e2e/npm_translate_lock_empty

All tests were cache hits

1 test (100.0%) was fully cached saving 30ms.


Test

e2e/npm_translate_lock_multi

All tests were cache hits

2 tests (100.0%) were fully cached saving 268ms.


Test

e2e/npm_translate_lock_partial_clone

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Test

e2e/npm_translate_lock_replace_packages

All tests were cache hits

3 tests (100.0%) were fully cached saving 603ms.


Test

e2e/npm_translate_lock_subdir_patch

All tests were cache hits

1 test (100.0%) was fully cached saving 98ms.


Test

e2e/npm_translate_package_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Test

e2e/npm_translate_yarn_lock

All tests were cache hits

1 test (100.0%) was fully cached saving 31ms.


Test

e2e/package_json_module

All tests were cache hits

1 test (100.0%) was fully cached saving 253ms.


Test

e2e/pnpm_lockfiles

All tests were cache hits

42 tests (100.0%) were fully cached saving 3s.


Test

e2e/pnpm_workspace

All tests were cache hits

10 tests (100.0%) were fully cached saving 2s.


Test

e2e/pnpm_workspace_rerooted

All tests were cache hits

12 tests (100.0%) were fully cached saving 2s.


Test

e2e/repo_mapping

All tests were cache hits

3 tests (100.0%) were fully cached saving 404ms.


Test

e2e/rules_foo

All tests were cache hits

2 tests (100.0%) were fully cached saving 187ms.


Test

e2e/runfiles

All tests were cache hits

1 test (100.0%) was fully cached saving 173ms.


Test

e2e/vendored_node

All tests were cache hits

1 test (100.0%) was fully cached saving 99ms.


Buildifier      Format

@jbedard jbedard force-pushed the rules_js-contrib-nextjs branch from 0f1eb19 to bd43409 Compare April 2, 2025 01:04
@jbedard jbedard force-pushed the rules_js-contrib-nextjs branch 8 times, most recently from c4a6105 to 41f6157 Compare April 3, 2025 23:32
@jbedard jbedard requested a review from alexeagle April 3, 2025 23:33
@jbedard jbedard force-pushed the rules_js-contrib-nextjs branch from 41f6157 to 4d140cc Compare April 3, 2025 23:36
8000
Copy link
@Izzy-CodersPlanet Izzy-CodersPlanet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! ✅

@jbedard jbedard force-pushed the rules_js-contrib-nextjs branch from 4d140cc to bc81760 Compare April 3, 2025 23:55
@jbedard
Copy link
Member Author
jbedard commented Apr 3, 2025

@Izzy-CodersPlanet want to try it out? Have any feedback?

@jbedard jbedard force-pushed the rules_js-contrib-nextjs branch 5 times, most recently from 7fee939 to 99029a4 Compare April 4, 2025 19:08
@jbedard jbedard force-pushed the rules_js-contrib-nextjs branch from 99029a4 to 31f508d Compare April 4, 2025 19:14
@jbedard
Copy link
Member Author
jbedard commented Apr 4, 2025

FYI @domenic-donato

@jbedard jbedard force-pushed the rules_js-contrib-nextjs branch from 31f508d to 437c803 Compare April 4, 2025 19:25
@jbedard jbedard marked this pull request as ready for review April 4, 2025 19:46
Copy link
Member
@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@alexeagle alexeagle merged commit 4862223 into aspect-build:main Apr 4, 2025
98 checks passed
@domenic-donato
Copy link
domenic-donato commented Apr 5, 2025

Awesome, thank you! 🚀

@jbedard jbedard deleted the rules_js-contrib-nextjs branch April 11, 2025 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: next.js js_image_layer targets fails symlink identification for .next
4 participants
0