天天看點

[Tools] Nx workspace with React

nx

choose

empty workspace

nx cloud

nx cli

shows all the available packages for nx

<code>bash yarn add @nrwl/react yarn nx g @nrwl/react:application --name store</code>

<code>bash yarn nx g @nrwl/react:application --help</code>

you can modify the port in <code>workspace.json</code>:

choose <code>y</code> to export the component.

you can find the component import path from <code>tsconfig.base.json</code>:

app.tsx:

this will add some routing config into application

added <code>--frontendproject</code> will also generate a <code>proxy.conf.json</code> file in <code>store</code> application.

run:

it will generate under <code>libs/api/util-interface</code>.

you should be able to see <code>storybook-configuration</code>.

it will generate <code>storybook</code> under <code>libs/ui-shared/.storybook</code> &amp; <code>cypress</code> under <code>store-ui-shared-e2e</code> folder

or

will generate a <code>dist</code> folder

<code>nx</code> use <code>git</code> history to detect which applications or libs have been changed.

and then run the affected libs and applications to speed up testing.

run unit testings based on master branch.

<code>nx</code> will cache the running <code>affected</code> result into <code>node_modules/.cache</code> to speed up next runtime.

you can <code>--skip-nx-cache</code> or delete cache.

then install the new packages.

if there is <code>migrations.json</code> created: