create-nx-workspace 19.5.0-beta.0 → 19.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/package.json +1 -1
- package/src/create-empty-workspace.js +1 -2
- package/src/create-preset.js +1 -2
- package/src/create-sandbox.js +1 -2
- package/src/create-workspace.js +1 -2
- package/src/internal-utils/prompts.js +4 -5
- package/src/internal-utils/yargs-options.js +6 -7
- package/src/utils/child-process-utils.js +2 -3
- package/src/utils/ci/is-ci.js +1 -2
- package/src/utils/ci/setup-ci.js +1 -2
- package/src/utils/error-utils.js +2 -2
- package/src/utils/git/default-base.js +1 -2
- package/src/utils/git/git.js +3 -4
- package/src/utils/nx/ab-testing.d.ts +16 -59
- package/src/utils/nx/ab-testing.js +56 -22
- package/src/utils/nx/nx-cloud.js +2 -3
- package/src/utils/nx/show-nx-warning.js +1 -2
- package/src/utils/package-manager.js +6 -6
- package/src/utils/preset/get-third-party-preset.js +1 -2
- package/src/utils/preset/point-to-tutorial-and-course.js +1 -2
- package/src/utils/preset/preset.js +2 -2
- package/src/utils/string-utils.js +1 -2
- package/src/utils/unparse.js +1 -2
- package/src/utils/validate-npm-package.js +1 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createEmptyWorkspace =
|
|
3
|
+
exports.createEmptyWorkspace = createEmptyWorkspace;
|
|
4
4
|
const ora = require("ora");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const child_process_utils_1 = require("./utils/child-process-utils");
|
|
@@ -64,4 +64,3 @@ async function createEmptyWorkspace(tmpDir, name, packageManager, options) {
|
|
|
64
64
|
}
|
|
65
65
|
return (0, path_1.join)(workingDir, directory);
|
|
66
66
|
}
|
|
67
|
-
exports.createEmptyWorkspace = createEmptyWorkspace;
|
package/src/create-preset.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPreset =
|
|
3
|
+
exports.createPreset = createPreset;
|
|
4
4
|
const output_1 = require("./utils/output");
|
|
5
5
|
const package_manager_1 = require("./utils/package-manager");
|
|
6
6
|
const child_process_utils_1 = require("./utils/child-process-utils");
|
|
@@ -41,4 +41,3 @@ async function createPreset(preset, parsedArgs, packageManager, directory) {
|
|
|
41
41
|
process.exit(1);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
exports.createPreset = createPreset;
|
package/src/create-sandbox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSandbox =
|
|
3
|
+
exports.createSandbox = createSandbox;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const tmp_1 = require("tmp");
|
|
6
6
|
const ora = require("ora");
|
|
@@ -52,4 +52,3 @@ async function createSandbox(packageManager) {
|
|
|
52
52
|
}
|
|
53
53
|
return tmpDir;
|
|
54
54
|
}
|
|
55
|
-
exports.createSandbox = createSandbox;
|
package/src/create-workspace.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createWorkspace =
|
|
3
|
+
exports.createWorkspace = createWorkspace;
|
|
4
4
|
const output_1 = require("./utils/output");
|
|
5
5
|
const nx_cloud_1 = require("./utils/nx/nx-cloud");
|
|
6
6
|
const create_sandbox_1 = require("./create-sandbox");
|
|
@@ -58,4 +58,3 @@ async function createWorkspace(preset, options) {
|
|
|
58
58
|
directory,
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
exports.createWorkspace = createWorkspace;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.determineNxCloud = determineNxCloud;
|
|
4
|
+
exports.determineIfGitHubWillBeUsed = determineIfGitHubWillBeUsed;
|
|
5
|
+
exports.determineDefaultBase = determineDefaultBase;
|
|
6
|
+
exports.determinePackageManager = determinePackageManager;
|
|
4
7
|
const ab_testing_1 = require("../utils/nx/ab-testing");
|
|
5
8
|
const output_1 = require("../utils/output");
|
|
6
9
|
const default_base_1 = require("../utils/git/default-base");
|
|
@@ -16,7 +19,6 @@ async function determineNxCloud(parsedArgs) {
|
|
|
16
19
|
return parsedArgs.nxCloud;
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
|
-
exports.determineNxCloud = determineNxCloud;
|
|
20
22
|
async function determineIfGitHubWillBeUsed(nxCloud) {
|
|
21
23
|
if (nxCloud === 'yes' || nxCloud === 'circleci') {
|
|
22
24
|
const reply = await enquirer.prompt([
|
|
@@ -32,7 +34,6 @@ async function determineIfGitHubWillBeUsed(nxCloud) {
|
|
|
32
34
|
}
|
|
33
35
|
return false;
|
|
34
36
|
}
|
|
35
|
-
exports.determineIfGitHubWillBeUsed = determineIfGitHubWillBeUsed;
|
|
36
37
|
async function nxCloudPrompt(key) {
|
|
37
38
|
const { message, choices, initial, fallback, footer, hint } = ab_testing_1.messages.getPrompt(key);
|
|
38
39
|
const promptConfig = {
|
|
@@ -82,7 +83,6 @@ async function determineDefaultBase(parsedArgs) {
|
|
|
82
83
|
}
|
|
83
84
|
return Promise.resolve((0, default_base_1.deduceDefaultBase)());
|
|
84
85
|
}
|
|
85
|
-
exports.determineDefaultBase = determineDefaultBase;
|
|
86
86
|
async function determinePackageManager(parsedArgs) {
|
|
87
87
|
const packageManager = parsedArgs.packageManager;
|
|
88
88
|
if (packageManager) {
|
|
@@ -119,4 +119,3 @@ async function determinePackageManager(parsedArgs) {
|
|
|
119
119
|
}
|
|
120
120
|
return Promise.resolve((0, package_manager_1.detectInvokedPackageManager)());
|
|
121
121
|
}
|
|
122
|
-
exports.determinePackageManager = determinePackageManager;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.withNxCloud = withNxCloud;
|
|
4
|
+
exports.withUseGitHub = withUseGitHub;
|
|
5
|
+
exports.withAllPrompts = withAllPrompts;
|
|
6
|
+
exports.withPackageManager = withPackageManager;
|
|
7
|
+
exports.withGitOptions = withGitOptions;
|
|
8
|
+
exports.withOptions = withOptions;
|
|
4
9
|
const chalk = require("chalk");
|
|
5
10
|
const ab_testing_1 = require("../utils/nx/ab-testing");
|
|
6
11
|
const package_manager_1 = require("../utils/package-manager");
|
|
@@ -14,7 +19,6 @@ function withNxCloud(argv) {
|
|
|
14
19
|
});
|
|
15
20
|
return result;
|
|
16
21
|
}
|
|
17
|
-
exports.withNxCloud = withNxCloud;
|
|
18
22
|
function withUseGitHub(argv) {
|
|
19
23
|
return argv.option('useGitHub', {
|
|
20
24
|
describe: chalk.dim `Will you be using GitHub as your git hosting provider?`,
|
|
@@ -22,7 +26,6 @@ function withUseGitHub(argv) {
|
|
|
22
26
|
default: false,
|
|
23
27
|
});
|
|
24
28
|
}
|
|
25
|
-
exports.withUseGitHub = withUseGitHub;
|
|
26
29
|
function withAllPrompts(argv) {
|
|
27
30
|
return argv.option('allPrompts', {
|
|
28
31
|
alias: 'a',
|
|
@@ -31,7 +34,6 @@ function withAllPrompts(argv) {
|
|
|
31
34
|
default: false,
|
|
32
35
|
});
|
|
33
36
|
}
|
|
34
|
-
exports.withAllPrompts = withAllPrompts;
|
|
35
37
|
function withPackageManager(argv) {
|
|
36
38
|
return argv.option('packageManager', {
|
|
37
39
|
alias: 'pm',
|
|
@@ -41,7 +43,6 @@ function withPackageManager(argv) {
|
|
|
41
43
|
type: 'string',
|
|
42
44
|
});
|
|
43
45
|
}
|
|
44
|
-
exports.withPackageManager = withPackageManager;
|
|
45
46
|
function withGitOptions(argv) {
|
|
46
47
|
return argv
|
|
47
48
|
.option('defaultBase', {
|
|
@@ -69,10 +70,8 @@ function withGitOptions(argv) {
|
|
|
69
70
|
default: 'Initial commit',
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
|
-
exports.withGitOptions = withGitOptions;
|
|
73
73
|
function withOptions(argv, ...options) {
|
|
74
74
|
// Reversing the options keeps the execution order correct.
|
|
75
75
|
// e.g. [withCI, withGIT] should transform into withGIT(withCI) so withCI resolves first.
|
|
76
76
|
return options.reverse().reduce((argv, option) => option(argv), argv);
|
|
77
77
|
}
|
|
78
|
-
exports.withOptions = withOptions;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.spawnAndWait = spawnAndWait;
|
|
4
|
+
exports.execAndWait = execAndWait;
|
|
4
5
|
const child_process_1 = require("child_process");
|
|
5
6
|
const fs_1 = require("fs");
|
|
6
7
|
const path_1 = require("path");
|
|
@@ -27,7 +28,6 @@ function spawnAndWait(command, args, cwd) {
|
|
|
27
28
|
});
|
|
28
29
|
});
|
|
29
30
|
}
|
|
30
|
-
exports.spawnAndWait = spawnAndWait;
|
|
31
31
|
function execAndWait(command, cwd) {
|
|
32
32
|
return new Promise((res, rej) => {
|
|
33
33
|
(0, child_process_1.exec)(command, { cwd, env: { ...process.env, NX_DAEMON: 'false' } }, (error, stdout, stderr) => {
|
|
@@ -43,4 +43,3 @@ function execAndWait(command, cwd) {
|
|
|
43
43
|
});
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
exports.execAndWait = execAndWait;
|
package/src/utils/ci/is-ci.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCI =
|
|
3
|
+
exports.isCI = isCI;
|
|
4
4
|
function isCI() {
|
|
5
5
|
return ((process.env.CI && process.env.CI !== 'false') ||
|
|
6
6
|
process.env.TF_BUILD === 'true' ||
|
|
@@ -17,4 +17,3 @@ function isCI() {
|
|
|
17
17
|
!!process.env.BUILD_BUILDID ||
|
|
18
18
|
!!process.env.TEAMCITY_VERSION);
|
|
19
19
|
}
|
|
20
|
-
exports.isCI = isCI;
|
package/src/utils/ci/setup-ci.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setupCI =
|
|
3
|
+
exports.setupCI = setupCI;
|
|
4
4
|
const ora = require("ora");
|
|
5
5
|
const child_process_utils_1 = require("../child-process-utils");
|
|
6
6
|
const error_utils_1 = require("../error-utils");
|
|
@@ -40,4 +40,3 @@ async function setupCI(directory, ci, packageManager, nxCloudSuccessfullyInstall
|
|
|
40
40
|
ciSpinner.stop();
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
exports.setupCI = setupCI;
|
package/src/utils/error-utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CreateNxWorkspaceError = void 0;
|
|
4
|
+
exports.mapErrorToBodyLines = mapErrorToBodyLines;
|
|
4
5
|
class CreateNxWorkspaceError extends Error {
|
|
5
6
|
constructor(logMessage, code, logFile) {
|
|
6
7
|
super(logMessage);
|
|
@@ -29,4 +30,3 @@ function mapErrorToBodyLines(error) {
|
|
|
29
30
|
}
|
|
30
31
|
return lines;
|
|
31
32
|
}
|
|
32
|
-
exports.mapErrorToBodyLines = mapErrorToBodyLines;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deduceDefaultBase =
|
|
3
|
+
exports.deduceDefaultBase = deduceDefaultBase;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
/*
|
|
6
6
|
* Because we don't want to depend on @nx/workspace (to speed up the workspace creation)
|
|
@@ -16,4 +16,3 @@ function deduceDefaultBase() {
|
|
|
16
16
|
return nxDefaultBase;
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
exports.deduceDefaultBase = deduceDefaultBase;
|
package/src/utils/git/git.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.checkGitVersion = checkGitVersion;
|
|
4
|
+
exports.initializeGitRepo = initializeGitRepo;
|
|
5
|
+
exports.commitChanges = commitChanges;
|
|
4
6
|
const child_process_1 = require("child_process");
|
|
5
7
|
const default_base_1 = require("./default-base");
|
|
6
8
|
const output_1 = require("../output");
|
|
@@ -13,7 +15,6 @@ function checkGitVersion() {
|
|
|
13
15
|
return null;
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
|
-
exports.checkGitVersion = checkGitVersion;
|
|
17
18
|
async function initializeGitRepo(directory, options) {
|
|
18
19
|
const execute = (args, ignoreErrorStream = false) => {
|
|
19
20
|
const outputStream = 'ignore';
|
|
@@ -75,7 +76,6 @@ async function initializeGitRepo(directory, options) {
|
|
|
75
76
|
await execute(['commit', `-m "${message}"`]);
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
|
-
exports.initializeGitRepo = initializeGitRepo;
|
|
79
79
|
function commitChanges(directory, message) {
|
|
80
80
|
try {
|
|
81
81
|
(0, child_process_1.execSync)('git add -A', { encoding: 'utf8', stdio: 'pipe', cwd: directory });
|
|
@@ -92,4 +92,3 @@ function commitChanges(directory, message) {
|
|
|
92
92
|
\n${e}`);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
exports.commitChanges = commitChanges;
|
|
@@ -1,64 +1,21 @@
|
|
|
1
1
|
export declare const NxCloudChoices: string[];
|
|
2
|
-
declare const messageOptions:
|
|
3
|
-
readonly setupCI: readonly [{
|
|
4
|
-
readonly code: "enable-nx-cloud";
|
|
5
|
-
readonly message: "Do you want Nx Cloud to make your CI fast?";
|
|
6
|
-
readonly initial: 1;
|
|
7
|
-
readonly choices: readonly [{
|
|
8
|
-
readonly value: "yes";
|
|
9
|
-
readonly name: "Yes, enable Nx Cloud";
|
|
10
|
-
}, {
|
|
11
|
-
readonly value: "github";
|
|
12
|
-
readonly name: "Yes, configure Nx Cloud for GitHub Actions";
|
|
13
|
-
}, {
|
|
14
|
-
readonly value: "circleci";
|
|
15
|
-
readonly name: "Yes, configure Nx Cloud for Circle CI";
|
|
16
|
-
}, {
|
|
17
|
-
readonly value: "skip";
|
|
18
|
-
readonly name: "Skip for now";
|
|
19
|
-
}];
|
|
20
|
-
readonly footer: "\nWatch a short video on Nx Cloud at https://nx.dev/ci/intro/why-nx-cloud";
|
|
21
|
-
readonly hint: "\n(it's free and can be disabled any time)";
|
|
22
|
-
readonly fallback: undefined;
|
|
23
|
-
}, {
|
|
24
|
-
readonly code: "set-up-ci";
|
|
25
|
-
readonly message: "Set up CI with caching, distribution and test deflaking";
|
|
26
|
-
readonly initial: 0;
|
|
27
|
-
readonly choices: readonly [{
|
|
28
|
-
readonly value: "github";
|
|
29
|
-
readonly name: "Yes, for GitHub Actions with Nx Cloud";
|
|
30
|
-
}, {
|
|
31
|
-
readonly value: "circleci";
|
|
32
|
-
readonly name: "Yes, for CircleCI with Nx Cloud";
|
|
33
|
-
}, {
|
|
34
|
-
readonly value: "skip";
|
|
35
|
-
readonly name: "Skip for now";
|
|
36
|
-
}];
|
|
37
|
-
readonly footer: "\nWatch a short video on Nx Cloud at https://nx.dev/ci/intro/why-nx-cloud";
|
|
38
|
-
readonly hint: "\n(it's free and can be disabled any time)";
|
|
39
|
-
readonly fallback: {
|
|
40
|
-
readonly value: "skip";
|
|
41
|
-
readonly key: "setupNxCloud";
|
|
42
|
-
};
|
|
43
|
-
}];
|
|
44
|
-
readonly setupNxCloud: readonly [{
|
|
45
|
-
readonly code: "enable-caching";
|
|
46
|
-
readonly message: "Would you like remote caching to make your build faster?";
|
|
47
|
-
readonly initial: 0;
|
|
48
|
-
readonly choices: readonly [{
|
|
49
|
-
readonly value: "yes";
|
|
50
|
-
readonly name: "Yes";
|
|
51
|
-
}, {
|
|
52
|
-
readonly value: "skip";
|
|
53
|
-
readonly name: "Skip for now";
|
|
54
|
-
}];
|
|
55
|
-
readonly footer: "\nRead more about remote caching at https://nx.dev/ci/features/remote-cache";
|
|
56
|
-
readonly hint: "\n(it's free and can be disabled any time)";
|
|
57
|
-
readonly fallback: undefined;
|
|
58
|
-
}];
|
|
59
|
-
};
|
|
2
|
+
declare const messageOptions: Record<string, MessageData[]>;
|
|
60
3
|
export type MessageKey = keyof typeof messageOptions;
|
|
61
|
-
|
|
4
|
+
interface MessageData {
|
|
5
|
+
code: string;
|
|
6
|
+
message: string;
|
|
7
|
+
initial: number;
|
|
8
|
+
choices: Array<{
|
|
9
|
+
value: string;
|
|
10
|
+
name: string;
|
|
11
|
+
}>;
|
|
12
|
+
footer: string;
|
|
13
|
+
hint?: string;
|
|
14
|
+
fallback?: {
|
|
15
|
+
value: string;
|
|
16
|
+
key: MessageKey;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
62
19
|
export declare class PromptMessages {
|
|
63
20
|
private selectedMessages;
|
|
64
21
|
getPrompt(key: MessageKey): MessageData;
|
|
@@ -1,40 +1,60 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.messages = exports.PromptMessages = exports.NxCloudChoices = void 0;
|
|
4
|
+
exports.recordStat = recordStat;
|
|
4
5
|
const node_child_process_1 = require("node:child_process");
|
|
5
6
|
const is_ci_1 = require("../ci/is-ci");
|
|
6
7
|
const package_manager_1 = require("../package-manager");
|
|
7
|
-
exports.NxCloudChoices = [
|
|
8
|
+
exports.NxCloudChoices = [
|
|
9
|
+
'github',
|
|
10
|
+
'circleci',
|
|
11
|
+
'gitlab',
|
|
12
|
+
'azure',
|
|
13
|
+
'bitbucket-pipelines',
|
|
14
|
+
'skip',
|
|
15
|
+
'yes', // Deprecated but still handled
|
|
16
|
+
];
|
|
8
17
|
const messageOptions = {
|
|
18
|
+
/**
|
|
19
|
+
* These messages are for setting up CI as part of create-nx-workspace and nx init
|
|
20
|
+
*/
|
|
9
21
|
setupCI: [
|
|
10
22
|
{
|
|
11
|
-
code: '
|
|
12
|
-
message: `
|
|
13
|
-
initial:
|
|
23
|
+
code: 'which-ci-provider',
|
|
24
|
+
message: `Which CI provider would you like to use?`,
|
|
25
|
+
initial: 0,
|
|
14
26
|
choices: [
|
|
15
|
-
{ value: '
|
|
16
|
-
{ value: '
|
|
17
|
-
{ value: '
|
|
18
|
-
{ value: '
|
|
27
|
+
{ value: 'github', name: 'GitHub Actions' },
|
|
28
|
+
{ value: 'circleci', name: 'Circle CI' },
|
|
29
|
+
{ value: 'gitlab', name: 'Gitlab' },
|
|
30
|
+
{ value: 'azure', name: 'Azure DevOps' },
|
|
31
|
+
{ value: 'bitbucket-pipelines', name: 'BitBucket Pipelines' },
|
|
32
|
+
{ value: 'skip', name: '\nDo it later' },
|
|
19
33
|
],
|
|
20
|
-
footer: '\
|
|
21
|
-
|
|
22
|
-
fallback: undefined,
|
|
34
|
+
footer: '\nRemote caching, task distribution and test splitting are provided by Nx Cloud. Read more at https://nx.dev/ci',
|
|
35
|
+
fallback: { value: 'skip', key: 'setupNxCloud' },
|
|
23
36
|
},
|
|
24
37
|
{
|
|
25
|
-
code: '
|
|
26
|
-
message: `
|
|
38
|
+
code: 'which-ci-provider2',
|
|
39
|
+
message: `Which CI provider would you like to use?`,
|
|
27
40
|
initial: 0,
|
|
28
41
|
choices: [
|
|
29
|
-
{ value: 'github', name: '
|
|
30
|
-
{ value: 'circleci', name: '
|
|
31
|
-
{ value: '
|
|
42
|
+
{ value: 'github', name: 'GitHub Actions' },
|
|
43
|
+
{ value: 'circleci', name: 'Circle CI' },
|
|
44
|
+
{ value: 'gitlab', name: 'Gitlab' },
|
|
45
|
+
{ value: 'azure', name: 'Azure DevOps' },
|
|
46
|
+
{ value: 'bitbucket-pipelines', name: 'BitBucket Pipelines' },
|
|
47
|
+
{
|
|
48
|
+
value: 'skip',
|
|
49
|
+
name: '\nNo - I would not like to set up CI with remote caching, task distribution and test splitting',
|
|
50
|
+
},
|
|
32
51
|
],
|
|
33
|
-
footer: '\
|
|
34
|
-
hint: `\n(it's free and can be disabled any time)`,
|
|
35
|
-
fallback: { value: 'skip', key: 'setupNxCloud' },
|
|
52
|
+
footer: '\nRemote caching, task distribution and test splitting are provided by Nx Cloud. Read more at https://nx.dev/ci',
|
|
36
53
|
},
|
|
37
54
|
],
|
|
55
|
+
/**
|
|
56
|
+
* These messages are a fallback for setting up CI as well as when migrating major versions
|
|
57
|
+
*/
|
|
38
58
|
setupNxCloud: [
|
|
39
59
|
{
|
|
40
60
|
code: 'enable-caching',
|
|
@@ -45,7 +65,22 @@ const messageOptions = {
|
|
|
45
65
|
{ value: 'skip', name: 'Skip for now' },
|
|
46
66
|
],
|
|
47
67
|
footer: '\nRead more about remote caching at https://nx.dev/ci/features/remote-cache',
|
|
48
|
-
hint: `\n(
|
|
68
|
+
hint: `\n(can be disabled any time)`,
|
|
69
|
+
fallback: undefined,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
code: 'enable-caching2',
|
|
73
|
+
message: `Would you like remote caching to make your build faster?`,
|
|
74
|
+
initial: 0,
|
|
75
|
+
choices: [
|
|
76
|
+
{ value: 'yes', name: 'Yes' },
|
|
77
|
+
{
|
|
78
|
+
value: 'skip',
|
|
79
|
+
name: 'No - I would not like remote caching',
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
footer: '\nRead more about remote caching at https://nx.dev/ci/features/remote-cache',
|
|
83
|
+
hint: `\n(can be disabled any time)`,
|
|
49
84
|
fallback: undefined,
|
|
50
85
|
},
|
|
51
86
|
],
|
|
@@ -105,7 +140,6 @@ async function recordStat(opts) {
|
|
|
105
140
|
}
|
|
106
141
|
}
|
|
107
142
|
}
|
|
108
|
-
exports.recordStat = recordStat;
|
|
109
143
|
function shouldRecordStats() {
|
|
110
144
|
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
|
111
145
|
if (!pmc.getRegistryUrl) {
|
package/src/utils/nx/nx-cloud.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setupNxCloud = setupNxCloud;
|
|
4
|
+
exports.printNxCloudSuccessMessage = printNxCloudSuccessMessage;
|
|
4
5
|
const ora = require("ora");
|
|
5
6
|
const child_process_utils_1 = require("../child-process-utils");
|
|
6
7
|
const output_1 = require("../output");
|
|
@@ -36,7 +37,6 @@ async function setupNxCloud(directory, packageManager, nxCloud, useGitHub) {
|
|
|
36
37
|
nxCloudSpinner.stop();
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
|
-
exports.setupNxCloud = setupNxCloud;
|
|
40
40
|
function printNxCloudSuccessMessage(nxCloudOut) {
|
|
41
41
|
// remove leading Nx carret and any new lines
|
|
42
42
|
const logContent = nxCloudOut.split('NX ')[1];
|
|
@@ -53,4 +53,3 @@ function printNxCloudSuccessMessage(nxCloudOut) {
|
|
|
53
53
|
bodyLines,
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
exports.printNxCloudSuccessMessage = printNxCloudSuccessMessage;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.showNxWarning =
|
|
3
|
+
exports.showNxWarning = showNxWarning;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const output_1 = require("../output");
|
|
@@ -26,4 +26,3 @@ function showNxWarning(workspaceName) {
|
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
exports.showNxWarning = showNxWarning;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.packageManagerList = void 0;
|
|
4
|
+
exports.detectPackageManager = detectPackageManager;
|
|
5
|
+
exports.getPackageManagerCommand = getPackageManagerCommand;
|
|
6
|
+
exports.generatePackageManagerFiles = generatePackageManagerFiles;
|
|
7
|
+
exports.getPackageManagerVersion = getPackageManagerVersion;
|
|
8
|
+
exports.detectInvokedPackageManager = detectInvokedPackageManager;
|
|
4
9
|
const child_process_1 = require("child_process");
|
|
5
10
|
const fs_1 = require("fs");
|
|
6
11
|
const path_1 = require("path");
|
|
@@ -18,7 +23,6 @@ function detectPackageManager(dir = '') {
|
|
|
18
23
|
? 'pnpm'
|
|
19
24
|
: 'npm';
|
|
20
25
|
}
|
|
21
|
-
exports.detectPackageManager = detectPackageManager;
|
|
22
26
|
/**
|
|
23
27
|
* Returns commands for the package manager used in the workspace.
|
|
24
28
|
* By default, the package manager is derived based on the lock file,
|
|
@@ -77,7 +81,6 @@ function getPackageManagerCommand(packageManager = detectPackageManager()) {
|
|
|
77
81
|
};
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
|
-
exports.getPackageManagerCommand = getPackageManagerCommand;
|
|
81
84
|
function generatePackageManagerFiles(root, packageManager = detectPackageManager()) {
|
|
82
85
|
const [pmMajor] = getPackageManagerVersion(packageManager).split('.');
|
|
83
86
|
switch (packageManager) {
|
|
@@ -90,7 +93,6 @@ function generatePackageManagerFiles(root, packageManager = detectPackageManager
|
|
|
90
93
|
break;
|
|
91
94
|
}
|
|
92
95
|
}
|
|
93
|
-
exports.generatePackageManagerFiles = generatePackageManagerFiles;
|
|
94
96
|
const pmVersionCache = new Map();
|
|
95
97
|
function getPackageManagerVersion(packageManager, cwd = process.cwd()) {
|
|
96
98
|
if (pmVersionCache.has(packageManager)) {
|
|
@@ -103,7 +105,6 @@ function getPackageManagerVersion(packageManager, cwd = process.cwd()) {
|
|
|
103
105
|
pmVersionCache.set(packageManager, version);
|
|
104
106
|
return version;
|
|
105
107
|
}
|
|
106
|
-
exports.getPackageManagerVersion = getPackageManagerVersion;
|
|
107
108
|
/**
|
|
108
109
|
* Detects which package manager was used to invoke create-nx-{plugin|workspace} command
|
|
109
110
|
* based on the main Module process that invokes the command
|
|
@@ -129,4 +130,3 @@ function detectInvokedPackageManager() {
|
|
|
129
130
|
}
|
|
130
131
|
return detectedPackageManager;
|
|
131
132
|
}
|
|
132
|
-
exports.detectInvokedPackageManager = detectInvokedPackageManager;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getPackageNameFromThirdPartyPreset =
|
|
3
|
+
exports.getPackageNameFromThirdPartyPreset = getPackageNameFromThirdPartyPreset;
|
|
4
4
|
const validate_npm_package_1 = require("../validate-npm-package");
|
|
5
5
|
const preset_1 = require("./preset");
|
|
6
6
|
/**
|
|
@@ -26,4 +26,3 @@ function getPackageNameFromThirdPartyPreset(preset) {
|
|
|
26
26
|
}
|
|
27
27
|
return packageName;
|
|
28
28
|
}
|
|
29
|
-
exports.getPackageNameFromThirdPartyPreset = getPackageNameFromThirdPartyPreset;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.pointToTutorialAndCourse =
|
|
3
|
+
exports.pointToTutorialAndCourse = pointToTutorialAndCourse;
|
|
4
4
|
const output_1 = require("../output");
|
|
5
5
|
const preset_1 = require("./preset");
|
|
6
6
|
function pointToTutorialAndCourse(preset) {
|
|
@@ -71,4 +71,3 @@ function pointToTutorialAndCourse(preset) {
|
|
|
71
71
|
break;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
|
-
exports.pointToTutorialAndCourse = pointToTutorialAndCourse;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Preset = void 0;
|
|
4
|
+
exports.isKnownPreset = isKnownPreset;
|
|
4
5
|
var Preset;
|
|
5
6
|
(function (Preset) {
|
|
6
7
|
Preset["Apps"] = "apps";
|
|
@@ -38,4 +39,3 @@ var Preset;
|
|
|
38
39
|
function isKnownPreset(preset) {
|
|
39
40
|
return Object.values(Preset).includes(preset);
|
|
40
41
|
}
|
|
41
|
-
exports.isKnownPreset = isKnownPreset;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.stringifyCollection =
|
|
3
|
+
exports.stringifyCollection = stringifyCollection;
|
|
4
4
|
function stringifyCollection(items) {
|
|
5
5
|
return items.map((item) => `"${item}"`).join(', ');
|
|
6
6
|
}
|
|
7
|
-
exports.stringifyCollection = stringifyCollection;
|
package/src/utils/unparse.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.unparse =
|
|
3
|
+
exports.unparse = unparse;
|
|
4
4
|
const flat_1 = require("flat");
|
|
5
5
|
function unparse(options) {
|
|
6
6
|
const unparsed = [];
|
|
@@ -10,7 +10,6 @@ function unparse(options) {
|
|
|
10
10
|
}
|
|
11
11
|
return unparsed;
|
|
12
12
|
}
|
|
13
|
-
exports.unparse = unparse;
|
|
14
13
|
function unparseOption(key, value, unparsed) {
|
|
15
14
|
if (value === true) {
|
|
16
15
|
unparsed.push(`--${key}`);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* https://github.com/npm/validate-npm-package-name/blob/main/lib/index.js
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.validateNpmPackage =
|
|
7
|
+
exports.validateNpmPackage = validateNpmPackage;
|
|
8
8
|
const scopedPackagePattern = new RegExp('^(?:@([^/]+?)[/])?([^/]+?)$');
|
|
9
9
|
const denyList = ['node_modules', 'favicon.ico'];
|
|
10
10
|
function validateNpmPackage(name) {
|
|
@@ -67,7 +67,6 @@ function validateNpmPackage(name) {
|
|
|
67
67
|
}
|
|
68
68
|
return formatResult(warnings, errors);
|
|
69
69
|
}
|
|
70
|
-
exports.validateNpmPackage = validateNpmPackage;
|
|
71
70
|
function formatResult(warnings, errors) {
|
|
72
71
|
return {
|
|
73
72
|
validForNewPackages: errors.length === 0 && warnings.length === 0,
|