@nx/remix 20.3.1 → 20.4.0-beta.0

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  (The MIT License)
2
2
 
3
- Copyright (c) 2017-2024 Narwhal Technologies Inc.
3
+ Copyright (c) 2017-2025 Narwhal Technologies Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining
6
6
  a copy of this software and associated documentation files (the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "20.3.1",
3
+ "version": "20.4.0-beta.0",
4
4
  "description": "The Remix plugin for Nx contains executors and generators for managing Remix applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Jest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, routes, loaders, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,9 +29,9 @@
29
29
  "migrations": "./migrations.json"
30
30
  },
31
31
  "dependencies": {
32
- "@nx/devkit": "20.3.1",
33
- "@nx/js": "20.3.1",
34
- "@nx/react": "20.3.1",
32
+ "@nx/devkit": "20.4.0-beta.0",
33
+ "@nx/js": "20.4.0-beta.0",
34
+ "@nx/react": "20.4.0-beta.0",
35
35
  "tslib": "^2.3.1",
36
36
  "@phenomnomnominal/tsquery": "~5.0.1"
37
37
  },
@@ -188,9 +188,6 @@ export default {...nxPreset};
188
188
  }
189
189
  tasks.push(await (0, lib_1.addE2E)(tree, options));
190
190
  (0, lib_1.addViteTempFilesToGitIgnore)(tree);
191
- if (!options.skipFormat) {
192
- await (0, devkit_1.formatFiles)(tree);
193
- }
194
191
  (0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.projectRoot, 'tsconfig.app.json', {
195
192
  jsx: 'react-jsx',
196
193
  module: 'esnext',
@@ -203,6 +200,9 @@ export default {...nxPreset};
203
200
  if (options.useTsSolution) {
204
201
  (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
205
202
  }
203
+ if (!options.skipFormat) {
204
+ await (0, devkit_1.formatFiles)(tree);
205
+ }
206
206
  tasks.push(() => {
207
207
  (0, log_show_project_command_1.logShowProjectCommand)(options.projectName);
208
208
  });
@@ -36,8 +36,18 @@ async function remixInitGeneratorInternal(tree, options) {
36
36
  ],
37
37
  serveStaticTargetName: [
38
38
  'serve-static',
39
- 'vite:serve-static',
40
- 'vite-serve-static',
39
+ 'remix:serve-static',
40
+ 'remix-serve-static',
41
+ ],
42
+ buildDepsTargetName: [
43
+ 'build-deps',
44
+ 'remix:build-deps',
45
+ 'remix-build-deps',
46
+ ],
47
+ watchDepsTargetName: [
48
+ 'watch-deps',
49
+ 'remix:watch-deps',
50
+ 'remix-watch-deps',
41
51
  ],
42
52
  }, options.updatePackageScripts);
43
53
  }
@@ -33,6 +33,112 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should create
33
33
  "{workspaceRoot}/my-app/public/build",
34
34
  ],
35
35
  },
