@nrwl/remix 13.7.1 → 14.1.7

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.
Files changed (71) hide show
  1. package/README.md +2 -2
  2. package/generators.json +25 -0
  3. package/package.json +1 -1
  4. package/src/generators/action/action.impl.d.ts +3 -0
  5. package/src/generators/action/action.impl.js +48 -0
  6. package/src/generators/action/action.impl.js.map +1 -0
  7. package/src/generators/action/schema.d.ts +4 -0
  8. package/src/generators/action/schema.json +27 -0
  9. package/src/generators/application/files/.gitignore__tmpl__ +4 -0
  10. package/src/generators/application/files/app/entry.client.tsx__tmpl__ +2 -2
  11. package/src/generators/application/files/app/entry.server.tsx__tmpl__ +4 -4
  12. package/src/generators/application/files/app/root.tsx__tmpl__ +10 -156
  13. package/src/generators/application/files/app/routes/index.tsx__tmpl__ +28 -96
  14. package/src/generators/application/files/package.json__tmpl__ +1 -1
  15. package/src/generators/application/files/remix.config.js__tmpl__ +7 -7
  16. package/src/generators/application/files/tsconfig.json__tmpl__ +6 -1
  17. package/src/generators/cypress/cypress.impl.js +3 -3
  18. package/src/generators/cypress/cypress.impl.js.map +1 -1
  19. package/src/generators/loader/loader.impl.d.ts +3 -0
  20. package/src/generators/loader/loader.impl.js +48 -0
  21. package/src/generators/loader/loader.impl.js.map +1 -0
  22. package/src/generators/loader/schema.d.ts +4 -0
  23. package/src/generators/loader/schema.json +27 -0
  24. package/src/generators/meta/meta.impl.d.ts +3 -0
  25. package/src/generators/meta/meta.impl.js +29 -0
  26. package/src/generators/meta/meta.impl.js.map +1 -0
  27. package/src/generators/meta/schema.d.ts +4 -0
  28. package/src/generators/meta/schema.json +27 -0
  29. package/src/generators/resource-route/resource-route.impl.d.ts +3 -0
  30. package/src/generators/resource-route/resource-route.impl.js +32 -0
  31. package/src/generators/resource-route/resource-route.impl.js.map +1 -0
  32. package/src/generators/resource-route/schema.d.ts +6 -0
  33. package/src/generators/resource-route/schema.json +44 -0
  34. package/src/generators/route/route.impl.js +37 -61
  35. package/src/generators/route/route.impl.js.map +1 -1
  36. package/src/generators/route/schema.d.ts +3 -0
  37. package/src/generators/route/schema.json +24 -9
  38. package/src/generators/style/schema.d.ts +4 -0
  39. package/src/generators/style/schema.json +34 -0
  40. package/src/generators/style/style.impl.d.ts +3 -0
  41. package/src/generators/style/style.impl.js +41 -0
  42. package/src/generators/style/style.impl.js.map +1 -0
  43. package/src/utils/get-default-export-name.d.ts +2 -0
  44. package/src/utils/get-default-export-name.js +10 -0
  45. package/src/utils/get-default-export-name.js.map +1 -0
  46. package/src/utils/get-default-export.d.ts +2 -0
  47. package/src/utils/get-default-export.js +16 -0
  48. package/src/utils/get-default-export.js.map +1 -0
  49. package/src/utils/insert-import.d.ts +4 -0
  50. package/src/utils/insert-import.js +55 -0
  51. package/src/utils/insert-import.js.map +1 -0
  52. package/src/utils/insert-statement-after-imports.d.ts +5 -0
  53. package/src/utils/insert-statement-after-imports.js +29 -0
  54. package/src/utils/insert-statement-after-imports.js.map +1 -0
  55. package/src/utils/insert-statement-in-default-function.d.ts +2 -0
  56. package/src/utils/insert-statement-in-default-function.js +24 -0
  57. package/src/utils/insert-statement-in-default-function.js.map +1 -0
  58. package/src/utils/remix-route-utils.d.ts +11 -0
  59. package/src/utils/remix-route-utils.js +53 -0
  60. package/src/utils/remix-route-utils.js.map +1 -0
  61. package/src/generators/application/files/app/routes/demos/about/index.tsx__tmpl__ +0 -17
  62. package/src/generators/application/files/app/routes/demos/about/whoa.tsx__tmpl__ +0 -20
  63. package/src/generators/application/files/app/routes/demos/about.tsx__tmpl__ +0 -44
  64. package/src/generators/application/files/app/routes/demos/actions.tsx__tmpl__ +0 -101
  65. package/src/generators/application/files/app/routes/demos/correct.tsx__tmpl__ +0 -3
  66. package/src/generators/application/files/app/routes/demos/params/$id.tsx__tmpl__ +0 -110
  67. package/src/generators/application/files/app/routes/demos/params/index.tsx__tmpl__ +0 -40
  68. package/src/generators/application/files/app/routes/demos/params.tsx__tmpl__ +0 -43
  69. package/src/generators/application/files/app/styles/dark.css +0 -7
  70. package/src/generators/application/files/app/styles/demos/about.css +0 -26
  71. package/src/generators/application/files/app/styles/global.css +0 -216
