create-nx-workspace 13.4.5 → 13.5.0-beta.2
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/README.md +21 -104
- package/bin/create-nx-workspace.js +2 -2
- package/bin/output.d.ts +20 -6
- package/bin/output.js +86 -38
- package/bin/output.js.map +1 -1
- package/bin/package-manager.d.ts +3 -1
- package/bin/package-manager.js +6 -1
- package/bin/package-manager.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,39 +17,13 @@
|
|
|
17
17
|
|
|
18
18
|
# `> npx create-nx-workspace`
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Nx is a next generation build system with first class monorepo support and powerful integrations.
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
{{getting-started}}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### Best-in-Class Support for Monorepos
|
|
27
|
-
|
|
28
|
-
<strong>Nx</strong> provides distributed graph-based task execution and computation caching.
|
|
29
|
-
|
|
30
|
-
<strong>Nx</strong> is smart. It analyzes your workspace and figures out what can be affected by every code change.
|
|
31
|
-
That's why Nx doesn't rebuild and retest everything on every commit--<strong>it only rebuilds what is necessary</strong>
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
<strong>Nx</strong> partitions commands into a graph of smaller tasks. Nx then runs those tasks in parallel,
|
|
35
|
-
and <strong>it can even distribute them across multiple machines without any configuration</strong>.
|
|
36
|
-
|
|
37
|
-
<strong>Nx also uses a distributed computation cache.</strong> If someone has already built or tested similar code, Nx
|
|
38
|
-
will use their results to speed up the command for everyone else.
|
|
39
|
-
|
|
40
|
-
### Holistic Dev Experience Powered by an Advanced CLI and Editor Plugins
|
|
41
|
-
|
|
42
|
-
<strong>Nx</strong> helps scale your development from one team building one application to many teams building multiple
|
|
43
|
-
frontend and backend applications all in the same workspace. <strong >When using Nx, developers have a holistic dev
|
|
44
|
-
experience powered by an advanced CLI</strong > (with editor plugins), capabilities for controlled code sharing and
|
|
45
|
-
consistent code generation.
|
|
46
|
-
|
|
47
|
-
### Rich Plugin Ecosystem
|
|
48
|
-
|
|
49
|
-
<strong>Nx</strong> is an open platform with plugins for many modern tools and frameworks. It has support for
|
|
50
|
-
TypeScript, React, Angular, Cypress, Jest, Prettier, Nest.js, Next.js, Storybook, Ionic among others. With Nx, you get a
|
|
51
|
-
consistent dev experience regardless of the tools used.
|
|
24
|
+
## What is It?
|
|
52
25
|
|
|
26
|
+
It's a command to create a new Nx workspace.
|
|
53
27
|
|
|
54
28
|
## Getting Started
|
|
55
29
|
|
|
@@ -77,8 +51,9 @@ The `create-nx-workspace` command will ask you to select a preset, which will co
|
|
|
77
51
|
|
|
78
52
|
```
|
|
79
53
|
? What to create in the new workspace (Use arrow keys)
|
|
80
|
-
❯
|
|
81
|
-
|
|
54
|
+
❯ apps [an empty workspace with no plugins with a layout that works best for building apps]
|
|
55
|
+
core [an empty workspace with no plugins set up to publish npm packages (similar to yarn workspaces)]
|
|
56
|
+
ts [an empty workspace with the JS/TS plugin preinstalled]
|
|
82
57
|
react [a workspace with a single React application]
|
|
83
58
|
angular [a workspace with a single Angular application]
|
|
84
59
|
next.js [a workspace with a single Next.js application]
|
|
@@ -86,87 +61,29 @@ The `create-nx-workspace` command will ask you to select a preset, which will co
|
|
|
86
61
|
nest [a workspace with a single Nest application]
|
|
87
62
|
express [a workspace with a single Express application]
|
|
88
63
|
web components [a workspace with a single app built using web components]
|
|
64
|
+
react-native [a workspace with a single React Native application]
|
|
89
65
|
react-express [a workspace with a full stack application (React + Express)]
|
|
90
|
-
angular-nest [a workspace with a full stack application (Angular + Nest)]
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Select the preset that works best for you.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
```
|
|
97
|
-
? Workspace name (e.g., org name) happyorg
|
|
98
|
-
? What to create in the new workspace web components [a workspace with a single app built using web components]
|
|
99
|
-
? Application name myapp
|
|
100
|
-
? Default stylesheet format CSS
|
|
101
66
|
```
|
|
102
67
|
|
|
103
|
-
|
|
68
|
+
Select the preset that works best for you
|
|
104
69
|
|
|
105
|
-
|
|
70
|
+
### Adding Nx to an Existing Monorepo
|
|
106
71
|
|
|
107
|
-
|
|
108
|
-
- Run `nx test myapp` to test it.
|
|
109
|
-
- Run `nx e2e myapp-e2e` to run e2e tests for it.
|
|
72
|
+
Run:
|
|
110
73
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Even though Nx isn't technology specific, we provide 3 separate flavours of the documentation site to it make it easier for you to get up and running. For every link below, you will be able to select whether you want your examples to be written in React, Node or Angular.
|
|
116
|
-
|
|
117
|
-
- [Nx Documentation and Guides](https://nx.dev)
|
|
118
|
-
- [Intro into Nx](https://nx.dev/getting-started/intro)
|
|
119
|
-
- [Interactive Tutorial with Videos](https://nx.dev/tutorial/01-create-application)
|
|
120
|
-
|
|
121
|
-
### Quick Start Videos
|
|
122
|
-
|
|
123
|
-
- [Scale Your React Development with Nx](https://www.youtube.com/watch?v=sNz-4PUM0k8)
|
|
124
|
-
- [Scale your Node Development with Nx](https://www.youtube.com/watch?v=iIh5h_G52kI)
|
|
125
|
-
- [Modern Angular with Nx Dev Tools](https://www.youtube.com/watch?v=cXOkmOy-8dk)
|
|
126
|
-
|
|
127
|
-
### Courses
|
|
128
|
-
|
|
129
|
-
<table>
|
|
130
|
-
<tr>
|
|
131
|
-
<td><strong>Scale React Development with Nx</strong></td>
|
|
132
|
-
<td><strong>Nx Workspaces</strong></td>
|
|
133
|
-
<td><strong>Advanced Nx Workspaces</strong></td>
|
|
134
|
-
</tr>
|
|
135
|
-
<tr>
|
|
136
|
-
<td>
|
|
137
|
-
<a href="https://egghead.io/playlists/scale-react-development-with-nx-4038" target="_blank">
|
|
138
|
-
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/EGH_ScalingReactNx.png" height="150px" alt="Nx - Scale React Development with Nx video course"></p>
|
|
139
|
-
</a>
|
|
140
|
-
</td>
|
|
141
|
-
<td>
|
|
142
|
-
<a href="https://www.youtube.com/watch?v=2mYLe9Kp9VM&list=PLakNactNC1dH38AfqmwabvOszDmKriGco" target="_blank">
|
|
143
|
-
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-workspace-course.png" width="350" alt="Nx Workspaces video course"></p>
|
|
144
|
-
</a>
|
|
145
|
-
</td>
|
|
146
|
-
<td>
|
|
147
|
-
<a href="https://nxplaybook.com/p/advanced-nx-workspaces" target="_blank">
|
|
148
|
-
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/advanced-nx-workspace-course.png" width="350" alt="Nx Advanced Workspaces video course"></p>
|
|
149
|
-
</a>
|
|
150
|
-
</td>
|
|
151
|
-
</tr>
|
|
152
|
-
</table>
|
|
153
|
-
|
|
154
|
-
### Videos, Blogs, Books, Examples
|
|
155
|
-
|
|
156
|
-
- [Nx Dev Tools for Monorepos, In-Depth Explainer (React)](https://www.youtube.com/watch?v=jCf92IyR-GE)
|
|
74
|
+
```bash
|
|
75
|
+
npx add-nx-to-monorepo@latest
|
|
76
|
+
```
|
|
157
77
|
|
|
158
|
-
|
|
78
|
+
### Documentation & Resources
|
|
159
79
|
|
|
160
|
-
|
|
80
|
+
A few links to help you get started:
|
|
161
81
|
|
|
82
|
+
- [Nx.Dev: Documentation, Guides, Interactive Tutorials](https://nx.dev)
|
|
83
|
+
- [Tutorial: Adding Nx to an Existing Monorepo](https://nx.dev/migration/adding-to-monorepo)
|
|
84
|
+
- [Official Nx YouTube Channel](https://www.youtube.com/c/Nrwl_io)
|
|
162
85
|
- [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
|
|
163
86
|
|
|
164
|
-
-
|
|
165
|
-
|
|
166
|
-
- [Nx Examples Repo](https://github.com/nrwl/nx-examples)
|
|
167
|
-
|
|
168
|
-
# Engage with the Core Team and the Community
|
|
169
|
-
|
|
170
|
-
- [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.
|
|
171
|
-
- [Follow Nx on Twitter](https://twitter.com/NxDevTools)
|
|
87
|
+
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
88
|
+
width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
|
|
172
89
|
|
|
@@ -87,8 +87,8 @@ const presetOptions = [
|
|
|
87
87
|
},
|
|
88
88
|
];
|
|
89
89
|
const tsVersion = '~4.4.3';
|
|
90
|
-
const cliVersion = '13.
|
|
91
|
-
const nxVersion = '13.
|
|
90
|
+
const cliVersion = '13.5.0-beta.2';
|
|
91
|
+
const nxVersion = '13.5.0-beta.2';
|
|
92
92
|
const prettierVersion = '2.3.2';
|
|
93
93
|
const parsedArgs = yargsParser(process.argv.slice(2), {
|
|
94
94
|
string: [
|
package/bin/output.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as chalk from 'chalk';
|
|
2
|
+
export declare function isCI(): string | boolean;
|
|
2
3
|
export interface CLIErrorMessageConfig {
|
|
3
4
|
title: string;
|
|
4
5
|
bodyLines?: string[];
|
|
@@ -17,13 +18,18 @@ export interface CLISuccessMessageConfig {
|
|
|
17
18
|
title: string;
|
|
18
19
|
bodyLines?: string[];
|
|
19
20
|
}
|
|
21
|
+
export declare enum TaskCacheStatus {
|
|
22
|
+
NoCache = "[no cache]",
|
|
23
|
+
MatchedExistingOutput = "[existing outputs match the cache, left as is]",
|
|
24
|
+
RetrievedFromCache = "[retrieved from cache]"
|
|
25
|
+
}
|
|
20
26
|
declare class CLIOutput {
|
|
21
|
-
|
|
27
|
+
readonly X_PADDING = " ";
|
|
22
28
|
/**
|
|
23
29
|
* Longer dash character which forms more of a continuous line when place side to side
|
|
24
30
|
* with itself, unlike the standard dash character
|
|
25
31
|
*/
|
|
26
|
-
private
|
|
32
|
+
private get VERTICAL_SEPARATOR();
|
|
27
33
|
/**
|
|
28
34
|
* Expose some color and other utility functions so that other parts of the codebase that need
|
|
29
35
|
* more fine-grained control of message bodies are still using a centralized
|
|
@@ -31,22 +37,30 @@ declare class CLIOutput {
|
|
|
31
37
|
*/
|
|
32
38
|
colors: {
|
|
33
39
|
gray: chalk.Chalk;
|
|
40
|
+
green: chalk.Chalk;
|
|
41
|
+
red: chalk.Chalk;
|
|
42
|
+
cyan: chalk.Chalk;
|
|
43
|
+
white: chalk.Chalk;
|
|
34
44
|
};
|
|
35
45
|
bold: chalk.Chalk;
|
|
36
46
|
underline: chalk.Chalk;
|
|
47
|
+
dim: chalk.Chalk;
|
|
37
48
|
private writeToStdOut;
|
|
38
49
|
private writeOutputTitle;
|
|
39
50
|
private writeOptionalOutputBody;
|
|
51
|
+
applyNxPrefix(color: string, text: string): string;
|
|
40
52
|
addNewline(): void;
|
|
41
|
-
addVerticalSeparator(): void;
|
|
42
|
-
addVerticalSeparatorWithoutNewLines(): void;
|
|
53
|
+
addVerticalSeparator(color?: string): void;
|
|
54
|
+
addVerticalSeparatorWithoutNewLines(color?: string): void;
|
|
43
55
|
error({ title, slug, bodyLines }: CLIErrorMessageConfig): void;
|
|
44
56
|
warn({ title, slug, bodyLines }: CLIWarnMessageConfig): void;
|
|
45
57
|
note({ title, bodyLines }: CLINoteMessageConfig): void;
|
|
46
58
|
success({ title, bodyLines }: CLISuccessMessageConfig): void;
|
|
47
59
|
logSingleLine(message: string): void;
|
|
48
|
-
logCommand(message: string,
|
|
49
|
-
log({ title, bodyLines }: CLIWarnMessageConfig
|
|
60
|
+
logCommand(message: string, cacheStatus?: TaskCacheStatus): void;
|
|
61
|
+
log({ title, bodyLines, color }: CLIWarnMessageConfig & {
|
|
62
|
+
color?: string;
|
|
63
|
+
}): void;
|
|
50
64
|
}
|
|
51
65
|
export declare const output: CLIOutput;
|
|
52
66
|
export {};
|
package/bin/output.js
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Because we don't want to depend on @nrwl/workspace (to speed up the workspace creation)
|
|
4
|
+
* we duplicate the helper functions from @nrwl/workspace in this file.
|
|
5
|
+
*/
|
|
2
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.output = void 0;
|
|
7
|
+
exports.output = exports.TaskCacheStatus = exports.isCI = void 0;
|
|
4
8
|
const chalk = require("chalk");
|
|
9
|
+
const os_1 = require("os");
|
|
10
|
+
function isCI() {
|
|
11
|
+
return (process.env.CI === 'true' ||
|
|
12
|
+
process.env.TF_BUILD === 'true' ||
|
|
13
|
+
process.env['bamboo.buildKey'] ||
|
|
14
|
+
process.env.BUILDKITE === 'true' ||
|
|
15
|
+
process.env.CIRCLECI === 'true' ||
|
|
16
|
+
process.env.CIRRUS_CI === 'true' ||
|
|
17
|
+
process.env.CODEBUILD_BUILD_ID ||
|
|
18
|
+
process.env.GITHUB_ACTIONS === 'true' ||
|
|
19
|
+
process.env.GITLAB_CI ||
|
|
20
|
+
process.env.HEROKU_TEST_RUN_ID ||
|
|
21
|
+
process.env.BUILD_ID ||
|
|
22
|
+
process.env.BUILD_BUILDID ||
|
|
23
|
+
process.env.TEAMCITY_VERSION ||
|
|
24
|
+
process.env.TRAVIS === 'true');
|
|
25
|
+
}
|
|
26
|
+
exports.isCI = isCI;
|
|
27
|
+
var TaskCacheStatus;
|
|
28
|
+
(function (TaskCacheStatus) {
|
|
29
|
+
TaskCacheStatus["NoCache"] = "[no cache]";
|
|
30
|
+
TaskCacheStatus["MatchedExistingOutput"] = "[existing outputs match the cache, left as is]";
|
|
31
|
+
TaskCacheStatus["RetrievedFromCache"] = "[retrieved from cache]";
|
|
32
|
+
})(TaskCacheStatus = exports.TaskCacheStatus || (exports.TaskCacheStatus = {}));
|
|
5
33
|
/**
|
|
6
34
|
* Automatically disable styling applied by chalk if CI=true
|
|
7
35
|
*/
|
|
8
|
-
if (
|
|
36
|
+
if (isCI()) {
|
|
9
37
|
chalk.level = 0;
|
|
10
38
|
}
|
|
11
39
|
class CLIOutput {
|
|
12
40
|
constructor() {
|
|
13
|
-
this.
|
|
14
|
-
/**
|
|
15
|
-
* Longer dash character which forms more of a continuous line when place side to side
|
|
16
|
-
* with itself, unlike the standard dash character
|
|
17
|
-
*/
|
|
18
|
-
this.VERTICAL_SEPARATOR = '———————————————————————————————————————————————';
|
|
41
|
+
this.X_PADDING = ' ';
|
|
19
42
|
/**
|
|
20
43
|
* Expose some color and other utility functions so that other parts of the codebase that need
|
|
21
44
|
* more fine-grained control of message bodies are still using a centralized
|
|
@@ -23,44 +46,65 @@ class CLIOutput {
|
|
|
23
46
|
*/
|
|
24
47
|
this.colors = {
|
|
25
48
|
gray: chalk.gray,
|
|
49
|
+
green: chalk.green,
|
|
50
|
+
red: chalk.red,
|
|
51
|
+
cyan: chalk.cyan,
|
|
52
|
+
white: chalk.white,
|
|
26
53
|
};
|
|
27
54
|
this.bold = chalk.bold;
|
|
28
55
|
this.underline = chalk.underline;
|
|
56
|
+
this.dim = chalk.dim;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Longer dash character which forms more of a continuous line when place side to side
|
|
60
|
+
* with itself, unlike the standard dash character
|
|
61
|
+
*/
|
|
62
|
+
get VERTICAL_SEPARATOR() {
|
|
63
|
+
let divider = '';
|
|
64
|
+
for (let i = 0; i < process.stdout.columns - this.X_PADDING.length * 2; i++) {
|
|
65
|
+
divider += '\u2014';
|
|
66
|
+
}
|
|
67
|
+
return divider;
|
|
29
68
|
}
|
|
30
69
|
writeToStdOut(str) {
|
|
31
70
|
process.stdout.write(str);
|
|
32
71
|
}
|
|
33
|
-
writeOutputTitle({
|
|
34
|
-
|
|
35
|
-
if (label) {
|
|
36
|
-
outputTitle = `${this.NX_PREFIX} ${label} ${title}\n`;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
outputTitle = `${this.NX_PREFIX} ${title}\n`;
|
|
40
|
-
}
|
|
41
|
-
this.writeToStdOut(outputTitle);
|
|
72
|
+
writeOutputTitle({ color, title, }) {
|
|
73
|
+
this.writeToStdOut(` ${this.applyNxPrefix(color, title)}${os_1.EOL}`);
|
|
42
74
|
}
|
|
43
75
|
writeOptionalOutputBody(bodyLines) {
|
|
44
76
|
if (!bodyLines) {
|
|
45
77
|
return;
|
|
46
78
|
}
|
|
47
79
|
this.addNewline();
|
|
48
|
-
bodyLines.forEach((bodyLine) => this.writeToStdOut(
|
|
80
|
+
bodyLines.forEach((bodyLine) => this.writeToStdOut(` ${bodyLine}${os_1.EOL}`));
|
|
81
|
+
}
|
|
82
|
+
applyNxPrefix(color = 'cyan', text) {
|
|
83
|
+
let nxPrefix = '';
|
|
84
|
+
if (chalk[color]) {
|
|
85
|
+
nxPrefix = `${chalk[color]('>')} ${chalk.reset.inverse.bold[color](' NX ')}`;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
nxPrefix = `${chalk.keyword(color)('>')} ${chalk.reset.inverse.bold.keyword(color)(' NX ')}`;
|
|
89
|
+
}
|
|
90
|
+
return `${nxPrefix} ${text}`;
|
|
49
91
|
}
|
|
50
92
|
addNewline() {
|
|
51
|
-
this.writeToStdOut(
|
|
93
|
+
this.writeToStdOut(os_1.EOL);
|
|
52
94
|
}
|
|
53
|
-
addVerticalSeparator() {
|
|
54
|
-
this.
|
|
95
|
+
addVerticalSeparator(color = 'gray') {
|
|
96
|
+
this.addNewline();
|
|
97
|
+
this.addVerticalSeparatorWithoutNewLines(color);
|
|
98
|
+
this.addNewline();
|
|
55
99
|
}
|
|
56
|
-
addVerticalSeparatorWithoutNewLines() {
|
|
57
|
-
this.writeToStdOut(`${chalk.
|
|
100
|
+
addVerticalSeparatorWithoutNewLines(color = 'gray') {
|
|
101
|
+
this.writeToStdOut(`${this.X_PADDING}${chalk.dim[color](this.VERTICAL_SEPARATOR)}${os_1.EOL}`);
|
|
58
102
|
}
|
|
59
103
|
error({ title, slug, bodyLines }) {
|
|
60
104
|
this.addNewline();
|
|
61
105
|
this.writeOutputTitle({
|
|
62
|
-
|
|
63
|
-
title: chalk.
|
|
106
|
+
color: 'red',
|
|
107
|
+
title: chalk.red(title),
|
|
64
108
|
});
|
|
65
109
|
this.writeOptionalOutputBody(bodyLines);
|
|
66
110
|
/**
|
|
@@ -68,15 +112,15 @@ class CLIOutput {
|
|
|
68
112
|
*/
|
|
69
113
|
if (slug && typeof slug === 'string') {
|
|
70
114
|
this.addNewline();
|
|
71
|
-
this.writeToStdOut(`${chalk.grey(' Learn more about this error: ')}https://errors.nx.dev/${slug}
|
|
115
|
+
this.writeToStdOut(`${chalk.grey(' Learn more about this error: ')}https://errors.nx.dev/${slug}${os_1.EOL}`);
|
|
72
116
|
}
|
|
73
117
|
this.addNewline();
|
|
74
118
|
}
|
|
75
119
|
warn({ title, slug, bodyLines }) {
|
|
76
120
|
this.addNewline();
|
|
77
121
|
this.writeOutputTitle({
|
|
78
|
-
|
|
79
|
-
title: chalk.
|
|
122
|
+
color: 'yellow',
|
|
123
|
+
title: chalk.yellow(title),
|
|
80
124
|
});
|
|
81
125
|
this.writeOptionalOutputBody(bodyLines);
|
|
82
126
|
/**
|
|
@@ -91,8 +135,8 @@ class CLIOutput {
|
|
|
91
135
|
note({ title, bodyLines }) {
|
|
92
136
|
this.addNewline();
|
|
93
137
|
this.writeOutputTitle({
|
|
94
|
-
|
|
95
|
-
title: chalk.
|
|
138
|
+
color: 'orange',
|
|
139
|
+
title: chalk.keyword('orange')(title),
|
|
96
140
|
});
|
|
97
141
|
this.writeOptionalOutputBody(bodyLines);
|
|
98
142
|
this.addNewline();
|
|
@@ -100,8 +144,8 @@ class CLIOutput {
|
|
|
100
144
|
success({ title, bodyLines }) {
|
|
101
145
|
this.addNewline();
|
|
102
146
|
this.writeOutputTitle({
|
|
103
|
-
|
|
104
|
-
title: chalk.
|
|
147
|
+
color: 'green',
|
|
148
|
+
title: chalk.green(title),
|
|
105
149
|
});
|
|
106
150
|
this.writeOptionalOutputBody(bodyLines);
|
|
107
151
|
this.addNewline();
|
|
@@ -109,22 +153,26 @@ class CLIOutput {
|
|
|
109
153
|
logSingleLine(message) {
|
|
110
154
|
this.addNewline();
|
|
111
155
|
this.writeOutputTitle({
|
|
156
|
+
color: 'gray',
|
|
112
157
|
title: message,
|
|
113
158
|
});
|
|
114
159
|
this.addNewline();
|
|
115
160
|
}
|
|
116
|
-
logCommand(message,
|
|
161
|
+
logCommand(message, cacheStatus = TaskCacheStatus.NoCache) {
|
|
117
162
|
this.addNewline();
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
|
|
163
|
+
let commandOutput = ` ${chalk.dim('> nx run')} ${message}`;
|
|
164
|
+
if (cacheStatus !== TaskCacheStatus.NoCache) {
|
|
165
|
+
commandOutput += ` ${chalk.grey(cacheStatus)}`;
|
|
121
166
|
}
|
|
167
|
+
this.writeToStdOut(commandOutput);
|
|
122
168
|
this.addNewline();
|
|
123
169
|
}
|
|
124
|
-
log({ title, bodyLines }) {
|
|
170
|
+
log({ title, bodyLines, color }) {
|
|
125
171
|
this.addNewline();
|
|
172
|
+
color = color || 'white';
|
|
126
173
|
this.writeOutputTitle({
|
|
127
|
-
|
|
174
|
+
color: 'cyan',
|
|
175
|
+
title: chalk[color](title),
|
|
128
176
|
});
|
|
129
177
|
this.writeOptionalOutputBody(bodyLines);
|
|
130
178
|
this.addNewline();
|
package/bin/output.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/bin/output.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/bin/output.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAA+B;AAC/B,2BAAyB;AAEzB,SAAgB,IAAI;IAClB,OAAO,CACL,OAAO,CAAC,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,IAAI,CAAC,gBAAgB,CAAC;YACpB,KAAK,EAAE,MAAM;YACb,KAAK,EAAE,OAAO;SACf,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED,UAAU,CACR,OAAe,EACf,cAA+B,eAAe,CAAC,OAAO;QAEtD,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,IAAI,aAAa,GAAG,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,OAAO,EAAE,CAAC;QAC9D,IAAI,WAAW,KAAK,eAAe,CAAC,OAAO,EAAE;YAC3C,aAAa,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;SACjD;QACD,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,CAAC;QAElC,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED,GAAG,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAA6C;QACxE,IAAI,CAAC,UAAU,EAAE,CAAC;QAElB,KAAK,GAAG,KAAK,IAAI,OAAO,CAAC;QAEzB,IAAI,CAAC,gBAAgB,CAAC;YACpB,KAAK,EAAE,MAAM;YACb,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC;SAC3B,CAAC,CAAC;QAEH,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;QAExC,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;CACF;AAEY,QAAA,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC"}
|
package/bin/package-manager.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
declare const packageManagerList: readonly ["pnpm", "yarn", "npm"];
|
|
2
|
+
export declare type PackageManager = typeof packageManagerList[number];
|
|
2
3
|
export declare function detectPackageManager(dir?: string): PackageManager;
|
|
3
4
|
/**
|
|
4
5
|
* Returns commands for the package manager used in the workspace.
|
|
@@ -32,3 +33,4 @@ export declare function getPackageManagerVersion(packageManager: PackageManager)
|
|
|
32
33
|
* Default to 'npm'
|
|
33
34
|
*/
|
|
34
35
|
export declare function detectInvokedPackageManager(): PackageManager;
|
|
36
|
+
export {};
|
package/bin/package-manager.js
CHANGED
|
@@ -4,6 +4,11 @@ exports.detectInvokedPackageManager = exports.getPackageManagerVersion = exports
|
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const fs_1 = require("fs");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
+
/*
|
|
8
|
+
* Because we don't want to depend on @nrwl/workspace (to speed up the workspace creation)
|
|
9
|
+
* we duplicate the helper functions from @nrwl/workspace in this file.
|
|
10
|
+
*/
|
|
11
|
+
const packageManagerList = ['pnpm', 'yarn', 'npm'];
|
|
7
12
|
function detectPackageManager(dir = '') {
|
|
8
13
|
return (0, fs_1.existsSync)((0, path_1.join)(dir, 'yarn.lock'))
|
|
9
14
|
? 'yarn'
|
|
@@ -88,7 +93,7 @@ function detectInvokedPackageManager() {
|
|
|
88
93
|
if (!invoker) {
|
|
89
94
|
return detectedPackageManager;
|
|
90
95
|
}
|
|
91
|
-
for (const pkgManager of
|
|
96
|
+
for (const pkgManager of packageManagerList) {
|
|
92
97
|
if (invoker.path.includes(pkgManager)) {
|
|
93
98
|
detectedPackageManager = pkgManager;
|
|
94
99
|
break;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager.js","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/bin/package-manager.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AACzC,2BAAgC;AAChC,+BAA4B;
|
|
1
|
+
{"version":3,"file":"package-manager.js","sourceRoot":"","sources":["../../../../packages/create-nx-workspace/bin/package-manager.ts"],"names":[],"mappings":";;;AAAA,iDAAyC;AACzC,2BAAgC;AAChC,+BAA4B;AAE5B;;;GAGG;AAEH,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAU,CA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