@nx/remix 19.8.0 → 20.0.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/package.json +5 -5
- package/src/generators/action/action.impl.js +1 -4
- package/src/generators/action/schema.d.ts +0 -4
- package/src/generators/action/schema.json +0 -6
- package/src/generators/application/__snapshots__/application.impl.spec.ts.snap +0 -516
- package/src/generators/application/lib/normalize-options.js +0 -1
- package/src/generators/error-boundary/__snapshots__/error-boundary.impl.spec.ts.snap +1 -31
- package/src/generators/error-boundary/lib/normalize-options.js +1 -4
- package/src/generators/error-boundary/schema.d.ts +0 -4
- package/src/generators/error-boundary/schema.json +0 -6
- package/src/generators/library/__snapshots__/library.impl.spec.ts.snap +0 -78
- package/src/generators/library/lib/normalize-options.js +0 -1
- package/src/generators/loader/loader.impl.js +1 -4
- package/src/generators/loader/schema.d.ts +0 -4
- package/src/generators/loader/schema.json +0 -6
- package/src/generators/meta/lib/v2.impl.js +1 -4
- package/src/generators/meta/schema.d.ts +0 -4
- package/src/generators/meta/schema.json +0 -6
- package/src/generators/resource-route/__snapshots__/resource-route.impl.spec.ts.snap +0 -16
- package/src/generators/resource-route/resource-route.impl.js +2 -7
- package/src/generators/resource-route/schema.d.ts +0 -4
- package/src/generators/resource-route/schema.json +0 -6
- package/src/generators/route/__snapshots__/route.impl.spec.ts.snap +0 -47
- package/src/generators/route/route.impl.js +2 -10
- package/src/generators/route/schema.d.ts +0 -4
- package/src/generators/route/schema.json +0 -6
- package/src/generators/style/schema.d.ts +0 -4
- package/src/generators/style/schema.json +0 -6
- package/src/generators/style/style.impl.js +2 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.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,12 +29,12 @@
|
|
|
29
29
|
"migrations": "./migrations.json"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@nx/devkit": "
|
|
33
|
-
"@nx/js": "
|
|
34
|
-
"@nx/react": "
|
|
32
|
+
"@nx/devkit": "20.0.0-beta.0",
|
|
33
|
+
"@nx/js": "20.0.0-beta.0",
|
|
34
|
+
"@nx/react": "20.0.0-beta.0",
|
|
35
35
|
"tslib": "^2.3.1",
|
|
36
36
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
37
|
-
"@nrwl/remix": "
|
|
37
|
+
"@nrwl/remix": "20.0.0-beta.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {},
|
|
40
40
|
"publishConfig": {
|
|
@@ -5,11 +5,8 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const insert_import_1 = require("../../utils/insert-import");
|
|
6
6
|
const insert_statement_after_imports_1 = require("../../utils/insert-statement-after-imports");
|
|
7
7
|
const insert_statement_in_default_function_1 = require("../../utils/insert-statement-in-default-function");
|
|
8
|
-
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
9
8
|
async function default_1(tree, schema) {
|
|
10
|
-
const routeFilePath = schema.
|
|
11
|
-
? schema.path
|
|
12
|
-
: await (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
|
|
9
|
+
const routeFilePath = schema.path;
|
|
13
10
|
if (!tree.exists(routeFilePath)) {
|
|
14
11
|
throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
|
|
15
12
|
}
|
|
@@ -3,8 +3,4 @@ import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-
|
|
|
3
3
|
export interface LoaderSchema {
|
|
4
4
|
path: string;
|
|
5
5
|
nameAndDirectoryFormat?: NameAndDirectoryFormat;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v20.
|
|
8
|
-
*/
|
|
9
|
-
project?: string;
|
|
10
6
|
}
|
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
"description": "Whether to generate the action in the directory as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
|
|
18
18
|
"type": "string",
|
|
19
19
|
"enum": ["as-provided", "derived"]
|
|
20
|
-
},
|
|
21
|
-
"project": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"description": "The name of the project.",
|
|
24
|
-
"pattern": "^[a-zA-Z].*$",
|
|
25
|
-
"x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v20."
|
|
26
20
|
}
|
|
27
21
|
},
|
|
28
22
|
"required": ["path"]
|
|
@@ -516,522 +516,6 @@ export default function Index() {
|
|
|
516
516
|
"
|
|
517
517
|
`;
|
|
518
518
|
|
|
519
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --directory should create the application correctly 1`] = `
|
|
520
|
-
"import { createWatchPaths } from '@nx/remix';
|
|
521
|
-
import { dirname } from 'path';
|
|
522
|
-
import { fileURLToPath } from 'url';
|
|
523
|
-
|
|
524
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
525
|
-
|
|
526
|
-
/**
|
|
527
|
-
* @type {import('@remix-run/dev').AppConfig}
|
|
528
|
-
*/
|
|
529
|
-
export default {
|
|
530
|
-
ignoredRouteFiles: ['**/.*'],
|
|
531
|
-
// appDirectory: "app",
|
|
532
|
-
// assetsBuildDirectory: "public/build",
|
|
533
|
-
// serverBuildPath: "build/index.js",
|
|
534
|
-
// publicPath: "/build/",
|
|
535
|
-
watchPaths: () => createWatchPaths(__dirname),
|
|
536
|
-
};
|
|
537
|
-
"
|
|
538
|
-
`;
|
|
539
|
-
|
|
540
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --directory should create the application correctly 2`] = `
|
|
541
|
-
"import type { MetaFunction } from '@remix-run/node';
|
|
542
|
-
import {
|
|
543
|
-
Links,
|
|
544
|
-
LiveReload,
|
|
545
|
-
Meta,
|
|
546
|
-
Outlet,
|
|
547
|
-
Scripts,
|
|
548
|
-
ScrollRestoration,
|
|
549
|
-
} from '@remix-run/react';
|
|
550
|
-
|
|
551
|
-
export const meta: MetaFunction = () => [
|
|
552
|
-
{
|
|
553
|
-
title: 'New Remix App',
|
|
554
|
-
},
|
|
555
|
-
];
|
|
556
|
-
|
|
557
|
-
export default function App() {
|
|
558
|
-
return (
|
|
559
|
-
<html lang="en">
|
|
560
|
-
<head>
|
|
561
|
-
<meta charSet="utf-8" />
|
|
562
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
563
|
-
<Meta />
|
|
564
|
-
<Links />
|
|
565
|
-
</head>
|
|
566
|
-
<body>
|
|
567
|
-
<Outlet />
|
|
568
|
-
<ScrollRestoration />
|
|
569
|
-
<Scripts />
|
|
570
|
-
<LiveReload />
|
|
571
|
-
</body>
|
|
572
|
-
</html>
|
|
573
|
-
);
|
|
574
|
-
}
|
|
575
|
-
"
|
|
576
|
-
`;
|
|
577
|
-
|
|
578
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --directory should create the application correctly 3`] = `
|
|
579
|
-
"import NxWelcome from '../nx-welcome';
|
|
580
|
-
|
|
581
|
-
export default function Index() {
|
|
582
|
-
return (
|
|
583
|
-
<div>
|
|
584
|
-
<NxWelcome title={'demo-test'} />
|
|
585
|
-
</div>
|
|
586
|
-
);
|
|
587
|
-
}
|
|
588
|
-
"
|
|
589
|
-
`;
|
|
590
|
-
|
|
591
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --directory should extract the layout directory from the directory options if it exists 1`] = `
|
|
592
|
-
"import { createWatchPaths } from '@nx/remix';
|
|
593
|
-
import { dirname } from 'path';
|
|
594
|
-
import { fileURLToPath } from 'url';
|
|
595
|
-
|
|
596
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
597
|
-
|
|
598
|
-
/**
|
|
599
|
-
* @type {import('@remix-run/dev').AppConfig}
|
|
600
|
-
*/
|
|
601
|
-
export default {
|
|
602
|
-
ignoredRouteFiles: ['**/.*'],
|
|
603
|
-
// appDirectory: "app",
|
|
604
|
-
// assetsBuildDirectory: "public/build",
|
|
605
|
-
// serverBuildPath: "build/index.js",
|
|
606
|
-
// publicPath: "/build/",
|
|
607
|
-
watchPaths: () => createWatchPaths(__dirname),
|
|
608
|
-
};
|
|
609
|
-
"
|
|
610
|
-
`;
|
|
611
|
-
|
|
612
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --directory should extract the layout directory from the directory options if it exists 2`] = `
|
|
613
|
-
"import type { MetaFunction } from '@remix-run/node';
|
|
614
|
-
import {
|
|
615
|
-
Links,
|
|
616
|
-
LiveReload,
|
|
617
|
-
Meta,
|
|
618
|
-
Outlet,
|
|
619
|
-
Scripts,
|
|
620
|
-
ScrollRestoration,
|
|
621
|
-
} from '@remix-run/react';
|
|
622
|
-
|
|
623
|
-
export const meta: MetaFunction = () => [
|
|
624
|
-
{
|
|
625
|
-
title: 'New Remix App',
|
|
626
|
-
},
|
|
627
|
-
];
|
|
628
|
-
|
|
629
|
-
export default function App() {
|
|
630
|
-
return (
|
|
631
|
-
<html lang="en">
|
|
632
|
-
<head>
|
|
633
|
-
<meta charSet="utf-8" />
|
|
634
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
635
|
-
<Meta />
|
|
636
|
-
<Links />
|
|
637
|
-
</head>
|
|
638
|
-
<body>
|
|
639
|
-
<Outlet />
|
|
640
|
-
<ScrollRestoration />
|
|
641
|
-
<Scripts />
|
|
642
|
-
<LiveReload />
|
|
643
|
-
</body>
|
|
644
|
-
</html>
|
|
645
|
-
);
|
|
646
|
-
}
|
|
647
|
-
"
|
|
648
|
-
`;
|
|
649
|
-
|
|
650
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --directory should extract the layout directory from the directory options if it exists 3`] = `
|
|
651
|
-
"import NxWelcome from '../nx-welcome';
|
|
652
|
-
|
|
653
|
-
export default function Index() {
|
|
654
|
-
return (
|
|
655
|
-
<div>
|
|
656
|
-
<NxWelcome title={'demo-test'} />
|
|
657
|
-
</div>
|
|
658
|
-
);
|
|
659
|
-
}
|
|
660
|
-
"
|
|
661
|
-
`;
|
|
662
|
-
|
|
663
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --e2eTestRunner should generate a cypress e2e application for the app 1`] = `
|
|
664
|
-
"import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
|
|
665
|
-
|
|
666
|
-
import { defineConfig } from 'cypress';
|
|
667
|
-
|
|
668
|
-
export default defineConfig({
|
|
669
|
-
e2e: {
|
|
670
|
-
...nxE2EPreset(__filename, {
|
|
671
|
-
cypressDir: 'src',
|
|
672
|
-
webServerCommands: {
|
|
673
|
-
default: 'npx nx run test:dev',
|
|
674
|
-
production: 'npx nx run test:serve-static',
|
|
675
|
-
},
|
|
676
|
-
ciWebServerCommand: 'npx nx run test:serve-static',
|
|
677
|
-
ciBaseUrl: 'http://localhost:3000',
|
|
678
|
-
}),
|
|
679
|
-
baseUrl: 'http://localhost:3000',
|
|
680
|
-
},
|
|
681
|
-
});
|
|
682
|
-
"
|
|
683
|
-
`;
|
|
684
|
-
|
|
685
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --e2eTestRunner should generate a playwright e2e application for the app 1`] = `
|
|
686
|
-
"import { defineConfig, devices } from '@playwright/test';
|
|
687
|
-
import { nxE2EPreset } from '@nx/playwright/preset';
|
|
688
|
-
|
|
689
|
-
import { workspaceRoot } from '@nx/devkit';
|
|
690
|
-
|
|
691
|
-
// For CI, you may want to set BASE_URL to the deployed application.
|
|
692
|
-
const baseURL = process.env['BASE_URL'] || 'http://localhost:3000';
|
|
693
|
-
|
|
694
|
-
/**
|
|
695
|
-
* Read environment variables from file.
|
|
696
|
-
* https://github.com/motdotla/dotenv
|
|
697
|
-
*/
|
|
698
|
-
// require('dotenv').config();
|
|
699
|
-
|
|
700
|
-
/**
|
|
701
|
-
* See https://playwright.dev/docs/test-configuration.
|
|
702
|
-
*/
|
|
703
|
-
export default defineConfig({
|
|
704
|
-
...nxE2EPreset(__filename, { testDir: './src' }),
|
|
705
|
-
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
|
|
706
|
-
use: {
|
|
707
|
-
baseURL,
|
|
708
|
-
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
|
|
709
|
-
trace: 'on-first-retry',
|
|
710
|
-
},
|
|
711
|
-
/* Run your local dev server before starting the tests */
|
|
712
|
-
webServer: {
|
|
713
|
-
command: 'npx nx run test:serve-static',
|
|
714
|
-
url: 'http://localhost:3000',
|
|
715
|
-
reuseExistingServer: !process.env.CI,
|
|
716
|
-
cwd: workspaceRoot,
|
|
717
|
-
},
|
|
718
|
-
projects: [
|
|
719
|
-
{
|
|
720
|
-
name: 'chromium',
|
|
721
|
-
use: { ...devices['Desktop Chrome'] },
|
|
722
|
-
},
|
|
723
|
-
|
|
724
|
-
{
|
|
725
|
-
name: 'firefox',
|
|
726
|
-
use: { ...devices['Desktop Firefox'] },
|
|
727
|
-
},
|
|
728
|
-
|
|
729
|
-
{
|
|
730
|
-
name: 'webkit',
|
|
731
|
-
use: { ...devices['Desktop Safari'] },
|
|
732
|
-
},
|
|
733
|
-
|
|
734
|
-
// Uncomment for mobile browsers support
|
|
735
|
-
/* {
|
|
736
|
-
name: 'Mobile Chrome',
|
|
737
|
-
use: { ...devices['Pixel 5'] },
|
|
738
|
-
},
|
|
739
|
-
{
|
|
740
|
-
name: 'Mobile Safari',
|
|
741
|
-
use: { ...devices['iPhone 12'] },
|
|
742
|
-
}, */
|
|
743
|
-
|
|
744
|
-
// Uncomment for branded browsers
|
|
745
|
-
/* {
|
|
746
|
-
name: 'Microsoft Edge',
|
|
747
|
-
use: { ...devices['Desktop Edge'], channel: 'msedge' },
|
|
748
|
-
},
|
|
749
|
-
{
|
|
750
|
-
name: 'Google Chrome',
|
|
751
|
-
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
|
|
752
|
-
} */
|
|
753
|
-
],
|
|
754
|
-
});
|
|
755
|
-
"
|
|
756
|
-
`;
|
|
757
|
-
|
|
758
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --js should create the application correctly 1`] = `
|
|
759
|
-
"import { createWatchPaths } from '@nx/remix';
|
|
760
|
-
import { dirname } from 'path';
|
|
761
|
-
import { fileURLToPath } from 'url';
|
|
762
|
-
|
|
763
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
764
|
-
|
|
765
|
-
/**
|
|
766
|
-
* @type {import('@remix-run/dev').AppConfig}
|
|
767
|
-
*/
|
|
768
|
-
export default {
|
|
769
|
-
ignoredRouteFiles: ['**/.*'],
|
|
770
|
-
// appDirectory: "app",
|
|
771
|
-
// assetsBuildDirectory: "public/build",
|
|
772
|
-
// serverBuildPath: "build/index.js",
|
|
773
|
-
// publicPath: "/build/",
|
|
774
|
-
watchPaths: () => createWatchPaths(__dirname),
|
|
775
|
-
};
|
|
776
|
-
"
|
|
777
|
-
`;
|
|
778
|
-
|
|
779
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --js should create the application correctly 2`] = `
|
|
780
|
-
"import {
|
|
781
|
-
Links,
|
|
782
|
-
LiveReload,
|
|
783
|
-
Meta,
|
|
784
|
-
Outlet,
|
|
785
|
-
Scripts,
|
|
786
|
-
ScrollRestoration,
|
|
787
|
-
} from '@remix-run/react';
|
|
788
|
-
export const meta = () => [
|
|
789
|
-
{
|
|
790
|
-
title: 'New Remix App',
|
|
791
|
-
},
|
|
792
|
-
];
|
|
793
|
-
export default function App() {
|
|
794
|
-
return (
|
|
795
|
-
<html lang="en">
|
|
796
|
-
<head>
|
|
797
|
-
<meta charSet="utf-8" />
|
|
798
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
799
|
-
<Meta />
|
|
800
|
-
<Links />
|
|
801
|
-
</head>
|
|
802
|
-
<body>
|
|
803
|
-
<Outlet />
|
|
804
|
-
<ScrollRestoration />
|
|
805
|
-
<Scripts />
|
|
806
|
-
<LiveReload />
|
|
807
|
-
</body>
|
|
808
|
-
</html>
|
|
809
|
-
);
|
|
810
|
-
}
|
|
811
|
-
"
|
|
812
|
-
`;
|
|
813
|
-
|
|
814
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --js should create the application correctly 3`] = `
|
|
815
|
-
"import NxWelcome from '../nx-welcome';
|
|
816
|
-
export default function Index() {
|
|
817
|
-
return (
|
|
818
|
-
<div>
|
|
819
|
-
<NxWelcome title={'test'} />
|
|
820
|
-
</div>
|
|
821
|
-
);
|
|
822
|
-
}
|
|
823
|
-
"
|
|
824
|
-
`;
|
|
825
|
-
|
|
826
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using jest 1`] = `
|
|
827
|
-
"import { createWatchPaths } from '@nx/remix';
|
|
828
|
-
import { dirname } from 'path';
|
|
829
|
-
import { fileURLToPath } from 'url';
|
|
830
|
-
|
|
831
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
832
|
-
|
|
833
|
-
/**
|
|
834
|
-
* @type {import('@remix-run/dev').AppConfig}
|
|
835
|
-
*/
|
|
836
|
-
export default {
|
|
837
|
-
ignoredRouteFiles: ['**/.*'],
|
|
838
|
-
// appDirectory: "app",
|
|
839
|
-
// assetsBuildDirectory: "public/build",
|
|
840
|
-
// serverBuildPath: "build/index.js",
|
|
841
|
-
// publicPath: "/build/",
|
|
842
|
-
watchPaths: () => createWatchPaths(__dirname),
|
|
843
|
-
};
|
|
844
|
-
"
|
|
845
|
-
`;
|
|
846
|
-
|
|
847
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using jest 2`] = `
|
|
848
|
-
"export default {
|
|
849
|
-
displayName: 'test',
|
|
850
|
-
preset: '../../jest.preset.js',
|
|
851
|
-
transform: {
|
|
852
|
-
'^.+\\\\.[tj]sx?$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
|
|
853
|
-
},
|
|
854
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
855
|
-
coverageDirectory: '../../coverage/apps/test',
|
|
856
|
-
};
|
|
857
|
-
"
|
|
858
|
-
`;
|
|
859
|
-
|
|
860
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using jest 3`] = `
|
|
861
|
-
"import { installGlobals } from '@remix-run/node';
|
|
862
|
-
import '@testing-library/jest-dom/matchers';
|
|
863
|
-
installGlobals();
|
|
864
|
-
"
|
|
865
|
-
`;
|
|
866
|
-
|
|
867
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using vitest 1`] = `
|
|
868
|
-
"import { createWatchPaths } from '@nx/remix';
|
|
869
|
-
import { dirname } from 'path';
|
|
870
|
-
import { fileURLToPath } from 'url';
|
|
871
|
-
|
|
872
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
873
|
-
|
|
874
|
-
/**
|
|
875
|
-
* @type {import('@remix-run/dev').AppConfig}
|
|
876
|
-
*/
|
|
877
|
-
export default {
|
|
878
|
-
ignoredRouteFiles: ['**/.*'],
|
|
879
|
-
// appDirectory: "app",
|
|
880
|
-
// assetsBuildDirectory: "public/build",
|
|
881
|
-
// serverBuildPath: "build/index.js",
|
|
882
|
-
// publicPath: "/build/",
|
|
883
|
-
watchPaths: () => createWatchPaths(__dirname),
|
|
884
|
-
};
|
|
885
|
-
"
|
|
886
|
-
`;
|
|
887
|
-
|
|
888
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using vitest 2`] = `
|
|
889
|
-
"/// <reference types='vitest' />
|
|
890
|
-
import { defineConfig } from 'vite';
|
|
891
|
-
import react from '@vitejs/plugin-react';
|
|
892
|
-
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
893
|
-
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
894
|
-
|
|
895
|
-
export default defineConfig({
|
|
896
|
-
root: __dirname,
|
|
897
|
-
cacheDir: '../../node_modules/.vite/apps/test',
|
|
898
|
-
|
|
899
|
-
plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
900
|
-
|
|
901
|
-
// Uncomment this if you are using workers.
|
|
902
|
-
// worker: {
|
|
903
|
-
// plugins: [ nxViteTsPaths() ],
|
|
904
|
-
// },
|
|
905
|
-
|
|
906
|
-
test: {
|
|
907
|
-
setupFiles: ['test-setup.ts'],
|
|
908
|
-
watch: false,
|
|
909
|
-
globals: true,
|
|
910
|
-
environment: 'jsdom',
|
|
911
|
-
include: ['./tests/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
912
|
-
|
|
913
|
-
reporters: ['default'],
|
|
914
|
-
coverage: {
|
|
915
|
-
reportsDirectory: '../../coverage/apps/test',
|
|
916
|
-
provider: 'v8',
|
|
917
|
-
},
|
|
918
|
-
},
|
|
919
|
-
});
|
|
920
|
-
"
|
|
921
|
-
`;
|
|
922
|
-
|
|
923
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using vitest 3`] = `
|
|
924
|
-
"import { installGlobals } from '@remix-run/node';
|
|
925
|
-
import '@testing-library/jest-dom/matchers';
|
|
926
|
-
installGlobals();
|
|
927
|
-
"
|
|
928
|
-
`;
|
|
929
|
-
|
|
930
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived --unitTestRunner should generate the correct files for testing using vitest 4`] = `
|
|
931
|
-
"{
|
|
932
|
-
"extends": "./tsconfig.json",
|
|
933
|
-
"compilerOptions": {
|
|
934
|
-
"outDir": "../../dist/out-tsc",
|
|
935
|
-
"types": [
|
|
936
|
-
"vitest/globals",
|
|
937
|
-
"vitest/importMeta",
|
|
938
|
-
"vite/client",
|
|
939
|
-
"node",
|
|
940
|
-
"vitest"
|
|
941
|
-
]
|
|
942
|
-
},
|
|
943
|
-
"include": [
|
|
944
|
-
"vite.config.ts",
|
|
945
|
-
"vitest.config.ts",
|
|
946
|
-
"app/**/*.ts",
|
|
947
|
-
"app/**/*.tsx",
|
|
948
|
-
"app/**/*.js",
|
|
949
|
-
"app/**/*.jsx",
|
|
950
|
-
"tests/**/*.spec.ts",
|
|
951
|
-
"tests/**/*.test.ts",
|
|
952
|
-
"tests/**/*.spec.tsx",
|
|
953
|
-
"tests/**/*.test.tsx",
|
|
954
|
-
"tests/**/*.spec.js",
|
|
955
|
-
"tests/**/*.test.js",
|
|
956
|
-
"tests/**/*.spec.jsx",
|
|
957
|
-
"tests/**/*.test.jsx"
|
|
958
|
-
]
|
|
959
|
-
}
|
|
960
|
-
"
|
|
961
|
-
`;
|
|
962
|
-
|
|
963
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived should create the application correctly 1`] = `
|
|
964
|
-
"import { createWatchPaths } from '@nx/remix';
|
|
965
|
-
import { dirname } from 'path';
|
|
966
|
-
import { fileURLToPath } from 'url';
|
|
967
|
-
|
|
968
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
969
|
-
|
|
970
|
-
/**
|
|
971
|
-
* @type {import('@remix-run/dev').AppConfig}
|
|
972
|
-
*/
|
|
973
|
-
export default {
|
|
974
|
-
ignoredRouteFiles: ['**/.*'],
|
|
975
|
-
// appDirectory: "app",
|
|
976
|
-
// assetsBuildDirectory: "public/build",
|
|
977
|
-
// serverBuildPath: "build/index.js",
|
|
978
|
-
// publicPath: "/build/",
|
|
979
|
-
watchPaths: () => createWatchPaths(__dirname),
|
|
980
|
-
};
|
|
981
|
-
"
|
|
982
|
-
`;
|
|
983
|
-
|
|
984
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived should create the application correctly 2`] = `
|
|
985
|
-
"import type { MetaFunction } from '@remix-run/node';
|
|
986
|
-
import {
|
|
987
|
-
Links,
|
|
988
|
-
LiveReload,
|
|
989
|
-
Meta,
|
|
990
|
-
Outlet,
|
|
991
|
-
Scripts,
|
|
992
|
-
ScrollRestoration,
|
|
993
|
-
} from '@remix-run/react';
|
|
994
|
-
|
|
995
|
-
export const meta: MetaFunction = () => [
|
|
996
|
-
{
|
|
997
|
-
title: 'New Remix App',
|
|
998
|
-
},
|
|
999
|
-
];
|
|
1000
|
-
|
|
1001
|
-
export default function App() {
|
|
1002
|
-
return (
|
|
1003
|
-
<html lang="en">
|
|
1004
|
-
<head>
|
|
1005
|
-
<meta charSet="utf-8" />
|
|
1006
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
1007
|
-
<Meta />
|
|
1008
|
-
<Links />
|
|
1009
|
-
</head>
|
|
1010
|
-
<body>
|
|
1011
|
-
<Outlet />
|
|
1012
|
-
<ScrollRestoration />
|
|
1013
|
-
<Scripts />
|
|
1014
|
-
<LiveReload />
|
|
1015
|
-
</body>
|
|
1016
|
-
</html>
|
|
1017
|
-
);
|
|
1018
|
-
}
|
|
1019
|
-
"
|
|
1020
|
-
`;
|
|
1021
|
-
|
|
1022
|
-
exports[`Remix Application Integrated Repo --projectNameAndRootFormat=derived should create the application correctly 3`] = `
|
|
1023
|
-
"import NxWelcome from '../nx-welcome';
|
|
1024
|
-
|
|
1025
|
-
export default function Index() {
|
|
1026
|
-
return (
|
|
1027
|
-
<div>
|
|
1028
|
-
<NxWelcome title={'test'} />
|
|
1029
|
-
</div>
|
|
1030
|
-
);
|
|
1031
|
-
}
|
|
1032
|
-
"
|
|
1033
|
-
`;
|
|
1034
|
-
|
|
1035
519
|
exports[`Remix Application Standalone Project Repo --e2eTestRunner should generate a cypress e2e application for the app 1`] = `
|
|
1036
520
|
"import { nxE2EPreset } from '@nx/cypress/plugins/cypress-preset';
|
|
1037
521
|
|
|
@@ -11,7 +11,6 @@ async function normalizeOptions(tree, options) {
|
|
|
11
11
|
directory: options.directory,
|
|
12
12
|
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
13
13
|
rootProject: options.rootProject,
|
|
14
|
-
callingGenerator: '@nx/remix:application',
|
|
15
14
|
});
|
|
16
15
|
options.rootProject = projectRoot === '.';
|
|
17
16
|
options.projectNameAndRootFormat = projectNameAndRootFormat;
|
|
@@ -1,36 +1,6 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
|
-
exports[`ErrorBoundary --
|
|
4
|
-
"import { useRouteError, isRouteErrorResponse } from '@remix-run/react';
|
|
5
|
-
export function ErrorBoundary() {
|
|
6
|
-
const error = useRouteError();
|
|
7
|
-
|
|
8
|
-
// when true, this is what used to go to 'CatchBoundary'
|
|
9
|
-
if (isRouteErrorResponse(error)) {
|
|
10
|
-
return (
|
|
11
|
-
<div>
|
|
12
|
-
<h1>Oops</h1>
|
|
13
|
-
<p>Status: {error.status}</p>
|
|
14
|
-
<p>{error.data.message}</p>
|
|
15
|
-
</div>
|
|
16
|
-
);
|
|
17
|
-
} else if (error instanceof Error) {
|
|
18
|
-
return (
|
|
19
|
-
<div>
|
|
20
|
-
<h1>Error</h1>
|
|
21
|
-
<p>{error.message}</p>
|
|
22
|
-
<p>The stack trace is:</p>
|
|
23
|
-
<pre>{error.stack}</pre>
|
|
24
|
-
</div>
|
|
25
|
-
);
|
|
26
|
-
} else {
|
|
27
|
-
return <h1>Unknown Error</h1>;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
"
|
|
31
|
-
`;
|
|
32
|
-
|
|
33
|
-
exports[`ErrorBoundary --nameAndDirectoryFormat=as-provided --apiVersion=2 should correctly add the ErrorBoundary to the route file 2`] = `
|
|
3
|
+
exports[`ErrorBoundary --apiVersion=2 should correctly add the ErrorBoundary to the route file 1`] = `
|
|
34
4
|
"import { useRouteError, isRouteErrorResponse } from '@remix-run/react';
|
|
35
5
|
export function ErrorBoundary() {
|
|
36
6
|
const error = useRouteError();
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
|
-
const remix_route_utils_1 = require("../../../utils/remix-route-utils");
|
|
5
4
|
async function normalizeOptions(tree, schema) {
|
|
6
|
-
const pathToRouteFile = schema.
|
|
7
|
-
? schema.path
|
|
8
|
-
: await (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
|
|
5
|
+
const pathToRouteFile = schema.path;
|
|
9
6
|
if (!tree.exists(pathToRouteFile)) {
|
|
10
7
|
throw new Error(`Route file specified does not exist "${pathToRouteFile}". Please ensure you pass a correct path to the file.`);
|
|
11
8
|
}
|
|
@@ -4,8 +4,4 @@ export interface ErrorBoundarySchema {
|
|
|
4
4
|
path: string;
|
|
5
5
|
skipFormat?: false;
|
|
6
6
|
nameAndDirectoryFormat?: NameAndDirectoryFormat;
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v20.
|
|
9
|
-
*/
|
|
10
|
-
project?: string;
|
|
11
7
|
}
|
|
@@ -20,12 +20,6 @@
|
|
|
20
20
|
"type": "string",
|
|
21
21
|
"enum": ["as-provided", "derived"]
|
|
22
22
|
},
|
|
23
|
-
"project": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"description": "The name of the project.",
|
|
26
|
-
"pattern": "^[a-zA-Z].*$",
|
|
27
|
-
"x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v20."
|
|
28
|
-
},
|
|
29
23
|
"skipFormat": {
|
|
30
24
|
"type": "boolean",
|
|
31
25
|
"description": "Skip formatting files after generation.",
|
|
@@ -77,81 +77,3 @@ exports[`Remix Library Generator -projectNameAndRootFormat=as-provided should ge
|
|
|
77
77
|
],
|
|
78
78
|
}
|
|
79
79
|
`;
|
|
80
|
-
|
|
81
|
-
exports[`Remix Library Generator -projectNameAndRootFormat=derived --unitTestRunner should create the correct config files for testing with jest 1`] = `
|
|
82
|
-
"export default {
|
|
83
|
-
setupFilesAfterEnv: ['./src/test-setup.ts'],
|
|
84
|
-
displayName: 'test',
|
|
85
|
-
preset: '../../jest.preset.js',
|
|
86
|
-
transform: {
|
|
87
|
-
'^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',
|
|
88
|
-
'^.+\\\\.[tj]sx?$': ['babel-jest', { presets: ['@nx/react/babel'] }],
|
|
89
|
-
},
|
|
90
|
-
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
|
|
91
|
-
coverageDirectory: '../../coverage/libs/test',
|
|
92
|
-
};
|
|
93
|
-
"
|
|
94
|
-
`;
|
|
95
|
-
|
|
96
|
-
exports[`Remix Library Generator -projectNameAndRootFormat=derived --unitTestRunner should create the correct config files for testing with jest 2`] = `
|
|
97
|
-
"import { installGlobals } from '@remix-run/node';
|
|
98
|
-
import '@testing-library/jest-dom/matchers';
|
|
99
|
-
installGlobals();
|
|
100
|
-
"
|
|
101
|
-
`;
|
|
102
|
-
|
|
103
|
-
exports[`Remix Library Generator -projectNameAndRootFormat=derived --unitTestRunner should create the correct config files for testing with vitest 1`] = `
|
|
104
|
-
"import { defineConfig } from 'vite';
|
|
105
|
-
import react from '@vitejs/plugin-react';
|
|
106
|
-
import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
|
|
107
|
-
import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin';
|
|
108
|
-
|
|
109
|
-
export default defineConfig({
|
|
110
|
-
root: __dirname,
|
|
111
|
-
cacheDir: '../../node_modules/.vite/libs/test',
|
|
112
|
-
|
|
113
|
-
plugins: [react(), nxViteTsPaths(), nxCopyAssetsPlugin(['*.md'])],
|
|
114
|
-
|
|
115
|
-
// Uncomment this if you are using workers.
|
|
116
|
-
// worker: {
|
|
117
|
-
// plugins: [ nxViteTsPaths() ],
|
|
118
|
-
// },
|
|
119
|
-
|
|
120
|
-
test: {
|
|
121
|
-
setupFiles: ['./src/test-setup.ts'],
|
|
122
|
-
watch: false,
|
|
123
|
-
globals: true,
|
|
124
|
-
environment: 'jsdom',
|
|
125
|
-
include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
|
126
|
-
reporters: ['default'],
|
|
127
|
-
coverage: { reportsDirectory: '../../coverage/libs/test', provider: 'v8' },
|
|
128
|
-
},
|
|
129
|
-
});
|
|
130
|
-
"
|
|
131
|
-
`;
|
|
132
|
-
|
|
133
|
-
exports[`Remix Library Generator -projectNameAndRootFormat=derived --unitTestRunner should create the correct config files for testing with vitest 2`] = `
|
|
134
|
-
"import { installGlobals } from '@remix-run/node';
|
|
135
|
-
import '@testing-library/jest-dom/matchers';
|
|
136
|
-
installGlobals();
|
|
137
|
-
"
|
|
138
|
-
`;
|
|
139
|
-
|
|
140
|
-
exports[`Remix Library Generator -projectNameAndRootFormat=derived should generate a library correctly 1`] = `
|
|
141
|
-
[
|
|
142
|
-
"test.module.css",
|
|
143
|
-
"test.spec.tsx",
|
|
144
|
-
"test.tsx",
|
|
145
|
-
]
|
|
146
|
-
`;
|
|
147
|
-
|
|
148
|
-
exports[`Remix Library Generator -projectNameAndRootFormat=derived should generate a library correctly 2`] = `
|
|
149
|
-
{
|
|
150
|
-
"@proj/libs/test": [
|
|
151
|
-
"libs/test/src/index.ts",
|
|
152
|
-
],
|
|
153
|
-
"@proj/libs/test/server": [
|
|
154
|
-
"libs/test/src/server.ts",
|
|
155
|
-
],
|
|
156
|
-
}
|
|
157
|
-
`;
|
|
@@ -10,7 +10,6 @@ async function normalizeOptions(tree, options) {
|
|
|
10
10
|
projectType: 'library',
|
|
11
11
|
directory: options.directory,
|
|
12
12
|
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
13
|
-
callingGenerator: '@nx/remix:library',
|
|
14
13
|
});
|
|
15
14
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
16
15
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
@@ -5,11 +5,8 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const insert_import_1 = require("../../utils/insert-import");
|
|
6
6
|
const insert_statement_after_imports_1 = require("../../utils/insert-statement-after-imports");
|
|
7
7
|
const insert_statement_in_default_function_1 = require("../../utils/insert-statement-in-default-function");
|
|
8
|
-
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
9
8
|
async function default_1(tree, schema) {
|
|
10
|
-
const routeFilePath = schema.
|
|
11
|
-
? schema.path
|
|
12
|
-
: await (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
|
|
9
|
+
const routeFilePath = schema.path;
|
|
13
10
|
if (!tree.exists(routeFilePath)) {
|
|
14
11
|
throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
|
|
15
12
|
}
|
|
@@ -3,8 +3,4 @@ import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-
|
|
|
3
3
|
export interface LoaderSchema {
|
|
4
4
|
path: string;
|
|
5
5
|
nameAndDirectoryFormat?: NameAndDirectoryFormat;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v20.
|
|
8
|
-
*/
|
|
9
|
-
project?: string;
|
|
10
6
|
}
|
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
"description": "Whether to generate the loader in the path as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
|
|
18
18
|
"type": "string",
|
|
19
19
|
"enum": ["as-provided", "derived"]
|
|
20
|
-
},
|
|
21
|
-
"project": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"description": "The name of the project.",
|
|
24
|
-
"pattern": "^[a-zA-Z].*$",
|
|
25
|
-
"x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v20."
|
|
26
20
|
}
|
|
27
21
|
},
|
|
28
22
|
"required": ["path"]
|
|
@@ -5,11 +5,8 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const get_default_export_name_1 = require("../../../utils/get-default-export-name");
|
|
6
6
|
const insert_import_1 = require("../../../utils/insert-import");
|
|
7
7
|
const insert_statement_after_imports_1 = require("../../../utils/insert-statement-after-imports");
|
|
8
|
-
const remix_route_utils_1 = require("../../../utils/remix-route-utils");
|
|
9
8
|
async function v2MetaGenerator(tree, schema) {
|
|
10
|
-
const routeFilePath = schema.
|
|
11
|
-
? schema.path
|
|
12
|
-
: await (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
|
|
9
|
+
const routeFilePath = schema.path;
|
|
13
10
|
if (!tree.exists(routeFilePath)) {
|
|
14
11
|
throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
|
|
15
12
|
}
|
|
@@ -3,8 +3,4 @@ import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-
|
|
|
3
3
|
export interface MetaSchema {
|
|
4
4
|
path: string;
|
|
5
5
|
nameAndDirectoryFormat?: NameAndDirectoryFormat;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v20.
|
|
8
|
-
*/
|
|
9
|
-
project?: string;
|
|
10
6
|
}
|
|
@@ -17,12 +17,6 @@
|
|
|
17
17
|
"description": "Whether to generate the meta function in the path as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
|
|
18
18
|
"type": "string",
|
|
19
19
|
"enum": ["as-provided", "derived"]
|
|
20
|
-
},
|
|
21
|
-
"project": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"description": "The name of the project.",
|
|
24
|
-
"pattern": "^[a-zA-Z].*$",
|
|
25
|
-
"x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v20."
|
|
26
20
|
}
|
|
27
21
|
},
|
|
28
22
|
"required": ["path"]
|
|
@@ -3,19 +3,3 @@
|
|
|
3
3
|
exports[`resource route --nameAndDirectoryFormat=as-provided should error if it detects a possible missing route param because of un-escaped dollar sign 1`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
4
4
|
|
|
5
5
|
exports[`resource route --nameAndDirectoryFormat=as-provided should error if it detects a possible missing route param because of un-escaped dollar sign 3`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
6
|
-
|
|
7
|
-
exports[`resource route --nameAndDirectoryFormat=as-provided should error if it detects a possible missing route param because of un-escaped dollar sign 4`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
8
|
-
|
|
9
|
-
exports[`resource route --nameAndDirectoryFormat=as-provided should error if it detects a possible missing route param because of un-escaped dollar sign 6`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
10
|
-
|
|
11
|
-
exports[`resource route --nameAndDirectoryFormat=derived should error if it detects a possible missing route param because of un-escaped dollar sign 1`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
12
|
-
|
|
13
|
-
exports[`resource route --nameAndDirectoryFormat=derived should error if it detects a possible missing route param because of un-escaped dollar sign 3`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
14
|
-
|
|
15
|
-
exports[`resource route --nameAndDirectoryFormat=derived should error if it detects a possible missing route param because of un-escaped dollar sign 4`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
16
|
-
|
|
17
|
-
exports[`resource route --nameAndDirectoryFormat=derived should error if it detects a possible missing route param because of un-escaped dollar sign 6`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
18
|
-
|
|
19
|
-
exports[`resource route --nameAndDirectoryFormat=derived should error if it detects a possible missing route param because of un-escaped dollar sign 7`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
20
|
-
|
|
21
|
-
exports[`resource route --nameAndDirectoryFormat=derived should error if it detects a possible missing route param because of un-escaped dollar sign 9`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
@@ -7,19 +7,14 @@ const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
|
7
7
|
const action_impl_1 = require("../action/action.impl");
|
|
8
8
|
const loader_impl_1 = require("../loader/loader.impl");
|
|
9
9
|
async function default_1(tree, options) {
|
|
10
|
-
const { artifactName: name, directory
|
|
11
|
-
artifactType: 'resource-route',
|
|
12
|
-
callingGenerator: '@nx/remix:resource-route',
|
|
10
|
+
const { artifactName: name, directory } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
13
11
|
name: options.path.replace(/^\//, '').replace(/\/$/, ''),
|
|
14
12
|
nameAndDirectoryFormat: options.nameAndDirectoryFormat,
|
|
15
|
-
project: options.project,
|
|
16
13
|
});
|
|
17
14
|
if (!options.skipChecks && (0, remix_route_utils_1.checkRoutePathForErrors)(options.path)) {
|
|
18
15
|
throw new Error(`Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.`);
|
|
19
16
|
}
|
|
20
|
-
const routeFilePath = await (0, remix_route_utils_1.resolveRemixRouteFile)(tree,
|
|
21
|
-
? (0, devkit_1.joinPathFragments)(directory, name)
|
|
22
|
-
: options.path, options.nameAndDirectoryFormat === 'as-provided' ? undefined : projectName, '.ts');
|
|
17
|
+
const routeFilePath = await (0, remix_route_utils_1.resolveRemixRouteFile)(tree, (0, devkit_1.joinPathFragments)(directory, name), undefined);
|
|
23
18
|
if (tree.exists(routeFilePath))
|
|
24
19
|
throw new Error(`Path already exists: ${options.path}`);
|
|
25
20
|
if (!options.loader && !options.action)
|
|
@@ -6,8 +6,4 @@ export interface RemixRouteSchema {
|
|
|
6
6
|
action: boolean;
|
|
7
7
|
loader: boolean;
|
|
8
8
|
skipChecks: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v20.
|
|
11
|
-
*/
|
|
12
|
-
project?: string;
|
|
13
9
|
}
|
|
@@ -25,12 +25,6 @@
|
|
|
25
25
|
"type": "string",
|
|
26
26
|
"enum": ["as-provided", "derived"]
|
|
27
27
|
},
|
|
28
|
-
"project": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"description": "The name of the project.",
|
|
31
|
-
"pattern": "^[a-zA-Z].*$",
|
|
32
|
-
"x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v20."
|
|
33
|
-
},
|
|
34
28
|
"action": {
|
|
35
29
|
"type": "boolean",
|
|
36
30
|
"description": "Generate an action function",
|
|
@@ -46,50 +46,3 @@ exports[`route --nameAndDirectoryFormat=as-provided should error if it detects a
|
|
|
46
46
|
exports[`route --nameAndDirectoryFormat=as-provided should error if it detects a possible missing route param because of un-escaped dollar sign 2`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
47
47
|
|
|
48
48
|
exports[`route --nameAndDirectoryFormat=as-provided should error if it detects a possible missing route param because of un-escaped dollar sign 3`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
49
|
-
|
|
50
|
-
exports[`route --nameAndDirectoryFormat=derived should add route component 1`] = `
|
|
51
|
-
"import { useLoaderData, useActionData } from '@remix-run/react';
|
|
52
|
-
import { json } from '@remix-run/node';
|
|
53
|
-
import type {
|
|
54
|
-
LoaderFunctionArgs,
|
|
55
|
-
MetaFunction,
|
|
56
|
-
ActionFunctionArgs,
|
|
57
|
-
LinksFunction,
|
|
58
|
-
} from '@remix-run/node';
|
|
59
|
-
|
|
60
|
-
import stylesUrl from '../../../styles/path/to/example.css';
|
|
61
|
-
|
|
62
|
-
export const links: LinksFunction = () => {
|
|
63
|
-
return [{ rel: 'stylesheet', href: stylesUrl }];
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export const action = async ({ request }: ActionFunctionArgs) => {
|
|
67
|
-
let formData = await request.formData();
|
|
68
|
-
|
|
69
|
-
return json({ message: formData.toString() }, { status: 200 });
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export const meta: MetaFunction = () => {
|
|
73
|
-
return [{ title: 'PathToExample Route' }];
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export const loader = async ({ request }: LoaderFunctionArgs) => {
|
|
77
|
-
return json({
|
|
78
|
-
message: 'Hello, world!',
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export default function PathToExample() {
|
|
83
|
-
const actionMessage = useActionData<typeof action>();
|
|
84
|
-
const data = useLoaderData<typeof loader>();
|
|
85
|
-
|
|
86
|
-
return <p>Message: {data.message}</p>;
|
|
87
|
-
}
|
|
88
|
-
"
|
|
89
|
-
`;
|
|
90
|
-
|
|
91
|
-
exports[`route --nameAndDirectoryFormat=derived should error if it detects a possible missing route param because of un-escaped dollar sign 1`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
92
|
-
|
|
93
|
-
exports[`route --nameAndDirectoryFormat=derived should error if it detects a possible missing route param because of un-escaped dollar sign 2`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
94
|
-
|
|
95
|
-
exports[`route --nameAndDirectoryFormat=derived should error if it detects a possible missing route param because of un-escaped dollar sign 3`] = `[Error: Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.]`;
|
|
@@ -11,11 +11,8 @@ const meta_impl_1 = require("../meta/meta.impl");
|
|
|
11
11
|
const style_impl_1 = require("../style/style.impl");
|
|
12
12
|
async function default_1(tree, options) {
|
|
13
13
|
const { artifactName: name, directory, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
14
|
-
artifactType: 'route',
|
|
15
|
-
callingGenerator: '@nx/remix:route',
|
|
16
14
|
name: options.path.replace(/^\//, '').replace(/\/$/, ''),
|
|
17
15
|
nameAndDirectoryFormat: options.nameAndDirectoryFormat,
|
|
18
|
-
project: options.project,
|
|
19
16
|
});
|
|
20
17
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
21
18
|
if (!project)
|
|
@@ -23,12 +20,8 @@ async function default_1(tree, options) {
|
|
|
23
20
|
if (!options.skipChecks && (0, remix_route_utils_1.checkRoutePathForErrors)(options.path)) {
|
|
24
21
|
throw new Error(`Your route path has an indicator of an un-escaped dollar sign for a route param. If this was intended, include the --skipChecks flag.`);
|
|
25
22
|
}
|
|
26
|
-
const routeFilePath = await (0, remix_route_utils_1.resolveRemixRouteFile)(tree,
|
|
27
|
-
|
|
28
|
-
: options.path, options.nameAndDirectoryFormat === 'as-provided' ? undefined : projectName, '.tsx');
|
|
29
|
-
const nameToUseForComponent = options.nameAndDirectoryFormat === 'as-provided'
|
|
30
|
-
? name.replace('.tsx', '')
|
|
31
|
-
: options.path.replace(/^\//, '').replace(/\/$/, '').replace('.tsx', '');
|
|
23
|
+
const routeFilePath = await (0, remix_route_utils_1.resolveRemixRouteFile)(tree, (0, devkit_1.joinPathFragments)(directory, name), undefined);
|
|
24
|
+
const nameToUseForComponent = name.replace('.tsx', '');
|
|
32
25
|
const { className: componentName } = (0, devkit_1.names)(nameToUseForComponent === '.' || nameToUseForComponent === ''
|
|
33
26
|
? (0, path_1.basename)((0, path_1.dirname)(routeFilePath))
|
|
34
27
|
: nameToUseForComponent);
|
|
@@ -69,7 +62,6 @@ async function default_1(tree, options) {
|
|
|
69
62
|
}
|
|
70
63
|
if (options.style === 'css') {
|
|
71
64
|
await (0, style_impl_1.default)(tree, {
|
|
72
|
-
project: projectName,
|
|
73
65
|
path: routeFilePath,
|
|
74
66
|
nameAndDirectoryFormat: 'as-provided',
|
|
75
67
|
});
|
|
@@ -8,8 +8,4 @@ export interface RemixRouteSchema {
|
|
|
8
8
|
meta: boolean;
|
|
9
9
|
loader: boolean;
|
|
10
10
|
skipChecks: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v20.
|
|
13
|
-
*/
|
|
14
|
-
project?: string;
|
|
15
11
|
}
|
|
@@ -25,12 +25,6 @@
|
|
|
25
25
|
"type": "string",
|
|
26
26
|
"enum": ["as-provided", "derived"]
|
|
27
27
|
},
|
|
28
|
-
"project": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"description": "The name of the project.",
|
|
31
|
-
"pattern": "^[a-zA-Z].*$",
|
|
32
|
-
"x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v20."
|
|
33
|
-
},
|
|
34
28
|
"style": {
|
|
35
29
|
"type": "string",
|
|
36
30
|
"description": "Generate a stylesheet",
|
|
@@ -3,8 +3,4 @@ import { NameAndDirectoryFormat } from '@nx/devkit/src/generators/artifact-name-
|
|
|
3
3
|
export interface RemixStyleSchema {
|
|
4
4
|
path: string;
|
|
5
5
|
nameAndDirectoryFormat?: NameAndDirectoryFormat;
|
|
6
|
-
/**
|
|
7
|
-
* @deprecated Provide the `path` option instead. The project will be determined from the path provided. It will be removed in Nx v20.
|
|
8
|
-
*/
|
|
9
|
-
project?: string;
|
|
10
6
|
}
|
|
@@ -24,12 +24,6 @@
|
|
|
24
24
|
"description": "Whether to generate the styles in the path as provided, relative to the current working directory and ignoring the project (`as-provided`) or generate it using the project and directory relative to the workspace root (`derived`).",
|
|
25
25
|
"type": "string",
|
|
26
26
|
"enum": ["as-provided", "derived"]
|
|
27
|
-
},
|
|
28
|
-
"project": {
|
|
29
|
-
"type": "string",
|
|
30
|
-
"description": "The name of the project.",
|
|
31
|
-
"pattern": "^[a-zA-Z].*$",
|
|
32
|
-
"x-deprecated": "Provide the `path` option instead and use the `as-provided` format. The project will be determined from the path provided. It will be removed in Nx v20."
|
|
33
27
|
}
|
|
34
28
|
},
|
|
35
29
|
"required": ["path"]
|
|
@@ -9,11 +9,8 @@ const insert_statement_after_imports_1 = require("../../utils/insert-statement-a
|
|
|
9
9
|
const remix_route_utils_1 = require("../../utils/remix-route-utils");
|
|
10
10
|
async function default_1(tree, options) {
|
|
11
11
|
const { project: projectName, artifactName: name } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(tree, {
|
|
12
|
-
artifactType: 'style',
|
|
13
|
-
callingGenerator: '@nx/remix:style',
|
|
14
12
|
name: options.path,
|
|
15
|
-
nameAndDirectoryFormat: options.nameAndDirectoryFormat,
|
|
16
|
-
project: options.project,
|
|
13
|
+
nameAndDirectoryFormat: options.nameAndDirectoryFormat ?? 'as-provided',
|
|
17
14
|
});
|
|
18
15
|
const project = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
19
16
|
if (!project)
|
|
@@ -33,9 +30,7 @@ async function default_1(tree, options) {
|
|
|
33
30
|
Liberation Mono, Courier New, monospace;
|
|
34
31
|
}
|
|
35
32
|
`);
|
|
36
|
-
const routeFilePath = options.
|
|
37
|
-
? options.path
|
|
38
|
-
: await (0, remix_route_utils_1.resolveRemixRouteFile)(tree, options.path, options.project, '.tsx');
|
|
33
|
+
const routeFilePath = options.path;
|
|
39
34
|
(0, insert_import_1.insertImport)(tree, routeFilePath, 'LinksFunction', '@remix-run/node', {
|
|
40
35
|
typeOnly: true,
|
|
41
36
|
});
|