@nx/workspace 18.0.4 → 18.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/workspace",
3
- "version": "18.0.4",
3
+ "version": "18.0.6",
4
4
  "private": false,
5
5
  "description": "The Workspace plugin contains executors and generators that are useful for any Nx workspace. It should be present in every Nx workspace and other plugins build on it.",
6
6
  "repository": {
@@ -61,13 +61,13 @@
61
61
  }
62
62
  },
63
63
  "dependencies": {
64
- "@nx/devkit": "18.0.4",
64
+ "@nx/devkit": "18.0.6",
65
65
  "chalk": "^4.1.0",
66
66
  "enquirer": "~2.3.6",
67
67
  "tslib": "^2.3.0",
68
68
  "yargs-parser": "21.1.1",
69
- "nx": "18.0.4",
70
- "@nrwl/workspace": "18.0.4"
69
+ "nx": "18.0.6",
70
+ "@nrwl/workspace": "18.0.6"
71
71
  },
72
72
  "publishConfig": {
73
73
  "access": "public"
@@ -2,52 +2,71 @@
2
2
 
3
3
  <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>
4
4
 
5
- ✨ **This workspace has been generated by [Nx, Smart Monorepos · Fast CI.](https://nx.dev)** ✨<% if (!!appName) { %>
5
+ ✨ **This workspace has been generated by [Nx, Smart Monorepos · Fast CI.](https://nx.dev)**
6
6
 
7
- <% if (includeServe) { %>
8
- ## Start the app
7
+ ## Integrate with editors
9
8
 
10
- To start the development server run `nx serve <%= appName %>`. Open your browser and navigate to http://localhost:4200/. Happy coding!<% } %>
11
- <% } %>
9
+ Enhance your Nx experience by installing [Nx Console](https://nx.dev/nx-console) for your favorite editor. Nx Console
10
+ provides an interactive UI to view your projects, run tasks, generate code, and more! Available for VSCode, IntelliJ and
11
+ comes with a LSP for Vim users.
12
+ <% if (!!appName) {
13
+ if (isJsStandalone) { %>
14
+ ## Build the library
15
+
16
+ Run `npx nx build` to build the library. The build artifacts are stored in the output directory (i.e. `dist/`), ready to be published.
17
+ <% } else { %>
18
+ ## Start the application
19
+
20
+ Run `npx nx <%= serveCommand %> <%= appName %>` to start the development server. Happy coding!
21
+
22
+ ## Build for production
12
23
 
13
- ## Generate code
24
+ 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.
25
+ <% } } else { %>
26
+ ## Nx plugins and code generators
14
27
 
15
- If you happen to use Nx plugins, you can leverage code generators that might come with it.
28
+ Add Nx plugins to leverage their code generators and automated, inferred tasks.
16
29
 
17
- Run `nx list` to get a list of available plugins and whether they have generators. Then run `nx list <plugin-name>` to see what generators are available.
30
+ ```
31
+ # Add plugin
32
+ npx nx add @nx/react
33
+
34
+ # Use code generator
35
+ npx nx generate @nx/react:app demo
18
36
 
19
- Learn more about [Nx generators on the docs](https://nx.dev/features/generate-code).
37
+ # Run development server
38
+ npx nx serve demo
39
+
40
+ # View project details
41
+ npx nx show project demo --web
42
+ ```
20
43
 
44
+ 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.
45
+
46
+ Learn more about [code generators](https://nx.dev/features/generate-code) and [inferred tasks](https://nx.dev/concepts/inferred-tasks) in the docs.
47
+ <% } %>
21
48
  ## Running tasks
22
49
 
23
50
  To execute tasks with Nx use the following syntax:
24
51
 
25
52
  ```
26
- nx <target> <project> <...options>
53
+ npx nx <target> <project> <...options>
27
54
  ```
28
55
 
29
56
  You can also run multiple targets:
30
57
 
31
58
  ```
32
- nx run-many -t <target1> <target2>
59
+ npx nx run-many -t <target1> <target2>
33
60
  ```
34
61
 
35
62
  ..or add `-p` to filter specific projects
36
63
 
37
64
  ```
38
- nx run-many -t <target1> <target2> -p <proj1> <proj2>
65
+ npx nx run-many -t <target1> <target2> -p <proj1> <proj2>
39
66
  ```
40
67
 
41
68
  Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/features/run-tasks).
42
69
 
43
- ## Want better Editor Integration?
44
-
45
- Have a look at the [Nx Console extensions](https://nx.dev/nx-console). It provides autocomplete support, a UI for exploring and running tasks & generators, and more! Available for VSCode, IntelliJ and comes with a LSP for Vim users.
46
-
47
- ## Ready to deploy?
48
-
49
- Just run `nx build demoapp` to build the application. The build artifacts will be stored in the `dist/` directory, ready to be deployed.
50
-
51
70
  ## Set up CI!
52
71
 
53
72
  Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further.
@@ -56,8 +75,9 @@ Nx comes with local caching already built-in (check your `nx.json`). On CI you m
56
75
  - [Set up task distribution across multiple machines](https://nx.dev/nx-cloud/features/distribute-task-execution)
57
76
  - [Learn more how to setup CI](https://nx.dev/recipes/ci)
58
77
 
59
- ## Explore the Project Graph
60
- Run `nx graph` to show the graph of the workspace.
78
+ ## Explore the project graph
79
+
80
+ Run `npx nx graph` to show the graph of the workspace.
61
81
  It will show tasks that you can run with Nx.
62
82
 
63
83
  - [Learn more about Exploring the Project Graph](https://nx.dev/core-features/explore-graph)
@@ -103,8 +103,11 @@ function createReadme(tree, { name, appName, directory, preset }) {
103
103
  const formattedNames = (0, devkit_1.names)(name);
104
104
  (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, './files-readme'), directory, {
105
105
  formattedNames,
106
- includeServe: preset !== presets_1.Preset.TsStandalone,
106
+ isJsStandalone: preset === presets_1.Preset.TsStandalone,
107
107
  appName,
108
+ serveCommand: preset === presets_1.Preset.NextJs || preset === presets_1.Preset.NextJsStandalone
109
+ ? 'dev'
110
+ : 'serve',
108
111
  name,
109
112
  });
110
113
  }
@@ -121,8 +124,7 @@ function addNpmScripts(tree, options) {
121
124
  options.preset === presets_1.Preset.ReactStandalone ||
122
125
  options.preset === presets_1.Preset.VueStandalone ||
123
126
  options.preset === presets_1.Preset.NuxtStandalone ||
124
- options.preset === presets_1.Preset.NodeStandalone ||
125
- options.preset === presets_1.Preset.NextJsStandalone) {
127
+ options.preset === presets_1.Preset.NodeStandalone) {
126
128
  (0, devkit_1.updateJson)(tree, (0, path_1.join)(options.directory, 'package.json'), (json) => {
127
129
  Object.assign(json.scripts, {
128
130
  start: 'nx serve',
@@ -132,6 +134,17 @@ function addNpmScripts(tree, options) {
132
134
  return json;
133
135
  });
134
136
  }
137
+ if (options.preset === presets_1.Preset.NextJsStandalone) {
138
+ (0, devkit_1.updateJson)(tree, (0, path_1.join)(options.directory, 'package.json'), (json) => {
139
+ Object.assign(json.scripts, {
140
+ dev: 'nx dev',
141
+ build: 'nx build',
142
+ start: 'nx start',
143
+ test: 'nx test',
144
+ });
145
+ return json;
146
+ });
147
+ }
135
148
  if (options.preset === presets_1.Preset.TsStandalone) {
136
149
  (0, devkit_1.updateJson)(tree, (0, path_1.join)(options.directory, 'package.json'), (json) => {
137
150
  Object.assign(json.scripts, {
@@ -10,7 +10,7 @@ if (process.env.CI === 'true') {
10
10
  }
11
11
  class CLIOutput {
12
12
  constructor() {
13
- this.NX_PREFIX = `${chalk.cyan('>')} ${chalk.reset.inverse.bold.cyan(' NX ')}`;
13
+ this.NX_PREFIX = chalk.reset.inverse.bold.cyan(' NX ');
14
14
  /**
15
15
  * Longer dash character which forms more of a continuous line when place side to side
16
16
  * with itself, unlike the standard dash character