fix(misc): update readmes (#27038)
updates - Nx GitHub repository readme - Generated readmes for all the available Nx presets (via CNW). Here's a snapshot of the new readme for each preset that can be used: https://github.com/juristr/nx_readme_updates/ --------- Co-authored-by: FrozenPandaz <jasonjean1993@gmail.com>
This commit is contained in:
parent
32dd7007a7
commit
cd228e538a
47
README.md
47
README.md
@ -23,24 +23,43 @@
|
||||
|
||||
Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
|
||||
|
||||
A few links to help you get started:
|
||||
Create a new Nx workspace with
|
||||
|
||||
- [Nx.Dev: Documentation, Guides, Interactive Tutorials](https://nx.dev)
|
||||
- [Nx.Dev: Core Tutorials](https://nx.dev/getting-started/intro)
|
||||
- [Recipe: Adding Nx to an Existing Monorepo](https://nx.dev/recipes/adopting-nx/adding-to-monorepo)
|
||||
- [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
|
||||
- [Blog Posts About Nx](https://nx.dev/blog)
|
||||
```shell
|
||||
npx create-nx-workspace
|
||||
```
|
||||
|
||||
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="./images/nx-courses-and-videos.svg"
|
||||
...or run
|
||||
|
||||
```
|
||||
npx nx init
|
||||
```
|
||||
|
||||
to add Nx to your existing workspace to get faster task scheduling, caching and more. More [in the docs](https://nx.dev/getting-started/intro#try-nx-yourself).
|
||||
|
||||
## Learn about CI with Nx Cloud
|
||||
|
||||
[Nx Cloud](https://nx.dev/nx-cloud) connects directly to your existing CI setup, helping you scale your monorepos on CI by leveraging [remote caching](https://nx.dev/ci/features/remote-cache?utm_source=nxrepo&utm_medium=readme&utm_campaign=nxrepo), [task distribution across multiple machines](https://nx.dev/ci/features/distribute-task-execution?utm_source=nxrepo&utm_medium=readme&utm_campaign=nxrepo), [automated e2e test splitting](https://nx.dev/ci/features/split-e2e-tasks?utm_source=nxrepo&utm_medium=readme&utm_campaign=nxrepo) and [automated task flakiness detection](https://nx.dev/ci/features/flaky-tasks?utm_source=nxrepo&utm_medium=readme&utm_campaign=nxrepo)
|
||||
|
||||
Connect your existing Nx workspace with
|
||||
|
||||
```
|
||||
npx nx connect
|
||||
```
|
||||
|
||||
Learn more in the [Nx CI docs »](https://nx.dev/ci/intro?utm_source=nxrepo&utm_medium=readme&utm_campaign=nxrepo)
|
||||
|
||||
## Useful links
|
||||
|
||||
- [Our docs](https://nx.dev/docs)
|
||||
- [Our blog](https://nx.dev/blog)
|
||||
- [Our community discord, live stream,...](https://nx.dev/community)
|
||||
- [Our YouTube channel](https://www.youtube.com/@NxDevtools)
|
||||
- [Our Twitter/X](https://x.com/nxdevtools)
|
||||
|
||||
<p style="text-align: center;"><a href="https://www.youtube.com/@nxdevtools/videos" target="_blank" rel="noreferrer"><img src="./images/nx-courses-and-videos.svg"
|
||||
width="100%" alt="Nx - Smart Monorepos · Fast CI"></a></p>
|
||||
|
||||
# Engage with the Core Team and the Community
|
||||
|
||||
- [Nx.Dev Community Page: Community Discord Channel, Newsletter, etc.](https://nx.dev/community)
|
||||
- [The Nx Show Playlist on YouTube](https://www.youtube.com/playlist?list=PLakNactNC1dE8KLQ5zd3fQwu_yQHjTmR5). It's a
|
||||
regular YouTube stream where we talk all things Nx. Join the stream, ask questions, etc.
|
||||
- [Follow Nx on Twitter](https://twitter.com/NxDevTools)
|
||||
|
||||
## Want to help?
|
||||
|
||||
If you want to file a bug or submit a PR, read up on
|
||||
|
||||
@ -1,54 +0,0 @@
|
||||
# Welcome to Nx + Remix!
|
||||
|
||||
- [Remix Docs](https://remix.run/docs)
|
||||
- [Nx Docs](https://nx.dev)
|
||||
|
||||
## Development
|
||||
|
||||
From your terminal:
|
||||
|
||||
```sh
|
||||
npx nx dev <%= projectName %>
|
||||
```
|
||||
|
||||
This starts your app in development mode, rebuilding assets on file changes.
|
||||
|
||||
## Deployment
|
||||
|
||||
First, build your app for production:
|
||||
|
||||
```sh
|
||||
npx nx build <%= projectName %>
|
||||
```
|
||||
|
||||
Then run the app in production mode:
|
||||
|
||||
```sh
|
||||
npx nx start <%= projectName %>
|
||||
```
|
||||
|
||||
Now you'll need to pick a host to deploy it to.
|
||||
|
||||
### DIY
|
||||
|
||||
If you're familiar with deploying node applications, the built-in Remix app server is production-ready.
|
||||
|
||||
Make sure to deploy the output of `remix build`
|
||||
|
||||
- `packages/<%= projectName %>/build/`
|
||||
- `packages/<%= projectName %>/public/build/`
|
||||
|
||||
### Using a Template
|
||||
|
||||
When you ran `npx create-remix@latest` there were a few choices for hosting. You can run that again to create a new project, then copy over your `app/` folder to the new project that's pre-configured for your target server.
|
||||
|
||||
```sh
|
||||
cd ..
|
||||
# create a new project, and pick a pre-configured host
|
||||
npx create-remix@latest
|
||||
cd my-new-remix-app
|
||||
# remove the new project's app (not the old one!)
|
||||
rm -rf app
|
||||
# copy your app over
|
||||
cp -R ../my-old-remix-app/app app
|
||||
```
|
||||
File diff suppressed because it is too large
Load Diff
@ -2,88 +2,152 @@
|
||||
|
||||
<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a>
|
||||
|
||||
✨ **This workspace has been generated by [Nx, Smart Monorepos · Fast CI.](https://nx.dev)** ✨
|
||||
|
||||
## Integrate with editors
|
||||
|
||||
Enhance your Nx experience by installing [Nx Console](https://nx.dev/nx-console) for your favorite editor. Nx Console
|
||||
provides an interactive UI to view your projects, run tasks, generate code, and more! Available for VSCode, IntelliJ and
|
||||
comes with a LSP for Vim users.
|
||||
<% if (!!appName) {
|
||||
if (isJsStandalone) { %>
|
||||
## Build the library
|
||||
|
||||
Run `npx nx build` to build the library. The build artifacts are stored in the output directory (i.e. `dist/`), ready to be published.
|
||||
✨ Your new, shiny [Nx workspace](https://nx.dev) is <% if (nxCloudOnboardingUrl) { %>almost <% } %>ready ✨.
|
||||
<% if (learnMoreLink) { %>
|
||||
[Learn more about this workspace setup and its capabilities](<%= learnMoreLink %>) or run `npx nx graph` to visually explore what was created. Now, let's get you up to speed!
|
||||
<% } else { %>
|
||||
## Start the application
|
||||
Run `npx nx graph` to visually explore what got created. Now, let's get you up to speed!
|
||||
<% } %><% if (nxCloudOnboardingUrl) { %>
|
||||
## Finish your <%= nxCloud === 'yes' ? 'remote caching' : 'CI' %> setup
|
||||
|
||||
Run `npx nx <%= serveCommand %> <%= appName %>` to start the development server. Happy coding!
|
||||
[Click here to finish setting up your workspace!](<%= nxCloudOnboardingUrl %>)
|
||||
|
||||
## Build for production
|
||||
|
||||
Run `npx nx build <%= appName %>` to build the application. The build artifacts are stored in the output directory (e.g. `dist/` or `build/`), ready to be deployed.
|
||||
<% } } else { %>
|
||||
## Nx plugins and code generators
|
||||
|
||||
Add Nx plugins to leverage their code generators and automated, inferred tasks.
|
||||
|
||||
```
|
||||
# Add plugin
|
||||
npx nx add @nx/react
|
||||
|
||||
# Use code generator
|
||||
npx nx generate @nx/react:app demo
|
||||
|
||||
# Run development server
|
||||
npx nx serve demo
|
||||
|
||||
# View project details
|
||||
npx nx show project demo --web
|
||||
```
|
||||
|
||||
Run `npx nx list` to get a list of available plugins and whether they have generators. Then run `npx nx list <plugin-name>` to see what generators are available.
|
||||
|
||||
Learn more about [code generators](https://nx.dev/features/generate-code) and [inferred tasks](https://nx.dev/concepts/inferred-tasks) in the docs.
|
||||
<% } %>
|
||||
## Running tasks
|
||||
|
||||
To execute tasks with Nx use the following syntax:
|
||||
## Run tasks
|
||||
<% if (!isEmptyRepo) { %><% if (isJsStandalone) { %>
|
||||
To build the library use:
|
||||
|
||||
```sh
|
||||
npx nx build
|
||||
```
|
||||
npx nx <target> <project> <...options>
|
||||
<% } else { %>
|
||||
To run the dev server for your app, use:
|
||||
|
||||
```sh
|
||||
npx nx <%= serveCommand %> <%= appName %>
|
||||
```
|
||||
|
||||
You can also run multiple targets:
|
||||
To create a production bundle:
|
||||
|
||||
```
|
||||
npx nx run-many -t <target1> <target2>
|
||||
```sh
|
||||
npx nx build <%= appName %>
|
||||
```
|
||||
|
||||
..or add `-p` to filter specific projects
|
||||
To see all available targets to run for a project, run:
|
||||
|
||||
```sh
|
||||
npx nx show project <%= appName %>
|
||||
```
|
||||
npx nx run-many -t <target1> <target2> -p <proj1> <proj2>
|
||||
<% } %><% } else { %>
|
||||
To run tasks with Nx use:
|
||||
|
||||
```sh
|
||||
npx nx <target> <project-name>
|
||||
```
|
||||
|
||||
Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/features/run-tasks).
|
||||
For example:
|
||||
|
||||
```sh
|
||||
npx nx build myproject
|
||||
```
|
||||
<% } %>
|
||||
These targets are either [inferred automatically](https://nx.dev/concepts/inferred-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) or defined in the `project.json` or `package.json` files.
|
||||
|
||||
[More about running tasks in the docs »](https://nx.dev/features/run-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
<% if(isJsStandalone || generateNxReleaseInfo) { %>
|
||||
## Versioning and releasing
|
||||
|
||||
To version and release the library use
|
||||
|
||||
```
|
||||
npx nx release
|
||||
```
|
||||
|
||||
Pass `--dry-run` to see what would happen without actually releasing the library.
|
||||
|
||||
[Learn more about Nx release »](hhttps://nx.dev/features/manage-releases?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
<% } %><% if (!isJsStandalone) { %>
|
||||
## Add new projects
|
||||
|
||||
While you could add new projects to your workspace manually, you might want to leverage [Nx plugins](https://nx.dev/concepts/nx-plugins?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) and their [code generation](https://nx.dev/features/generate-code?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) feature.
|
||||
<% if (isEmptyRepo) { %>
|
||||
To install a new plugin you can use the `nx add` command. Here's an example of adding the React plugin:
|
||||
```sh
|
||||
npx nx add @nx/react
|
||||
```
|
||||
|
||||
Use the plugin's generator to create new projects. For example, to create a new React app or library:
|
||||
|
||||
```sh
|
||||
# Genenerate an app
|
||||
npx nx g @nx/react:app demo
|
||||
|
||||
# Generate a library
|
||||
npx nx g @nx/react:lib some-lib
|
||||
```
|
||||
<% } else { %>
|
||||
Use the plugin's generator to create new projects.
|
||||
<% if(generateAppCmd) {%>
|
||||
To generate a new application, use:
|
||||
|
||||
```sh
|
||||
npx nx g <%= generateAppCmd%>:app demo
|
||||
```
|
||||
<% } %><% if(generateLibCmd) {%>
|
||||
To generate a new library, use:
|
||||
|
||||
```sh
|
||||
npx nx g <%= generateLibCmd%>:lib mylib
|
||||
```
|
||||
<% } %><% } %>
|
||||
You can use `npx nx list` to get a list of installed plugins. Then, run `npx nx list <plugin-name>` to learn about more specific capabilities of a particular plugin. Alternatively, [install Nx Console](https://nx.dev/getting-started/editor-setup?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) to browse plugins and generators in your IDE.
|
||||
|
||||
[Learn more about Nx plugins »](https://nx.dev/concepts/nx-plugins?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) | [Browse the plugin registry »](https://nx.dev/plugin-registry?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
<% } %><% if (nxCloud === 'skip') { %>
|
||||
## Set up CI!
|
||||
|
||||
Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further.
|
||||
### Step 1
|
||||
|
||||
- [Set up remote caching](https://nx.dev/features/share-your-cache)
|
||||
- [Set up task distribution across multiple machines](https://nx.dev/nx-cloud/features/distribute-task-execution)
|
||||
- [Learn more how to setup CI](https://nx.dev/recipes/ci)
|
||||
To connect to Nx Cloud, run the following command:
|
||||
|
||||
## Explore the project graph
|
||||
```sh
|
||||
npx nx connect
|
||||
```
|
||||
|
||||
Run `npx nx graph` to show the graph of the workspace.
|
||||
It will show tasks that you can run with Nx.
|
||||
Connecting to Nx Cloud ensures a [fast and scalable CI](https://nx.dev/ci/intro/why-nx-cloud?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects) pipeline. It includes features such as:
|
||||
|
||||
- [Learn more about Exploring the Project Graph](https://nx.dev/core-features/explore-graph)
|
||||
- [Remote caching](https://nx.dev/ci/features/remote-cache?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
- [Task distribution across multiple machines](https://nx.dev/ci/features/distribute-task-execution?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
- [Automated e2e test splitting](https://nx.dev/ci/features/split-e2e-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
- [Task flakiness detection and rerunning](https://nx.dev/ci/features/flaky-tasks?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
|
||||
## Connect with us!
|
||||
### Step 2
|
||||
|
||||
- [Join the community](https://nx.dev/community)
|
||||
- [Subscribe to the Nx Youtube Channel](https://www.youtube.com/@nxdevtools)
|
||||
- [Follow us on Twitter](https://twitter.com/nxdevtools)
|
||||
Use the following command to configure a CI workflow for your workspace:
|
||||
|
||||
```sh
|
||||
npx nx g ci-workflow
|
||||
```<% } %>
|
||||
|
||||
[Learn more about Nx on CI](https://nx.dev/ci/intro/ci-with-nx#ready-get-started-with-your-provider?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
|
||||
## Install Nx Console
|
||||
|
||||
Nx Console is an editor extension that enriches your developer experience. It lets you run tasks, generate code, and improves code autocompletion in your IDE. It is available for VSCode and IntelliJ.
|
||||
|
||||
[Install Nx Console »](https://nx.dev/getting-started/editor-setup?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
|
||||
## Useful links
|
||||
|
||||
Learn more:
|
||||
<% if(learnMoreLink){ %>
|
||||
- [Learn more about this workspace setup](<%= learnMoreLink %>)<% } %>
|
||||
- [Learn about Nx on CI](https://nx.dev/ci/intro/ci-with-nx?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
- [Releasing Packages with Nx release](https://nx.dev/features/manage-releases?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
- [What are Nx plugins?](https://nx.dev/concepts/nx-plugins?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
|
||||
And join the Nx community:
|
||||
- [Discord](https://go.nx.dev/community)
|
||||
- [Follow us on X](https://twitter.com/nxdevtools) or [LinkedIn](https://www.linkedin.com/company/nrwl)
|
||||
- [Our Youtube channel](https://www.youtube.com/@nxdevtools)
|
||||
- [Our blog](https://nx.dev/blog?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects)
|
||||
|
||||
@ -1,10 +1,32 @@
|
||||
import { createNxCloudOnboardingURL } from 'nx/src/nx-cloud/utilities/url-shorten';
|
||||
|
||||
jest.mock(
|
||||
'nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud',
|
||||
() => ({
|
||||
...jest.requireActual(
|
||||
'nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud'
|
||||
),
|
||||
connectToNxCloud: async () => {
|
||||
return 'TEST_NX_CLOUD_TOKEN';
|
||||
},
|
||||
})
|
||||
);
|
||||
jest.mock('nx/src/nx-cloud/utilities/url-shorten', () => ({
|
||||
...jest.requireActual('nx/src/nx-cloud/utilities/url-shorten'),
|
||||
createNxCloudOnboardingURL: async (source, token) => {
|
||||
return `https://test.nx.app/connect?source=${source}&token=${token}`;
|
||||
},
|
||||
}));
|
||||
|
||||
import type { NxJsonConfiguration, Tree } from '@nx/devkit';
|
||||
import { readJson } from '@nx/devkit';
|
||||
import { formatFiles, readJson } from '@nx/devkit';
|
||||
import Ajv from 'ajv';
|
||||
import { generateWorkspaceFiles } from './generate-workspace-files';
|
||||
import { createTree } from '@nx/devkit/testing';
|
||||
import { Preset } from '../utils/presets';
|
||||
import * as nxSchema from 'nx/schemas/nx-schema.json';
|
||||
import { mkdirSync, writeFileSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
describe('@nx/workspace:generateWorkspaceFiles', () => {
|
||||
let tree: Tree;
|
||||
@ -28,41 +50,54 @@ describe('@nx/workspace:generateWorkspaceFiles', () => {
|
||||
});
|
||||
|
||||
describe('README.md', () => {
|
||||
it.each(Object.keys(Preset))(
|
||||
'should be created for %s preset',
|
||||
async (preset) => {
|
||||
let appName;
|
||||
if (
|
||||
[
|
||||
Preset.ReactMonorepo,
|
||||
Preset.ReactStandalone,
|
||||
Preset.VueMonorepo,
|
||||
Preset.VueStandalone,
|
||||
Preset.Nuxt,
|
||||
Preset.NuxtStandalone,
|
||||
Preset.AngularMonorepo,
|
||||
Preset.AngularStandalone,
|
||||
Preset.Nest,
|
||||
Preset.NextJs,
|
||||
Preset.WebComponents,
|
||||
Preset.Express,
|
||||
Preset.NodeStandalone,
|
||||
Preset.NextJsStandalone,
|
||||
Preset.TsStandalone,
|
||||
].includes(Preset[preset])
|
||||
) {
|
||||
appName = 'app1';
|
||||
}
|
||||
describe.each(['github', 'yes', 'skip'] as const)(
|
||||
'Nx Cloud (%s)',
|
||||
(nxCloud) => {
|
||||
it.each(Object.keys(Preset))(
|
||||
'should be created for %s preset',
|
||||
async (preset) => {
|
||||
let appName;
|
||||
if (
|
||||
[
|
||||
Preset.ReactMonorepo,
|
||||
Preset.ReactStandalone,
|
||||
Preset.VueMonorepo,
|
||||
Preset.VueStandalone,
|
||||
Preset.Nuxt,
|
||||
Preset.NuxtStandalone,
|
||||
Preset.AngularMonorepo,
|
||||
Preset.AngularStandalone,
|
||||
Preset.Nest,
|
||||
Preset.NextJs,
|
||||
Preset.WebComponents,
|
||||
Preset.Express,
|
||||
Preset.NodeStandalone,
|
||||
Preset.NextJsStandalone,
|
||||
Preset.TsStandalone,
|
||||
].includes(Preset[preset])
|
||||
) {
|
||||
appName = 'app1';
|
||||
}
|
||||
|
||||
await generateWorkspaceFiles(tree, {
|
||||
name: 'proj',
|
||||
directory: 'proj',
|
||||
preset: Preset[preset],
|
||||
defaultBase: 'main',
|
||||
appName,
|
||||
isCustomPreset: false,
|
||||
});
|
||||
expect(tree.read('proj/README.md', 'utf-8')).toMatchSnapshot();
|
||||
await generateWorkspaceFiles(tree, {
|
||||
name: 'proj',
|
||||
directory: 'proj',
|
||||
preset: Preset[preset],
|
||||
defaultBase: 'main',
|
||||
appName,
|
||||
isCustomPreset: false,
|
||||
nxCloud: nxCloud,
|
||||
});
|
||||
await formatFiles(tree);
|
||||
const dir = join(__dirname, 'tmp', `${preset}-${nxCloud}`);
|
||||
mkdirSync(dir, { recursive: true });
|
||||
writeFileSync(
|
||||
join(dir, 'README.md'),
|
||||
tree.read('proj/README.md', 'utf-8')
|
||||
);
|
||||
expect(tree.read('proj/README.md', 'utf-8')).toMatchSnapshot();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
it('should be created for custom plugins', async () => {
|
||||
|
||||
@ -14,6 +14,154 @@ import { Preset } from '../utils/presets';
|
||||
import { deduceDefaultBase } from '../../utilities/default-base';
|
||||
import { NormalizedSchema } from './new';
|
||||
import { connectToNxCloud } from 'nx/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud';
|
||||
import { createNxCloudOnboardingURL } from 'nx/src/nx-cloud/utilities/url-shorten';
|
||||
|
||||
type PresetInfo = {
|
||||
generateAppCmd?: string;
|
||||
generateLibCmd?: string;
|
||||
generateNxReleaseInfo?: boolean;
|
||||
learnMoreLink?: string;
|
||||
};
|
||||
|
||||
// map from the preset to the name of the plugin s.t. the README can have a more
|
||||
// meaningful generator command.
|
||||
const presetToPluginMap: { [key in Preset]: PresetInfo } = {
|
||||
[Preset.Apps]: {
|
||||
learnMoreLink:
|
||||
'https://nx.dev/getting-started/intro#learn-nx?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.NPM]: {
|
||||
generateNxReleaseInfo: true,
|
||||
learnMoreLink:
|
||||
'https://nx.dev/getting-started/tutorials/npm-workspaces-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.TS]: {
|
||||
generateLibCmd: '@nx/js',
|
||||
generateNxReleaseInfo: true,
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/js?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.WebComponents]: {
|
||||
generateAppCmd: null,
|
||||
learnMoreLink:
|
||||
'https://nx.dev/getting-started/intro#learn-nx?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.AngularMonorepo]: {
|
||||
generateAppCmd: '@nx/angular',
|
||||
generateLibCmd: '@nx/angular',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/getting-started/tutorials/angular-monorepo-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.AngularStandalone]: {
|
||||
generateAppCmd: '@nx/angular',
|
||||
generateLibCmd: '@nx/angular',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/getting-started/tutorials/angular-standalone-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.ReactMonorepo]: {
|
||||
generateAppCmd: '@nx/react',
|
||||
generateLibCmd: '@nx/react',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/getting-started/tutorials/react-monorepo-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.ReactStandalone]: {
|
||||
generateAppCmd: '@nx/react',
|
||||
generateLibCmd: '@nx/react',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/getting-started/tutorials/react-standalone-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.NextJsStandalone]: {
|
||||
generateAppCmd: '@nx/next',
|
||||
generateLibCmd: '@nx/react',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/next?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.RemixMonorepo]: {
|
||||
generateAppCmd: '@nx/remix',
|
||||
generateLibCmd: '@nx/react',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/remix?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.RemixStandalone]: {
|
||||
generateAppCmd: '@nx/remix',
|
||||
generateLibCmd: '@nx/react',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/remix?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.ReactNative]: {
|
||||
generateAppCmd: '@nx/react-native',
|
||||
generateLibCmd: '@nx/react',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/react-native?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.VueMonorepo]: {
|
||||
generateAppCmd: '@nx/vue',
|
||||
generateLibCmd: '@nx/vue',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/getting-started/tutorials/vue-standalone-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.VueStandalone]: {
|
||||
generateAppCmd: '@nx/vue',
|
||||
generateLibCmd: '@nx/vue',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/getting-started/tutorials/vue-standalone-tutorial?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.Nuxt]: {
|
||||
generateAppCmd: '@nx/nuxt',
|
||||
generateLibCmd: '@nx/vue',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/nuxt?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.NuxtStandalone]: {
|
||||
generateAppCmd: '@nx/nuxt',
|
||||
generateLibCmd: '@nx/vue',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/nuxt?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.Expo]: {
|
||||
generateAppCmd: '@nx/expo',
|
||||
generateLibCmd: '@nx/react',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/expo?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.NextJs]: {
|
||||
generateAppCmd: '@nx/next',
|
||||
generateLibCmd: '@nx/react',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/next?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.Nest]: {
|
||||
generateAppCmd: '@nx/nest',
|
||||
generateLibCmd: '@nx/node',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/nest?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.Express]: {
|
||||
generateAppCmd: '@nx/express',
|
||||
generateLibCmd: '@nx/node',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/express?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.NodeStandalone]: {
|
||||
generateAppCmd: '@nx/node',
|
||||
generateLibCmd: '@nx/node',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/node?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.NodeMonorepo]: {
|
||||
generateAppCmd: '@nx/node',
|
||||
generateLibCmd: '@nx/node',
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/node?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
[Preset.TsStandalone]: {
|
||||
generateAppCmd: null,
|
||||
generateLibCmd: null,
|
||||
generateNxReleaseInfo: true,
|
||||
learnMoreLink:
|
||||
'https://nx.dev/nx-api/js?utm_source=nx_project&utm_medium=readme&utm_campaign=nx_projects',
|
||||
},
|
||||
};
|
||||
|
||||
export async function generateWorkspaceFiles(
|
||||
tree: Tree,
|
||||
@ -29,7 +177,6 @@ export async function generateWorkspaceFiles(
|
||||
tree.root
|
||||
);
|
||||
options = normalizeOptions(options);
|
||||
createReadme(tree, options);
|
||||
createFiles(tree, options);
|
||||
const nxJson = createNxJson(tree, options);
|
||||
|
||||
@ -46,6 +193,8 @@ export async function generateWorkspaceFiles(
|
||||
)
|
||||
: null;
|
||||
|
||||
await createReadme(tree, options, token);
|
||||
|
||||
const [packageMajor] = packageManagerVersion.split('.');
|
||||
if (options.packageManager === 'pnpm' && +packageMajor >= 7) {
|
||||
createNpmrc(tree, options);
|
||||
@ -140,20 +289,39 @@ function createFiles(tree: Tree, options: NormalizedSchema) {
|
||||
});
|
||||
}
|
||||
|
||||
function createReadme(
|
||||
async function createReadme(
|
||||
tree: Tree,
|
||||
{ name, appName, directory, preset }: NormalizedSchema
|
||||
{ name, appName, directory, preset, nxCloud }: NormalizedSchema,
|
||||
nxCloudToken?: string
|
||||
) {
|
||||
const formattedNames = names(name);
|
||||
|
||||
// default to an empty one for custom presets
|
||||
const presetInfo: PresetInfo = presetToPluginMap[preset] ?? {
|
||||
package: '',
|
||||
generateLibCmd: null,
|
||||
};
|
||||
|
||||
const nxCloudOnboardingUrl = nxCloudToken
|
||||
? await createNxCloudOnboardingURL('readme', nxCloudToken)
|
||||
: null;
|
||||
|
||||
generateFiles(tree, join(__dirname, './files-readme'), directory, {
|
||||
formattedNames,
|
||||
isJsStandalone: preset === Preset.TsStandalone,
|
||||
isEmptyRepo: !appName,
|
||||
appName,
|
||||
generateAppCmd: presetInfo.generateAppCmd,
|
||||
generateLibCmd: presetInfo.generateLibCmd,
|
||||
generateNxReleaseInfo: presetInfo.generateNxReleaseInfo,
|
||||
learnMoreLink: presetInfo.learnMoreLink,
|
||||
serveCommand:
|
||||
preset === Preset.NextJs || preset === Preset.NextJsStandalone
|
||||
? 'dev'
|
||||
: 'serve',
|
||||
name,
|
||||
nxCloud,
|
||||
nxCloudOnboardingUrl,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user