36
+ "build-deps": {
37
+ "dependsOn": [
38
+ "^build",
39
+ ],
40
+ },
41
+ "dev": {
42
+ "command": "remix dev --manual",
43
+ "options": {
44
+ "cwd": "my-app",
45
+ },
46
+ },
47
+ "serve-static": {
48
+ "command": "remix-serve build/index.js",
49
+ "dependsOn": [
50
+ "build",
51
+ ],
52
+ "options": {
53
+ "cwd": "my-app",
54
+ },
55
+ },
56
+ "start": {
57
+ "command": "remix-serve build/index.js",
58
+ "dependsOn": [
59
+ "build",
60
+ ],
61
+ "options": {
62
+ "cwd": "my-app",
63
+ },
64
+ },
65
+ "static-serve": {
66
+ "command": "remix-serve build/index.js",
67
+ "dependsOn": [
68
+ "build",
69
+ ],
70
+ "options": {
71
+ "cwd": "my-app",
72
+ },
73
+ },
74
+ "tsc": {
75
+ "cache": true,
76
+ "command": "tsc",
77
+ "inputs": [
78
+ "production",
79
+ "^production",
80
+ {
81
+ "externalDependencies": [
82
+ "typescript",
83
+ ],
84
+ },
85
+ ],
86
+ "options": {
87
+ "cwd": "my-app",
88
+ },
89
+ },
90
+ "watch-deps": {
91
+ "command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
92
+ "dependsOn": [
93
+ "build-deps",
94
+ ],
95
+ },
96
+ },
97
+ },
98
+ },
99
+ },
100
+ ],
101
+ ]
102
+ `;
103
+
104
+ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should infer watch-deps target 1`] = `
105
+ [
106
+ [
107
+ "my-app/remix.config.cjs",
108
+ {
109
+ "projects": {
110
+ "my-app": {
111
+ "metadata": {},
112
+ "root": "my-app",
113
+ "targets": {
114
+ "build": {
115
+ "cache": true,
116
+ "command": "remix build",
117
+ "dependsOn": [
118
+ "^build",
119
+ ],
120
+ "inputs": [
121
+ "production",
122
+ "^production",
123
+ {
124
+ "externalDependencies": [
125
+ "@remix-run/dev",
126
+ ],
127
+ },
128
+ ],
129
+ "options": {
130
+ "cwd": "my-app",
131
+ },
132
+ "outputs": [
133
+ "{workspaceRoot}/my-app/build",
134
+ "{workspaceRoot}/my-app/public/build",
135
+ ],
136
+ },
137
+ "build-deps": {
138
+ "dependsOn": [
139
+ "^build",
140
+ ],
141
+ },
36
142
  "dev": {
37
143
  "command": "remix dev --manual",
38
144
  "options": {
@@ -82,6 +188,12 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should create
82
188
  "cwd": "my-app",
83
189
  },
84
190
  },
191
+ "watch-deps": {
192
+ "command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
193
+ "dependsOn": [
194
+ "build-deps",
195
+ ],
196
+ },
85
197
  },
86
198
  },
87
199
  },
@@ -212,6 +324,11 @@ exports[`@nx/remix/plugin Remix Vite Compiler non-root project should create nod
212
324
  "{workspaceRoot}/my-app/build",
213
325
  ],
214
326
  },
327
+ "build-deps": {
328
+ "dependsOn": [
329
+ "^build",
330
+ ],
331
+ },
215
332
  "dev": {
216
333
  "command": "remix vite:dev",
217
334
  "options": {
@@ -261,6 +378,12 @@ exports[`@nx/remix/plugin Remix Vite Compiler non-root project should create nod
261
378
  "cwd": "my-app",
262
379
  },
263
380
  },
381
+ "watch-deps": {
382
+ "command": "npx nx watch --projects my-app --includeDependentProjects -- npx nx build-deps my-app",
383
+ "dependsOn": [
384
+ "build-deps",
385
+ ],
386
+ },
264
387
  },
265
388
  },
266
389
  },
@@ -4,6 +4,8 @@ export interface RemixPluginOptions {
4
4
  devTargetName?: string;
5
5
  startTargetName?: string;
6
6
  typecheckTargetName?: string;
7
+ buildDepsTargetName?: string;
8
+ watchDepsTargetName?: string;
7
9
  /**
8
10
  * @deprecated Use serveStaticTargetName instead. This option will be removed in Nx 21.
9
11
  */
@@ -11,6 +11,8 @@ const js_1 = require("@nx/js");
11
11
  const path_1 = require("path");
12
12
  const fs_1 = require("fs");
13
13
  const executor_utils_1 = require("../utils/executor-utils");
14
+ const util_1 = require("@nx/js/src/plugins/typescript/util");
15
+ const pmc = (0, devkit_1.getPackageManagerCommand)();
14
16
  function readTargetsCache(cachePath) {
15
17
  return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
16
18
  }
@@ -87,6 +89,7 @@ async function buildRemixTargets(configFilePath, projectRoot, options, context,
87
89
  targets[options.staticServeTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler);
88
90
  targets[options.serveStaticTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler);
89
91
  targets[options.typecheckTargetName] = typecheckTarget(projectRoot, namedInputs, siblingFiles);
92
+ (0, util_1.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
90
93
  return { targets, metadata: {} };
91
94
  }
92
95
  function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler) {