diff --git a/.eslintrc.json b/.eslintrc.json index 13d266de370e40..2aa0de27f3fd94 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -47,6 +47,7 @@ "error", { "enforceBuildableLibDependency": true, + "checkDynamicDependenciesExceptions": [".*"], "allow": [], "depConstraints": [ { diff --git a/community/approved-plugins.json b/community/approved-plugins.json index bc3bb45fd1aa5c..548d8c90a1ec3f 100644 --- a/community/approved-plugins.json +++ b/community/approved-plugins.json @@ -39,6 +39,11 @@ "description": "An nx plugin for the aws-cdk v2.", "url": "https://github.com/adrian-goe/nx-aws-cdk-v2" }, + { + "name": "@berenddeboer/nx-sst", + "description": "Nx plugin to generate an SST stack and execute all SST commands.", + "url": "https://github.com/berenddeboer/nx-plugins/tree/main/packages/nx-sst" + }, { "name": "@rxap/plugin-localazy", "description": "An Nx plugin for localazy.com upload and download tasks.", diff --git a/docs/generated/cli/show.md b/docs/generated/cli/show.md index 7e293151ed8f5a..0c22a989345c80 100644 --- a/docs/generated/cli/show.md +++ b/docs/generated/cli/show.md @@ -159,7 +159,7 @@ Show only projects that have a specific target ### project -Show a list of targets in the workspace. +Shows resolved project configuration for a given project. ```shell nx show project @@ -177,7 +177,7 @@ Show help Type: `string` -Show targets for the given project +Which project should be viewed? ##### version diff --git a/docs/generated/packages/eslint-plugin/documents/dependency-checks.md b/docs/generated/packages/eslint-plugin/documents/dependency-checks.md index c905320bf852e0..10733d0326170a 100644 --- a/docs/generated/packages/eslint-plugin/documents/dependency-checks.md +++ b/docs/generated/packages/eslint-plugin/documents/dependency-checks.md @@ -8,9 +8,13 @@ We use the version numbers of the installed packages when checking whether the v ## Usage -You can use the `dependency-checks` rule by adding it to your ESLint rules configuration: +Library generators from `@nx` packages will configure this rule automatically when you opt-in for bundler/build setup. This rule is intended for publishable/buildable libraries, so it will only run if a `build` target is detected in the configuration (this name can be modified - see [options](#options)). -```jsonc {% fileName=".eslintrc.json" %} +### Manual setup + +To set it up manually for existing libraries, you need to add the `dependency-checks` rule to your project's ESLint configuration: + +```jsonc {% fileName="/.eslintrc.json" %} { // ... more ESLint config here "overrides": [ @@ -26,9 +30,9 @@ You can use the `dependency-checks` rule by adding it to your ESLint rules confi } ``` -Linting `JSON` files is not enabled by default, so you will also need to add `package.json` to the `lintFilePatterns`: +Additionally, you need to adjust your `lintFilePatterns` to include the project's `package.json` file:: -```jsonc {% fileName="project.json" %} +```jsonc {% fileName="/project.json" %} { // ... project.json config "targets": { @@ -47,6 +51,8 @@ Linting `JSON` files is not enabled by default, so you will also need to add `pa } ``` +### Overriding defaults + Sometimes we intentionally want to add or remove a dependency from our `package.json` despite what the rule suggests. We can use the rule's options to override default behavior: ```jsonc {% fileName=".eslintrc.json" %} @@ -54,7 +60,11 @@ Sometimes we intentionally want to add or remove a dependency from our `package. "@nx/dependency-checks": [ "error", { - // for available options check below + "buildTargets": ["build", "custom-build"], // add non standard build target names + "ignoredDependencies": ["lodash"], // these libs will be omitted from checks + "checkMissingDependencies": true, // toggle to disable + "checkObsoleteDependencies": true, // toggle to disable + "checkVersionMismatches": true // toggle to disable } ] } diff --git a/docs/generated/packages/nx/documents/show.md b/docs/generated/packages/nx/documents/show.md index 7e293151ed8f5a..0c22a989345c80 100644 --- a/docs/generated/packages/nx/documents/show.md +++ b/docs/generated/packages/nx/documents/show.md @@ -159,7 +159,7 @@ Show only projects that have a specific target ### project -Show a list of targets in the workspace. +Shows resolved project configuration for a given project. ```shell nx show project @@ -177,7 +177,7 @@ Show help Type: `string` -Show targets for the given project +Which project should be viewed? ##### version diff --git a/docs/shared/core-features/automate-updating-dependencies.md b/docs/shared/core-features/automate-updating-dependencies.md index 9b3c078f3bccf0..263949903bb33e 100644 --- a/docs/shared/core-features/automate-updating-dependencies.md +++ b/docs/shared/core-features/automate-updating-dependencies.md @@ -10,6 +10,11 @@ The `nx migrate` command helps by automating the process of updating: ## How does it work? +{% youtube +src="https://www.youtube.com/embed/3CIv-_hTTY4" +title="How Automated Code Migrations Work" +width="100%" /%} + Nx knows where its configuration files are and can therefore make sure they match the expected format. This automated update process, commonly referred to as "migration," becomes even more powerful when you leverage [Nx plugins](/packages). Nx plugins, which are NPM packages with a range of capabilities (code generation, task automation...), offer targeted updates based on their specific areas of responsibility. For example, the [Nx ESLint plugin](/packages/linter) excels at configuring linting in your workspace. With its understanding of the configuration file locations, this plugin can provide precise migration scripts to update ESLint packages in your `package.json` and corresponding configuration files in your workspace when a new version is released. diff --git a/docs/shared/packages/linter/dependency-checks.md b/docs/shared/packages/linter/dependency-checks.md index c905320bf852e0..10733d0326170a 100644 --- a/docs/shared/packages/linter/dependency-checks.md +++ b/docs/shared/packages/linter/dependency-checks.md @@ -8,9 +8,13 @@ We use the version numbers of the installed packages when checking whether the v ## Usage -You can use the `dependency-checks` rule by adding it to your ESLint rules configuration: +Library generators from `@nx` packages will configure this rule automatically when you opt-in for bundler/build setup. This rule is intended for publishable/buildable libraries, so it will only run if a `build` target is detected in the configuration (this name can be modified - see [options](#options)). -```jsonc {% fileName=".eslintrc.json" %} +### Manual setup + +To set it up manually for existing libraries, you need to add the `dependency-checks` rule to your project's ESLint configuration: + +```jsonc {% fileName="/.eslintrc.json" %} { // ... more ESLint config here "overrides": [ @@ -26,9 +30,9 @@ You can use the `dependency-checks` rule by adding it to your ESLint rules confi } ``` -Linting `JSON` files is not enabled by default, so you will also need to add `package.json` to the `lintFilePatterns`: +Additionally, you need to adjust your `lintFilePatterns` to include the project's `package.json` file:: -```jsonc {% fileName="project.json" %} +```jsonc {% fileName="/project.json" %} { // ... project.json config "targets": { @@ -47,6 +51,8 @@ Linting `JSON` files is not enabled by default, so you will also need to add `pa } ``` +### Overriding defaults + Sometimes we intentionally want to add or remove a dependency from our `package.json` despite what the rule suggests. We can use the rule's options to override default behavior: ```jsonc {% fileName=".eslintrc.json" %} @@ -54,7 +60,11 @@ Sometimes we intentionally want to add or remove a dependency from our `package. "@nx/dependency-checks": [ "error", { - // for available options check below + "buildTargets": ["build", "custom-build"], // add non standard build target names + "ignoredDependencies": ["lodash"], // these libs will be omitted from checks + "checkMissingDependencies": true, // toggle to disable + "checkObsoleteDependencies": true, // toggle to disable + "checkVersionMismatches": true // toggle to disable } ] } diff --git a/docs/shared/reference/project-configuration.md b/docs/shared/reference/project-configuration.md index b812fd1f39ae7c..8a2062338fd5b2 100644 --- a/docs/shared/reference/project-configuration.md +++ b/docs/shared/reference/project-configuration.md @@ -313,13 +313,13 @@ Sometimes, multiple targets might write to the same directory. When possible it } ``` -But if the above is not possible, globs (parsed with the [minimatch](https://github.com/isaacs/minimatch) library) can be specified as outputs to only cache a set of files rather than the whole directory. +But if the above is not possible, globs (parsed by the [GlobSet](https://docs.rs/globset/0.4.5/globset/#syntax) Rust library) can be specified as outputs to only cache a set of files rather than the whole directory. ```json { "targets": { "build-js": { - "outputs": ["{workspaceRoot}/dist/libs/mylib/**/*.js"] + "outputs": ["{workspaceRoot}/dist/libs/mylib/**/*.{js,map}"] }, "build-css": { "outputs": ["{workspaceRoot}/dist/libs/mylib/**/*.css"] diff --git a/e2e/expo/src/expo.test.ts b/e2e/expo/src/expo.test.ts index 029d5f8a9ff8fa..9b2abff7c93cba 100644 --- a/e2e/expo/src/expo.test.ts +++ b/e2e/expo/src/expo.test.ts @@ -14,6 +14,7 @@ import { runCommandUntil, uniq, updateFile, + updateJson, } from '@nx/e2e/utils'; import { join } from 'path'; @@ -24,6 +25,16 @@ describe('expo', () => { beforeAll(() => { proj = newProject(); + // we create empty preset above which skips creation of `production` named input + updateJson('nx.json', (nxJson) => { + nxJson.namedInputs = { + default: ['{projectRoot}/**/*', 'sharedGlobals'], + production: ['default'], + sharedGlobals: [], + }; + nxJson.targetDefaults.build.inputs = ['production', '^production']; + return nxJson; + }); runCLI(`generate @nx/expo:application ${appName} --no-interactive`); runCLI( `generate @nx/expo:library ${libName} --buildable --publishable --importPath=${proj}/${libName}` diff --git a/e2e/linter/src/linter.test.ts b/e2e/linter/src/linter.test.ts index 47e8608119df1f..e2f23bf602a4b8 100644 --- a/e2e/linter/src/linter.test.ts +++ b/e2e/linter/src/linter.test.ts @@ -478,12 +478,12 @@ describe('Linter', () => { content.replace(/return .*;/, `return names(${mylib}).className;`) ); - // output should now report missing dependencies section + // output should now report missing dependency out = runCLI(`lint ${mylib}`, { silenceError: true }); expect(out).toContain('they are missing'); expect(out).toContain('@nx/devkit'); - // should fix the missing section issue + // should fix the missing dependency issue out = runCLI(`lint ${mylib} --fix`, { silenceError: true }); expect(out).toContain( `Successfully ran target lint for project ${mylib}` diff --git a/e2e/nx-misc/src/workspace.test.ts b/e2e/nx-misc/src/workspace.test.ts index e96d28420e66c0..ad815edcac1b36 100644 --- a/e2e/nx-misc/src/workspace.test.ts +++ b/e2e/nx-misc/src/workspace.test.ts @@ -15,7 +15,6 @@ import { getPackageManagerCommand, getSelectedPackageManager, runCommand, - runCreateWorkspace, } from '@nx/e2e/utils'; let proj: string; @@ -176,6 +175,7 @@ describe('Workspace Tests', () => { expect(project.sourceRoot).toBe(`${newPath}/src`); expect(project.targets.lint.options.lintFilePatterns).toEqual([ `libs/shared/${lib1}/data-access/**/*.ts`, + `libs/shared/${lib1}/data-access/package.json`, ]); /** @@ -306,6 +306,7 @@ describe('Workspace Tests', () => { expect(project.targets.lint.options.lintFilePatterns).toEqual([ `libs/shared/${lib1}/data-access/**/*.ts`, + `libs/shared/${lib1}/data-access/package.json`, ]); /** @@ -434,6 +435,7 @@ describe('Workspace Tests', () => { expect(project.sourceRoot).toBe(`${newPath}/src`); expect(project.targets.lint.options.lintFilePatterns).toEqual([ `packages/shared/${lib1}/data-access/**/*.ts`, + `packages/shared/${lib1}/data-access/package.json`, ]); expect(project.tags).toEqual([]); @@ -569,6 +571,7 @@ describe('Workspace Tests', () => { expect(project.sourceRoot).toBe(`${newPath}/src`); expect(project.targets.lint.options.lintFilePatterns).toEqual([ `libs/${lib1}/data-access/**/*.ts`, + `libs/${lib1}/data-access/package.json`, ]); /** @@ -682,6 +685,7 @@ describe('Workspace Tests', () => { expect(project.sourceRoot).toBe(`${newPath}/src`); expect(project.targets.lint.options.lintFilePatterns).toEqual([ `libs/shared/${lib1}/data-access/**/*.ts`, + `libs/shared/${lib1}/data-access/package.json`, ]); /** diff --git a/e2e/nx-run/src/cache.test.ts b/e2e/nx-run/src/cache.test.ts index d571676106d29b..cbebdc873770d9 100644 --- a/e2e/nx-run/src/cache.test.ts +++ b/e2e/nx-run/src/cache.test.ts @@ -157,7 +157,7 @@ describe('cache', () => { updateProjectConfig(mylib, (c) => { c.targets.build = { executor: 'nx:run-commands', - outputs: ['{workspaceRoot}/dist/*.txt'], + outputs: ['{workspaceRoot}/dist/*.{txt,md}'], options: { commands: [ 'rm -rf dist', @@ -167,7 +167,8 @@ describe('cache', () => { 'echo c > dist/c.txt', 'echo d > dist/d.txt', 'echo e > dist/e.txt', - 'echo f > dist/f.txt', + 'echo f > dist/f.md', + 'echo g > dist/g.html', ], parallel: false, }, @@ -188,7 +189,8 @@ describe('cache', () => { expect(outputsWithUntouchedOutputs).toContain('c.txt'); expect(outputsWithUntouchedOutputs).toContain('d.txt'); expect(outputsWithUntouchedOutputs).toContain('e.txt'); - expect(outputsWithUntouchedOutputs).toContain('f.txt'); + expect(outputsWithUntouchedOutputs).toContain('f.md'); + expect(outputsWithUntouchedOutputs).toContain('g.html'); // Create a file in the dist that does not match output glob updateFile('dist/c.ts', ''); @@ -202,7 +204,8 @@ describe('cache', () => { expect(outputsAfterAddingUntouchedFileAndRerunning).toContain('c.txt'); expect(outputsAfterAddingUntouchedFileAndRerunning).toContain('d.txt'); expect(outputsAfterAddingUntouchedFileAndRerunning).toContain('e.txt'); - expect(outputsAfterAddingUntouchedFileAndRerunning).toContain('f.txt'); + expect(outputsAfterAddingUntouchedFileAndRerunning).toContain('f.md'); + expect(outputsAfterAddingUntouchedFileAndRerunning).toContain('g.html'); expect(outputsAfterAddingUntouchedFileAndRerunning).toContain('c.ts'); // Clear Dist @@ -217,8 +220,9 @@ describe('cache', () => { expect(outputsWithoutOutputs).toContain('c.txt'); expect(outputsWithoutOutputs).toContain('d.txt'); expect(outputsWithoutOutputs).toContain('e.txt'); - expect(outputsWithoutOutputs).toContain('f.txt'); + expect(outputsWithoutOutputs).toContain('f.md'); expect(outputsWithoutOutputs).not.toContain('c.ts'); + expect(outputsWithoutOutputs).not.toContain('g.html'); }); it('should use consider filesets when hashing', async () => { diff --git a/e2e/react-native/src/react-native.test.ts b/e2e/react-native/src/react-native.test.ts index a7b4bf482f60d7..7de73a0fee948a 100644 --- a/e2e/react-native/src/react-native.test.ts +++ b/e2e/react-native/src/react-native.test.ts @@ -14,6 +14,7 @@ import { runCommandUntil, uniq, updateFile, + updateJson, } from '@nx/e2e/utils'; import { ChildProcess } from 'child_process'; import { join } from 'path'; @@ -25,6 +26,16 @@ describe('react native', () => { beforeAll(() => { proj = newProject(); + // we create empty preset above which skips creation of `production` named input + updateJson('nx.json', (nxJson) => { + nxJson.namedInputs = { + default: ['{projectRoot}/**/*', 'sharedGlobals'], + production: ['default'], + sharedGlobals: [], + }; + nxJson.targetDefaults.build.inputs = ['production', '^production']; + return nxJson; + }); runCLI( `generate @nx/react-native:application ${appName} --install=false --no-interactive` ); diff --git a/graph/client/tailwind.config.js b/graph/client/tailwind.config.js index a130bfceccd483..18a8d985ec32a7 100644 --- a/graph/client/tailwind.config.js +++ b/graph/client/tailwind.config.js @@ -36,5 +36,10 @@ module.exports = { translate: ['group-hover'], }, }, - plugins: [require('@tailwindcss/typography')], + plugins: [ + require('@tailwindcss/typography'), + require('@tailwindcss/forms')({ + strategy: 'class', + }), + ], }; diff --git a/graph/ui-components/src/lib/dropdown.tsx b/graph/ui-components/src/lib/dropdown.tsx index 19d0e6fef065d6..f7a1d8323dabec 100644 --- a/graph/ui-components/src/lib/dropdown.tsx +++ b/graph/ui-components/src/lib/dropdown.tsx @@ -9,7 +9,7 @@ export function Dropdown(props: DropdownProps) { const { className, children, ...rest } = props; return (