Compare commits

...

138 Commits

Author SHA1 Message Date
Austin Fahsl 585d702614 fix(release): currentVersionResolver git-tag should prefer merged tags (#22082) 2024-02-29 17:31:30 -05:00
Jack Hsu a9d39c4c8f fix(core): nextjs-standalone generates package scripts consistent with create-next-app (#21996) 2024-02-29 17:31:26 -05:00
Leosvel Pérez Espinosa 666c1f470b fix(misc): fix buildable libs utils calculating dependent projects from task graph (#22015) 2024-02-29 17:31:22 -05:00
Katerina Skroumpelou 5264cf6c29 fix(misc): make sure to add e2e crystal plugin (#22041) 2024-02-29 17:31:19 -05:00
Nicholas Cunningham d54e934303 fix(nuxt): Add e2e-ci and serve-static targets (#22056) 2024-02-29 17:31:04 -05:00
Katerina Skroumpelou 1d8f3baef8 fix(nuxt): fix storybook preview config path (#22020) 2024-02-29 17:30:37 -05:00
Nicholas Cunningham 1f6baa753f fix(node): Increase timeout for CI (#22003) 2024-02-29 17:30:34 -05:00
Jack Hsu 2dac233cf8 fix(js): set moduleResolution to Node10 so it is compatible with CommonJS module 2024-02-23 18:21:17 -05:00
Jack Hsu 9aedc68923 fix(core): update generated README pages with more useful instructions (#21976) 2024-02-23 16:27:44 -05:00
Leosvel Pérez Espinosa 7cc1a999d4 fix(misc): set nx property in root package.json when no replacing script in nx init (#21974) 2024-02-23 16:27:40 -05:00
Craigory Coppola 81a347d568 fix(core): target defaults application shouldn't include extra scripts (#21970) 2024-02-23 16:27:37 -05:00
Leosvel Pérez Espinosa e0077ca2ea fix(core): normalize migration target versions when sorting migrations (#21967) 2024-02-23 16:27:34 -05:00
Katerina Skroumpelou 93cbdb4b14 fix(nuxt): tsconfig types and output dir (#21934) 2024-02-23 16:27:31 -05:00
Leosvel Pérez Espinosa b0f4a17621 fix(linter): fix eslint-plugin migration target version (#21966) 2024-02-23 16:27:27 -05:00
Colum Ferry 6e50dfcd0f fix(react): ensure playwright configuration is using correct port in app gen (#21941) 2024-02-23 16:27:19 -05:00
Craigory Coppola b1fa2bd0cf fix(testing): add null checks when reading targets (#21952) 2024-02-23 16:25:51 -05:00
Craigory Coppola e8209ec847 fix(testing): playwright plugin enoent error (#21951) 2024-02-23 16:25:48 -05:00
Craigory Coppola b724efe7f3 fix(misc): logs from rm-default-collection should render properly (#21953) 2024-02-23 16:25:45 -05:00
Craigory Coppola 3194ed3347 fix(repo): update browser tools to fix ci (#21955) 2024-02-23 16:25:42 -05:00
Steven Nance de9b6d271d fix(devkit): respect expectComments when parsing json (#21584) 2024-02-23 16:25:38 -05:00
Katerina Skroumpelou c4cacf1fb2 fix(vite): update vitest and use parseCLI (#21890) 2024-02-23 16:25:30 -05:00
Colum Ferry 2cf9d1e6cd fix(testing): ensure baseUrl is not passed to playwright cli (#21943) 2024-02-23 16:23:55 -05:00
Leosvel Pérez Espinosa fe1ac80f8c fix(angular): ensure generated editor tsconfig in apps only include runtime files (#21945) 2024-02-23 16:23:51 -05:00
Leosvel Pérez Espinosa 662b7089ed fix(angular): do not add target defaults for the ng-packagr-lite executor when generating non-buildable library (#21935) 2024-02-23 16:23:48 -05:00
Emily Xiong 3cde493b99 fix(graph): fix open project with / in name (#21722)
Co-authored-by: Jason Jean <jasonjean1993@gmail.com>
2024-02-23 16:23:45 -05:00
Jonathan Cammisuli e9748326ff fix(core): do not use the new pty function for older versions of windows (#21854) 2024-02-23 16:23:39 -05:00
Jack Hsu da46c303e8 fix(webpack): surface original error when remotes fail to start (#21919) 2024-02-23 16:23:35 -05:00
Katerina Skroumpelou 39a449ff08 fix(core): include nx/nuxt in migrations (#21885) 2024-02-23 16:23:32 -05:00
Leosvel Pérez Espinosa 40233a2949 fix(testing): pin cypress version to avoid issue with verifying cypress (#21917) 2024-02-23 16:23:07 -05:00
Katerina Skroumpelou 85c840d92f fix(nuxt): turn on autoimport (#21894) 2024-02-23 16:23:04 -05:00
Colum Ferry c7731e0044 fix(nuxt): init generator should add @nx/vite to dependencies (#21911) 2024-02-23 16:23:00 -05:00
Craigory Coppola 97b0282c7b fix(core): read all targets from package json when defining target defaults (#21719) 2024-02-23 16:22:57 -05:00
Miroslav Jonaš 4acc245b50 fix(core): align terminal output padding and remove leading arrow (#21809) 2024-02-23 16:22:53 -05:00
Miroslav Jonaš abe273df5a fix(core): ensure migrate works with yarn PnP (#21824) 2024-02-23 16:22:48 -05:00
Katerina Skroumpelou b7f0bdffa4 fix(vite): project conversion generator (#21646) 2024-02-23 16:21:51 -05:00
Colum Ferry d55add9b46 fix(remix): typo in tsconfig.spec.json update led to invalid tsconfig (#21886) 2024-02-23 16:21:47 -05:00
Dan Roujinsky a1e22c08d5 fix(webpack): correctly handle paranthesis in PostCSS in url (#21884) 2024-02-23 16:21:44 -05:00
Viktor Pöntinen 71ae788eae fix(remix): adjust remix start script when building (#21883) 2024-02-23 16:21:37 -05:00
Tine Kondo afc9c988be fix(core): propagate verbose flag when running init generator dur… (#21868) 2024-02-23 16:21:32 -05:00
Leosvel Pérez Espinosa a36d5c61b0 fix(vite): normalize vitest cli args in executor (#21870) 2024-02-23 16:21:29 -05:00
Julian Martin 0ecfcc4e61 fix(vue): tailwind generator ignoring styleSheet option (#21840) 2024-02-23 16:21:25 -05:00
Nicholas Cunningham e9af4b309e fix(nextjs): Add missing e2e-ci target for cypress (#21805) 2024-02-23 16:21:21 -05:00
Zachary DeRose b9d4a53913 fix(vue): fixing vue and nuxt welcome templates (#21792) 2024-02-23 16:21:18 -05:00
Colum Ferry 5e21d4cfc2 fix(remix): the output path should respect the remix.config.js in crystal (#21842) 2024-02-23 16:21:14 -05:00
Colum Ferry ca14bb0490 fix(remix): should add remix plugin to nx.json on init correctly (#21827) 2024-02-23 16:21:10 -05:00
Emily Xiong 462dee750f fix(react-native): add all flag to sync-deps (#21821) 2024-02-23 16:21:07 -05:00
Nicholas Cunningham 3054cad0c4 fix(core): Update NxWelcome connect to cloud (#21830) 2024-02-23 16:21:03 -05:00
Emily Xiong 97eea7c10a fix(react-native): change gradlew to absolute path (#21725) 2024-02-23 16:20:54 -05:00
Emily Xiong 813b3dbb74 fix(webpack): resolve relative path for assets inputs (#21822) 2024-02-23 16:20:51 -05:00
Austin Fahsl 0a3d4616e3 fix(release): move github release creation to git tasks (#21510) 2024-02-23 16:20:47 -05:00
Colum Ferry c9407dda14 fix(js): swc executor should support inlining on windows (#21801) 2024-02-23 16:20:42 -05:00
Vadim Goy 4bbf4f1efe fix(react): full support custom secure host for module federation (#21777)
Co-authored-by: Vadim Goy <vadim.goy@zoominfo.com>
2024-02-23 16:20:36 -05:00
Emily Xiong 58435682f1 fix(testing): fix cypress project targets does not exist (#21785) 2024-02-23 16:20:32 -05:00
Leosvel Pérez Espinosa a0f2d4be0f fix(core): run migrations ordered by their target version (#21799) 2024-02-23 16:20:26 -05:00
Austin Fahsl 705ca029b4 fix(release): use --first-parent to support merged repos (#21686) 2024-02-23 16:20:23 -05:00
Remco Krams e46d9def17 fix(react): generate correctly when --js is used for module federation host/remote (#20119)
Co-authored-by: Jack Hsu <jack.hsu@gmail.com>
2024-02-23 16:20:09 -05:00
Edouard Bozon 714e140f6a fix(release): skip prompt for publish when no version created (#21769) 2024-02-23 16:20:05 -05:00
Colum Ferry ebdbc455a3 fix(testing): jest should handle root jest.preset.cjs (#21746) 2024-02-23 16:20:02 -05:00
Colum Ferry 25fe0d260a fix(js): nx release-version resolve-version-spec should normalize fetchSpec (#21710) 2024-02-23 16:19:58 -05:00
Nicholas Cunningham 5e7a074ed3 fix(nextjs): Svg should work when svgr is true in next config (#21761) 2024-02-23 16:19:53 -05:00
Leosvel Pérez Espinosa 7e64aae099 cleanup(misc): cleanup misc e2e tests (#21704)
(cherry picked from commit e810f82124)
2024-02-09 18:21:31 -05:00
Emily Xiong 02ff0bd0b2 fix(playwright): fix include in tsconfig.json (#21730)
(cherry picked from commit 27faa7d017)
2024-02-09 18:21:30 -05:00
Jason Jean e4c40d66e0 fix(testing): ensure cypress closes the web dev server (#21759)
(cherry picked from commit 2fe4396e51)
2024-02-09 18:21:29 -05:00
Emily Xiong a50d119d73 feat(core): update swc/register (#21755)
(cherry picked from commit f3cdce0c7a)
2024-02-09 18:21:27 -05:00
James Henry c5f2e80a0e fix(core): static run one lifecycle should always print dependent task status, and output when verbose (#21720)
(cherry picked from commit 5911ca653b)
2024-02-09 18:21:26 -05:00
Nicholas Cunningham 78ef14e8c5 fix(nextjs): Custom server should work with Crystal (#21736)
(cherry picked from commit 9683ebca24)
2024-02-09 18:21:25 -05:00
Jack Hsu 73a013cd8c fix(js): babel preset should also check for JEST_WORKER_ID to transpile to CJS (#21754)
(cherry picked from commit 70ea82d58c)
2024-02-09 18:21:24 -05:00
James Henry 4adc24fab4 fix(release): do not stop daemon in dry-run (#21743)
(cherry picked from commit a568df2934)
2024-02-09 18:21:23 -05:00
James Henry 342ce28673 fix(release): ensure nx release publish --graph only includes projects with target (#21726)
(cherry picked from commit 114faf85b0)
2024-02-09 18:21:22 -05:00
Leosvel Pérez Espinosa 1c161c61d5 fix(angular): add missing forceEsbuild option to dev-server executor (#21753)
(cherry picked from commit 3e193b94b6)
2024-02-09 18:21:21 -05:00
Isaac Mann d7f5cb0a12 docs(core): expand e2e split guide (#21689)
(cherry picked from commit a8dfc299e8)
2024-02-09 18:21:20 -05:00
Juri Strumpflohner c5cc33b762 feat(nx-dev): update launch page link text (#21747)
(cherry picked from commit df60a60c10)
2024-02-09 18:21:19 -05:00
Leosvel Pérez Espinosa ebbd798b4e fix(testing): increase the default timeout to 15s for the dev server to start (#21716)
(cherry picked from commit fdae86c81c)
2024-02-09 18:21:19 -05:00
Isaac Mann b2acd0fcef docs(core): fix home page links (#21749)
(cherry picked from commit d5a4fd886b)
2024-02-09 18:21:18 -05:00
Leosvel Pérez Espinosa ad43e66deb fix(misc): pin generated vite version to ~5.0.0 to avoid issues with storybook (#21740)
(cherry picked from commit d2272fdebd)
2024-02-09 18:21:17 -05:00
Philip Fulcher efdda7b22f docs(nx-dev): revert back to standard layout for launch nx page (#21732)
(cherry picked from commit 3b21cefd8c)
2024-02-09 18:21:16 -05:00
Zachary DeRose 076e7fce2a docs(misc): thursday announcement (#21728)
(cherry picked from commit 9b4ee1bba7)
2024-02-09 18:21:15 -05:00
Philip Fulcher d427edbcc1 docs(nx-dev): livestream template (#21678)
(cherry picked from commit 5f21561841)
2024-02-09 18:21:14 -05:00
Jonathan Cammisuli f7597465ea docs(core): remove beta tags from AI chat (#21708)
(cherry picked from commit 81410e496a)
2024-02-09 18:21:13 -05:00
Colum Ferry ae090ef35c fix(remix): do not rename root jest.preset.js (#21703)
(cherry picked from commit ec00acd4eb)
2024-02-09 18:21:12 -05:00
Leosvel Pérez Espinosa 5b507042d5 docs(testing): fix example in cypress overview for configuration generator (#21717)
(cherry picked from commit 7b807a9c5d)
2024-02-09 18:21:11 -05:00
Leosvel Pérez Espinosa dc48960240 fix(module-federation): map static remote locations correctly (#21709)
(cherry picked from commit 7f4c97e5a7)
2024-02-09 18:21:10 -05:00
Juri db78715a70 feat(nx-dev): update launch conf timings
(cherry picked from commit a0e4cf747d)
2024-02-09 18:21:09 -05:00
Miroslav Jonaš 3ecf9a0ae4 fix(nx-dev): remove fence from new packages and "nx add" commands (#21705)
(cherry picked from commit 3ead01987b)
2024-02-09 18:21:08 -05:00
Austin Fahsl 90a10a89c4 fix(release): logging improvements (#21692)
(cherry picked from commit 49bba42d37)
2024-02-09 18:21:07 -05:00
Leosvel Pérez Espinosa 36235051fb fix(angular): generate app server module setup correctly in setup-ssr generator (#21702)
(cherry picked from commit ab9c57994b)
2024-02-09 18:21:06 -05:00
Leosvel Pérez Espinosa 8464b64ea7 fix(angular): resolve the index html transformer correctly for esbuild based build targets in dev-server (#21679)
(cherry picked from commit db4c617c2c)
2024-02-09 18:21:05 -05:00
Yu Zheng 280056c7a0 feat(expo): support cjs and mjs (#21408)
Co-authored-by: Miroslav Jonaš <missing.manual@gmail.com>
(cherry picked from commit bf45f08992)
2024-02-09 18:21:04 -05:00
DJ Stelmach d7815fa2a5 docs(nx-dev): nx plugin submission @dman926/nx-python-pdm (#20416)
Co-authored-by: Isaac Mann <isaacplmann@users.noreply.github.com>
Co-authored-by: Miroslav Jonaš <missing.manual@gmail.com>
(cherry picked from commit 17d058857b)
2024-02-09 18:21:03 -05:00
Miroslav Jonas 89797d2f7a fix(core): remove implementation detail from warning
(cherry picked from commit 18efd62003)
2024-02-09 18:21:02 -05:00
Nicholas Cunningham b0506c9f8f fix(nextjs): src package.json should not be copied to output folder
closes: #21535
(cherry picked from commit aa622bab5a)
2024-02-09 18:21:02 -05:00
Jason Jean 5b3af217ed chore(repo): disable failing e2e test (#21690)
(cherry picked from commit 202f141778)
2024-02-09 18:21:01 -05:00
Nicholas Cunningham 49b3bdda30 docs(webpack): Add docs for webpack ci deployment (#21650)
Co-authored-by: Isaac Mann <isaacplmann@users.noreply.github.com>
(cherry picked from commit a6ceef6b98)
2024-02-07 18:17:34 -05:00
Craigory Coppola d64deae065 fix(testing): cleanup e2e atomization plugins (#21688)
(cherry picked from commit ebbb2f0241)
2024-02-07 18:17:33 -05:00
Jonathan Cammisuli 785178969e fix(core): handle blocking stdin (#21672)
(cherry picked from commit 1dd363706b)
2024-02-07 18:17:32 -05:00
Leosvel Pérez Espinosa 3eb2090c09 fix(misc): ensure swc transpiler process required files (#21674)
(cherry picked from commit 0f1207e825)
2024-02-07 18:17:31 -05:00
Jack Hsu 68ebcca812 fix(vite): import esbuild before loading config to keep it in cache (#21685)
(cherry picked from commit db8b37f809)
2024-02-07 18:17:30 -05:00
Jonathan Cammisuli 5683b5389e fix(core): temporary use forked portable_pty to inherit cursor position for windows (#21683)
(cherry picked from commit e0d8eab0f5)
2024-02-07 18:17:29 -05:00
Zachary DeRose f49fa31b7c docs(misc): adding wednesday's launch (#21661)
Co-authored-by: Juri <juri.strumpflohner@gmail.com>
(cherry picked from commit a86b6291c8)
2024-02-07 18:17:28 -05:00
Miroslav Jonas 3078ecf66f fix(core): add missing parts to ci workflws and update docs
(cherry picked from commit ab76d6291a)
2024-02-07 18:17:27 -05:00
Juri Strumpflohner 37649ebfd4 fix(nx-dev): redirect on remote caching page (#21669)
(cherry picked from commit 2413e5daa5)
2024-02-07 18:17:26 -05:00
Colum Ferry 9bf2613f9e cleanup(angular): e2es should add targetDefaults when using buildable libs (#21667)
(cherry picked from commit 8cbb36fb37)
2024-02-07 18:17:25 -05:00
Juri e8d2b471a8 fix(nx-dev): launch page mobile experience
(cherry picked from commit de676e207f)
2024-02-07 18:17:24 -05:00
Victor Savkin acdf13b67a docs(core): document windows resource class
(cherry picked from commit 6485e3cc4a)
2024-02-07 18:17:23 -05:00
Jason Jean 5315052fc4 chore(repo): update nx to 18.0.2 (#21562)
(cherry picked from commit 7409125639)
2024-02-07 18:17:22 -05:00
Katerina Skroumpelou 3b4ac84a30 docs(storybook): update docs about browserTarget (#21642)
(cherry picked from commit f4fa014ff6)
2024-02-07 18:17:21 -05:00
Nikita Barsukov 985fb4c9d3 feat(bundling): bump rollup-plugin-typescript2 version (#20609)
(cherry picked from commit fa226c9a9a)
2024-02-07 18:17:20 -05:00
Colum Ferry 88859bf37e fix(angular): ajv hoisting issue (#21641)
(cherry picked from commit 448a83a116)
2024-02-07 18:17:19 -05:00
Rares Matei 67d47a6c49 chore(repo): use the latest v3 image to avoid caching issues (#21648)
(cherry picked from commit ebca8e24cf)
2024-02-07 18:17:18 -05:00
Zachary DeRose ee06f0fd83 docs(misc): launch nx tuesday announcement (#21645)
(cherry picked from commit 9046eef903)
2024-02-07 18:17:17 -05:00
Miroslav Jonaš c638f6b0b9 fix(linter): adjust terminal run check for crystal (#21638)
(cherry picked from commit f79aabba46)
2024-02-07 18:17:16 -05:00
Colum Ferry 3d2ffc9d3f feat(remix): add playwright option for e2eTestRunner (#21603)
(cherry picked from commit ab5137c639)
2024-02-07 18:17:15 -05:00
Jack Hsu 7b0c86924f fix(webpack): require ForkTsCheckerWebpackPlugin only as required (#21629)
(cherry picked from commit bf62661bb9)
2024-02-05 18:20:03 -05:00
Nicholas Cunningham fde900b607 fix(nextjs): Enable next e2e test (#21625)
(cherry picked from commit 7285253b8e)
2024-02-05 18:20:00 -05:00
Craigory Coppola 2ebfee5781 fix(core): prevent target defaults from being discarded during merge process (#21624)
(cherry picked from commit b1253d8af6)
2024-02-05 18:19:57 -05:00
Philip Fulcher 7ee4137638 docs(nx-dev): improvements to launch nx page (#21621)
(cherry picked from commit fb0df72de5)
2024-02-05 18:19:53 -05:00
Jack Hsu 5a8a56dc15 fix(core): remove logic to reload process with esm loader for Node 18 (#21623)
(cherry picked from commit 7086f5700e)
2024-02-05 18:19:48 -05:00
Altan Stalker f7ed73d088 docs(nx-cloud): add troubleshooting section for "ci execution failed" (#21622)
(cherry picked from commit 55d3055d0e)
2024-02-05 18:19:42 -05:00
Jason Jean cb8e02bf88 docs(core): document NX_ADD_PLUGINS environment variable (#21565)
(cherry picked from commit f950f9b68d)
2024-02-05 18:19:39 -05:00
Leosvel Pérez Espinosa fbb24615b2 fix(angular): support inferred cypress targets in setup-mf generator (#21619)
(cherry picked from commit 758c1ab70e)
2024-02-05 18:19:36 -05:00
Leosvel Pérez Espinosa df446f7b1e cleanup(angular): re-add assertion to expect successful port kill in e2e test (#21620)
(cherry picked from commit 86ba07e2a8)
2024-02-05 18:19:33 -05:00
Leosvel Pérez Espinosa 2a7743c543 cleanup(testing): re-enable cypress e2e tests (#21604)
(cherry picked from commit 0d9997a213)
2024-02-05 18:19:30 -05:00
Jack Hsu 563ebc2494 chore(misc): re-enable e2e-react-core tests (#21542)
(cherry picked from commit bca5b70553)
2024-02-05 18:19:26 -05:00
Isaac Mann 31f61f8527 docs(core): update nx node matrix (#21608)
(cherry picked from commit d83300a285)
2024-02-05 18:19:23 -05:00
Katerina Skroumpelou 8764424e9b fix(nx-dev): redirect core-features page (#21616)
(cherry picked from commit 7513da3aca)
2024-02-05 18:19:19 -05:00
Isaac Mann 81d73e3512 docs(core): redirect for nx-agents (#21617)
(cherry picked from commit 19fc320e20)
2024-02-05 18:19:17 -05:00
Leosvel Pérez Espinosa 4056645034 fix(misc): handle workspaces if no plugin selected in nx init and only generate files after prompts (#21606)
(cherry picked from commit 717d45f884)
2024-02-05 18:19:13 -05:00
Nicholas Cunningham 66f3bcb633 fix(node): Broken E2E tests (#21569)
(cherry picked from commit 371a1ed6b8)
2024-02-05 18:19:10 -05:00
Rares Matei bbe8e6678d chore(repo): install lsof and other e2e deps (#21615)
(cherry picked from commit f38ad96ec5)
2024-02-05 18:19:07 -05:00
Jack Hsu c5a44ef4ae fix(core): pass the full resolved path of ts-node/esm when reloading the CLI (#21607)
(cherry picked from commit b97958c1b3)
2024-02-05 18:19:03 -05:00
Jack Hsu 8dd1db291e fix(nextjs): move next/constants from top-level import to when it is needed (#21612)
(cherry picked from commit 44d33c243a)
2024-02-05 18:19:00 -05:00
Isaac Mann 1fe809f6d6 docs(core): project crystal video (#21605)
(cherry picked from commit 140d22f7a3)
2024-02-05 18:18:56 -05:00
Philip Fulcher 489aa8f2e0 docs(nx-dev): add launch nx announcements template (#21557)
Co-authored-by: Juri <juri.strumpflohner@gmail.com>
(cherry picked from commit a6ddf08201)
2024-02-05 18:18:53 -05:00
Laurence "DC5B" Lord 7a44f6ea22 Correct typo (#21597)
Co-authored-by: Isaac Mann <isaacplmann@gmail.com>
(cherry picked from commit a02af1615a)
2024-02-05 18:18:50 -05:00
Leosvel Pérez Espinosa 577061c5a1 fix(angular): fix wrong trailing comma in mf bootstrap code generation (#21600)
(cherry picked from commit 04211785e8)
2024-02-05 18:18:46 -05:00
Pascal Brewing 984edacd41 docs(core): add analogjs nx plugin to approved-plugins.json (#21080)
Co-authored-by: PASCAL BREWING <pascal.brewing@mercedes-benz.com>
(cherry picked from commit 48296b043d)
2024-02-05 18:18:43 -05:00
Jack Hsu 7163769b39 chore(nextjs): remove tests that are unnecessary (#21566)
(cherry picked from commit a524665073)
2024-02-05 18:18:40 -05:00
Miroslav Jonaš 01831e3e67 chore(linter): fix and reenable disabled eslint test (#21601)
(cherry picked from commit c1ede83d62)
2024-02-05 18:18:37 -05:00
474 changed files with 9247 additions and 5168 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ version: 2.1
orbs:
nx: nrwl/nx@1.6.2
rust: circleci/rust@1.6.0
browser-tools: circleci/browser-tools@1.4.6
browser-tools: circleci/browser-tools@1.4.8
# -------------------------
# EXECUTORS
+1
View File
@@ -31,6 +31,7 @@ CHANGELOG.md
# Next.js
.next
out
# Angular Cache
.angular
+5 -2
View File
@@ -1,7 +1,7 @@
launch-templates:
linux-medium:
resource-class: 'docker_linux_amd64/medium+'
image: 'ubuntu22.04-node20.9-v2'
image: 'ubuntu22.04-node20.9-v3'
env:
GIT_AUTHOR_EMAIL: test@test.com
GIT_AUTHOR_NAME: Test
@@ -21,7 +21,10 @@ launch-templates:
~/.cache/Cypress
~/.pnpm-store
BASE_BRANCH: 'master'
- name: Install e2e deps
script: |
sudo apt-get update
sudo apt-get install -y ca-certificates lsof
- name: Install Pnpm
script: |
npm install -g @pnpm/exe@8.7.4
Generated
+4 -5
View File
@@ -482,9 +482,8 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "filedescriptor"
version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7199d965852c3bac31f779ef99cbb4537f80e952e2d6aa0ffeb30cce00f4f46e"
version = "0.8.3"
source = "git+https://github.com/cammisuli/wezterm#3db3f2d05f7188af9c7527214605f18332fac06d"
dependencies = [
"libc",
"thiserror",
@@ -1537,6 +1536,7 @@ dependencies = [
"ignore",
"ignore-files 2.0.0",
"itertools",
"mio",
"napi",
"napi-build",
"napi-derive",
@@ -1660,8 +1660,7 @@ dependencies = [
[[package]]
name = "portable-pty"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "806ee80c2a03dbe1a9fb9534f8d19e4c0546b790cde8fd1fea9d6390644cb0be"
source = "git+https://github.com/cammisuli/wezterm#3db3f2d05f7188af9c7527214605f18332fac06d"
dependencies = [
"anyhow",
"bitflags 1.3.2",
+10
View File
@@ -454,9 +454,19 @@
"description": "Nx plugin to support Firebase Apps and Cloud Functions in Nx workspaces",
"url": "https://github.com/simondotm/nx-firebase"
},
{
"name": "@dman926/nx-python-pdm",
"description": "Use Python in NX workspaces with PDM",
"url": "https://github.com/dman926/nx-python-pdm"
},
{
"name": "@gnuechtel/nx-cucumber",
"description": "Plugin to use Cucumber within Nx workspaces",
"url": "https://gitlab.com/gnuechtel/open-source/-/tree/main/libs/nx-cucumber"
},
{
"name": "@analogjs/platform",
"description": "Official plugin to add Analog to your Nx monorepo.",
"url": "https://analogjs.org/docs/integrations/nx"
}
]
+2 -2
View File
@@ -9,7 +9,7 @@ Description of a file change in the Nx virtual file system/
- [content](../../devkit/documents/FileChange#content): Buffer
- [options](../../devkit/documents/FileChange#options): TreeWriteOptions
- [path](../../devkit/documents/FileChange#path): string
- [type](../../devkit/documents/FileChange#type): "DELETE" | "CREATE" | "UPDATE"
- [type](../../devkit/documents/FileChange#type): "CREATE" | "DELETE" | "UPDATE"
## Properties
@@ -39,6 +39,6 @@ Path relative to the workspace root
### type
**type**: `"DELETE"` \| `"CREATE"` \| `"UPDATE"`
**type**: `"CREATE"` \| `"DELETE"` \| `"UPDATE"`
Type of change: 'CREATE' | 'DELETE' | 'UPDATE'
+59 -2
View File
@@ -176,7 +176,7 @@
},
{
"id": "split-e2e-tasks",
"name": "Automatically Split E2E Tasks",
"name": "Automatically Split E2E Tasks (TestAtomizer)",
"description": "",
"mediaImage": "",
"file": "nx-cloud/features/split-e2e-tasks",
@@ -258,7 +258,7 @@
},
"/ci/features/split-e2e-tasks": {
"id": "split-e2e-tasks",
"name": "Automatically Split E2E Tasks",
"name": "Automatically Split E2E Tasks (TestAtomizer)",
"description": "",
"mediaImage": "",
"file": "nx-cloud/features/split-e2e-tasks",
@@ -675,6 +675,29 @@
"path": "/ci/recipes/on-premise",
"tags": []
},
{
"id": "troubleshooting",
"name": "Troubleshooting",
"description": "Learn how to solve common issues in Nx Cloud.",
"mediaImage": "",
"file": "",
"itemList": [
{
"id": "ci-execution-failed",
"name": "CI Execution Failed",
"description": "",
"mediaImage": "",
"file": "nx-cloud/troubleshooting/ci-execution-failed",
"itemList": [],
"isExternal": false,
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"tags": []
}
],
"isExternal": false,
"path": "/ci/recipes/troubleshooting",
"tags": []
},
{
"id": "other",
"name": "Other",
@@ -1224,6 +1247,40 @@
"path": "/ci/recipes/on-premise/advanced-config",
"tags": []
},
"/ci/recipes/troubleshooting": {
"id": "troubleshooting",
"name": "Troubleshooting",
"description": "Learn how to solve common issues in Nx Cloud.",
"mediaImage": "",
"file": "",
"itemList": [
{
"id": "ci-execution-failed",
"name": "CI Execution Failed",
"description": "",
"mediaImage": "",
"file": "nx-cloud/troubleshooting/ci-execution-failed",
"itemList": [],
"isExternal": false,
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"tags": []
}
],
"isExternal": false,
"path": "/ci/recipes/troubleshooting",
"tags": []
},
"/ci/recipes/troubleshooting/ci-execution-failed": {
"id": "ci-execution-failed",
"name": "CI Execution Failed",
"description": "",
"mediaImage": "",
"file": "nx-cloud/troubleshooting/ci-execution-failed",
"itemList": [],
"isExternal": false,
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"tags": []
},
"/ci/recipes/other": {
"id": "other",
"name": "Other",
+53 -11
View File
@@ -5005,9 +5005,9 @@
"disableCollapsible": false
},
{
"name": "Angular: The browserTarget",
"path": "/deprecated/storybook/angular-browser-target",
"id": "angular-browser-target",
"name": "Angular - The projectBuildConfig",
"path": "/deprecated/storybook/angular-project-build-config",
"id": "angular-project-build-config",
"isExternal": false,
"children": [],
"disableCollapsible": false
@@ -5161,9 +5161,9 @@
"disableCollapsible": false
},
{
"name": "Angular: The browserTarget",
"path": "/deprecated/storybook/angular-browser-target",
"id": "angular-browser-target",
"name": "Angular - The projectBuildConfig",
"path": "/deprecated/storybook/angular-project-build-config",
"id": "angular-project-build-config",
"isExternal": false,
"children": [],
"disableCollapsible": false
@@ -5212,9 +5212,9 @@
"disableCollapsible": false
},
{
"name": "Angular: The browserTarget",
"path": "/deprecated/storybook/angular-browser-target",
"id": "angular-browser-target",
"name": "Angular - The projectBuildConfig",
"path": "/deprecated/storybook/angular-project-build-config",
"id": "angular-project-build-config",
"isExternal": false,
"children": [],
"disableCollapsible": false
@@ -5779,7 +5779,7 @@
"disableCollapsible": false
},
{
"name": "Automatically Split E2E Tasks",
"name": "Automatically Split E2E Tasks (TestAtomizer)",
"path": "/ci/features/split-e2e-tasks",
"id": "split-e2e-tasks",
"isExternal": false,
@@ -5838,7 +5838,7 @@
"disableCollapsible": false
},
{
"name": "Automatically Split E2E Tasks",
"name": "Automatically Split E2E Tasks (TestAtomizer)",
"path": "/ci/features/split-e2e-tasks",
"id": "split-e2e-tasks",
"isExternal": false,
@@ -6144,6 +6144,23 @@
],
"disableCollapsible": false
},
{
"name": "Troubleshooting",
"path": "/ci/recipes/troubleshooting",
"id": "troubleshooting",
"isExternal": false,
"children": [
{
"name": "CI Execution Failed",
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"id": "ci-execution-failed",
"isExternal": false,
"children": [],
"disableCollapsible": false
}
],
"disableCollapsible": false
},
{
"name": "Other",
"path": "/ci/recipes/other",
@@ -6544,6 +6561,31 @@
"children": [],
"disableCollapsible": false
},
{
"name": "Troubleshooting",
"path": "/ci/recipes/troubleshooting",
"id": "troubleshooting",
"isExternal": false,
"children": [
{
"name": "CI Execution Failed",
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"id": "ci-execution-failed",
"isExternal": false,
"children": [],
"disableCollapsible": false
}
],
"disableCollapsible": false
},
{
"name": "CI Execution Failed",
"path": "/ci/recipes/troubleshooting/ci-execution-failed",
"id": "ci-execution-failed",
"isExternal": false,
"children": [],
"disableCollapsible": false
},
{
"name": "Other",
"path": "/ci/recipes/other",
+16 -16
View File
@@ -6852,14 +6852,14 @@
"tags": []
},
{
"id": "angular-browser-target",
"name": "Angular: The browserTarget",
"description": "This document explains the role of the browserTarget in Angular projects with a Storybook configuration, and how the Storybook executors use it.",
"id": "angular-project-build-config",
"name": "Angular - The projectBuildConfig",
"description": "This document explains the role of the projectBuildConfig in Angular projects with a Storybook configuration, and how the Storybook executors use it.",
"mediaImage": "",
"file": "shared/deprecated/storybook/angular-browser-target",
"file": "shared/deprecated/storybook/angular-project-build-config",
"itemList": [],
"isExternal": false,
"path": "/deprecated/storybook/angular-browser-target",
"path": "/deprecated/storybook/angular-project-build-config",
"tags": []
},
{
@@ -7067,14 +7067,14 @@
"tags": []
},
{
"id": "angular-browser-target",
"name": "Angular: The browserTarget",
"description": "This document explains the role of the browserTarget in Angular projects with a Storybook configuration, and how the Storybook executors use it.",
"id": "angular-project-build-config",
"name": "Angular - The projectBuildConfig",
"description": "This document explains the role of the projectBuildConfig in Angular projects with a Storybook configuration, and how the Storybook executors use it.",
"mediaImage": "",
"file": "shared/deprecated/storybook/angular-browser-target",
"file": "shared/deprecated/storybook/angular-project-build-config",
"itemList": [],
"isExternal": false,
"path": "/deprecated/storybook/angular-browser-target",
"path": "/deprecated/storybook/angular-project-build-config",
"tags": []
},
{
@@ -7137,15 +7137,15 @@
"path": "/deprecated/storybook/angular-storybook-targets",
"tags": []
},
"/deprecated/storybook/angular-browser-target": {
"id": "angular-browser-target",
"name": "Angular: The browserTarget",
"description": "This document explains the role of the browserTarget in Angular projects with a Storybook configuration, and how the Storybook executors use it.",
"/deprecated/storybook/angular-project-build-config": {
"id": "angular-project-build-config",
"name": "Angular - The projectBuildConfig",
"description": "This document explains the role of the projectBuildConfig in Angular projects with a Storybook configuration, and how the Storybook executors use it.",
"mediaImage": "",
"file": "shared/deprecated/storybook/angular-browser-target",
"file": "shared/deprecated/storybook/angular-project-build-config",
"itemList": [],
"isExternal": false,
"path": "/deprecated/storybook/angular-browser-target",
"path": "/deprecated/storybook/angular-project-build-config",
"tags": []
},
"/deprecated/storybook/migrate-webpack-final-angular": {
@@ -33,7 +33,7 @@ In any Nx workspace, you can install `@nx/angular` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/angular
```
@@ -105,6 +105,11 @@
"type": "number",
"description": "Enable and define the file watching poll time period in milliseconds."
},
"forceEsbuild": {
"type": "boolean",
"description": "Force the development server to use the 'browser-esbuild' builder when building. This is a developer preview option for the esbuild-based build system. _Note: this is only supported in Angular versions >= 16.1.0_.",
"default": false
},
"buildLibsFromSource": {
"type": "boolean",
"description": "Read buildable libraries from source instead of building them separately. If not set, it will take the value specified in the `browserTarget` options, or it will default to `true` if it's also not set in the `browserTarget` options.",
@@ -29,7 +29,7 @@ In any Nx workspace, you can install `@nx/cypress` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/cypress
```
@@ -75,6 +75,30 @@ The `@nx/cypress/plugin` is configured in the `plugins` array in `nx.json`.
The `@nx/cypress/plugin` will automatically split your e2e tasks by file. You can read more about this feature [here](/ci/features/split-e2e-tasks).
To enable e2e task splitting, make sure there is a `ciWebServerCommand` property set in your `cypress.config.ts` file. It will look something like this:
```ts {% fileName="apps/my-project-e2e/cypress.config.ts" highlightLines=[13] %}
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: {
...nxE2EPreset(__filename, {
cypressDir: 'src',
bundler: 'vite',
webServerCommands: {
default: 'nx run my-project:serve',
production: 'nx run my-project:preview',
},
ciWebServerCommand: 'nx run my-project:serve-static',
}),
baseUrl: 'http://localhost:4200',
},
});
```
Note: The `nxE2EPreset` is a collection of default settings, but is not necessary for task splitting.
{% /tab %}
{% tab label="Nx < 18" %}
@@ -95,18 +119,18 @@ By default, when creating a new frontend application, Nx will use Cypress to cre
nx g @nx/web:app frontend
```
### Creating a Cypress E2E project for an existing project
### Configure Cypress for an existing project
To generate an E2E project based on an existing project, run the following generator
To configure Cypress for an existing project, run the following generator
```shell
nx g @nx/cypress:configuration your-app-name-e2e --project=your-app-name
nx g @nx/cypress:configuration --project=your-app-name
```
Optionally, you can use the `--baseUrl` option if you don't want cypress plugin to serve `your-app-name`.
Optionally, you can use the `--baseUrl` option if you don't want the Cypress plugin to serve `your-app-name`.
```shell
nx g @nx/cypress:configuration your-app-name-e2e --baseUrl=http://localhost:4200
nx g @nx/cypress:configuration --project=your-app-name --baseUrl=http://localhost:4200
```
Replace `your-app-name` with the app's name as defined in your `tsconfig.base.json` file or the `name` property of your `package.json`.
@@ -36,7 +36,7 @@ In any Nx workspace, you can install `@nx/detox` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/detox
```
@@ -25,7 +25,7 @@ In any Nx workspace, you can install `@nx/esbuild` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/esbuild
```
@@ -13,10 +13,27 @@ Make sure to install the `@nx/eslint-plugin` version that matches the version of
In any Nx workspace, you can install `@nx/eslint-plugin` by running the following commands if the package is not already installed:
```shell
{% tabs %}
{% tab label="Nx 18+" %}
```shell {% skipRescope=true %}
nx add @nx/eslint-plugin
```
This will install the correct version of `@nx/eslint-plugin`.
{% /tab %}
{% tab label="Nx < 18" %}
Install the `@nx/eslint-plugin` package with your package manager.
```shell
npm add -D @nx/eslint-plugin
```
{% /tab %}
{% /tabs %}
## Included plugins
The plugin contains the following rule configurations divided into sub-plugins.
@@ -13,7 +13,7 @@ In any Nx workspace, you can install `@nx/eslint` by running the following comma
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/eslint
```
@@ -57,14 +57,23 @@ The `@nx/eslint/plugin` is configured in the `plugins` array in `nx.json`.
- The `targetName` option controls the name of the inferred ESLint tasks. The default name is `lint`.
{% /tab %}
{% tab label="Nx < 18" %}
{% tab label="Nx 17" %}
Install the `@nx/eslint` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/eslint
```
{% /tab %}
{% tab label="Nx < 17" %}
Install the `@nx/linter` package with your package manager.
```shell
npm add -D @nx/linter
```
{% /tab %}
{% /tabs %}
@@ -21,7 +21,7 @@ In any Nx workspace, you can install `@nx/expo` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/expo
```
@@ -22,6 +22,11 @@
"items": { "type": "string" },
"default": [],
"description": "An array of npm packages to exclude."
},
"all": {
"type": "boolean",
"description": "Copy all dependencies and devDependencies from the workspace root package.json.",
"default": false
}
},
"presets": []
@@ -22,7 +22,7 @@ In any Nx workspace, you can install `@nx/express` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/express
```
@@ -22,7 +22,7 @@ In any Nx workspace, you can install `@nx/jest` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/jest
```
@@ -18,7 +18,7 @@ In any Nx workspace, you can install `@nx/js` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/js
```
@@ -34,7 +34,7 @@ In any Nx workspace, you can install `@nx/nest` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/nest
```
@@ -30,7 +30,7 @@ In any workspace, you can install `@nx/next` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/next
```
@@ -60,7 +60,8 @@ The `@nx/next/plugin` is configured in the `plugins` array in `nx.json`.
"options": {
"buildTargetName": "build",
"devTargetName": "dev",
"startTargetName": "start"
"startTargetName": "start",
"serveStaticTargetName": "serve-static"
}
}
]
@@ -70,6 +71,10 @@ The `@nx/next/plugin` is configured in the `plugins` array in `nx.json`.
- The `buildTargetName` option controls the name of Next.js' compilation task which compiles the application for production deployment. The default name is `build`.
- The `devTargetName` option controls the name of Next.js' development serve task which starts the application in development mode. The default name is `dev`.
- The `startTargetName` option controls the name of Next.js' production serve task which starts the application in production mode. The default name is `start`.
- The `serveStaticTargetName` option controls the name of Next.js' static export task which exports the application to static HTML files. The default name is `serve-static`.
{% /tab %}
{% tab label="Nx < 18" %}
{% /tab %}
{% tab label="Nx < 18" %}
@@ -238,7 +243,7 @@ The library in `dist` is publishable to npm or a private registry.
### Static HTML Export
Next.js applications can be statically exported by changing th eoutput inside your Next.js configuration file.
Next.js applications can be statically exported by changing the output inside your Next.js configuration file.
```js {% fileName="apps/my-next-app/next.config.js" %}
const nextConfig = {
@@ -246,9 +251,50 @@ const nextConfig = {
nx: {
svgr: false,
},
output: 'export',
};
```
After setting the output to `export`, you can run the `build` command to generate the static HTML files.
```shell
nx build my-next-app
```
You can then check your project folder for the `out` folder which contains the static HTML files.
```shell
├── index.d.ts
├── jest.config.ts
├── next-env.d.ts
├── next.config.js
├── out
├── project.json
├── public
├── specs
├── src
├── tsconfig.json
└── tsconfig.spec.json
```
#### E2E testing
You can perform end-to-end (E2E) testing on static HTML files using a test runner like Cypress. When you create a Next.js application, Nx automatically creates a `serve-static` target. This target is designed to serve the static HTML files produced by the build command.
This feature is particularly useful for testing in continuous integration (CI) pipelines, where resources may be constrained. Unlike the `dev` and `start` targets, `serve-static` does not require a Next.js server to operate, making it more efficient and faster by eliminating background processes, such as file change monitoring.
To utilize the `serve-static` target for testing, run the following command:
```shell
nx serve-static my-next-app-e2e
```
This command performs several actions:
1. It will build the Next.js application and generate the static HTML files.
2. It will serve the static HTML files using a simple HTTP server.
3. It will run the Cypress tests against the served static HTML files.
### Deploying Next.js Applications
Once you are ready to deploy your Next.js application, you have absolute freedom to choose any hosting provider that fits your needs.
@@ -13,7 +13,7 @@ In any Nx workspace, you can install `@nx/node` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/node
```
@@ -23,7 +23,7 @@ Make sure to install the `@nx/nuxt` version that matches the version of `nx` in
In any Nx workspace, you can install `@nx/nuxt` by running the following command:
```shell
```shell {% skipRescope=true %}
nx add @nx/nuxt
```
@@ -56,7 +56,9 @@ The `@nx/nuxt/plugin` is configured in the `plugins` array in `nx.json`.
"options": {
"buildTargetName": "build",
"testTargetName": "test",
"serveTargetName": "serve"
"serveTargetName": "serve",
"buildStaticTargetName": "build-static",
"serveStaticTargetName": "serve-static"
}
}
]
@@ -65,6 +67,8 @@ The `@nx/nuxt/plugin` is configured in the `plugins` array in `nx.json`.
- The `buildTargetName`, `testTargetName` and `serveTargetName` options control the names of the inferred Nuxt tasks. The default names are `build`, `test` and `serve`.
The `buildStaticTargetName` and `serveStaticTargetName` options control the names of the inferred Nuxt static tasks. The default names are `build-static` and `serve-static`.
## Using Nuxt
### Generate a new Nuxt app
@@ -78,3 +82,23 @@ nx g @nx/nuxt:app my-app
Once you are ready to deploy your Nuxt application, you have absolute freedom to choose any hosting provider that fits your needs.
We have detailed [how to deploy your Nuxt application to Vercel in a separate guide](/recipes/nuxt/deploy-nuxt-to-vercel).
### E2E testing
By default `nuxt` **does not** generate static HTML files when you run the `build` command. However, Nx provides a `build-static` target that you can use to generate static HTML files for your Nuxt application. Essentially, this target runs the `nuxt build --prerender` command to generate static HTML files.
To perform end-to-end (E2E) testing on static HTML files using a test runner like Cypress. When you create a Nuxt application, Nx automatically creates a `serve-static` target. This target is designed to serve the static HTML files produced by the `build-static` command.
This feature is particularly useful for testing in continuous integration (CI) pipelines, where resources may be constrained. Unlike the `serve` target, `serve-static` does not require a Nuxt's Nitro server to operate, making it more efficient and faster by eliminating background processes, such as file change monitoring.
To utilize the `serve-static` target for testing, run the following command:
```shell
nx serve-static my-nuxt-app-e2e
```
This command performs several actions:
1. It will build the Nuxt application and generate the static HTML files.
2. It will serve the static HTML files using a simple HTTP server.
3. It will run the Cypress tests against the served static HTML files.
@@ -24,7 +24,7 @@ In any Nx workspace, you can install `@nx/playwright` by running the following c
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/playwright
```
@@ -74,7 +74,7 @@ The `@nx/playwright/plugin` will automatically split your e2e tasks by file. You
Install the `@nx/playwright` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/playwright
```
@@ -35,7 +35,7 @@ In any Nx workspace, you can install `@nx/react-native` by running the following
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/react-native
```
@@ -22,6 +22,11 @@
"items": { "type": "string" },
"default": [],
"description": "An array of npm packages to exclude."
},
"all": {
"type": "boolean",
"description": "Copy all dependencies and devDependencies from the workspace root package.json.",
"default": false
}
},
"presets": []
@@ -27,7 +27,7 @@ In any Nx workspace, you can install `@nx/react` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/react
```
@@ -69,7 +69,8 @@
"e2eTestRunner": {
"type": "string",
"enum": ["cypress", "playwright", "none"],
"description": "Test runner to use for end to end (e2e) tests.",
"description": "Test runner to use for end to end (E2E) tests.",
"x-prompt": "Which E2E test runner would you like to use?",
"default": "cypress"
},
"host": {
@@ -94,7 +94,8 @@
"e2eTestRunner": {
"type": "string",
"enum": ["cypress", "playwright", "none"],
"description": "Test runner to use for end to end (e2e) tests.",
"description": "Test runner to use for end to end (E2E) tests.",
"x-prompt": "Which E2E test runner would you like to use?",
"default": "cypress"
},
"tags": {
@@ -164,7 +165,7 @@
},
"typescriptConfiguration": {
"type": "boolean",
"description": "Whether the module federation configuration and webpack configuration files should use TS.",
"description": "Whether the module federation configuration and webpack configuration files should use TS. When --js is used, this flag is ignored.",
"default": true
}
},
@@ -100,7 +100,8 @@
"e2eTestRunner": {
"type": "string",
"enum": ["cypress", "playwright", "none"],
"description": "Test runner to use for end to end (e2e) tests.",
"description": "Test runner to use for end to end (E2E) tests.",
"x-prompt": "Which E2E test runner would you like to use?",
"default": "cypress"
},
"tags": {
@@ -163,7 +164,7 @@
},
"typescriptConfiguration": {
"type": "boolean",
"description": "Whether the module federation configuration and webpack configuration files should use TS.",
"description": "Whether the module federation configuration and webpack configuration files should use TS. When --js is used, this flag is ignored.",
"default": true
}
},
@@ -28,7 +28,7 @@ In any Nx workspace, you can install `@nx/remix` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/remix
```
@@ -89,7 +89,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %}
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %}
> NX Generating @nx/remix:application
NX Generating @nx/remix:application
✔ What unit test runner should be used? · vitest
@@ -135,9 +135,9 @@ Building Remix app in production mode...
Built in 857ms
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project myapp (3s)
NX Successfully ran target build for project myapp (3s)
```
2. To serve your application for use during development run:
@@ -155,18 +155,18 @@ Remix App Server started at http://localhost:3000 (http://192.168.0.14:3000)
```{% command="nx test myapp" path="~/acme" %}
> nx run myapp:test
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
stderr | app/routes/index.spec.ts > test > should render
Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
✓ app/routes/index.spec.ts (1 test) 10ms
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 16:15:45
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
✓ app/routes/index.spec.ts (1 test) 10ms
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 16:15:45
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target test for project myapp (2s)
NX Successfully ran target test for project myapp (2s)
```
## Generating an Nx Library
@@ -176,7 +176,7 @@ When developing your application, it often makes sense to split your codebase in
To generate a library to use in your Remix application run:
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %}
> NX Generating @nx/remix:library
NX Generating @nx/remix:library
✔ What test runner should be used? · vitest
UPDATE nx.json
@@ -223,7 +223,7 @@ You can also run test on your library:
To generate a route for your application:
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %}
> NX Generating @nx/remix:route
NX Generating @nx/remix:route
CREATE apps/myapp/app/routes/admin.tsx
CREATE apps/myapp/app/styles/admin.css
@@ -236,7 +236,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be
1. Generate a loader for your route:
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %}
> NX Generating @nx/remix:loader
NX Generating @nx/remix:loader
UPDATE apps/myapp/app/routes/admin.tsx
```
@@ -45,7 +45,7 @@
},
"e2eTestRunner": {
"type": "string",
"enum": ["cypress", "none"],
"enum": ["cypress", "playwright", "none"],
"default": "cypress",
"description": "Test runner to use for e2e tests"
},
@@ -20,7 +20,7 @@ In any Nx workspace, you can install `@nx/storybook` by running the following co
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/storybook
```
@@ -134,7 +134,7 @@
},
"additionalProperties": true,
"required": ["configDir"],
"examplesFile": "---\ntitle: Storybook builder executor examples\ndescription: This page contains examples for the @nx/storybook:build executor.\n---\n\n`project.json`:\n\n```json\n//...\n\"ui\": {\n \"targets\": {\n //...\n \"build-storybook\": {\n \"executor\": \"@nx/storybook:build\",\n \"outputs\": [\"{options.outputDir}\"],\n \"options\": {\n \"outputDir\": \"dist/storybook/ui\",\n \"configDir\": \"libs/ui/.storybook\"\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n }\n}\n```\n\n```bash\nnx run ui:build-storybook\n```\n\n## Examples\n\n### For non-Angular projects\n\n{% tabs %}\n{% tab label=\"Working in docsMode\" %}\n\nYou can work in docs mode, building a documentation-only site, by setting the `docsMode` option to `true` and using the `@storybook/addon-docs` addon.\n\nRead more on the [Storybook documentation page for `addon-docs`](https://storybook.js.org/addons/@storybook/addon-docs).\n\n```json\n\"storybook\": {\n \"executor\": \"@nx/storybook:build\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\",\n \"docsMode\": true\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% /tabs %}\n\n### For Angular projects\n\n{% tabs %}\n{% tab label=\"Default configuration\" %}\n\nThis is the default configuration for Angular projects using Storybook. You can see that it uses the native `@storybook/angular:build-storybook` executor. You can read more about the configuration options at the relevant [Storybook documentation page](https://storybook.js.org/docs/angular/get-started/install).\n\n```json\n\"build-storybook\": {\n \"executor\": \"@storybook/angular:build-storybook\",\n \"outputs\": [\"{options.outputDir}\"],\n \"options\": {\n \"outputDir\": \"dist/storybook/ngapp\",\n \"configDir\": \"apps/ngapp/.storybook\",\n \"browserTarget\": \"ngapp:build\",\n \"compodoc\": false\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"Changing the browserTarget\" %}\n\nYou can set the [`browserTarget`](/deprecated/storybook/angular-browser-target) to use `build-storybook` as the builder. This is most useful in the cases where your project does not have a `build` target.\n\n```json\n\"build-storybook\": {\n \"executor\": \"@storybook/angular:build-storybook\",\n \"outputs\": [\"{options.outputDir}\"],\n \"options\": {\n \"outputDir\": \"dist/storybook/ngapp\",\n \"configDir\": \"apps/ngapp/.storybook\",\n \"browserTarget\": \"ngapp:build-storybook\",\n \"compodoc\": false\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"Adding styles\" %}\n\nYou can add paths to stylesheets to be included in the Storybook build by using the `styles` array. You can also add `stylePreprocessorOptions`, much like you would do in the Angular builder. You can read more in our guide about [styles and preprocessor options for Storybook](/recipes/storybook/angular-configuring-styles).\n\n```json\n\"build-storybook\": {\n \"executor\": \"@storybook/angular:build-storybook\",\n \"outputs\": [\"{options.outputDir}\"],\n \"options\": {\n \"outputDir\": \"dist/storybook/ngapp\",\n \"configDir\": \"apps/ngapp/.storybook\",\n \"browserTarget\": \"ngapp:build-storybook\",\n \"compodoc\": false,\n \"styles\": [\"some-styles.css\"],\n \"stylePreprocessorOptions\": {\n \"includePaths\": [\"some-style-paths\"]\n }\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% /tabs %}\n"
"examplesFile": "---\ntitle: Storybook builder executor examples\ndescription: This page contains examples for the @nx/storybook:build executor.\n---\n\n`project.json`:\n\n```json\n//...\n\"ui\": {\n \"targets\": {\n //...\n \"build-storybook\": {\n \"executor\": \"@nx/storybook:build\",\n \"outputs\": [\"{options.outputDir}\"],\n \"options\": {\n \"outputDir\": \"dist/storybook/ui\",\n \"configDir\": \"libs/ui/.storybook\"\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n }\n}\n```\n\n```bash\nnx run ui:build-storybook\n```\n\n## Examples\n\n### For non-Angular projects\n\n{% tabs %}\n{% tab label=\"Working in docsMode\" %}\n\nYou can work in docs mode, building a documentation-only site, by setting the `docsMode` option to `true` and using the `@storybook/addon-docs` addon.\n\nRead more on the [Storybook documentation page for `addon-docs`](https://storybook.js.org/addons/@storybook/addon-docs).\n\n```json\n\"storybook\": {\n \"executor\": \"@nx/storybook:build\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\",\n \"docsMode\": true\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% /tabs %}\n\n### For Angular projects\n\n{% tabs %}\n{% tab label=\"Default configuration\" %}\n\nThis is the default configuration for Angular projects using Storybook. You can see that it uses the native `@storybook/angular:build-storybook` executor. You can read more about the configuration options at the relevant [Storybook documentation page](https://storybook.js.org/docs/angular/get-started/install).\n\n```json\n\"build-storybook\": {\n \"executor\": \"@storybook/angular:build-storybook\",\n \"outputs\": [\"{options.outputDir}\"],\n \"options\": {\n \"outputDir\": \"dist/storybook/ngapp\",\n \"configDir\": \"apps/ngapp/.storybook\",\n \"browserTarget\": \"ngapp:build\",\n \"compodoc\": false\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n}\n```\n\n{% /tab %}\n{% tab label=\"Changing the browserTarget\" %}\n\nYou can set the `browserTarget` to use `build-storybook` as the builder. This is most useful in the cases where your project does not have a `build` target. Read more about the `browserTarget` in the [Set up Storybook for Angular Projects](/recipes/storybook/overview-angular) recipe.\n\n```json\n\"build-storybook\": {\n \"executor\": \"@storybook/angular:build-storybook\",\n \"outputs\": [\"{options.outputDir}\"],\n \"options\": {\n \"outputDir\": \"dist/storybook/ngapp\",\n \"configDir\": \"apps/ngapp/.storybook\",\n \"browserTarget\": \"ngapp:build-storybook\",\n \"compodoc\": false\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% tab label=\"Adding styles\" %}\n\nYou can add paths to stylesheets to be included in the Storybook build by using the `styles` array. You can also add `stylePreprocessorOptions`, much like you would do in the Angular builder. You can read more in our guide about [styles and preprocessor options for Storybook](/recipes/storybook/angular-configuring-styles).\n\n```json\n\"build-storybook\": {\n \"executor\": \"@storybook/angular:build-storybook\",\n \"outputs\": [\"{options.outputDir}\"],\n \"options\": {\n \"outputDir\": \"dist/storybook/ngapp\",\n \"configDir\": \"apps/ngapp/.storybook\",\n \"browserTarget\": \"ngapp:build-storybook\",\n \"compodoc\": false,\n \"styles\": [\"some-styles.css\"],\n \"stylePreprocessorOptions\": {\n \"includePaths\": [\"some-style-paths\"]\n }\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% /tabs %}\n"
},
"description": "Build Storybook.",
"aliases": [],
@@ -113,7 +113,7 @@
"additionalProperties": true,
"definitions": {},
"required": ["configDir"],
"examplesFile": "---\ntitle: Storybook dev server executor examples\ndescription: This page contains examples for the @nx/storybook:storybook executor.\n---\n\n`project.json`:\n\n```json\n//...\n\"ui\": {\n \"targets\": {\n //...\n \"storybook\": {\n \"executor\": \"@nx/storybook:storybook\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\"\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n },\n }\n}\n```\n\n```bash\nnx run ui:storybook\n```\n\n## Examples\n\n### For non-Angular projects\n\n{% tabs %}\n{% tab label=\"Working in docsMode\" %}\n\nYou can work in docs mode, building a documentation-only site, by setting the `docsMode` option to `true` and using the `@storybook/addon-docs` addon.\n\nRead more on the [Storybook documentation page for `addon-docs`](https://storybook.js.org/addons/@storybook/addon-docs).\n\n```json\n\"storybook\": {\n \"executor\": \"@nx/storybook:storybook\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\",\n \"docsMode\": true\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% /tabs %}\n\n### For Angular projects\n\n{% tabs %}\n{% tab label=\"Default configuration\" %}\n\nThis is the default configuration for Angular projects using Storybook. You can see that it uses the native `@storybook/angular:start-storybook` executor. You can read more about the configuration options at the relevant [Storybook documentation page](https://storybook.js.org/docs/angular/get-started/install).\n\n```json\n\"storybook\": {\n \"executor\": \"@storybook/angular:start-storybook\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\",\n \"browserTarget\": \"ui:build\",\n \"compodoc\": false\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n},\n```\n\n{% /tab %}\n{% tab label=\"Changing the browserTarget\" %}\n\nYou can set the [`browserTarget`](/deprecated/storybook/angular-browser-target) to use `build-storybook` as the builder. This is most useful in the cases where your project does not have a `build` target.\n\n```json\n\"storybook\": {\n \"executor\": \"@storybook/angular:start-storybook\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\",\n \"browserTarget\": \"ui:build-storybook\",\n \"compodoc\": false\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n},\n```\n\n{% /tab %}\n\n{% tab label=\"Adding styles\" %}\n\nYou can add paths to stylesheets to be included in the Storybook build by using the `styles` array. You can also add `stylePreprocessorOptions`, much like you would do in the Angular builder. You can read more in our guide about [styles and preprocessor options for Storybook](/recipes/storybook/angular-configuring-styles).\n\n```json\n\"storybook\": {\n \"executor\": \"@storybook/angular:start-storybook\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\",\n \"browserTarget\": \"ui:build\",\n \"compodoc\": false,\n \"styles\": [\"some-styles.css\"],\n \"stylePreprocessorOptions\": {\n \"includePaths\": [\"some-style-paths\"]\n }\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n},\n```\n\n{% /tab %}\n\n{% /tabs %}\n"
"examplesFile": "---\ntitle: Storybook dev server executor examples\ndescription: This page contains examples for the @nx/storybook:storybook executor.\n---\n\n`project.json`:\n\n```json\n//...\n\"ui\": {\n \"targets\": {\n //...\n \"storybook\": {\n \"executor\": \"@nx/storybook:storybook\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\"\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n },\n }\n}\n```\n\n```bash\nnx run ui:storybook\n```\n\n## Examples\n\n### For non-Angular projects\n\n{% tabs %}\n{% tab label=\"Working in docsMode\" %}\n\nYou can work in docs mode, building a documentation-only site, by setting the `docsMode` option to `true` and using the `@storybook/addon-docs` addon.\n\nRead more on the [Storybook documentation page for `addon-docs`](https://storybook.js.org/addons/@storybook/addon-docs).\n\n```json\n\"storybook\": {\n \"executor\": \"@nx/storybook:storybook\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\",\n \"docsMode\": true\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n}\n```\n\n{% /tab %}\n\n{% /tabs %}\n\n### For Angular projects\n\n{% tabs %}\n{% tab label=\"Default configuration\" %}\n\nThis is the default configuration for Angular projects using Storybook. You can see that it uses the native `@storybook/angular:start-storybook` executor. You can read more about the configuration options at the relevant [Storybook documentation page](https://storybook.js.org/docs/angular/get-started/install).\n\n```json\n\"storybook\": {\n \"executor\": \"@storybook/angular:start-storybook\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\",\n \"browserTarget\": \"ui:build\",\n \"compodoc\": false\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n},\n```\n\n{% /tab %}\n{% tab label=\"Changing the browserTarget\" %}\n\nYou can set the `browserTarget` to use `build-storybook` as the builder. This is most useful in the cases where your project does not have a `build` target. Read more about the `browserTarget` in the [Set up Storybook for Angular Projects](/recipes/storybook/overview-angular) recipe.\n\n```json\n\"storybook\": {\n \"executor\": \"@storybook/angular:start-storybook\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\",\n \"browserTarget\": \"ui:build-storybook\",\n \"compodoc\": false\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n},\n```\n\n{% /tab %}\n\n{% tab label=\"Adding styles\" %}\n\nYou can add paths to stylesheets to be included in the Storybook build by using the `styles` array. You can also add `stylePreprocessorOptions`, much like you would do in the Angular builder. You can read more in our guide about [styles and preprocessor options for Storybook](/recipes/storybook/angular-configuring-styles).\n\n```json\n\"storybook\": {\n \"executor\": \"@storybook/angular:start-storybook\",\n \"options\": {\n \"port\": 4400,\n \"configDir\": \"libs/ui/.storybook\",\n \"browserTarget\": \"ui:build\",\n \"compodoc\": false,\n \"styles\": [\"some-styles.css\"],\n \"stylePreprocessorOptions\": {\n \"includePaths\": [\"some-style-paths\"]\n }\n },\n \"configurations\": {\n \"ci\": {\n \"quiet\": true\n }\n }\n},\n```\n\n{% /tab %}\n\n{% /tabs %}\n"
},
"description": "Serve Storybook.",
"aliases": [],
@@ -35,7 +35,7 @@ In any Nx workspace, you can install `@nx/vite` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/vite
```
@@ -20,6 +20,7 @@
"type": "string",
"description": "Directory to write coverage report to."
},
"mode": { "type": "string", "description": "Mode for Vite." },
"testFiles": {
"aliases": ["testFile"],
"type": "array",
File diff suppressed because one or more lines are too long
@@ -26,7 +26,7 @@ In any Nx workspace, you can install `@nx/vue` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/vue
```
@@ -37,7 +37,7 @@ This will install the correct version of `@nx/vue`.
Install the `@nx/vue` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/vue
```
@@ -21,7 +21,7 @@ In any Nx workspace, you can install `@nx/web` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/web
```
@@ -36,7 +36,7 @@ In any Nx workspace, you can install `@nx/webpack` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/webpack
```
@@ -11,5 +11,6 @@ and the version of NodeJS that we tested it against.
| 13.x | 10.x, 12.x, 14.x | ~4.6.2 |
| 14.x | 12.x, 14.x, 16.x | ~4.7.2 |
| 15.x | 14.x, 16.x, 18.x | ~5.0.0 |
| 16.x (previous) | 16.x, 18.x, 20.x | ~5.1.0 |
| 17.x (latest) | 18.x, 20.x | ~5.1.0 |
| 16.x | 16.x, 18.x, 20.x | ~5.1.0 |
| 17.x (previous) | 18.x, 20.x | ~5.1.0 |
| 18.x (latest) | 18.x, 20.x | ~5.1.0 |
+17 -5
View File
@@ -1429,10 +1429,10 @@
"file": "shared/deprecated/storybook/angular-storybook-targets"
},
{
"id": "angular-browser-target",
"name": "Angular: The browserTarget",
"description": "This document explains the role of the browserTarget in Angular projects with a Storybook configuration, and how the Storybook executors use it.",
"file": "shared/deprecated/storybook/angular-browser-target"
"id": "angular-project-build-config",
"name": "Angular - The projectBuildConfig",
"description": "This document explains the role of the projectBuildConfig in Angular projects with a Storybook configuration, and how the Storybook executors use it.",
"file": "shared/deprecated/storybook/angular-project-build-config"
},
{
"id": "migrate-webpack-final-angular",
@@ -1712,7 +1712,7 @@
"file": "nx-cloud/features/dynamic-agents"
},
{
"name": "Automatically Split E2E Tasks",
"name": "Automatically Split E2E Tasks (TestAtomizer)",
"id": "split-e2e-tasks",
"file": "nx-cloud/features/split-e2e-tasks"
},
@@ -1899,6 +1899,18 @@
}
]
},
{
"name": "Troubleshooting",
"id": "troubleshooting",
"description": "Learn how to solve common issues in Nx Cloud.",
"itemList": [
{
"name": "CI Execution Failed",
"id": "ci-execution-failed",
"file": "nx-cloud/troubleshooting/ci-execution-failed"
}
]
},
{
"name": "Other",
"id": "other",
+1 -1
View File
@@ -10,7 +10,7 @@ The standard way to set up [Nx Agents](/ci/features/distribute-task-execution) i
```yaml {% fileName=".nx/workflows/dynamic-changesets.yaml" %}
distribute-on:
small-changeset: 1 linux-medium-js
small-changeset: 3 linux-medium-js
medium-changeset: 6 linux-medium-js
large-changeset: 10 linux-medium-js
```
Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

+9 -3
View File
@@ -8,14 +8,20 @@ Nx is perfectly positioned to detect which tasks are flaky and automatically re-
Nx creates a hash of all the inputs for a task whenever it is run. If Nx ever encounters a task that fails with a particular set of inputs and then succeeds with those same inputs, Nx knows for a fact that the task is flaky. Nx can't know with certainty when the task has been fixed to no longer be flaky, so if a particular task has no flakiness incidents for 2 weeks, the `flaky` flag is removed for that task.
![Flaky tasks in CI](/nx-cloud/features/flaky-tasks-ci.png)
In this image, the `e2e-ci--src/e2e/app.cy.ts` task is a flaky task that has been automatically retried once. There is a `1 retry` indicator to show that it has been retried and, once expanded, you can see tabs that contain the logs for `Attempt 1` and `Attempt 2`. With this UI, you can easily compare the output between a successful and unsuccessful run of a flaky task.
## Manually Mark a Task as Flaky or Not Flaky
If you need to manually mark a task as flaky or not flaky, you can do so from the run details screen. Flaky tasks will have a button that says `Mark task as no longer flaky` and failed tasks that are not flaky will have a button that says `Mark task as likely flaky`. Using these buttons, you can ensure that Nx Cloud treats tasks in the appropriate way.
![Mark task as no longer flaky button](/nx-cloud/features/mark-task-as-no-longer-flaky.png)
If you suspect that a task is flaky, but Nx has not confirmed it yet, you can manually mark it as `likely flaky` from the run details screen. Failed tasks that are not flaky will have a button that says `Mark task as likely flaky`.
![Mark task as likely flaky button](/nx-cloud/features/mark-task-as-likely-flaky.png)
Once you've resolved the issue that caused a task to be flaky, you can immediately mark the task as not flaky by clicking on `Mark task as no longer flaky` on the same run details screen.
![Mark task as no longer flaky button](/nx-cloud/features/mark-task-as-no-longer-flaky.png)
## Re-run Flaky Tasks
When a flaky task fails in CI with [distributed task execution](/ci/features/distribute-task-execution) enabled, Nx will automatically send that task to a different agent and run it again (up to 2 tries in total). Its important to run the task on a different agent to ensure that the agent itself or the other tasks that were run on that agent are not the reason for the flakiness.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 66 KiB

+303 -9
View File
@@ -11,14 +11,14 @@ To enable automatically split e2e tasks, you need to turn on [inferred tasks](/c
{% tabs %}
{% tab label="Cypress" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/cypress
```
{% /tab %}
{% tab label="Playwright" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/playwright
```
@@ -33,15 +33,301 @@ If you are already using the `@nx/cypress` or `@nx/playwright` plugin, you need
## Usage
You can view the available tasks in the graph:
You can view the available tasks for your project in the project detail view:
```shell
nx graph
nx show project myproject-e2e --web
```
{% project-details title="Project Details View" height="100px" %}
```json
{
"project": {
"name": "admin-e2e",
"data": {
"root": "apps/admin-e2e",
"projectType": "application",
"targets": {
"e2e": {
"cache": true,
"inputs": ["default", "^production"],
"outputs": [
"{workspaceRoot}/dist/cypress/apps/admin-e2e/videos",
"{workspaceRoot}/dist/cypress/apps/admin-e2e/screenshots"
],
"executor": "nx:run-commands",
"dependsOn": ["^build"],
"options": {
"cwd": "apps/admin-e2e",
"command": "cypress run"
},
"configurations": {
"production": {
"command": "cypress run --env webServerCommand=\"nx run admin:preview\""
}
}
},
"e2e-ci--src/e2e/app.cy.ts": {
"outputs": [
"{workspaceRoot}/dist/cypress/apps/admin-e2e/videos",
"{workspaceRoot}/dist/cypress/apps/admin-e2e/screenshots"
],
"inputs": [
"default",
"^production",
{
"externalDependencies": ["cypress"]
}
],
"cache": true,
"options": {
"cwd": "apps/admin-e2e",
"command": "cypress run --env webServerCommand=\"nx run admin:serve-static\" --spec src/e2e/app.cy.ts"
},
"executor": "nx:run-commands",
"configurations": {}
},
"e2e-ci--src/e2e/login.cy.ts": {
"outputs": [
"{workspaceRoot}/dist/cypress/apps/admin-e2e/videos",
"{workspaceRoot}/dist/cypress/apps/admin-e2e/screenshots"
],
"inputs": [
"default",
"^production",
{
"externalDependencies": ["cypress"]
}
],
"cache": true,
"options": {
"cwd": "apps/admin-e2e",
"command": "cypress run --env webServerCommand=\"nx run admin:serve-static\" --spec src/e2e/login.cy.ts"
},
"executor": "nx:run-commands",
"configurations": {}
},
"e2e-ci": {
"executor": "nx:noop",
"cache": true,
"inputs": [
"default",
"^production",
{
"externalDependencies": ["cypress"]
}
],
"outputs": [
"{workspaceRoot}/dist/cypress/apps/admin-e2e/videos",
"{workspaceRoot}/dist/cypress/apps/admin-e2e/screenshots"
],
"dependsOn": [
{
"target": "e2e-ci--src/e2e/app.cy.ts",
"projects": "self",
"params": "forward"
},
{
"target": "e2e-ci--src/e2e/login.cy.ts",
"projects": "self",
"params": "forward"
}
],
"options": {},
"configurations": {}
},
"lint": {
"executor": "@nx/eslint:lint",
"inputs": ["default", "{workspaceRoot}/.eslintrc.json"],
"cache": true,
"outputs": ["{options.outputFile}"],
"options": {},
"configurations": {}
}
},
"name": "admin-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/admin-e2e/src",
"tags": [],
"implicitDependencies": ["admin"]
}
},
"sourceMap": {
"root": ["apps/admin-e2e/project.json", "nx/core/project-json"],
"projectType": ["apps/admin-e2e/project.json", "nx/core/project-json"],
"targets": ["apps/admin-e2e/project.json", "nx/core/project-json"],
"targets.e2e": ["apps/admin-e2e/project.json", "nx/core/target-defaults"],
"targets.e2e.options": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e.cache": [
"apps/admin-e2e/project.json",
"nx/core/target-defaults"
],
"targets.e2e.inputs": [
"apps/admin-e2e/project.json",
"nx/core/target-defaults"
],
"targets.e2e.outputs": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e.configurations": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e.executor": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e.options.cwd": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e.options.command": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e.configurations.production": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e.configurations.production.command": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/app.cy.ts": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/app.cy.ts.outputs": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/app.cy.ts.inputs": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/app.cy.ts.cache": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/app.cy.ts.options": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/app.cy.ts.executor": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/app.cy.ts.options.cwd": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/app.cy.ts.options.command": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/login.cy.ts": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/login.cy.ts.outputs": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/login.cy.ts.inputs": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/login.cy.ts.cache": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/login.cy.ts.options": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/login.cy.ts.executor": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/login.cy.ts.options.cwd": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci--src/e2e/login.cy.ts.options.command": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci.executor": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci.cache": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci.inputs": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci.outputs": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e-ci.dependsOn": [
"apps/admin-e2e/cypress.config.ts",
"@nx/cypress/plugin"
],
"targets.e2e.dependsOn": [
"apps/admin-e2e/project.json",
"nx/core/target-defaults"
],
"targets.lint": ["apps/admin-e2e/project.json", "nx/core/project-json"],
"targets.lint.executor": [
"apps/admin-e2e/project.json",
"nx/core/project-json"
],
"targets.lint.inputs": [
"apps/admin-e2e/project.json",
"nx/core/target-defaults"
],
"targets.lint.cache": [
"apps/admin-e2e/project.json",
"nx/core/target-defaults"
],
"name": ["apps/admin-e2e/project.json", "nx/core/project-json"],
"$schema": ["apps/admin-e2e/project.json", "nx/core/project-json"],
"sourceRoot": ["apps/admin-e2e/project.json", "nx/core/project-json"],
"tags": ["apps/admin-e2e/project.json", "nx/core/project-json"],
"implicitDependencies": [
"apps/admin-e2e/project.json",
"nx/core/project-json"
],
"implicitDependencies.admin": [
"apps/admin-e2e/project.json",
"nx/core/project-json"
],
"targets.lint.outputs": [
"apps/admin-e2e/project.json",
"nx/core/project-json"
]
}
}
```
{% /project-details %}
You'll see that there are tasks named `e2e`, `e2e-ci` and a task for each e2e test file.
Developers can run all e2e tests locally the same way as usual:
Developers can run all e2e tests locally with the `e2e` target:
```shell
nx e2e my-project-e2e
@@ -55,8 +341,16 @@ nx e2e-ci my-project-e2e
## Benefits
Smaller e2e tasks enable the following benefits:
With more granular e2e tasks, all the other features of Nx become more powerful. Let's imagine a scenario where there are 10 spec files in a single e2e project and each spec file takes 3 minutes to run.
- Nx's cache can be used for all the e2e tasks that succeeded and only the failed tasks need to be re-run
- Distributed Task Execution allows your e2e tests to be run on multiple machines simultaneously, which reduces the total time of the CI pipeline
- Nx Agents can [automatically re-run failed flaky e2e tests](/ci/features/flaky-tasks) on a separate agent without a developer needing to manually re-run the CI pipeline
### Improved Caching
[Nx's cache](/ci/features/remote-cache) can be used for all the individual e2e tasks that succeeded and only the failed tasks need to be re-run. Without e2e task splitting, a single spec file failing would force you to re-run all the e2e tests for the project, which would take 30 minutes. With e2e task splitting, a single spec file that fails can be re-run in 3 minutes and the other successful spec file results can be retrieved from the cache.
### Better Distribution
[Distributed task execution](/ci/features/distribute-task-execution) allows your e2e tests to be run on multiple machines simultaneously, which reduces the total time of the CI pipeline. Without e2e task splitting, the CI pipeline has to take at least 30 minutes to complete because the one e2e task needs that long to finish. With e2e task splitting, a fully distributed pipeline with 10 agents could finish in 3 minutes.
### More Precise Flaky Task Identification
Nx Agents [automatically re-run failed flaky e2e tests](/ci/features/flaky-tasks) on a separate agent without a developer needing to manually re-run the CI pipeline. Leveraging e2e task splitting, Nx identifies the specific flaky test file - this way you can quickly fix the offending test file. Without e2e splitting, Nx identifies that at least one of the e2e tests are flaky - requiring you to find the flaky test on your own.
+8 -2
View File
@@ -10,8 +10,8 @@ This is an example of a launch template using all built-in features:
```yaml
launch-templates:
my-linux-medium-js:
resourceClass: ''
image: 'ubuntu22.04-node20.9-v1'
resourceClass: 'docker_linux_amd64/medium'
image: 'ubuntu22.04-node20.9-v3'
env: MY_ENV_VAR=shared
init-steps:
- name: Checkout # using a reusable step
@@ -47,6 +47,7 @@ The following resource classes are available:
- `docker_linux_amd64/large+`
- `docker_linux_amd64/extra_large`
- `docker_linux_amd64/extra_large+`
- `windows/medium`
See their detailed description and pricing at [nx.app/pricing](https://nx.app/pricing).
@@ -58,6 +59,11 @@ The following images are available:
- `ubuntu22.04-node20.9-withDind-v1`
- `ubuntu22.04-node20.9-v2`
- `ubuntu22.04-node20.9-withDind-v2`
- `ubuntu22.04-node20.9-v3`
- `ubuntu22.04-node20.9-withDind-v3`
- `windows-2022`
_Note: Windows-based images can only run on Windows-based resource classes._
Enterprise accounts can use custom images.
+2 -2
View File
@@ -21,7 +21,7 @@ You can also define the configuration in a file and reference it as follows:
```yaml {% fileName=".nx/workflows/dynamic-changesets.yaml" %}
distribute-on:
small-changeset: 1 linux-medium-js
small-changeset: 3 linux-medium-js
medium-changeset: 6 linux-medium-js
large-changeset: 10 linux-medium-js
```
@@ -86,7 +86,7 @@ individual commands as follows:
## npx nx-cloud stop-all-agents
Same as `npx nx-cloud complete-ci-run` and `npx nx-cloud complete-run-group`.
Same as `npx nx-cloud complete-ci-run`.
This command tells Nx Cloud to terminate all agents associated with this CI pipeline execution.
Invoking this command is not needed anymore. New versions of Nx Cloud can track when the main job terminates
@@ -0,0 +1,62 @@
# Understanding 'CI Execution Failed'
## Task Runner-Related
### No additional tasks detected
Nx Cloud is not aware of any more tasks to distribute. This can occur if Nx Cloud thinks it is done receiving tasks to distribute and all existing tasks have been completed.
If you are receiving this error before your full pipeline has completed, consider using [--stop-agents-after](https://nx.dev/ci/reference/nx-cloud-cli#stopagentsafter) with the target set to the last target run in your pipeline.
### The Nx Cloud heartbeat process failed to report its status in time
While running in CI environments, Nx Cloud spawns a background process called the "heartbeat" to help maintain status synchronization between itself and external platforms. When the heartbeat process does not report to Nx Cloud for 30 seconds or longer, Nx Cloud assumes something has gone wrong and terminates the current CI Pipeline Execution.
This behavior can be disabled by setting the [--require-explicit-completion](https://nx.dev/ci/reference/nx-cloud-cli#requireexplicitcompletion) flag to `true` on your `nx-cloud start-ci-run` command.
### A command was issued to stop all Nx Cloud agents
Nx Cloud provides two commands to forcibly stop agents, [stop-all-agents and complete-ci-run](https://nx.dev/ci/reference/nx-cloud-cli#npx-nxcloud-stopallagents).
Once these commands are invoked, the current CI Pipeline Execution is closed and can no longer receive new work.
### Nx Cloud agents were stopped due to an error
Nx Cloud detected a failed task in the current CI Pipeline Execution and has halted further execution.
This behavior can be disabled by setting the [--stop-agents-on-failure](https://nx.dev/ci/reference/nx-cloud-cli#stopagentsonfailure) flag to `false` on your `nx-cloud start-ci-run` command.
## Nx Agents-Related
### Failed to start Nx Agents workflow
Nx Cloud was unable to start the agents workflow with the configuration provided to `nx-cloud start-ci-run`. View the CI Pipeline Execution in the Nx Cloud UI for additional details.
### Unable to get workflow status from Nx Agents
Nx Cloud was unable to communicate with the Nx Agents assigned to a workflow for the current CI Pipeline Execution. View the CI Pipeline Execution in the Nx Cloud UI for additional details.
## Status Reconciliation-Related
### One or more workflows were cancelled
The current CI Pipeline Execution had a workflow cancelled due to either:
- a manual request in the Nx Cloud UI, or
- a push to the same branch that already had a running workflow.
### One or more workflows encountered a critical error
The current CI Pipeline Execution encountered a critical error in a child execution environment. View the CI Pipeline Execution in the Nx Cloud UI for additional details.
### One or more workflows failed
The current CI Pipeline Execution had at least one workflow with failed steps.
### One or more workflows encountered an error
The current CI Pipeline Execution had at least one workflow that executed tasks which failed. See also: [Nx Cloud agents were stopped due to an error](#nx-cloud-agents-were-stopped-due-to-an-error)
### One or more workflows timed out
The current CI Pipeline Execution had at least one workflow that exceeded the timeout duration. View the CI Pipeline Execution in the Nx Cloud UI for additional details.
+31 -25
View File
@@ -212,16 +212,16 @@ pnpm nx build landing-page
Clearly this is not a scalable solution as it requires us to manually add every new app to the pipeline (and it doesn't include other tasks like `lint`, `test` etc). To improve this we can change the command to run the `build` for all projects like
```{% command="nx run-many -t build" %}
✔ nx run shared-product-types:build (429ms)
✔ nx run shared-product-ui:build (455ms)
✔ nx run shared-header:build (467ms)
✔ nx run landing-page:build:production (3s)
✔ nx run admin:build:production (3s)
✔ nx run cart:build:production (3s)
✔ nx run shared-product-types:build (429ms)
✔ nx run shared-product-ui:build (455ms)
✔ nx run shared-header:build (467ms)
✔ nx run landing-page:build:production (3s)
✔ nx run admin:build:production (3s)
✔ nx run cart:build:production (3s)
————————————————————————————————————————————————————————————————
————————————————————————————————————————————————————————————————
> NX Successfully ran target build for 6 projects (10s)
NX Successfully ran target build for 6 projects (10s)
```
This change makes our CI pipeline configuration more maintainable. For a small repository, this might be good enough, but after a little bit of growth this approach will cause your CI times to become unmanageable.
@@ -229,14 +229,14 @@ This change makes our CI pipeline configuration more maintainable. For a small r
Nx comes with a dedicated ["affected" command](/ci/features/affected) to help with that by only running tasks for projects that were affected by the changes in a given PR.
```{% command="nx affected -t build" %}
✔ nx run shared-product-types:build (404ms)
✔ nx run shared-product-ui:build (445ms)
✔ nx run shared-header:build (465ms)
✔ nx run cart:build:production (3s)
✔ nx run shared-product-types:build (404ms)
✔ nx run shared-product-ui:build (445ms)
✔ nx run shared-header:build (465ms)
✔ nx run cart:build:production (3s)
——————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project cart and 3 tasks it depends on (4s)
NX Successfully ran target build for project cart and 3 tasks it depends on (4s)
```
### Configuring the Comparison Range for Affected Commands
@@ -336,8 +336,14 @@ This wires up all the CI for you and configures access. Folks who can see your r
To manually connect your workspace to Nx Cloud, run the following command in your repository:
```shell
pnpm nx connect
```{% command="pnpm nx connect" %}
$ nx g nx:connect-to-nx-cloud --quiet --no-interactive
NX Your Nx Cloud workspace is public
To restrict access, connect it to your Nx Cloud account:
- Push your changes
- Login at https://cloud.nx.app to connect your repository
```
Click the link in the terminal to claim your workspace on [nx.app](https://nx.app).
@@ -360,18 +366,18 @@ What is more, if you run tasks locally, you will also get cache hits:
```{% command="nx run-many -t build" %}
...
✔ nx run express-legacy:build [remote cache]
✔ nx run nx-plugin-legacy:build [remote cache]
✔ nx run esbuild-legacy:build [remote cache]
✔ nx run react-native-legacy:build [remote cache]
✔ nx run angular-legacy:build [remote cache]
✔ nx run remix-legacy:build [remote cache]
✔ nx run express-legacy:build [remote cache]
✔ nx run nx-plugin-legacy:build [remote cache]
✔ nx run esbuild-legacy:build [remote cache]
✔ nx run react-native-legacy:build [remote cache]
✔ nx run angular-legacy:build [remote cache]
✔ nx run remix-legacy:build [remote cache]
————————————————————————————————————————————————
————————————————————————————————————————————————
> NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m)
NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m)
Nx read the output from the cache instead of running the command for 116 out of 120 tasks.
Nx read the output from the cache instead of running the command for 116 out of 120 tasks.
```
You might also want to learn more about [how to fine-tune caching](/recipes/running-tasks/configure-inputs) to get even better results.
+23 -23
View File
@@ -207,16 +207,16 @@ pnpm nx build landing-page
Clearly this is not a scalable solution as it requires us to manually add every new app to the pipeline (and it doesn't include other tasks like `lint`, `test` etc). To improve this we can change the command to run the `build` for all projects like
```{% command="nx run-many -t build" %}
✔ nx run shared-product-types:build (429ms)
✔ nx run shared-product-ui:build (455ms)
✔ nx run shared-header:build (467ms)
✔ nx run landing-page:build:production (3s)
✔ nx run admin:build:production (3s)
✔ nx run cart:build:production (3s)
✔ nx run shared-product-types:build (429ms)
✔ nx run shared-product-ui:build (455ms)
✔ nx run shared-header:build (467ms)
✔ nx run landing-page:build:production (3s)
✔ nx run admin:build:production (3s)
✔ nx run cart:build:production (3s)
————————————————————————————————————————————————————————————————
————————————————————————————————————————————————————————————————
> NX Successfully ran target build for 6 projects (10s)
NX Successfully ran target build for 6 projects (10s)
```
This change makes our CI pipeline configuration more maintainable. For a small repository, this might be good enough, but after a little bit of growth this approach will cause your CI times to become unmanageable.
@@ -224,14 +224,14 @@ This change makes our CI pipeline configuration more maintainable. For a small r
Nx comes with a dedicated ["affected" command](/ci/features/affected) to help with that by only running tasks for projects that were affected by the changes in a given PR.
```{% command="nx affected -t build" %}
✔ nx run shared-product-types:build (404ms)
✔ nx run shared-product-ui:build (445ms)
✔ nx run shared-header:build (465ms)
✔ nx run cart:build:production (3s)
✔ nx run shared-product-types:build (404ms)
✔ nx run shared-product-ui:build (445ms)
✔ nx run shared-header:build (465ms)
✔ nx run cart:build:production (3s)
——————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project cart and 3 tasks it depends on (4s)
NX Successfully ran target build for project cart and 3 tasks it depends on (4s)
```
### Configuring the Comparison Range for Affected Commands
@@ -345,18 +345,18 @@ What is more, if you run tasks locally, you will also get cache hits:
```{% command="nx run-many -t build" %}
...
✔ nx run express-legacy:build [remote cache]
✔ nx run nx-plugin-legacy:build [remote cache]
✔ nx run esbuild-legacy:build [remote cache]
✔ nx run react-native-legacy:build [remote cache]
✔ nx run angular-legacy:build [remote cache]
✔ nx run remix-legacy:build [remote cache]
✔ nx run express-legacy:build [remote cache]
✔ nx run nx-plugin-legacy:build [remote cache]
✔ nx run esbuild-legacy:build [remote cache]
✔ nx run react-native-legacy:build [remote cache]
✔ nx run angular-legacy:build [remote cache]
✔ nx run remix-legacy:build [remote cache]
————————————————————————————————————————————————
————————————————————————————————————————————————
> NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m)
NX Successfully ran target build for 58 projects and 62 tasks they depend on (1m)
Nx read the output from the cache instead of running the command for 116 out of 120 tasks.
Nx read the output from the cache instead of running the command for 116 out of 120 tasks.
```
You might also want to learn more about [how to fine-tune caching](/recipes/running-tasks/configure-inputs) to get even better results.
@@ -470,14 +470,14 @@ More conveniently, we can also run them in parallel using the following syntax:
```{% command="nx run-many -t test lint e2e" path="myngapp" %}
✔ nx run e2e:lint (1s)
✔ nx run myngapp:lint (1s)
✔ nx run myngapp:test (2s)
✔ nx run e2e:e2e (6s)
✔ nx run e2e:lint (1s)
✔ nx run myngapp:lint (1s)
✔ nx run myngapp:test (2s)
✔ nx run e2e:e2e (6s)
——————————————————————————————————————————————————————
——————————————————————————————————————————————————————
> NX Successfully ran targets test, lint, e2e for 2 projects (8s)
NX Successfully ran targets test, lint, e2e for 2 projects (8s)
```
### Caching
@@ -490,16 +490,16 @@ Note that all of these targets are automatically cached by Nx. If you re-run a s
```{% command="nx run-many -t test lint e2e" path="myngapp" %}
✔ nx run myngapp:lint [existing outputs match the cache, left as is]
✔ nx run e2e:lint [existing outputs match the cache, left as is]
✔ nx run myngapp:test [existing outputs match the cache, left as is]
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
✔ nx run myngapp:lint [existing outputs match the cache, left as is]
✔ nx run e2e:lint [existing outputs match the cache, left as is]
✔ nx run myngapp:test [existing outputs match the cache, left as is]
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
———————————————————————————————————————————————————————
———————————————————————————————————————————————————————
> NX Successfully ran targets test, lint, e2e for 2 projects (143ms)
Successfully ran targets test, lint, e2e for 2 projects (143ms)
Nx read the output from the cache instead of running the command for 4 out of 4 tasks.
Nx read the output from the cache instead of running the command for 4 out of 4 tasks.
```
Not all tasks might be cacheable though. You can configure the `cache` properties in the targets under `targetDefaults` in the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results).
@@ -514,44 +514,44 @@ Generators allow you to easily scaffold code, configuration or entire projects.
```{% command="npx nx list @nx/angular" path="myngapp" %}
> NX Capabilities in @nx/angular:
NX Capabilities in @nx/angular:
> NX Capabilities in @nx/angular:
NX Capabilities in @nx/angular:
GENERATORS
GENERATORS
add-linting : Adds linting configuration to an Angular project.
application : Creates an Angular application.
component : Generate an Angular Component.
...
library : Creates an Angular library.
library-secondary-entry-point : Creates a secondary entry point for an Angular publishable library.
remote : Generate a Remote Angular Module Federation Application.
move : Moves an Angular application or library to another folder within the workspace and updates the project configuration.
convert-to-with-mf : Converts an old micro frontend configuration...
host : Generate a Host Angular Module Federation Application.
ng-add : Migrates an Angular CLI workspace to Nx or adds the Angular plugin to an Nx workspace.
ngrx : Adds NgRx support to an application or library.
scam-to-standalone : Convert an existing Single Component Angular Module (SCAM) to a Standalone Component.
scam : Generate a component with an accompanying Single Component Angular Module (SCAM).
scam-directive : Generate a directive with an accompanying Single Component Angular Module (SCAM).
scam-pipe : Generate a pipe with an accompanying Single Component Angular Module (SCAM).
setup-mf : Generate a Module Federation configuration for a given Angular application.
setup-ssr : Generate Angular Universal (SSR) setup for an Angular application.
setup-tailwind : Configures Tailwind CSS for an application or a buildable/publishable library.
stories : Creates stories/specs for all components declared in a project.
storybook-configuration : Adds Storybook configuration to a project.
cypress-component-configuration : Setup Cypress component testing for a project.
web-worker : Creates a Web Worker.
directive : Generate an Angular directive.
ngrx-feature-store : Adds an NgRx Feature Store to an application or library.
ngrx-root-store : Adds an NgRx Root Store to an application.
pipe : Generate an Angular Pipe
add-linting : Adds linting configuration to an Angular project.
application : Creates an Angular application.
component : Generate an Angular Component.
...
library : Creates an Angular library.
library-secondary-entry-point : Creates a secondary entry point for an Angular publishable library.
remote : Generate a Remote Angular Module Federation Application.
move : Moves an Angular application or library to another folder within the workspace and updates the project configuration.
convert-to-with-mf : Converts an old micro frontend configuration...
host : Generate a Host Angular Module Federation Application.
ng-add : Migrates an Angular CLI workspace to Nx or adds the Angular plugin to an Nx workspace.
ngrx : Adds NgRx support to an application or library.
scam-to-standalone : Convert an existing Single Component Angular Module (SCAM) to a Standalone Component.
scam : Generate a component with an accompanying Single Component Angular Module (SCAM).
scam-directive : Generate a directive with an accompanying Single Component Angular Module (SCAM).
scam-pipe : Generate a pipe with an accompanying Single Component Angular Module (SCAM).
setup-mf : Generate a Module Federation configuration for a given Angular application.
setup-ssr : Generate Angular Universal (SSR) setup for an Angular application.
setup-tailwind : Configures Tailwind CSS for an application or a buildable/publishable library.
stories : Creates stories/specs for all components declared in a project.
storybook-configuration : Adds Storybook configuration to a project.
cypress-component-configuration : Setup Cypress component testing for a project.
web-worker : Creates a Web Worker.
directive : Generate an Angular directive.
ngrx-feature-store : Adds an NgRx Feature Store to an application or library.
ngrx-root-store : Adds an NgRx Root Store to an application.
pipe : Generate an Angular Pipe
EXECUTORS/BUILDERS/
EXECUTORS/BUILDERS/
delegate-build : Delegates the build to a different target while supporting incremental builds.
...
delegate-build : Delegates the build to a different target while supporting incremental builds.
...
```
{% callout type="info" title="Prefer a more visual UI?" %}
@@ -565,7 +565,7 @@ More info can be found in [the integrate with editors article](/features/integra
Run the following command to generate a new "hello-world" component. Note how we append `--dry-run` to first check the output.
```{% command="npx nx g @nx/angular:component hello-world --directory=src/app/hello-world --standalone --dry-run" path="myngapp" %}
> NX Generating @nx/angular:component
NX Generating @nx/angular:component
CREATE src/app/hello-world/hello-world.component.css
CREATE src/app/hello-world/hello-world.component.html
@@ -614,9 +614,9 @@ styles.ef46db3751d8e999.css | styles | 0 bytes |
Build at: 2023-05-23T14:00:31.981Z - Hash: 9086e92ce0bfefca - Time: 5228ms
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project myngapp (7s)
Successfully ran target build for project myngapp (7s)
```
All the required files will be placed in the `dist/myngapp` folder and can be deployed to your favorite hosting provider.
@@ -1051,29 +1051,29 @@ export class ProductsComponent {}
If you lint your workspace you'll get an error now:
```{% command="nx run-many -t lint" %}
✖ nx run products:lint
Linting "products"...
✖ nx run products:lint
Linting "products"...
/Users/juri/nrwl/content/myngapp/modules/products/src/lib/products/products.component.ts
3:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries
/Users/juri/nrwl/content/myngapp/modules/products/src/lib/products/products.component.ts
3:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries
✖ 1 problem (1 error, 0 warnings)
✖ 1 problem (1 error, 0 warnings)
Lint errors found in the listed files.
Lint errors found in the listed files.
✔ nx run orders:lint (1s)
✔ nx run myngapp:lint (1s)
✔ nx run e2e:lint (682ms)
✔ nx run shared-ui:lint (797ms)
✔ nx run orders:lint (1s)
✔ nx run myngapp:lint (1s)
✔ nx run e2e:lint (682ms)
✔ nx run shared-ui:lint (797ms)
—————————————————————————————————————————————————————————————————————
—————————————————————————————————————————————————————————————————————
> NX Ran target lint for 5 projects (2s)
NX Ran target lint for 5 projects (2s)
✔ 4/5 succeeded [0 read from cache]
✔ 4/5 succeeded [0 read from cache]
✖ 1/5 targets failed, including the following:
- nx run products:lint
✖ 1/5 targets failed, including the following:
- nx run products:lint
```
@@ -52,7 +52,7 @@ title="Tutorial: Standalone Angular Application"
Create a new Angular monorepo with the following command:
```{% command="npx create-nx-workspace@latest angular-monorepo --preset=angular-monorepo" path="~" %}
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Application name · angular-store
✔ Which bundler would you like to use? · esbuild
@@ -566,7 +566,7 @@ Nx plugins usually provide [generators](/features/generate-code) that allow you
```{% command="npx nx list @nx/angular" path="angular-monorepo" %}
> NX Capabilities in @nx/angular:
NX Capabilities in @nx/angular:
GENERATORS
@@ -608,7 +608,7 @@ More info can be found in [the integrate with editors article](/features/integra
Run the following command to generate a new `inventory` application. Note how we append `--dry-run` to first check the output.
```{% command="npx nx g @nx/angular:app inventory --directory=apps/inventory --dry-run" path="angular-monorepo" %}
> NX Generating @nx/angular:application
NX Generating @nx/angular:application
✔ Would you like to configure routing for this application? (y/N) · false
✔ Would you like to use Standalone Components? (y/N) · true
@@ -1009,17 +1009,16 @@ One thing to highlight is that Nx is able to [cache the tasks you run](/features
Note that all of these targets are automatically cached by Nx. If you re-run a single one or all of them again, you'll see that the task completes immediately. In addition, (as can be seen in the output example below) there will be a note that a matching cache result was found and therefore the task was not run again.
```{% command="nx run-many -t test lint e2e" path="angular-monorepo" %}
✔ nx run e2e:lint [existing outputs match the cache, left as is]
✔ nx run angular-store:lint [existing outputs match the cache, left as is]
✔ nx run angular-store:test [existing outputs match the cache, left as is]
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
✔ nx run e2e:lint [existing outputs match the cache, left as is]
✔ nx run angular-store:lint [existing outputs match the cache, left as is]
✔ nx run angular-store:test [existing outputs match the cache, left as is]
✔ nx run e2e:e2e [existing outputs match the cache, left as is]
——————————————————————————————————————————————————————
——————————————————————————————————————————————————————
NX Successfully ran targets test, lint, e2e for 5 projects (54ms)
> NX Successfully ran targets test, lint, e2e for 5 projects (54ms)
Nx read the output from the cache instead of running the command for 10 out of 10 tasks.
Nx read the output from the cache instead of running the command for 10 out of 10 tasks.
```
Not all tasks might be cacheable though. You can configure `cacheableOperations` in the `nx.json` file. You can also [learn more about how caching works](/features/cache-task-results).
@@ -1153,7 +1152,7 @@ nx graph --affected
If you're ready and want to ship your applications, you can build them using
```{% command="npx nx run-many -t build" path="angular-monorepo" %}
> NX Generating @nx/angular:component
NX Generating @nx/angular:component
CREATE libs/orders/src/lib/order-list/order-list.component.css
CREATE libs/orders/src/lib/order-list/order-list.component.html
@@ -1162,12 +1161,12 @@ CREATE libs/orders/src/lib/order-list/order-list.component.ts
UPDATE libs/orders/src/index.ts
nx run-many -t build
✔ nx run inventory:build:production (7s)
✔ nx run angular-store:build:production (7s)
✔ nx run inventory:build:production (7s)
✔ nx run angular-store:build:production (7s)
———————————————————————————————————————————————————————————————————————
———————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for 2 projects (7s)
NX Successfully ran target build for 2 projects (7s)
```
All the required files will be placed in `dist/apps/angular-store` and `dist/apps/inventory` and can be deployed to your favorite hosting provider.
@@ -1321,36 +1320,36 @@ export class ProductListComponent {}
If you lint your workspace you'll get an error now:
```{% command="nx run-many -t lint" %}
> NX Running target lint for 7 projects
✖ nx run products:lint
Linting "products"...
NX Running target lint for 7 projects
✖ nx run products:lint
Linting "products"...
/Users/isaac/Documents/code/nx-recipes/angular-monorepo/libs/products/src/lib/product-list/product-list.component.ts
5:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries
5:10 warning 'OrderListComponent' is defined but never used @typescript-eslint/no-unused-vars
/Users/isaac/Documents/code/nx-recipes/angular-monorepo/libs/products/src/lib/product-list/product-list.component.ts
5:1 error A project tagged with "scope:products" can only depend on libs tagged with "scope:products", "scope:shared" @nx/enforce-module-boundaries
5:10 warning 'OrderListComponent' is defined but never used @typescript-eslint/no-unused-vars
✖ 2 problems (1 error, 1 warning)
✖ 2 problems (1 error, 1 warning)
Lint warnings found in the listed files.
Lint warnings found in the listed files.
Lint errors found in the listed files.
Lint errors found in the listed files.
✔ nx run orders:lint (1s)
✔ nx run angular-store:lint (1s)
✔ nx run angular-store-e2e:lint (689ms)
✔ nx run inventory-e2e:lint (690ms)
✔ nx run inventory:lint (858ms)
✔ nx run shared-ui:lint (769ms)
✔ nx run orders:lint (1s)
✔ nx run angular-store:lint (1s)
✔ nx run angular-store-e2e:lint (689ms)
✔ nx run inventory-e2e:lint (690ms)
✔ nx run inventory:lint (858ms)
✔ nx run shared-ui:lint (769ms)
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Ran target lint for 7 projects (3s)
NX Ran target lint for 7 projects (3s)
6/7 succeeded [0 read from cache]
6/7 succeeded [0 read from cache]
1/7 targets failed, including the following:
- nx run products:lint
1/7 targets failed, including the following:
- nx run products:lint
```
If you have the ESLint plugin installed in your IDE you should immediately see an error:
+6 -1
View File
@@ -1,9 +1,14 @@
# Inferred Tasks
# Inferred Tasks (Project Crystal)
In Nx version 18, many Nx plugins will automatically infer tasks for your projects based on the configuration of different tools. Many tools have configuration files which determine what a tool does. Nx is able to cache the results of running the tool. Nx plugins use the same configuration files to infer how Nx should [run the task](/features/run-tasks). This includes [fine-tuned cache settings](/features/cache-task-results) and automatic [task dependencies](/concepts/task-pipeline-configuration).
For example, the `@nx/webpack` plugin infers tasks to run webpack through Nx based on your repository's webpack configuration. This configuration already defines the destination of your build files, so Nx reads that value and caches the correct output files.
{% youtube
src="https://youtu.be/wADNsVItnsM"
title="Project Crystal"
/%}
## How Does a Plugin Infer Tasks?
Every plugin has its own custom logic, but in order to infer tasks, they all go through the following steps.
+3 -3
View File
@@ -135,11 +135,11 @@ Hello, World!
||----w |
|| ||
—————————————————————————————————————————————————————————————————————————————————————————
—————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target serve for project cli (2s)
NX Successfully ran target serve for project cli (2s)
See Nx Cloud run details at https://nx.app/runs/THRW7SDRL9S
See Nx Cloud run details at https://nx.app/runs/THRW7SDRL9S
```
@@ -48,7 +48,7 @@ Update `packages/ascii/assets/cow.txt`:
```plaintext
_____
< Hi! >
< moo >
-----
\ ^__^
\ (oo)\_______
@@ -66,14 +66,14 @@ Printing the affected projects can be handy, but usually you want to do somethin
**Run `nx affected -t build` to rebuild only the projects affected by the change.**
```shell
✔ nx run blog:build (1s)
✔ nx run cli:build (2s)
✔ nx run blog:build (1s)
✔ nx run cli:build (2s)
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for 2 projects (2s)
NX Successfully ran target build for 2 projects (2s)
See Nx Cloud run details at https://nx.app/runs/XfhRFaOyGCE
See Nx Cloud run details at https://nx.app/runs/XfhRFaOyGCE
```
Note that Nx only built `blog` and `cli`. It didn't build `ascii` because there is no build script created for it.
@@ -99,14 +99,13 @@ ______________________________________________________
(__)\ )\/\
||----w |
|| ||
Done in 0.14s.
Done in 0.14s.
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target serve for project cow
NX Successfully ran target serve for project cow
See Nx Cloud run details at https://nx.app/runs/nZBYYBEuIfG
See Nx Cloud run details at https://nx.app/runs/nZBYYBEuIfG
```
## View the Project Graph
@@ -24,7 +24,7 @@ To mitigate the impact of this change of direction, Nx will prompt you when runn
```{% command="nx g lib my-lib --directory=shared/my-lib" path="~/myorg" %}
✔ Which generator would you like to use? · @nx/node:library
> NX Generating @nx/node:library
NX Generating @nx/node:library
? What should be the project name and where should it be generated? …
As provided:
@@ -1,49 +1,18 @@
---
title: Angular - The browserTarget
description: This document explains the role of the browserTarget in Angular projects with a Storybook configuration, and how the Storybook executors use it.
title: Angular - The projectBuildConfig
description: This document explains the role of projectBuildConfig in Angular projects with a Storybook configuration, and how the Storybook executors use it.
---
# The `browserTarget` for Angular projects with a Storybook configuration
# Setting up `projectBuildConfig` for Nx versions `<14.1.8`
{% callout type="warning" title="Deprecated!" %}
**Careful**: This is for older versions of Nx - for the latest version please look at the [Set up Storybook for Angular Projects](/recipes/storybook/overview-angular) recipe.
{% /callout %}
{% callout type="note" title="Note" %}
This documentation page contains information about the [Storybook plugin](/nx-api/storybook), specifically regarding [Angular projects that are using Storybook](/recipes/storybook/overview-angular).
{% /callout %}
## Setting up `browserTarget`
If you're using [Storybook](/nx-api/storybook) in your Angular project, you will notice that `browserTarget` is specified for the `storybook` and `build-storybook` targets, much like it is done for `serve` or other targets. Angular needs the `browserTarget` for Storybook in order to know which configuration to use for the build. If your project is buildable (it has a `build` target, and uses the main Angular builder - `@angular-devkit/build-angular:browser`) the `browserTarget` for Storybook will use the `build` target, if it's not buildable it will use the `build-storybook` target.
You do not have to do anything manually. Nx will create the configuration for you. Even if you are migrating from an older version of Nx, Nx will make sure to change your `package.json` Storybook targets to match the new schema.
You can read more about the `browserTarget` in the [official Angular documentation](https://angular.io/cli/serve).
Your Storybook targets in your `project.json` will look like this:
```jsonc {% fileName="project.json" %}
"storybook": {
"executor": "@storybook/angular:start-storybook",
"options": {
...
"browserTarget": "my-project:build"
},
...
},
"build-storybook": {
"executor": "@storybook/angular:build-storybook",
...
"options": {
...
"browserTarget": "my-project:build"
},
...
}
```
This setup instructs Nx to use the configuration under the `build` target of `my-project` when using the `storybook` and `build-storybook` executors.
## Setting up `projectBuildConfig` for Nx versions `<14.1.8`
**_Careful: This is for older versions of Nx - for the latest version please look at the section above, about `browserTarget`_**
If you are on Nx version `<14.1.8`, you're still using our custom executor, which means that you have to comply by the Nx Storybook schema. This means that the contents of `browserTarget` should be placed in the `projectBuildConfig` property. This is telling Storybook where to get the build configuration from. To know more about the purpose of `browserTarget` (and `projectBuildConfig`) read the section above.
If you're using Nx version `>=13.4.6` either in a new Nx workspace, or you migrated your older Nx workspace to Nx version `>=13.4.6`, Nx will automatically add the `projectBuildConfig` property in your projects `project.json` files, for projects that are using Storybook.
@@ -15,7 +15,7 @@ Nx provides an `enforce-module-boundaries` eslint rule that enforces the public
To set up the lint rule, install these dependencies:
```shell
```shell {% skipRescope=true %}
nx add @nx/eslint-plugin @nx/devkit
```
+11 -14
View File
@@ -25,22 +25,19 @@ To see the remote cache in action, run:
src/index.tsx → dist...
created dist in 786ms
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project header (2s)
NX Successfully ran target build for project header (2s)
See logs and investigate cache misses at https://cloud.nx.app/runs/k0HDHACpL8
See logs and investigate cache misses at https://cloud.nx.app/runs/k0HDHACpL8
NX Resetting the Nx workspace cache and stopping the Nx Daemon.
> NX Resetting the Nx workspace cache and stopping the Nx Daemon.
This might take a few minutes.
This might take a few minutes.
NX Daemon Server - Stopped
> NX Daemon Server - Stopped
> NX Successfully reset the Nx workspace.
NX Successfully reset the Nx workspace.
> nx run header:build [remote cache]
@@ -53,13 +50,13 @@ created dist in 786ms
src/index.tsx → dist...
created dist in 786ms
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project header (664ms)
NX Successfully ran target build for project header (664ms)
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
Nx Cloud made it possible to reuse header: https://nx.app/runs/P0X6ZGTkqZ
Nx Cloud made it possible to reuse header: https://nx.app/runs/P0X6ZGTkqZ
```
## Skipping Cloud Cache
+1 -1
View File
@@ -30,7 +30,7 @@ This will guide you through the setup, asking whether you want a monorepo or a s
```{% command="npx create-nx-workspace" path="~" %}
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Where would you like to create your workspace? · myorg
? Which stack do you want to use? …
@@ -301,7 +301,7 @@ To use Module Federation well, we recommend that you enable [Nx Cloud](https://n
when using `create-nx-workspace`, you can do the following.
```shell
nx connect-to-nx-cloud
nx connect
```
With Nx Cloud enabled, a large set of builds can be skipped entirely when running the application locally (and in
@@ -327,11 +327,11 @@ If you inspect the terminal output, you'll see something like this, even if you
```shell
> nx run about:build:development [existing outputs match the cache, left as is]
(snip)
(snip)
> NX Successfully ran target build for project about
NX Successfully ran target build for project about
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
```
+1 -1
View File
@@ -134,7 +134,7 @@ When using React Native in Nx, you get the out-of-the-box support for TypeScript
For existing Nx workspaces, install the `@nx/react-native` package to add React Native capabilities to it.
```shell
```shell {% skipRescope=true %}
nx add @nx/react-native
```
+22 -22
View File
@@ -5,24 +5,24 @@ In this recipe, we'll show you how to create a [Remix](https://remix.run) applic
## Create Nx Workspace
```{% command="npx create-nx-workspace acme --preset=apps" path="~/" %}
> NX Let's create a new workspace [https://nx.dev/getting-started/intro]
NX Let's create a new workspace [https://nx.dev/getting-started/intro]
✔ Do you want Nx Cloud to make your CI fast? · Yes
> NX Creating your v16.3.2 workspace.
NX Creating your v16.3.2 workspace.
To make sure the command works reliably in all environments, and that the preset is applied correctly,
Nx will run "npm install" several times. Please wait.
To make sure the command works reliably in all environments, and that the preset is applied correctly,
Nx will run "npm install" several times. Please wait.
✔ Installing dependencies with npm
✔ Successfully created the workspace: acme.
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX First time using Nx? Check out this interactive Nx tutorial.
NX First time using Nx? Check out this interactive Nx tutorial.
https://nx.dev/tutorials/package-based-repo-tutorial
https://nx.dev/tutorials/package-based-repo-tutorial
```
## Install Nx Remix Plugin
@@ -31,7 +31,7 @@ In this recipe, we'll show you how to create a [Remix](https://remix.run) applic
Make sure to install the `@nx/remix` version that is on the same minor version as the `nx` version in your repository. If the version numbers get out of sync, you can encounter some difficult to debug errors. You can [fix Nx version mismatches with this recipe](/recipes/tips-n-tricks/keep-nx-versions-in-sync).
{% /callout %}
```shell
```shell {% skipRescope=true %}
nx add @nx/remix
```
@@ -42,7 +42,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %}
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %}
> NX Generating @nx/remix:application
NX Generating @nx/remix:application
✔ What unit test runner should be used? · vitest
@@ -88,9 +88,9 @@ Building Remix app in production mode...
Built in 857ms
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project myapp (3s)
NX Successfully ran target build for project myapp (3s)
```
2. To serve your application for use during development run:
@@ -108,18 +108,18 @@ Remix App Server started at http://localhost:3000 (http://192.168.0.14:3000)
```{% command="nx test myapp" path="~/acme" %}
> nx run myapp:test
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
stderr | app/routes/index.spec.ts > test > should render
Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
✓ app/routes/index.spec.ts (1 test) 10ms
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 16:15:45
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
✓ app/routes/index.spec.ts (1 test) 10ms
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 16:15:45
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target test for project myapp (2s)
NX Successfully ran target test for project myapp (2s)
```
## Generating an Nx Library
@@ -129,7 +129,7 @@ When developing your application, it often makes sense to split your codebase in
To generate a library to use in your Remix application run:
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %}
> NX Generating @nx/remix:library
NX Generating @nx/remix:library
✔ What test runner should be used? · vitest
UPDATE nx.json
@@ -176,7 +176,7 @@ You can also run test on your library:
To generate a route for your application:
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %}
> NX Generating @nx/remix:route
NX Generating @nx/remix:route
CREATE apps/myapp/app/routes/admin.tsx
CREATE apps/myapp/app/styles/admin.css
@@ -189,7 +189,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be
1. Generate a loader for your route:
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %}
> NX Generating @nx/remix:loader
NX Generating @nx/remix:loader
UPDATE apps/myapp/app/routes/admin.tsx
```
+1 -1
View File
@@ -41,7 +41,7 @@ At the next prompt, you can choose whether to use [Nx Cloud](https://nx.app) or
Your new workspace wont have much in it because of the `apps` preset. Youll need to generate an application to have some structure created. Add the Angular plugin to your workspace:
```shell
```shell {% skipRescope=true %}
nx add @nx/angular
```
+16 -36
View File
@@ -24,10 +24,12 @@ jobs:
pool:
vmImage: 'ubuntu-latest'
steps:
- checkout: self
fetchDepth: 0
# Set Azure Devops CLI default settings
- bash: az devops configure --defaults organization=$(System.TeamFoundationCollectionUri) project=$(System.TeamProject)
displayName: 'Set default Azure DevOps organization and project'
# Get last successfull commit from Azure Devops CLI
- displayName: 'Get last successful commit SHA'
condition: ne(variables['Build.Reason'], 'PullRequest')
@@ -45,39 +47,19 @@ jobs:
# Required for nx affected if we're on a branch
- script: git branch --track main origin/main
- script: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" # this line enables distribution
# This line enables distribution
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
- script: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
- script: npm ci
- script: npx nx-cloud record -- nx format:check --base=$(BASE_SHA)
- script: npx nx affected --base=$(BASE_SHA) -t lint test build --parallel=3
- script: npx nx affected --base=$(BASE_SHA) -t lint test build e2e-ci
```
{% callout type="note" title="Check your Shallow Fetch settings" %}
Nx needs additional Git history available for [`affected`](/ci/features/affected) to function correctly. Make sure
Shallow fetching is disabled in your pipeline settings UI. For more info, check out this article from
Microsoft [here](https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/steps-checkout?view=azure-pipelines#shallow-fetch).
{% /callout %}
Unlike `GitHub Actions` and `CircleCI`, you don't have the metadata to help you track the last successful run on `main`.
In the example below, the base is set to `HEAD~1` (for push) or branching point (for pull requests), but a more robust
solution would be to tag a SHA in the main job once it succeeds and then use this tag as a base. You can also
try [using the devops CLI within the pipeline yaml](#get-the-commit-of-the-last-successful-build). See
the [nx-tag-successful-ci-run](https://github.com/nrwl/nx-tag-successful-ci-run)
and [nx-set-shas](https://github.com/nrwl/nx-set-shas) (version 1 implements tagging mechanism) repositories for more
information.
We also have to set `NX_BRANCH` explicitly. NX_BRANCH does not impact the functionality of your runs, but does provide a
human-readable label to easily identify them in the Nx Cloud app.
The `main` job implements the CI workflow.
## Get the Commit of the Last Successful Build
In the example above we ran a script to retrieve the commit of the last successful build. The idea is to
use [Azure Devops CLI](https://learn.microsoft.com/en-us/cli/azure/pipelines?view=azure-cli-latest)
directly in
the [Pipeline Yaml](https://learn.microsoft.com/en-us/azure/devops/cli/azure-devops-cli-in-yaml?view=azure-devops)
In the example above, we ran a script to retrieve the commit of the last successful build. The idea is to
use [Azure Devops CLI](https://learn.microsoft.com/en-us/cli/azure/pipelines?view=azure-cli-latest) directly in the [Pipeline Yaml](https://learn.microsoft.com/en-us/azure/devops/cli/azure-devops-cli-in-yaml?view=azure-devops)
First, we configure Devops CLI
@@ -100,17 +82,15 @@ Then we can query the pipelines API (providing the auth token)
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
```
We can target a specific build, in this example we specified:
We can target a specific build; in this example, we specified:
- The branch (--branch)
- The pipeline Id (--definition-ids)
- The pipeline ID (--definition-ids)
- The result type (--result)
- The number of result (-top)
- The number of the result (-top)
By default the command returns an entire JSON object with all the information. But we can narrow it down to the desired
result with the `--query` param that uses [JMESPath](https://jmespath.org/)
The command returns an entire JSON object with all the information. But we can narrow it down to the desired result with the `--query` param that uses [JMESPath](https://jmespath.org/)
format ([more details](https://learn.microsoft.com/en-us/cli/azure/query-azure-cli?tabs=concepts%2Cbash))
Finally we extract the result in a
common [custom variable](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/set-variables-scripts?view=azure-devops&tabs=bash)
named `BASE_SHA` used later by `nx affected` commands
Finally, we extract the result in a common [custom variable](https://learn.microsoft.com/en-us/azure/devops/pipelines/process/set-variables-scripts?view=azure-devops&tabs=bash)
named `BASE_SHA` used later by the `nx format` and `nx affected` commands.
+22 -9
View File
@@ -1,33 +1,46 @@
# Configuring CI Using Bitbucket Pipelines and Nx
Below is an example of an Bitbucket Pipelines, building and testing only what is affected.
Below is an example of a Bitbucket Pipelines, building and testing only what is affected.
```yaml {% fileName="bitbucket-pipelines.yml" %}
image: node:20
clone:
depth: full
pipelines:
pull-requests:
'**':
- step:
name: 'Build and test affected apps on Pull Requests'
caches: # optional
- node
script:
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" # this line enables distribution
# This line enables distribution
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
- npm ci
- npx nx-cloud record -- nx format:check
- npx nx affected -t lint test build --base=origin/master --head=HEAD
- npx nx affected -t lint test build e2e-ci --base=origin/main
branches:
main:
- step:
name: "Build and test affected apps on 'main' branch changes"
caches: # optional
- node
script:
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" # this line enables distribution
- export NX_BRANCH=$BITBUCKET_PR_ID
# This line enables distribution
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
- npm ci
- npx nx-cloud record -- nx format:check
- npx nx affected -t lint test build --base=HEAD~1
- npx nx affected -t lint test build e2e-ci --base=HEAD~1
```
The `pull-requests` and `main` jobs implement the CI workflow.
### Get the Commit of the Last Successful Build
Unlike `GitHub Actions` and `CircleCI`, you don't have the metadata to help you track the last successful run on `main`. In the example below, the base is set to `HEAD~1` (for push) or branching point (for pull requests), but a more robust solution would be to tag an SHA in the main job once it succeeds and then use this tag as a base. See the [nx-tag-successful-ci-run](https://github.com/nrwl/nx-tag-successful-ci-run) and [nx-set-shas](https://github.com/nrwl/nx-set-shas) (version 1 implements tagging mechanism) repositories for more information.
We also have to set `NX_BRANCH` explicitly.
+11 -6
View File
@@ -1,23 +1,28 @@
# Configuring CI Using Circle CI and Nx
Below is an example of an Circle CI setup, building and testing only what is affected.
Below is an example of a Circle CI setup, building, and testing only what is affected.
```yaml {% fileName=".circleci/config.yml" %}
version: 2.1
orbs:
nx: nrwl/nx@1.5.1
nx: nrwl/nx@1.6.2
jobs:
main:
docker:
- image: cimg/node:lts-browsers
steps:
- checkout
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" # this line enables distribution
# This line enables distribution
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
- run: npm ci
- nx/set-shas
- run: npx nx-cloud record -- nx format:check
- run: npx nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build --parallel=3
- run: npx nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build e2e-ci
workflows:
build:
jobs:
@@ -26,13 +31,13 @@ workflows:
### Get the Commit of the Last Successful Build
`CircleCI` can track the last successful run on the `main` branch and use this as a reference point for the `BASE`. The `Nx Orb` provides a convenient implementation of this functionality which you can drop into your existing CI config. Specifically, `nx/set-shas` populates the `$NX_BASE` environment variable with the commit SHA of the last successful run.
`CircleCI` can track the last successful run on the `main` branch and use this as a reference point for the `BASE`. The [Nx Orb](https://github.com/nrwl/nx-orb) provides a convenient implementation of this functionality, which you can drop into your existing CI workflow. Specifically, for push commits, `nx/set-shas` populates the `$NX_BASE` environment variable with the commit SHA of the last successful run.
To understand why knowing the last successful build is important for the affected command, check out the [in-depth explanation in Orb's docs](https://github.com/nrwl/nx-orb#background).
### Using CircleCI in a private repository
To use the [Nx Orb](https://github.com/nrwl/nx-orb) with a private repository on your main branch, you need to grant the orb access to your CircleCI API. You can do this by creating an environment variable called `CIRCLE_API_TOKEN` in the context or the project.
To use the [Nx Orb](https://github.com/nrwl/nx-orb) with a private repository on your main branch, you need to grant the orb access to your CircleCI API. Create an environment variable called `CIRCLE_API_TOKEN` in the context of the project.
{% callout type="warning" title="Caution" %}
It should be a user token, not the project token.
+8 -5
View File
@@ -1,6 +1,6 @@
# Configuring CI Using GitHub Actions and Nx
Below is an example of an GitHub Actions setup, building and testing only what is affected.
Below is an example of a GitHub Actions setup, building, and testing only what is affected.
```yaml {% fileName=".github/workflows/ci.yml" %}
name: CI
@@ -23,22 +23,25 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# Cache node_modules
- uses: actions/setup-node@v3
with:
node-version: 20
cache: 'npm'
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" # this line enables distribution
# This line enables distribution
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
- run: npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
- run: npm ci
- uses: nrwl/nx-set-shas@v3
# This line is needed for nx affected to work when CI is running on a PR
- run: git branch --track main origin/main
- run: npx nx-cloud record -- nx format:check
- run: npx nx affected -t lint test build --parallel=3
- run: npx nx affected -t lint test build e2e-ci
```
### Get the Commit of the Last Successful Build
`GitHub` can track the last successful run on the `main` branch and use this as a reference point for the `BASE`. The `nrwl/nx-set-shas` provides a convenient implementation of this functionality which you can drop into your existing CI config.
The `GitHub` can track the last successful run on the `main` branch and use this as a reference point for the `BASE`. The [nrwl/nx-set-shas](https://github.com/marketplace/actions/nx-set-shas) provides a convenient implementation of this functionality, which you can drop into your existing CI workflow.
To understand why knowing the last successful build is important for the affected command, check out the [in-depth explanation in Actions's docs](https://github.com/marketplace/actions/nx-set-shas#background).
+11 -34
View File
@@ -1,16 +1,14 @@
# Configuring CI Using GitLab and Nx
Below is an example of an GitLab setup, building and testing only what is affected.
Below is an example of a GitLab setup, building and testing only what is affected.
```yaml {% fileName=".gitlab-ci.yml" %}
image: node:18
image: node:20
stages:
- lint
- test
- build
variables:
GIT_DEPTH: 0
.distributed:
main:
interruptible: true
only:
- main
@@ -21,36 +19,15 @@ stages:
- package-lock.json
paths:
- .npm/
before_script:
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="build" # this line enables distribution
script:
# Connect your workspace on <%= nxCloudHost %> and uncomment this to enable task distribution.
# The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
- npx nx-cloud start-ci-run --distribute-on="5 linux-medium-js" --stop-agents-after="e2e-ci"
- npm ci --cache .npm --prefer-offline
- NX_HEAD=$CI_COMMIT_SHA
- NX_BASE=${CI_MERGE_REQUEST_DIFF_BASE_SHA:-$CI_COMMIT_BEFORE_SHA}
variables:
GIT_DEPTH: 0
format-check:
stage: test
extends: .distributed
script:
- npx nx-cloud record -- nx format:check --base=$NX_BASE --head=$NX_HEAD
lint:
stage: test
extends: .distributed
script:
- npx nx affected --base=$NX_BASE --head=$NX_HEAD -t lint --parallel=3
test:
stage: test
extends: .distributed
script:
- npx nx affected --base=$NX_BASE --head=$NX_HEAD -t test --parallel=3
build:
stage: build
extends: .distributed
script:
- npx nx affected --base=$NX_BASE --head=$NX_HEAD -t build --parallel=3
- npx nx affected --base=$NX_BASE --head=$NX_HEAD -t lint test build e2e-ci
```
+9 -5
View File
@@ -1,6 +1,6 @@
# Configuring CI Using Jenkins and Nx
Below is an example of an Jenkins setup, building and testing only what is affected.
Below is an example of a Jenkins setup, building and testing only what is affected.
```groovy
pipeline {
@@ -17,10 +17,12 @@ pipeline {
}
agent any
steps {
sh "npx nx-cloud start-ci-run --distribute-on='5 linux-medium-js' --stop-agents-after='build'" // this line enables distribution
// This line enables distribution
// The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
sh "npx nx-cloud start-ci-run --distribute-on='5 linux-medium-js' --stop-agents-after='e2e-ci'"
sh "npm ci"
sh "npx nx-cloud record -- nx format:check"
sh "npx nx affected --base=HEAD~1 -t lint test build --parallel=3"
sh "npx nx affected --base=HEAD~1 -t lint test build e2e-ci"
}
}
stage('PR') {
@@ -29,10 +31,12 @@ pipeline {
}
agent any
steps {
sh "npx nx-cloud start-ci-run --distribute-on='5 linux-medium-js' --stop-agents-after='build'" // this line enables distribution
// This line enables distribution
// The "--stop-agents-after" is optional, but allows idle agents to shut down once the "e2e-ci" targets have been requested
sh "npx nx-cloud start-ci-run --distribute-on='5 linux-medium-js' --stop-agents-after='e2e-ci'"
sh "npm ci"
sh "npx nx-cloud record -- nx format:check"
sh "npx nx affected --base origin/${env.CHANGE_TARGET} -t lint test build --parallel=3"
sh "npx nx affected --base origin/${env.CHANGE_TARGET} -t lint test build e2e-ci"
}
}
}
+7 -7
View File
@@ -191,9 +191,9 @@ Run the same command a second time and you'll see the build cache is being used:
Compiling TypeScript files for project "is-even"...
Done compiling TypeScript files for project "is-even".
—————————————————————————————————————————————————————————————————————
—————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project is-even (713ms)
NX Successfully ran target build for project is-even (713ms)
```
## Running Multiple Tasks
@@ -207,14 +207,14 @@ npx nx run-many -t build
What you would get is the following:
```{% command="npx nx run-many -t build" %}
✔ nx run is-even:build [existing outputs match the cache, left as is]
✔ nx run is-odd:build (906ms)
✔ nx run is-even:build [existing outputs match the cache, left as is]
✔ nx run is-odd:build (906ms)
—————————————————————————————————————————————————————————————————
—————————————————————————————————————————————————————————————————
> NX Successfully ran target build for 2 projects (914ms)
NX Successfully ran target build for 2 projects (914ms)
Nx read the output from the cache instead of running the command for 1 out of 2 tasks.
Nx read the output from the cache instead of running the command for 1 out of 2 tasks.
```
Note how on the `is-even:build` it didn't run the build but rather pulled it out of the cache because the build has ran before. If you re-run the `run-many` command all of the builds would be cached.
+18 -18
View File
@@ -221,11 +221,11 @@ Run the command:
> tsc index.ts --outDir dist
——————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project is-even (33ms)
NX Successfully ran target build for project is-even (33ms)
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
Nx read the output from the cache instead of running the command for 1 out of 1 tasks.
```
@@ -236,25 +236,25 @@ Note that the cache for the `build` script was already populated when we ran it
To run the `build` target for all the packages in the workspace, use:
```{% command="npx nx run-many -t build" %}
✔ nx run is-even:build [existing outputs match the cache, left as is]
✔ nx run is-odd:build [existing outputs match the cache, left as is]
✔ nx run is-even:build [existing outputs match the cache, left as is]
✔ nx run is-odd:build [existing outputs match the cache, left as is]
————————————————————————————————————————————————————————————————————————————————————————
————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for 2 projects (35ms)
NX Successfully ran target build for 2 projects (35ms)
Nx read the output from the cache instead of running the command for 2 out of 2 tasks.
Nx read the output from the cache instead of running the command for 2 out of 2 tasks.
```
Notice that both builds are replayed from cache. We can skip the cache by adding the `--skip-nx-cache` option:
```{% command="npx nx run-many -t build --skip-nx-cache" %}
✔ nx run is-even:build (1s)
✔ nx run is-odd:build (1s)
✔ nx run is-even:build (1s)
✔ nx run is-odd:build (1s)
———————————————————————————————————————————————————————————————————————
———————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for 2 projects (2s)
NX Successfully ran target build for 2 projects (2s)
```
Notice that using this method, the `is-even` build ran before the `is-odd` build, and that the `is-even` build only happened once. This demonstrates how `run-many` is informed by the `targetDefaults` we set earlier.
@@ -263,17 +263,17 @@ You can also only run tasks on packages that got changed by using the command:
```{% command="npx nx affected -t build" %}
> NX Affected criteria defaulted to --base=main --head=HEAD
NX Affected criteria defaulted to --base=main --head=HEAD
✔ nx run is-even:build [existing outputs match the cache, left as is]
✔ nx run is-odd:build [existing outputs match the cache, left as is]
✔ nx run is-even:build [existing outputs match the cache, left as is]
✔ nx run is-odd:build [existing outputs match the cache, left as is]
——————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for 2 projects (34ms)
NX Successfully ran target build for 2 projects (34ms)
Nx read the output from the cache instead of running the command for 2 out of 2 tasks.
Nx read the output from the cache instead of running the command for 2 out of 2 tasks.
```
Notice that the `base` and `head` options were populated with their default values. You could provide your own options here as needed. Notice too that the cache is also used with the `affected` command.
@@ -33,7 +33,7 @@ In any Nx workspace, you can install `@nx/angular` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/angular
```
+30 -6
View File
@@ -29,7 +29,7 @@ In any Nx workspace, you can install `@nx/cypress` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/cypress
```
@@ -75,6 +75,30 @@ The `@nx/cypress/plugin` is configured in the `plugins` array in `nx.json`.
The `@nx/cypress/plugin` will automatically split your e2e tasks by file. You can read more about this feature [here](/ci/features/split-e2e-tasks).
To enable e2e task splitting, make sure there is a `ciWebServerCommand` property set in your `cypress.config.ts` file. It will look something like this:
```ts {% fileName="apps/my-project-e2e/cypress.config.ts" highlightLines=[13] %}
import { defineConfig } from 'cypress';
import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
export default defineConfig({
e2e: {
...nxE2EPreset(__filename, {
cypressDir: 'src',
bundler: 'vite',
webServerCommands: {
default: 'nx run my-project:serve',
production: 'nx run my-project:preview',
},
ciWebServerCommand: 'nx run my-project:serve-static',
}),
baseUrl: 'http://localhost:4200',
},
});
```
Note: The `nxE2EPreset` is a collection of default settings, but is not necessary for task splitting.
{% /tab %}
{% tab label="Nx < 18" %}
@@ -95,18 +119,18 @@ By default, when creating a new frontend application, Nx will use Cypress to cre
nx g @nx/web:app frontend
```
### Creating a Cypress E2E project for an existing project
### Configure Cypress for an existing project
To generate an E2E project based on an existing project, run the following generator
To configure Cypress for an existing project, run the following generator
```shell
nx g @nx/cypress:configuration your-app-name-e2e --project=your-app-name
nx g @nx/cypress:configuration --project=your-app-name
```
Optionally, you can use the `--baseUrl` option if you don't want cypress plugin to serve `your-app-name`.
Optionally, you can use the `--baseUrl` option if you don't want the Cypress plugin to serve `your-app-name`.
```shell
nx g @nx/cypress:configuration your-app-name-e2e --baseUrl=http://localhost:4200
nx g @nx/cypress:configuration --project=your-app-name --baseUrl=http://localhost:4200
```
Replace `your-app-name` with the app's name as defined in your `tsconfig.base.json` file or the `name` property of your `package.json`.
+1 -1
View File
@@ -36,7 +36,7 @@ In any Nx workspace, you can install `@nx/detox` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/detox
```
@@ -25,7 +25,7 @@ In any Nx workspace, you can install `@nx/esbuild` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/esbuild
```
+18 -1
View File
@@ -13,10 +13,27 @@ Make sure to install the `@nx/eslint-plugin` version that matches the version of
In any Nx workspace, you can install `@nx/eslint-plugin` by running the following commands if the package is not already installed:
```shell
{% tabs %}
{% tab label="Nx 18+" %}
```shell {% skipRescope=true %}
nx add @nx/eslint-plugin
```
This will install the correct version of `@nx/eslint-plugin`.
{% /tab %}
{% tab label="Nx < 18" %}
Install the `@nx/eslint-plugin` package with your package manager.
```shell
npm add -D @nx/eslint-plugin
```
{% /tab %}
{% /tabs %}
## Included plugins
The plugin contains the following rule configurations divided into sub-plugins.
+12 -3
View File
@@ -13,7 +13,7 @@ In any Nx workspace, you can install `@nx/eslint` by running the following comma
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/eslint
```
@@ -57,14 +57,23 @@ The `@nx/eslint/plugin` is configured in the `plugins` array in `nx.json`.
- The `targetName` option controls the name of the inferred ESLint tasks. The default name is `lint`.
{% /tab %}
{% tab label="Nx < 18" %}
{% tab label="Nx 17" %}
Install the `@nx/eslint` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/eslint
```
{% /tab %}
{% tab label="Nx < 17" %}
Install the `@nx/linter` package with your package manager.
```shell
npm add -D @nx/linter
```
{% /tab %}
{% /tabs %}
+1 -1
View File
@@ -21,7 +21,7 @@ In any Nx workspace, you can install `@nx/expo` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/expo
```
@@ -22,7 +22,7 @@ In any Nx workspace, you can install `@nx/express` by running the following comm
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/express
```
+1 -1
View File
@@ -22,7 +22,7 @@ In any Nx workspace, you can install `@nx/jest` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/jest
```
+1 -1
View File
@@ -18,7 +18,7 @@ In any Nx workspace, you can install `@nx/js` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/js
```
+1 -1
View File
@@ -34,7 +34,7 @@ In any Nx workspace, you can install `@nx/nest` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/nest
```
+49 -3
View File
@@ -30,7 +30,7 @@ In any workspace, you can install `@nx/next` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/next
```
@@ -60,7 +60,8 @@ The `@nx/next/plugin` is configured in the `plugins` array in `nx.json`.
"options": {
"buildTargetName": "build",
"devTargetName": "dev",
"startTargetName": "start"
"startTargetName": "start",
"serveStaticTargetName": "serve-static"
}
}
]
@@ -70,6 +71,10 @@ The `@nx/next/plugin` is configured in the `plugins` array in `nx.json`.
- The `buildTargetName` option controls the name of Next.js' compilation task which compiles the application for production deployment. The default name is `build`.
- The `devTargetName` option controls the name of Next.js' development serve task which starts the application in development mode. The default name is `dev`.
- The `startTargetName` option controls the name of Next.js' production serve task which starts the application in production mode. The default name is `start`.
- The `serveStaticTargetName` option controls the name of Next.js' static export task which exports the application to static HTML files. The default name is `serve-static`.
{% /tab %}
{% tab label="Nx < 18" %}
{% /tab %}
{% tab label="Nx < 18" %}
@@ -238,7 +243,7 @@ The library in `dist` is publishable to npm or a private registry.
### Static HTML Export
Next.js applications can be statically exported by changing th eoutput inside your Next.js configuration file.
Next.js applications can be statically exported by changing the output inside your Next.js configuration file.
```js {% fileName="apps/my-next-app/next.config.js" %}
const nextConfig = {
@@ -246,9 +251,50 @@ const nextConfig = {
nx: {
svgr: false,
},
output: 'export',
};
```
After setting the output to `export`, you can run the `build` command to generate the static HTML files.
```shell
nx build my-next-app
```
You can then check your project folder for the `out` folder which contains the static HTML files.
```shell
├── index.d.ts
├── jest.config.ts
├── next-env.d.ts
├── next.config.js
├── out
├── project.json
├── public
├── specs
├── src
├── tsconfig.json
└── tsconfig.spec.json
```
#### E2E testing
You can perform end-to-end (E2E) testing on static HTML files using a test runner like Cypress. When you create a Next.js application, Nx automatically creates a `serve-static` target. This target is designed to serve the static HTML files produced by the build command.
This feature is particularly useful for testing in continuous integration (CI) pipelines, where resources may be constrained. Unlike the `dev` and `start` targets, `serve-static` does not require a Next.js server to operate, making it more efficient and faster by eliminating background processes, such as file change monitoring.
To utilize the `serve-static` target for testing, run the following command:
```shell
nx serve-static my-next-app-e2e
```
This command performs several actions:
1. It will build the Next.js application and generate the static HTML files.
2. It will serve the static HTML files using a simple HTTP server.
3. It will run the Cypress tests against the served static HTML files.
### Deploying Next.js Applications
Once you are ready to deploy your Next.js application, you have absolute freedom to choose any hosting provider that fits your needs.
+1 -1
View File
@@ -13,7 +13,7 @@ In any Nx workspace, you can install `@nx/node` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/node
```
+26 -2
View File
@@ -23,7 +23,7 @@ Make sure to install the `@nx/nuxt` version that matches the version of `nx` in
In any Nx workspace, you can install `@nx/nuxt` by running the following command:
```shell
```shell {% skipRescope=true %}
nx add @nx/nuxt
```
@@ -56,7 +56,9 @@ The `@nx/nuxt/plugin` is configured in the `plugins` array in `nx.json`.
"options": {
"buildTargetName": "build",
"testTargetName": "test",
"serveTargetName": "serve"
"serveTargetName": "serve",
"buildStaticTargetName": "build-static",
"serveStaticTargetName": "serve-static"
}
}
]
@@ -65,6 +67,8 @@ The `@nx/nuxt/plugin` is configured in the `plugins` array in `nx.json`.
- The `buildTargetName`, `testTargetName` and `serveTargetName` options control the names of the inferred Nuxt tasks. The default names are `build`, `test` and `serve`.
The `buildStaticTargetName` and `serveStaticTargetName` options control the names of the inferred Nuxt static tasks. The default names are `build-static` and `serve-static`.
## Using Nuxt
### Generate a new Nuxt app
@@ -78,3 +82,23 @@ nx g @nx/nuxt:app my-app
Once you are ready to deploy your Nuxt application, you have absolute freedom to choose any hosting provider that fits your needs.
We have detailed [how to deploy your Nuxt application to Vercel in a separate guide](/recipes/nuxt/deploy-nuxt-to-vercel).
### E2E testing
By default `nuxt` **does not** generate static HTML files when you run the `build` command. However, Nx provides a `build-static` target that you can use to generate static HTML files for your Nuxt application. Essentially, this target runs the `nuxt build --prerender` command to generate static HTML files.
To perform end-to-end (E2E) testing on static HTML files using a test runner like Cypress. When you create a Nuxt application, Nx automatically creates a `serve-static` target. This target is designed to serve the static HTML files produced by the `build-static` command.
This feature is particularly useful for testing in continuous integration (CI) pipelines, where resources may be constrained. Unlike the `serve` target, `serve-static` does not require a Nuxt's Nitro server to operate, making it more efficient and faster by eliminating background processes, such as file change monitoring.
To utilize the `serve-static` target for testing, run the following command:
```shell
nx serve-static my-nuxt-app-e2e
```
This command performs several actions:
1. It will build the Nuxt application and generate the static HTML files.
2. It will serve the static HTML files using a simple HTTP server.
3. It will run the Cypress tests against the served static HTML files.
@@ -24,7 +24,7 @@ In any Nx workspace, you can install `@nx/playwright` by running the following c
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/playwright
```
@@ -74,7 +74,7 @@ The `@nx/playwright/plugin` will automatically split your e2e tasks by file. You
Install the `@nx/playwright` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/playwright
```
@@ -35,7 +35,7 @@ In any Nx workspace, you can install `@nx/react-native` by running the following
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/react-native
```
+1 -1
View File
@@ -27,7 +27,7 @@ In any Nx workspace, you can install `@nx/react` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/react
```
+15 -15
View File
@@ -28,7 +28,7 @@ In any Nx workspace, you can install `@nx/remix` by running the following comman
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/remix
```
@@ -89,7 +89,7 @@ The command below uses the `as-provided` directory flag behavior, which is the d
{% /callout %}
```{% command="nx g @nx/remix:app myapp --directory=apps/myapp" path="~/acme" %}
> NX Generating @nx/remix:application
NX Generating @nx/remix:application
✔ What unit test runner should be used? · vitest
@@ -135,9 +135,9 @@ Building Remix app in production mode...
Built in 857ms
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target build for project myapp (3s)
NX Successfully ran target build for project myapp (3s)
```
2. To serve your application for use during development run:
@@ -155,18 +155,18 @@ Remix App Server started at http://localhost:3000 (http://192.168.0.14:3000)
```{% command="nx test myapp" path="~/acme" %}
> nx run myapp:test
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
RUN v0.31.4 /Users/columferry/dev/nrwl/issues/remixguide/acme/apps/myapp
stderr | app/routes/index.spec.ts > test > should render
Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
✓ app/routes/index.spec.ts (1 test) 10ms
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 16:15:45
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
✓ app/routes/index.spec.ts (1 test) 10ms
Test Files 1 passed (1)
Tests 1 passed (1)
Start at 16:15:45
Duration 1.20s (transform 51ms, setup 139ms, collect 180ms, tests 10ms, environment 379ms, prepare 103ms)
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
> NX Successfully ran target test for project myapp (2s)
NX Successfully ran target test for project myapp (2s)
```
## Generating an Nx Library
@@ -176,7 +176,7 @@ When developing your application, it often makes sense to split your codebase in
To generate a library to use in your Remix application run:
```{% command="nx g @nx/remix:lib login --directory=libs/login" path="~/acme" %}
> NX Generating @nx/remix:library
NX Generating @nx/remix:library
✔ What test runner should be used? · vitest
UPDATE nx.json
@@ -223,7 +223,7 @@ You can also run test on your library:
To generate a route for your application:
```{% command="nx g @nx/remix:route admin --path=apps/myapp/app/routes" path="~/acme" %}
> NX Generating @nx/remix:route
NX Generating @nx/remix:route
CREATE apps/myapp/app/routes/admin.tsx
CREATE apps/myapp/app/styles/admin.css
@@ -236,7 +236,7 @@ To use a Route Loader where the logic lives in your library, follow the steps be
1. Generate a loader for your route:
```{% command="nx g @nx/remix:loader admin --path=apps/myapp/app/routes" path="~/acme" %}
> NX Generating @nx/remix:loader
NX Generating @nx/remix:loader
UPDATE apps/myapp/app/routes/admin.tsx
```
@@ -20,7 +20,7 @@ In any Nx workspace, you can install `@nx/storybook` by running the following co
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/storybook
```
+1 -1
View File
@@ -35,7 +35,7 @@ In any Nx workspace, you can install `@nx/vite` by running the following command
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/vite
```
+2 -2
View File
@@ -26,7 +26,7 @@ In any Nx workspace, you can install `@nx/vue` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/vue
```
@@ -37,7 +37,7 @@ This will install the correct version of `@nx/vue`.
Install the `@nx/vue` package with your package manager.
```shell
```shell {% skipRescope=true %}
npm add -D @nx/vue
```
+1 -1
View File
@@ -21,7 +21,7 @@ In any Nx workspace, you can install `@nx/web` by running the following command:
{% tabs %}
{% tab label="Nx 18+" %}
```shell
```shell {% skipRescope=true %}
nx add @nx/web
```

Some files were not shown because too many files have changed in this diff Show More