package/README.md CHANGED
@@ -111,10 +111,10 @@ npx nx dev demo
111
111
 
112
112
  ### Running unit tests
113
113
 
114
- Run `nx test remix` to execute the unit tests via [Jest](https://jestjs.io).
114
+ Run `nx test demo` to execute the unit tests via [Jest](https://jestjs.io).
115
115
 
116
116
  ### Publishing
117
117
 
118
118
  ```bash
119
- nx publish remix --ver=[version]
119
+ nx publish demo --ver=[version]
120
120
  ```
package/generators.json CHANGED
@@ -35,6 +35,31 @@
35
35
  "schema": "./src/generators/route/schema.json",
36
36
  "description": "Generate a new route"
37
37
  },
38
+ "resource-route": {
39
+ "implementation": "./src/generators/resource-route/resource-route.impl",
40
+ "schema": "./src/generators/resource-route/schema.json",
41
+ "description": "Generate a new resource route"
42
+ },
43
+ "action": {
44
+ "implementation": "./src/generators/action/action.impl",
45
+ "schema": "./src/generators/action/schema.json",
46
+ "description": "Add an action function to an existing route"
47
+ },
48
+ "loader": {
49
+ "implementation": "./src/generators/loader/loader.impl",
50
+ "schema": "./src/generators/loader/schema.json",
51
+ "description": "Add a loader function to an existing route"
52
+ },
53
+ "style": {
54
+ "implementation": "./src/generators/style/style.impl",
55
+ "schema": "./src/generators/style/schema.json",
56
+ "description": "Generates a new stylesheet and adds it to an existing route"
57
+ },
58
+ "meta": {
59
+ "implementation": "./src/generators/meta/meta.impl",
60
+ "schema": "./src/generators/meta/schema.json",
61
+ "description": "Add a meta function to an existing route"
62
+ },
38
63
  "cypress": {
39
64
  "implementation": "./src/generators/cypress/cypress.impl",
40
65
  "schema": "./src/generators/cypress/schema.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nrwl/remix",
3
- "version": "13.7.1",
3
+ "version": "14.1.7",
4
4
  "main": "src/index.js",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ import { LoaderSchema } from './schema';
3
+ export default function (tree: Tree, schema: LoaderSchema): Promise<void>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ const insert_import_1 = require("../../utils/insert-import");
6
+ const insert_statement_after_imports_1 = require("../../utils/insert-statement-after-imports");
7
+ const get_default_export_name_1 = require("../../utils/get-default-export-name");
8
+ const insert_statement_in_default_function_1 = require("../../utils/insert-statement-in-default-function");
9
+ const remix_route_utils_1 = require("../../utils/remix-route-utils");
10
+ function default_1(tree, schema) {
11
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
12
+ const routeFilePath = (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
13
+ if (!tree.exists(routeFilePath)) {
14
+ throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
15
+ }
16
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'ActionFunction', '@remix-run/node', {
17
+ typeOnly: true,
18
+ });
19
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'json', '@remix-run/node');
20
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'useActionData', '@remix-run/react');
21
+ const defaultExportName = (0, get_default_export_name_1.getDefaultExportName)(tree, routeFilePath);
22
+ const actionTypeName = `${defaultExportName}ActionData`;
23
+ (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
24
+ type ${actionTypeName} = {
25
+ message: string;
26
+ };
27
+
28
+ export let action: ActionFunction = async ({ request }) => {
29
+ let formData = await request.formData();
30
+
31
+ return json({message: formData.toString()}, { status: 200 });
32
+ };
33
+
34
+ `);
35
+ const statement = `\nconst actionMessage = useActionData<${actionTypeName}>();`;
36
+ try {
37
+ (0, insert_statement_in_default_function_1.insertStatementInDefaultFunction)(tree, routeFilePath, statement);
38
+ }
39
+ catch (err) {
40
+ // eslint-disable-next-line no-empty
41
+ }
42
+ finally {
43
+ yield (0, devkit_1.formatFiles)(tree);
44
+ }
45
+ });
46
+ }
47
+ exports.default = default_1;
48
+ //# sourceMappingURL=action.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/action/action.impl.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAEjD,6DAAyD;AACzD,+FAAyF;AACzF,iFAA2E;AAC3E,2GAAoG;AACpG,qEAAsE;AAEtE,mBAA+B,IAAU,EAAE,MAAoB;;QAC7D,MAAM,aAAa,GAAG,IAAA,yCAAqB,EACzC,IAAI,EACJ,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,OAAO,CACf,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,8BAA8B,aAAa,wCAAwC,CACpF,CAAC;SACH;QAED,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE;YACrE,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;QAC7D,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAC;QAEvE,MAAM,iBAAiB,GAAG,IAAA,8CAAoB,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACpE,MAAM,cAAc,GAAG,GAAG,iBAAiB,YAAY,CAAC;QAExD,IAAA,4DAA2B,EACzB,IAAI,EACJ,aAAa,EACb;WACO,cAAc;;;;;;;;;;KAUpB,CACF,CAAC;QAEF,MAAM,SAAS,GAAG,yCAAyC,cAAc,MAAM,CAAC;QAEhF,IAAI;YACF,IAAA,uEAAgC,EAAC,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;SAClE;QAAC,OAAO,GAAG,EAAE;YACZ,oCAAoC;SACrC;gBAAS;YACR,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AAhDD,4BAgDC"}
@@ -0,0 +1,4 @@
1
+ export interface LoaderSchema {
2
+ path: string;
3
+ project: string;
4
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "cli": "nx",
4
+ "$id": "action",
5
+ "type": "object",
6
+ "properties": {
7
+ "path": {
8
+ "type": "string",
9
+ "description": "The route path or path to the filename of the route.",
10
+ "$default": {
11
+ "$source": "argv",
12
+ "index": 0
13
+ },
14
+ "x-prompt": "What is the path of the route? (e.g. 'foo/bar')"
15
+ },
16
+ "project": {
17
+ "type": "string",
18
+ "description": "The name of the project.",
19
+ "$default": {
20
+ "$source": "projectName"
21
+ },
22
+ "x-prompt": "What project is this route for?",
23
+ "pattern": "^[a-zA-Z].*$"
24
+ }
25
+ },
26
+ "required": ["path", "project"]
27
+ }
@@ -0,0 +1,4 @@
1
+ .cache
2
+ build
3
+ public/build
4
+ .env
@@ -1,4 +1,4 @@
1
+ import { RemixBrowser } from "@remix-run/react";
1
2
  import { hydrate } from "react-dom";
2
- import { RemixBrowser } from "remix";
3
3
 
4
- hydrate(<RemixBrowser />, document);
4
+ hydrate(<RemixBrowser />, document);
@@ -1,6 +1,6 @@
1
+ import type { EntryContext } from "@remix-run/node";
2
+ import { RemixServer } from "@remix-run/react";
1
3
  import { renderToString } from "react-dom/server";
2
- import { RemixServer } from "remix";
3
- import type { EntryContext } from "remix";
4
4
 
5
5
  export default function handleRequest(
6
6
  request: Request,
@@ -16,6 +16,6 @@ export default function handleRequest(
16
16
 
17
17
  return new Response("<!DOCTYPE html>" + markup, {
18
18
  status: responseStatusCode,
19
- headers: responseHeaders
19
+ headers: responseHeaders,
20
20
  });
21
- }
21
+ }
@@ -1,178 +1,32 @@
1
+ import type { MetaFunction } from "@remix-run/node";
1
2
  import {
2
- Link,
3
3
  Links,
4
4
  LiveReload,
5
5
  Meta,
6
6
  Outlet,
7
7
  Scripts,
8
8
  ScrollRestoration,
9
- useCatch
10
- } from "remix";
11
- import type { LinksFunction } from "remix";
9
+ } from "@remix-run/react";
12
10
 
13
- import globalStylesUrl from "~/styles/global.css";
14
- import darkStylesUrl from "~/styles/dark.css";
11
+ export const meta: MetaFunction = () => ({
12
+ charset: "utf-8",
13
+ title: "New Remix App",
14
+ viewport: "width=device-width,initial-scale=1",
15
+ });
15
16
 
16
- // https://remix.run/api/app#links
17
- export let links: LinksFunction = () => {
18
- return [
19
- { rel: "stylesheet", href: globalStylesUrl },
20
- {
21
- rel: "stylesheet",
22
- href: darkStylesUrl,
23
- media: "(prefers-color-scheme: dark)"
24
- }
25
- ];
26
- };
27
-
28
- // https://remix.run/api/conventions#default-export
29
- // https://remix.run/api/conventions#route-filenames
30
17
  export default function App() {
31
- return (
32
- <Document>
33
- <Layout>
34
- <Outlet />
35
- </Layout>
36
- </Document>
37
- );
38
- }
39
-
40
- // https://remix.run/docs/en/v1/api/conventions#errorboundary
41
- export function ErrorBoundary({ error }: { error: Error }) {
42
- console.error(error);
43
- return (
44
- <Document title="Error!">
45
- <Layout>
46
- <div>
47
- <h1>There was an error</h1>
48
- <p>{error.message}</p>
49
- <hr />
50
- <p>
51
- Hey, developer, you should replace this with what you want your
52
- users to see.
53
- </p>
54
- </div>
55
- </Layout>
56
- </Document>
57
- );
58
- }
59
-
60
- // https://remix.run/docs/en/v1/api/conventions#catchboundary
61
- export function CatchBoundary() {
62
- let caught = useCatch();
63
-
64
- let message;
65
- switch (caught.status) {
66
- case 401:
67
- message = (
68
- <p>
69
- Oops! Looks like you tried to visit a page that you do not have access
70
- to.
71
- </p>
72
- );
73
- break;
74
- case 404:
75
- message = (
76
- <p>Oops! Looks like you tried to visit a page that does not exist.</p>
77
- );
78
- break;
79
-
80
- default:
81
- throw new Error(caught.data || caught.statusText);
82
- }
83
-
84
- return (
85
- <Document title={`${caught.status} ${caught.statusText}`}>
86
- <Layout>
87
- <h1>
88
- {caught.status}: {caught.statusText}
89
- </h1>
90
- {message}
91
- </Layout>
92
- </Document>
93
- );
94
- }
95
-
96
- function Document({
97
- children,
98
- title
99
- }: {
100
- children: React.ReactNode;
101
- title?: string;
102
- }) {
103
18
  return (
104
19
  <html lang="en">
105
20
  <head>
106
- <meta charSet="utf-8" />
107
- <meta name="viewport" content="width=device-width,initial-scale=1" />
108
- {title ? <title>{title}</title> : null}
109
21
  <Meta />
110
22
  <Links />
111
23
  </head>
112
24
  <body>
113
- {children}
25
+ <Outlet />
114
26
  <ScrollRestoration />
115
27
  <Scripts />
116
- {process.env.NODE_ENV === "development" && <LiveReload />}
28
+ <LiveReload />
117
29
  </body>
118
30
  </html>
119
31
  );
120
- }
121
-
122
- function Layout({ children }: { children: React.ReactNode }) {
123
- return (
124
- <div className="remix-app">
125
- <header className="remix-app__header">
126
- <div className="container remix-app__header-content">
127
- <Link to="/" title="Remix" className="remix-app__header-home-link">
128
- <RemixLogo />
129
- </Link>
130
- <nav aria-label="Main navigation" className="remix-app__header-nav">
131
- <ul>
132
- <li>
133
- <Link to="/">Home</Link>
134
- </li>
135
- <li>
136
- <a href="https://remix.run/docs">Remix Docs</a>
137
- </li>
138
- <li>
139
- <a href="https://github.com/remix-run/remix">GitHub</a>
140
- </li>
141
- </ul>
142
- </nav>
143
- </div>
144
- </header>
145
- <div className="remix-app__main">
146
- <div className="container remix-app__main-content">{children}</div>
147
- </div>
148
- <footer className="remix-app__footer">
149
- <div className="container remix-app__footer-content">
150
- <p>&copy; You!</p>
151
- </div>
152
- </footer>
153
- </div>
154
- );
155
- }
156
-
157
- function RemixLogo() {
158
- return (
159
- <svg
160
- viewBox="0 0 659 165"
161
- version="1.1"
162
- xmlns="http://www.w3.org/2000/svg"
163
- xmlnsXlink="http://www.w3.org/1999/xlink"
164
- aria-labelledby="remix-run-logo-title"
165
- role="img"
166
- width="106"
167
- height="30"
168
- fill="currentColor"
169
- >
170
- <title id="remix-run-logo-title">Remix Logo</title>
171
- <path d="M0 161V136H45.5416C53.1486 136 54.8003 141.638 54.8003 145V161H0Z M133.85 124.16C135.3 142.762 135.3 151.482 135.3 161H92.2283C92.2283 158.927 92.2653 157.03 92.3028 155.107C92.4195 149.128 92.5411 142.894 91.5717 130.304C90.2905 111.872 82.3473 107.776 67.7419 107.776H54.8021H0V74.24H69.7918C88.2407 74.24 97.4651 68.632 97.4651 53.784C97.4651 40.728 88.2407 32.816 69.7918 32.816H0V0H77.4788C119.245 0 140 19.712 140 51.2C140 74.752 125.395 90.112 105.665 92.672C122.32 96 132.057 105.472 133.85 124.16Z" />
172
- <path d="M229.43 120.576C225.59 129.536 218.422 133.376 207.158 133.376C194.614 133.376 184.374 126.72 183.35 112.64H263.478V101.12C263.478 70.1437 243.254 44.0317 205.11 44.0317C169.526 44.0317 142.902 69.8877 142.902 105.984C142.902 142.336 169.014 164.352 205.622 164.352C235.83 164.352 256.822 149.76 262.71 123.648L229.43 120.576ZM183.862 92.6717C185.398 81.9197 191.286 73.7277 204.598 73.7277C216.886 73.7277 223.542 82.4317 224.054 92.6717H183.862Z" />
173
- <path d="M385.256 66.5597C380.392 53.2477 369.896 44.0317 349.672 44.0317C332.52 44.0317 320.232 51.7117 314.088 64.2557V47.1037H272.616V161.28H314.088V105.216C314.088 88.0638 318.952 76.7997 332.52 76.7997C345.064 76.7997 348.136 84.9917 348.136 100.608V161.28H389.608V105.216C389.608 88.0638 394.216 76.7997 408.04 76.7997C420.584 76.7997 423.4 84.9917 423.4 100.608V161.28H464.872V89.5997C464.872 65.7917 455.656 44.0317 424.168 44.0317C404.968 44.0317 391.4 53.7597 385.256 66.5597Z" />
174
- <path d="M478.436 47.104V161.28H519.908V47.104H478.436ZM478.18 36.352H520.164V0H478.18V36.352Z" />
175
- <path d="M654.54 47.1035H611.788L592.332 74.2395L573.388 47.1035H527.564L568.78 103.168L523.98 161.28H566.732L589.516 130.304L612.3 161.28H658.124L613.068 101.376L654.54 47.1035Z" />
176
- </svg>
177
- );
178
- }
32
+ }
@@ -1,100 +1,32 @@
1
- import type { MetaFunction, LoaderFunction } from "remix";
2
- import { useLoaderData, json, Link } from "remix";
3
-
4
- type IndexData = {
5
- resources: Array<{ name: string; url: string }>;
6
- demos: Array<{ name: string; to: string }>;
7
- };
8
-
9
- // Loaders provide data to components and are only ever called on the server, so
10
- // you can connect to a database or run any server side code you want right next
11
- // to the component that renders it.
12
- // https://remix.run/api/conventions#loader
13
- export let loader: LoaderFunction = () => {
14
- let data: IndexData = {
15
- resources: [
16
- {
17
- name: "Remix Docs",
18
- url: "https://remix.run/docs"
19
- },
20
- {
21
- name: "React Router Docs",
22
- url: "https://reactrouter.com/docs"
23
- },
24
- {
25
- name: "Remix Discord",
26
- url: "https://discord.gg/VBePs6d"
27
- }
28
- ],
29
- demos: [
30
- {
31
- to: "demos/actions",
32
- name: "Actions"
33
- },
34
- {
35
- to: "demos/about",
36
- name: "Nested Routes, CSS loading/unloading"
37
- },
38
- {
39
- to: "demos/params",
40
- name: "URL Params and Error Boundaries"
41
- }
42
- ]
43
- };
44
-
45
- // https://remix.run/api/remix#json
46
- return json(data);
47
- };
48
-
49
- // https://remix.run/api/conventions#meta
50
- export let meta: MetaFunction = () => {
51
- return {
52
- title: "Remix Starter",
53
- description: "Welcome to remix!"
54
- };
55
- };
56
-
57
- // https://remix.run/guides/routing#index-routes
58
1
  export default function Index() {
59
- let data = useLoaderData<IndexData>();
60
-
61
2
  return (
62
- <div className="remix__page">
63
- <main>
64
- <h2>Welcome to Remix!</h2>
65
- <p>We're stoked that you're here. 🥳</p>
66
- <p>
67
- Feel free to take a look around the code to see how Remix does things,
68
- it might be a bit different than what you’re used to. When you're
69
- ready to dive deeper, we've got plenty of resources to get you
70
- up-and-running quickly.
71
- </p>
72
- <p>
73
- Check out all the demos in this starter, and then just delete the{" "}
74
- <code>app/routes/demos</code> and <code>app/styles/demos</code>{" "}
75
- folders when you're ready to turn this into your next project.
76
- </p>
77
- </main>
78
- <aside>
79
- <h2>Demos In This App</h2>
80
- <ul>
81
- {data.demos.map(demo => (
82
- <li key={demo.to} className="remix__page__resource">
83
- <Link to={demo.to} prefetch="intent">
84
- {demo.name}
85
- </Link>
86
- </li>
87
- ))}
88
- </ul>
89
- <h2>Resources</h2>
90
- <ul>
91
- {data.resources.map(resource => (
92
- <li key={resource.url} className="remix__page__resource">
93
- <a href={resource.url}>{resource.name}</a>
94
- </li>
95
- ))}
96
- </ul>
97
- </aside>
3
+ <div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
4
+ <h1>Welcome to Remix</h1>
5
+ <ul>
6
+ <li>
7
+ <a
8
+ target="_blank"
9
+ href="https://remix.run/tutorials/blog"
10
+ rel="noreferrer"
11
+ >
12
+ 15m Quickstart Blog Tutorial
13
+ </a>
14
+ </li>
15
+ <li>
16
+ <a
17
+ target="_blank"
18
+ href="https://remix.run/tutorials/jokes"
19
+ rel="noreferrer"
20
+ >
21
+ Deep Dive Jokes App Tutorial
22
+ </a>
23
+ </li>
24
+ <li>
25
+ <a target="_blank" href="https://remix.run/docs" rel="noreferrer">
26
+ Remix Docs
27
+ </a>
28
+ </li>
29
+ </ul>
98
30
  </div>
99
31
  );
100
- }
32
+ }
@@ -20,7 +20,7 @@
20
20
  "@remix-run/dev": "^1.0.6",
21
21
  "@types/react": "^17.0.24",
22
22
  "@types/react-dom": "^17.0.9",
23
- "typescript": "^4.1.2"
23
+ "typescript": "^4.6.4"
24
24
  },
25
25
  "engines": {
26
26
  "node": ">=14"
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @type {import('@remix-run/dev/config').AppConfig}
2
+ * @type {import('@remix-run/dev').AppConfig}
3
3
  */
4
4
  module.exports = {
5
- appDirectory: "app",
6
- browserBuildDirectory: "public/build",
7
- publicPath: "/build/",
8
- serverBuildDirectory: "build",
9
- devServerPort: 8002
10
- };
5
+ ignoredRouteFiles: ["**/.*"],
6
+ // appDirectory: "app",
7
+ // assetsBuildDirectory: "public/build",
8
+ // serverBuildPath: "build/index.js",
9
+ // publicPath: "/build/",
10
+ };
@@ -2,16 +2,21 @@
2
2
  "include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
3
3
  "compilerOptions": {
4
4
  "lib": ["DOM", "DOM.Iterable", "ES2019"],
5
+ "isolatedModules": true,
5
6
  "esModuleInterop": true,
6
7
  "jsx": "react-jsx",
7
8
  "moduleResolution": "node",
8
9
  "resolveJsonModule": true,
9
10
  "target": "ES2019",
10
11
  "strict": true,
12
+ "allowJs": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "baseUrl": ".",
11
15
  "paths": {
12
16
  "~/*": ["./app/*"]
13
17
  },
18
+
14
19
  // Remix takes care of building everything in `remix build`.
15
20
  "noEmit": true
16
21
  }
17
- }
22
+ }
@@ -5,11 +5,11 @@ const devkit_1 = require("@nrwl/devkit");
5
5
  const cypress_1 = require("@nrwl/cypress");
6
6
  function default_1(tree, options) {
7
7
  return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
8
- const initSideEffects = (0, cypress_1.cypressInitGenerator)(tree);
8
+ const initSideEffects = (0, cypress_1.cypressInitGenerator)(tree, {});
9
9
  const projSideEffects = (0, cypress_1.cypressProjectGenerator)(tree, Object.assign(Object.assign({}, options), { standaloneConfig: true }));
10
10
  const config = (0, devkit_1.readProjectConfiguration)(tree, options.name);
11
- tree.delete((0, devkit_1.joinPathFragments)(config.sourceRoot, "support", "app.po.ts"));
12
- tree.write((0, devkit_1.joinPathFragments)(config.sourceRoot, "integration", "app.spec.ts"), `describe('webapp', () => {
11
+ tree.delete((0, devkit_1.joinPathFragments)(config.sourceRoot, 'support', 'app.po.ts'));
12
+ tree.write((0, devkit_1.joinPathFragments)(config.sourceRoot, 'integration', 'app.spec.ts'), `describe('webapp', () => {
13
13
  beforeEach(() => cy.visit('/'));
14
14
 
15
15
  it('should display welcome message', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"cypress.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/cypress/cypress.impl.ts"],"names":[],"mappings":";;;AAAA,yCAAgF;AAEhF,2CAA2E;AAE3E,mBACE,IAAU,EACV,OAAY;;QAEZ,MAAM,eAAe,GAAG,IAAA,8BAAoB,EAAC,IAAI,CAAC,CAAC;QACnD,MAAM,eAAe,GAAG,IAAA,iCAAuB,EAAC,IAAI,kCAAM,OAAO,KAAE,gBAAgB,EAAE,IAAI,IAAE,CAAA;QAE3F,MAAM,MAAM,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;QAC3D,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,KAAK,CAAC,IAAA,0BAAiB,EAAC,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,aAAa,CAAC,EAAE;;;;;;IAM7E,CAAC,CAAA;QACH,oEAAoE;QACpE,OAAO,GAAS,EAAE;YAChB,MAAM,eAAe,CAAA;YACrB,MAAM,eAAe,CAAA;QACvB,CAAC,CAAA,CAAC;IACJ,CAAC;CAAA;AArBD,4BAqBC"}
1
+ {"version":3,"file":"cypress.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/cypress/cypress.impl.ts"],"names":[],"mappings":";;;AAAA,yCAIsB;AAEtB,2CAA8E;AAE9E,mBAA+B,IAAU,EAAE,OAAY;;QACrD,MAAM,eAAe,GAAG,IAAA,8BAAoB,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACvD,MAAM,eAAe,GAAG,IAAA,iCAAuB,EAAC,IAAI,kCAC/C,OAAO,KACV,gBAAgB,EAAE,IAAI,IACtB,CAAC;QAEH,MAAM,MAAM,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QAC5D,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,KAAK,CACR,IAAA,0BAAiB,EAAC,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,aAAa,CAAC,EAClE;;;;;;IAMA,CACD,CAAC;QACF,oEAAoE;QACpE,OAAO,GAAS,EAAE;YAChB,MAAM,eAAe,CAAC;YACtB,MAAM,eAAe,CAAC;QACxB,CAAC,CAAA,CAAC;IACJ,CAAC;CAAA;AAxBD,4BAwBC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ import { LoaderSchema } from './schema';
3
+ export default function (tree: Tree, schema: LoaderSchema): Promise<void>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nrwl/devkit");
5
+ const insert_import_1 = require("../../utils/insert-import");
6
+ const insert_statement_after_imports_1 = require("../../utils/insert-statement-after-imports");
7
+ const get_default_export_name_1 = require("../../utils/get-default-export-name");
8
+ const insert_statement_in_default_function_1 = require("../../utils/insert-statement-in-default-function");
9
+ const remix_route_utils_1 = require("../../utils/remix-route-utils");
10
+ function default_1(tree, schema) {
11
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
12
+ const routeFilePath = (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
13
+ if (!tree.exists(routeFilePath)) {
14
+ throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
15
+ }
16
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'LoaderFunction', '@remix-run/node', {
17
+ typeOnly: true,
18
+ });
19
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'useLoaderData', '@remix-run/react');
20
+ (0, insert_import_1.insertImport)(tree, routeFilePath, 'json', '@remix-run/node');
21
+ const defaultExportName = (0, get_default_export_name_1.getDefaultExportName)(tree, routeFilePath);
22
+ const loaderTypeName = `${defaultExportName}LoaderData`;
23
+ (0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
24
+ type ${loaderTypeName} = {
25
+ message: string;
26
+ };
27
+
28
+ export const loader: LoaderFunction = async () => {
29
+ return json({
30
+ message: 'Hello, world!',
31
+ })
32
+ };
33
+
34
+ `);
35
+ const statement = `\nconst data = useLoaderData<${loaderTypeName}>();`;
36
+ try {
37
+ (0, insert_statement_in_default_function_1.insertStatementInDefaultFunction)(tree, routeFilePath, statement);
38
+ // eslint-disable-next-line no-empty
39
+ }
40
+ catch (err) {
41
+ }
42
+ finally {
43
+ yield (0, devkit_1.formatFiles)(tree);
44
+ }
45
+ });
46
+ }
47
+ exports.default = default_1;
48
+ //# sourceMappingURL=loader.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loader.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/loader/loader.impl.ts"],"names":[],"mappings":";;;AAAA,yCAAiD;AAEjD,6DAAyD;AACzD,+FAAyF;AACzF,iFAA2E;AAC3E,2GAAoG;AACpG,qEAAsE;AAEtE,mBAA+B,IAAU,EAAE,MAAoB;;QAC7D,MAAM,aAAa,GAAG,IAAA,yCAAqB,EACzC,IAAI,EACJ,MAAM,CAAC,IAAI,EACX,MAAM,CAAC,OAAO,CACf,CAAC;QAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;YAC/B,MAAM,IAAI,KAAK,CACb,8BAA8B,aAAa,wCAAwC,CACpF,CAAC;SACH;QAED,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,iBAAiB,EAAE;YACrE,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACH,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAC;QACvE,IAAA,4BAAY,EAAC,IAAI,EAAE,aAAa,EAAE,MAAM,EAAE,iBAAiB,CAAC,CAAC;QAE7D,MAAM,iBAAiB,GAAG,IAAA,8CAAoB,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACpE,MAAM,cAAc,GAAG,GAAG,iBAAiB,YAAY,CAAC;QAExD,IAAA,4DAA2B,EACzB,IAAI,EACJ,aAAa,EACb;WACO,cAAc;;;;;;;;;;KAUpB,CACF,CAAC;QAEF,MAAM,SAAS,GAAG,gCAAgC,cAAc,MAAM,CAAC;QAEvE,IAAI;YACF,IAAA,uEAAgC,EAAC,IAAI,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;YACjE,oCAAoC;SACrC;QAAC,OAAO,GAAG,EAAE;SACb;gBAAS;YACR,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;IACH,CAAC;CAAA;AAhDD,4BAgDC"}
@@ -0,0 +1,4 @@
1
+ export interface LoaderSchema {
2
+ project: string;
3
+ path: string;
4
+ }