@nx/next 0.0.0-pr-29993-0fbf3d3 → 0.0.0-pr-29720-06f67e5
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 +7 -7
- package/src/generators/application/application.js +7 -8
- package/src/generators/application/lib/add-e2e.js +27 -28
- package/src/generators/application/lib/add-project.js +19 -21
- package/src/generators/application/lib/create-application-files.js +1 -1
- package/src/generators/application/lib/normalize-options.d.ts +1 -4
- package/src/generators/application/lib/normalize-options.js +5 -10
- package/src/generators/application/schema.d.ts +0 -1
- package/src/generators/application/schema.json +0 -4
- package/src/generators/library/lib/normalize-options.js +2 -4
- package/src/generators/library/library.js +1 -2
- package/src/generators/library/schema.d.ts +0 -1
- package/src/generators/library/schema.json +0 -4
- package/tailwind.d.ts +2 -3
- package/tailwind.js +20 -29
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-29720-06f67e5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Next.js plugin for Nx contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n\n- Integration with building, serving, and exporting a Next.js application.\n\n- Integration with React libraries within the workspace. \n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Playwright, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
|
|
6
6
|
"repository": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"next": ">=14.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@nx/devkit": "0.0.0-pr-
|
|
38
|
+
"@nx/devkit": "0.0.0-pr-29720-06f67e5",
|
|
39
39
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
40
40
|
"@svgr/webpack": "^8.1.0",
|
|
41
41
|
"copy-webpack-plugin": "^10.2.4",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"semver": "^7.5.3",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
46
|
"webpack-merge": "^5.8.0",
|
|
47
|
-
"@nx/js": "0.0.0-pr-
|
|
48
|
-
"@nx/eslint": "0.0.0-pr-
|
|
49
|
-
"@nx/react": "0.0.0-pr-
|
|
50
|
-
"@nx/web": "0.0.0-pr-
|
|
51
|
-
"@nx/webpack": "0.0.0-pr-
|
|
47
|
+
"@nx/js": "0.0.0-pr-29720-06f67e5",
|
|
48
|
+
"@nx/eslint": "0.0.0-pr-29720-06f67e5",
|
|
49
|
+
"@nx/react": "0.0.0-pr-29720-06f67e5",
|
|
50
|
+
"@nx/web": "0.0.0-pr-29720-06f67e5",
|
|
51
|
+
"@nx/webpack": "0.0.0-pr-29720-06f67e5",
|
|
52
52
|
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
@@ -28,7 +28,6 @@ const add_swc_to_custom_server_1 = require("../../utils/add-swc-to-custom-server
|
|
|
28
28
|
async function applicationGenerator(host, schema) {
|
|
29
29
|
return await applicationGeneratorInternal(host, {
|
|
30
30
|
addPlugin: false,
|
|
31
|
-
useProjectJson: true,
|
|
32
31
|
...schema,
|
|
33
32
|
});
|
|
34
33
|
}
|
|
@@ -40,8 +39,8 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
40
39
|
js: options.js,
|
|
41
40
|
skipPackageJson: options.skipPackageJson,
|
|
42
41
|
skipFormat: true,
|
|
43
|
-
addTsPlugin:
|
|
44
|
-
formatter:
|
|
42
|
+
addTsPlugin: schema.useTsSolution,
|
|
43
|
+
formatter: schema.formatter,
|
|
45
44
|
platform: 'web',
|
|
46
45
|
});
|
|
47
46
|
tasks.push(jsInitTask);
|
|
@@ -52,11 +51,6 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
52
51
|
tasks.push(nextTask);
|
|
53
52
|
(0, create_application_files_1.createApplicationFiles)(host, options);
|
|
54
53
|
(0, add_project_1.addProject)(host, options);
|
|
55
|
-
// If we are using the new TS solution
|
|
56
|
-
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
57
|
-
if (options.isTsSolutionSetup) {
|
|
58
|
-
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
59
|
-
}
|
|
60
54
|
const e2eTask = await (0, add_e2e_1.addE2e)(host, options);
|
|
61
55
|
tasks.push(e2eTask);
|
|
62
56
|
const jestTask = await (0, add_jest_1.addJest)(host, options);
|
|
@@ -106,6 +100,11 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
106
100
|
}, options.linter === 'eslint'
|
|
107
101
|
? ['.next', 'eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
108
102
|
: ['.next'], options.src ? 'src' : '.');
|
|
103
|
+
// If we are using the new TS solution
|
|
104
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
105
|
+
if (options.useTsSolution) {
|
|
106
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
107
|
+
}
|
|
109
108
|
(0, sort_fields_1.sortPackageJsonFields)(host, options.appProjectRoot);
|
|
110
109
|
if (!options.skipFormat) {
|
|
111
110
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addE2e = addE2e;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
6
|
-
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
7
|
-
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
8
5
|
const eslint_1 = require("@nx/eslint");
|
|
9
|
-
const web_1 = require("@nx/web");
|
|
10
6
|
const versions_1 = require("../../../utils/versions");
|
|
7
|
+
const web_1 = require("@nx/web");
|
|
8
|
+
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
9
|
+
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
10
|
+
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
11
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
11
12
|
async function addE2e(host, options) {
|
|
12
13
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
13
14
|
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
@@ -24,15 +25,17 @@ async function addE2e(host, options) {
|
|
|
24
25
|
spa: true,
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
|
|
29
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
|
|
30
|
+
name: options.e2eProjectName,
|
|
31
|
+
version: '0.0.1',
|
|
32
|
+
private: true,
|
|
33
|
+
nx: {
|
|
34
|
+
projectType: 'application',
|
|
35
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
36
|
+
implicitDependencies: [options.projectName],
|
|
37
|
+
},
|
|
38
|
+
});
|
|
36
39
|
}
|
|
37
40
|
else {
|
|
38
41
|
(0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
|
|
@@ -44,9 +47,6 @@ async function addE2e(host, options) {
|
|
|
44
47
|
implicitDependencies: [options.projectName],
|
|
45
48
|
});
|
|
46
49
|
}
|
|
47
|
-
if (!options.useProjectJson || options.isTsSolutionSetup) {
|
|
48
|
-
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
|
|
49
|
-
}
|
|
50
50
|
const e2eTask = await configurationGenerator(host, {
|
|
51
51
|
...options,
|
|
52
52
|
linter: eslint_1.Linter.EsLint,
|
|
@@ -81,15 +81,17 @@ async function addE2e(host, options) {
|
|
|
81
81
|
}
|
|
82
82
|
else if (options.e2eTestRunner === 'playwright') {
|
|
83
83
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
|
|
85
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
|
|
86
|
+
name: options.e2eProjectName,
|
|
87
|
+
version: '0.0.1',
|
|
88
|
+
private: true,
|
|
89
|
+
nx: {
|
|
90
|
+
projectType: 'application',
|
|
91
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
92
|
+
implicitDependencies: [options.projectName],
|
|
93
|
+
},
|
|
94
|
+
});
|
|
93
95
|
}
|
|
94
96
|
else {
|
|
95
97
|
(0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
|
|
@@ -101,9 +103,6 @@ async function addE2e(host, options) {
|
|
|
101
103
|
implicitDependencies: [options.projectName],
|
|
102
104
|
});
|
|
103
105
|
}
|
|
104
|
-
if (!options.useProjectJson || options.isTsSolutionSetup) {
|
|
105
|
-
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
|
|
106
|
-
}
|
|
107
106
|
const e2eTask = await configurationGenerator(host, {
|
|
108
107
|
rootProject: options.rootProject,
|
|
109
108
|
project: options.e2eProjectName,
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addProject = addProject;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
6
8
|
const versions_1 = require("../../../utils/versions");
|
|
7
9
|
const react_1 = require("@nx/react");
|
|
8
10
|
function addProject(host, options) {
|
|
@@ -55,31 +57,27 @@ function addProject(host, options) {
|
|
|
55
57
|
targets,
|
|
56
58
|
tags: options.parsedTags,
|
|
57
59
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
60
|
+
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
|
|
61
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), {
|
|
62
|
+
name: (0, get_import_path_1.getImportPath)(host, options.name),
|
|
63
|
+
version: '0.0.1',
|
|
64
|
+
private: true,
|
|
65
|
+
dependencies: {
|
|
66
|
+
next: versions_1.nextVersion,
|
|
67
|
+
react: react_1.reactVersion,
|
|
68
|
+
'react-dom': react_1.reactDomVersion,
|
|
69
|
+
},
|
|
70
|
+
nx: {
|
|
71
|
+
name: options.name,
|
|
72
|
+
projectType: 'application',
|
|
73
|
+
sourceRoot: options.appProjectRoot,
|
|
74
|
+
tags: options.parsedTags?.length ? options.parsedTags : undefined,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
76
77
|
}
|
|
77
78
|
else {
|
|
78
79
|
(0, devkit_1.addProjectConfiguration)(host, options.projectName, {
|
|
79
80
|
...project,
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
|
-
if (!options.useProjectJson || options.isTsSolutionSetup) {
|
|
83
|
-
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
|
|
84
|
-
}
|
|
85
83
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from '../schema';
|
|
3
|
-
export interface NormalizedSchema extends
|
|
3
|
+
export interface NormalizedSchema extends Schema {
|
|
4
4
|
projectName: string;
|
|
5
|
-
projectSimpleName: string;
|
|
6
5
|
appProjectRoot: string;
|
|
7
|
-
importPath: string;
|
|
8
6
|
outputPath: string;
|
|
9
7
|
e2eProjectName: string;
|
|
10
8
|
e2eProjectRoot: string;
|
|
11
9
|
parsedTags: string[];
|
|
12
10
|
fileName: string;
|
|
13
11
|
styledModule: null | string;
|
|
14
|
-
isTsSolutionSetup: boolean;
|
|
15
12
|
js?: boolean;
|
|
16
13
|
}
|
|
17
14
|
export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
|
|
@@ -5,10 +5,9 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const eslint_1 = require("@nx/eslint");
|
|
7
7
|
const assertion_1 = require("@nx/react/src/utils/assertion");
|
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
9
8
|
async function normalizeOptions(host, options) {
|
|
10
|
-
await (0, project_name_and_root_utils_1.
|
|
11
|
-
const { projectName
|
|
9
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'application');
|
|
10
|
+
const { projectName: appProjectName, projectRoot: appProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
12
11
|
name: options.name,
|
|
13
12
|
projectType: 'application',
|
|
14
13
|
directory: options.directory,
|
|
@@ -19,11 +18,10 @@ async function normalizeOptions(host, options) {
|
|
|
19
18
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
20
19
|
nxJson.useInferencePlugins !== false;
|
|
21
20
|
options.addPlugin ??= addPlugin;
|
|
22
|
-
const isTsSolutionSetup = options.useTsSolution || (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
23
|
-
const appProjectName = !isTsSolutionSetup || options.name ? projectName : importPath;
|
|
24
21
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
25
22
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
26
|
-
const
|
|
23
|
+
const name = (0, devkit_1.names)(options.name).fileName;
|
|
24
|
+
const outputPath = (0, devkit_1.joinPathFragments)('dist', appProjectRoot, ...(options.rootProject ? [name] : []));
|
|
27
25
|
const parsedTags = options.tags
|
|
28
26
|
? options.tags.split(',').map((s) => s.trim())
|
|
29
27
|
: [];
|
|
@@ -44,15 +42,12 @@ async function normalizeOptions(host, options) {
|
|
|
44
42
|
e2eTestRunner: options.e2eTestRunner || 'playwright',
|
|
45
43
|
fileName,
|
|
46
44
|
linter: options.linter || eslint_1.Linter.EsLint,
|
|
45
|
+
name,
|
|
47
46
|
outputPath,
|
|
48
47
|
parsedTags,
|
|
49
48
|
projectName: appProjectName,
|
|
50
|
-
projectSimpleName: projectNames.projectSimpleName,
|
|
51
49
|
style: options.style || 'css',
|
|
52
50
|
styledModule,
|
|
53
51
|
unitTestRunner: options.unitTestRunner || 'jest',
|
|
54
|
-
importPath,
|
|
55
|
-
isTsSolutionSetup,
|
|
56
|
-
useProjectJson: options.useProjectJson ?? !isTsSolutionSetup,
|
|
57
52
|
};
|
|
58
53
|
}
|
|
@@ -144,10 +144,6 @@
|
|
|
144
144
|
"default": false,
|
|
145
145
|
"hidden": true,
|
|
146
146
|
"x-priority": "internal"
|
|
147
|
-
},
|
|
148
|
-
"useProjectJson": {
|
|
149
|
-
"type": "boolean",
|
|
150
|
-
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
151
147
|
}
|
|
152
148
|
},
|
|
153
149
|
"required": ["directory"],
|
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
7
|
async function normalizeOptions(host, options) {
|
|
8
|
-
await (0, project_name_and_root_utils_1.
|
|
8
|
+
await (0, project_name_and_root_utils_1.ensureProjectName)(host, options, 'library');
|
|
9
9
|
const { projectRoot, importPath } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
10
10
|
name: options.name,
|
|
11
11
|
projectType: 'library',
|
|
@@ -16,12 +16,10 @@ async function normalizeOptions(host, options) {
|
|
|
16
16
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
17
17
|
nxJson.useInferencePlugins !== false;
|
|
18
18
|
options.addPlugin ??= addPlugin;
|
|
19
|
-
const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
20
19
|
return {
|
|
21
20
|
...options,
|
|
22
21
|
importPath,
|
|
23
22
|
projectRoot,
|
|
24
|
-
isUsingTsSolutionConfig,
|
|
25
|
-
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
23
|
+
isUsingTsSolutionConfig: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
|
|
26
24
|
};
|
|
27
25
|
}
|
|
@@ -14,7 +14,6 @@ const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
|
14
14
|
async function libraryGenerator(host, rawOptions) {
|
|
15
15
|
return await libraryGeneratorInternal(host, {
|
|
16
16
|
addPlugin: false,
|
|
17
|
-
useProjectJson: true,
|
|
18
17
|
...rawOptions,
|
|
19
18
|
});
|
|
20
19
|
}
|
|
@@ -97,7 +96,7 @@ async function libraryGeneratorInternal(host, rawOptions) {
|
|
|
97
96
|
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
98
97
|
: undefined);
|
|
99
98
|
if (options.isUsingTsSolutionConfig) {
|
|
100
|
-
|
|
99
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.projectRoot);
|
|
101
100
|
}
|
|
102
101
|
(0, sort_fields_1.sortPackageJsonFields)(host, options.projectRoot);
|
|
103
102
|
if (!options.skipFormat) {
|
|
@@ -158,10 +158,6 @@
|
|
|
158
158
|
"default": false,
|
|
159
159
|
"description": "Do not add dependencies to `package.json`.",
|
|
160
160
|
"x-priority": "internal"
|
|
161
|
-
},
|
|
162
|
-
"useProjectJson": {
|
|
163
|
-
"type": "boolean",
|
|
164
|
-
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
165
161
|
}
|
|
166
162
|
},
|
|
167
163
|
"required": ["directory"],
|
package/tailwind.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates a set of glob patterns based off the source root of the app and its dependencies
|
|
3
3
|
* @param dirPath workspace relative directory path that will be used to infer the parent project and dependencies
|
|
4
|
-
* @param
|
|
5
|
-
* @param fileGlobPatternToExclude pass a custom glob pattern for files to be excluded
|
|
4
|
+
* @param fileGlobPattern pass a custom glob pattern to be used
|
|
6
5
|
*/
|
|
7
|
-
export declare function createGlobPatternsForDependencies(dirPath: string, fileGlobPatternToInclude?: string, fileGlobPatternToExclude?: string):
|
|
6
|
+
export declare function createGlobPatternsForDependencies(dirPath: string, fileGlobPatternToInclude?: string, fileGlobPatternToExclude?: string): string[];
|
package/tailwind.js
CHANGED
|
@@ -6,36 +6,27 @@ const path_1 = require("path");
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates a set of glob patterns based off the source root of the app and its dependencies
|
|
8
8
|
* @param dirPath workspace relative directory path that will be used to infer the parent project and dependencies
|
|
9
|
-
* @param
|
|
10
|
-
* @param fileGlobPatternToExclude pass a custom glob pattern for files to be excluded
|
|
9
|
+
* @param fileGlobPattern pass a custom glob pattern to be used
|
|
11
10
|
*/
|
|
12
11
|
function createGlobPatternsForDependencies(dirPath, fileGlobPatternToInclude = '/**/*.{tsx,ts,jsx,js,html}', fileGlobPatternToExclude = '/**/*.{stories,spec}.{tsx,ts,jsx,js,html}') {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
`${e.message}\n`);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
const { createGlobPatternsForDependencies: reactGlobPatternFunction, } = require('@nx/react/tailwind');
|
|
37
|
-
return reactGlobPatternFunction(dirPath, fileGlobPatternToInclude);
|
|
38
|
-
}
|
|
12
|
+
try {
|
|
13
|
+
return [
|
|
14
|
+
...(0, generate_globs_1.createGlobPatternsForDependencies)(dirPath, fileGlobPatternToInclude).map((glob) => (0, path_1.relative)(dirPath, glob)),
|
|
15
|
+
...(0, generate_globs_1.createGlobPatternsForDependencies)(dirPath, fileGlobPatternToExclude).map((glob) => `!${(0, path_1.relative)(dirPath, glob)}`),
|
|
16
|
+
];
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
/**
|
|
20
|
+
* It should not be possible to reach this point when the utility is invoked as part of the normal
|
|
21
|
+
* lifecycle of Nx executors. However, other tooling, such as the VSCode Tailwind IntelliSense plugin
|
|
22
|
+
* or JetBrains editors such as WebStorm, may execute the tailwind.config.js file in order to provide
|
|
23
|
+
* autocomplete features, for example.
|
|
24
|
+
*
|
|
25
|
+
* In order to best support that use-case, we therefore do not hard error when the ProjectGraph is
|
|
26
|
+
* fundamently unavailable in this tailwind-specific context.
|
|
27
|
+
*/
|
|
28
|
+
console.warn('\nWARNING: There was an error creating glob patterns, returning an empty array\n' +
|
|
29
|
+
`${e.message}\n`);
|
|
30
|
+
return [];
|
|
39
31
|
}
|
|
40
|
-
return [];
|
|
41
32
|
}
|