@nx/remix 16.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/README.md +120 -0
- package/generators.json +69 -0
- package/migrations.json +119 -0
- package/package.json +17 -0
- package/src/generators/action/action.impl.d.ts +3 -0
- package/src/generators/action/action.impl.js +41 -0
- package/src/generators/action/action.impl.js.map +1 -0
- package/src/generators/action/schema.d.ts +4 -0
- package/src/generators/action/schema.json +26 -0
- package/src/generators/application/application.impl.d.ts +3 -0
- package/src/generators/application/application.impl.js +94 -0
- package/src/generators/application/application.impl.js.map +1 -0
- package/src/generators/application/files/common/README.md__tmpl__ +54 -0
- package/src/generators/application/files/common/app/root.tsx__tmpl__ +32 -0
- package/src/generators/application/files/common/app/routes/index.tsx__tmpl__ +32 -0
- package/src/generators/application/files/common/public/favicon.ico +0 -0
- package/src/generators/application/files/common/remix.config.js__tmpl__ +11 -0
- package/src/generators/application/files/common/remix.env.d.ts__tmpl__ +2 -0
- package/src/generators/application/files/common/tsconfig.json__tmpl__ +18 -0
- package/src/generators/application/files/integrated/.gitignore__tmpl__ +4 -0
- package/src/generators/application/files/integrated/package.json__tmpl__ +32 -0
- package/src/generators/application/lib/normalize-options.d.ts +8 -0
- package/src/generators/application/lib/normalize-options.js +20 -0
- package/src/generators/application/lib/normalize-options.js.map +1 -0
- package/src/generators/application/schema.d.ts +6 -0
- package/src/generators/application/schema.json +32 -0
- package/src/generators/cypress/cypress.impl.d.ts +2 -0
- package/src/generators/cypress/cypress.impl.js +45 -0
- package/src/generators/cypress/cypress.impl.js.map +1 -0
- package/src/generators/cypress/schema.json +55 -0
- package/src/generators/library/library.impl.d.ts +3 -0
- package/src/generators/library/library.impl.js +57 -0
- package/src/generators/library/library.impl.js.map +1 -0
- package/src/generators/library/schema.d.ts +9 -0
- package/src/generators/library/schema.json +44 -0
- package/src/generators/loader/loader.impl.d.ts +3 -0
- package/src/generators/loader/loader.impl.js +41 -0
- package/src/generators/loader/loader.impl.js.map +1 -0
- package/src/generators/loader/schema.d.ts +4 -0
- package/src/generators/loader/schema.json +26 -0
- package/src/generators/meta/lib/normalize-options.d.ts +3 -0
- package/src/generators/meta/lib/normalize-options.js +15 -0
- package/src/generators/meta/lib/normalize-options.js.map +1 -0
- package/src/generators/meta/lib/v1.impl.d.ts +3 -0
- package/src/generators/meta/lib/v1.impl.js +30 -0
- package/src/generators/meta/lib/v1.impl.js.map +1 -0
- package/src/generators/meta/lib/v2.impl.d.ts +3 -0
- package/src/generators/meta/lib/v2.impl.js +30 -0
- package/src/generators/meta/lib/v2.impl.js.map +1 -0
- package/src/generators/meta/meta.impl.d.ts +3 -0
- package/src/generators/meta/meta.impl.js +22 -0
- package/src/generators/meta/meta.impl.js.map +1 -0
- package/src/generators/meta/schema.d.ts +5 -0
- package/src/generators/meta/schema.json +30 -0
- package/src/generators/preset/lib/normalize-options.d.ts +8 -0
- package/src/generators/preset/lib/normalize-options.js +18 -0
- package/src/generators/preset/lib/normalize-options.js.map +1 -0
- package/src/generators/preset/preset.impl.d.ts +3 -0
- package/src/generators/preset/preset.impl.js +29 -0
- package/src/generators/preset/preset.impl.js.map +1 -0
- package/src/generators/preset/schema.d.ts +4 -0
- package/src/generators/preset/schema.json +13 -0
- package/src/generators/resource-route/resource-route.impl.d.ts +3 -0
- package/src/generators/resource-route/resource-route.impl.js +35 -0
- package/src/generators/resource-route/resource-route.impl.js.map +1 -0
- package/src/generators/resource-route/schema.d.ts +7 -0
- package/src/generators/resource-route/schema.json +48 -0
- package/src/generators/route/route.impl.d.ts +3 -0
- package/src/generators/route/route.impl.js +65 -0
- package/src/generators/route/route.impl.js.map +1 -0
- package/src/generators/route/schema.d.ts +9 -0
- package/src/generators/route/schema.json +59 -0
- package/src/generators/setup/schema.json +13 -0
- package/src/generators/setup/setup.impl.d.ts +2 -0
- package/src/generators/setup/setup.impl.js +34 -0
- package/src/generators/setup/setup.impl.js.map +1 -0
- package/src/generators/style/schema.d.ts +4 -0
- package/src/generators/style/schema.json +33 -0
- package/src/generators/style/style.impl.d.ts +3 -0
- package/src/generators/style/style.impl.js +53 -0
- package/src/generators/style/style.impl.js.map +1 -0
- package/src/index.d.ts +0 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -0
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.d.ts +6 -0
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js +45 -0
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js.map +1 -0
- package/src/migrations/update-15-8-6/update-remix-env-d.d.ts +6 -0
- package/src/migrations/update-15-8-6/update-remix-env-d.js +27 -0
- package/src/migrations/update-15-8-6/update-remix-env-d.js.map +1 -0
- package/src/utils/get-default-export-name.d.ts +2 -0
- package/src/utils/get-default-export-name.js +10 -0
- package/src/utils/get-default-export-name.js.map +1 -0
- package/src/utils/get-default-export.d.ts +2 -0
- package/src/utils/get-default-export.js +16 -0
- package/src/utils/get-default-export.js.map +1 -0
- package/src/utils/get-remix-projects.d.ts +2 -0
- package/src/utils/get-remix-projects.js +15 -0
- package/src/utils/get-remix-projects.js.map +1 -0
- package/src/utils/insert-import.d.ts +4 -0
- package/src/utils/insert-import.js +55 -0
- package/src/utils/insert-import.js.map +1 -0
- package/src/utils/insert-statement-after-imports.d.ts +5 -0
- package/src/utils/insert-statement-after-imports.js +29 -0
- package/src/utils/insert-statement-after-imports.js.map +1 -0
- package/src/utils/insert-statement-in-default-function.d.ts +2 -0
- package/src/utils/insert-statement-in-default-function.js +24 -0
- package/src/utils/insert-statement-in-default-function.js.map +1 -0
- package/src/utils/remix-config.d.ts +5 -0
- package/src/utils/remix-config.js +22 -0
- package/src/utils/remix-config.js.map +1 -0
- package/src/utils/remix-route-utils.d.ts +13 -0
- package/src/utils/remix-route-utils.js +64 -0
- package/src/utils/remix-route-utils.js.map +1 -0
- package/src/utils/versions.d.ts +11 -0
- package/src/utils/versions.js +24 -0
- package/src/utils/versions.js.map +1 -0
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<p style="text-align: center;"><img src="https://github.com/nrwl/nx-labs/raw/main/packages/remix/nx-remix.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
|
|
2
|
+
|
|
3
|
+
Next generation full stack framework and build system together. Build better websites with [Remix](https://remix.run/) and [Nx](https://nx.dev).
|
|
4
|
+
|
|
5
|
+
Nx makes supercharges your builds, and the optional [Nx Cloud](https://nx.app) provide out-of-the-box distributed caching, distributed task execution, and valuable workspace insights.
|
|
6
|
+
|
|
7
|
+
## Creating new Remix workspace
|
|
8
|
+
|
|
9
|
+
Use `--preset=@nrwl/remix` when creating new workspace.
|
|
10
|
+
|
|
11
|
+
e.g.
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx create-nx-workspace@latest acme \
|
|
15
|
+
--preset=@nrwl/remix \
|
|
16
|
+
--project=demo
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Now, you can go into the `acme` folder and start development.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
cd acme
|
|
23
|
+
npx nx dev demo
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Note:** This command runs the `dev` script in `apps/demo/package.json`.
|
|
27
|
+
|
|
28
|
+
Start the production server with one command.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx nx start demo
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Note:** This will run the build before starting (as defined in `nx.json`).
|
|
35
|
+
|
|
36
|
+
## Existing workspaces
|
|
37
|
+
|
|
38
|
+
You can add Remix to any existing Nx workspace.
|
|
39
|
+
|
|
40
|
+
First, install the plugin:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install --save-dev @nrwl/remix
|
|
44
|
+
|
|
45
|
+
# Or with yarn
|
|
46
|
+
yarn add -D @nrwl/remix
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Then, run the setup generator:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npx nx g @nrwl/remix:setup
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
You can then add your first app and run it:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx nx g @nrwl/remix:app demo
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Adding new routes
|
|
62
|
+
|
|
63
|
+
Add a new route with one command.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
npx nx g route
|
|
67
|
+
|
|
68
|
+
# e.g.
|
|
69
|
+
npx nx g route foo/bar --project=demo
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Browse to `http://localhost:3000/foo/bar` to see the new route.
|
|
73
|
+
|
|
74
|
+
## Workspace libraries
|
|
75
|
+
|
|
76
|
+
The Remix setup leverages npm/yarn/pnpm workspaces and Nx buildable libraries.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx nx g @nrwl/remix:lib mylib
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Import the new library in your app.
|
|
83
|
+
|
|
84
|
+
```typescript jsx
|
|
85
|
+
// apps/demo/app/root.tsx
|
|
86
|
+
import { Mylib } from '@acme/mylib';
|
|
87
|
+
|
|
88
|
+
// ...
|
|
89
|
+
|
|
90
|
+
export default function App() {
|
|
91
|
+
return (
|
|
92
|
+
<Document>
|
|
93
|
+
<Layout>
|
|
94
|
+
<Mylib />
|
|
95
|
+
<Outlet />
|
|
96
|
+
</Layout>
|
|
97
|
+
</Document>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Now, run the dev server again to see the new library in action.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx nx dev demo
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Note:** You must restart the server if you make any changes to your library. Luckily, with Nx cache this operation should be super fast.
|
|
109
|
+
|
|
110
|
+
## Contributing
|
|
111
|
+
|
|
112
|
+
### Running unit tests
|
|
113
|
+
|
|
114
|
+
Run `nx test demo` to execute the unit tests via [Jest](https://jestjs.io).
|
|
115
|
+
|
|
116
|
+
### Publishing
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
nx publish demo --ver=[version]
|
|
120
|
+
```
|
package/generators.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"name": "NxRemix",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"extends": ["@nx/react"],
|
|
6
|
+
"generators": {
|
|
7
|
+
"preset": {
|
|
8
|
+
"implementation": "./src/generators/preset/preset.impl",
|
|
9
|
+
"schema": "./src/generators/preset/schema.json",
|
|
10
|
+
"description": "Generate a new Remix workspace",
|
|
11
|
+
"hidden": true
|
|
12
|
+
},
|
|
13
|
+
"setup": {
|
|
14
|
+
"implementation": "./src/generators/setup/setup.impl",
|
|
15
|
+
"schema": "./src/generators/setup/schema.json",
|
|
16
|
+
"description": "Setup a Remix in an existing workspace",
|
|
17
|
+
"hidden": true
|
|
18
|
+
},
|
|
19
|
+
"application": {
|
|
20
|
+
"implementation": "./src/generators/application/application.impl",
|
|
21
|
+
"schema": "./src/generators/application/schema.json",
|
|
22
|
+
"description": "Generate a new Remix application",
|
|
23
|
+
"aliases": ["app"],
|
|
24
|
+
"x-type": "application"
|
|
25
|
+
},
|
|
26
|
+
"library": {
|
|
27
|
+
"implementation": "./src/generators/library/library.impl",
|
|
28
|
+
"schema": "./src/generators/library/schema.json",
|
|
29
|
+
"description": "Generate a new library",
|
|
30
|
+
"aliases": ["lib"],
|
|
31
|
+
"x-type": "library"
|
|
32
|
+
},
|
|
33
|
+
"route": {
|
|
34
|
+
"implementation": "./src/generators/route/route.impl",
|
|
35
|
+
"schema": "./src/generators/route/schema.json",
|
|
36
|
+
"description": "Generate a new route"
|
|
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
|
+
},
|
|
63
|
+
"cypress": {
|
|
64
|
+
"implementation": "./src/generators/cypress/cypress.impl",
|
|
65
|
+
"schema": "./src/generators/cypress/schema.json",
|
|
66
|
+
"description": "Generate a project for testing Remix apps using Cypress"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
package/migrations.json
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schematics": {},
|
|
3
|
+
"packageJsonUpdates": {
|
|
4
|
+
"14.5.4": {
|
|
5
|
+
"version": "14.5.4",
|
|
6
|
+
"packages": {
|
|
7
|
+
"@remix-run/react": {
|
|
8
|
+
"version": "^1.6.8",
|
|
9
|
+
"alwaysAddToPackageJson": true
|
|
10
|
+
},
|
|
11
|
+
"@remix-run/node": {
|
|
12
|
+
"version": "^1.6.8",
|
|
13
|
+
"alwaysAddToPackageJson": true
|
|
14
|
+
},
|
|
15
|
+
"@remix-run/serve": {
|
|
16
|
+
"version": "^1.6.8",
|
|
17
|
+
"alwaysAddToPackageJson": true
|
|
18
|
+
},
|
|
19
|
+
"@remix-run/dev": {
|
|
20
|
+
"version": "^1.6.8",
|
|
21
|
+
"alwaysAddToPackageJson": true
|
|
22
|
+
},
|
|
23
|
+
"@remix-run/eslint-config": {
|
|
24
|
+
"version": "^1.6.8",
|
|
25
|
+
"alwaysAddToPackageJson": true
|
|
26
|
+
},
|
|
27
|
+
"react": {
|
|
28
|
+
"version": "^18.2.0",
|
|
29
|
+
"alwaysAddToPackageJson": true
|
|
30
|
+
},
|
|
31
|
+
"react-dom": {
|
|
32
|
+
"version": "^18.2.0",
|
|
33
|
+
"alwaysAddToPackageJson": true
|
|
34
|
+
},
|
|
35
|
+
"@types/react-dom": {
|
|
36
|
+
"version": "^18.0.6",
|
|
37
|
+
"alwaysAddToPackageJson": true
|
|
38
|
+
},
|
|
39
|
+
"@types/react": {
|
|
40
|
+
"version": "^18.0.15",
|
|
41
|
+
"alwaysAddToPackageJson": true
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"15.8.6": {
|
|
46
|
+
"version": "15.8.6",
|
|
47
|
+
"packages": {
|
|
48
|
+
"@remix-run/node": {
|
|
49
|
+
"version": "^1.14.0",
|
|
50
|
+
"alwaysAddToPackageJson": true
|
|
51
|
+
},
|
|
52
|
+
"@remix-run/react": {
|
|
53
|
+
"version": "^1.14.0",
|
|
54
|
+
"alwaysAddToPackageJson": true
|
|
55
|
+
},
|
|
56
|
+
"@remix-run/serve": {
|
|
57
|
+
"version": "^1.14.0",
|
|
58
|
+
"alwaysAddToPackageJson": true
|
|
59
|
+
},
|
|
60
|
+
"@remix-run/dev": {
|
|
61
|
+
"version": "^1.14.0",
|
|
62
|
+
"alwaysAddToPackageJson": true
|
|
63
|
+
},
|
|
64
|
+
"@remix-run/eslint-config": {
|
|
65
|
+
"version": "^1.14.0",
|
|
66
|
+
"alwaysAddToPackageJson": true
|
|
67
|
+
},
|
|
68
|
+
"@types/react-dom": {
|
|
69
|
+
"version": "^18.0.8",
|
|
70
|
+
"alwaysAddToPackageJson": true
|
|
71
|
+
},
|
|
72
|
+
"@types/react": {
|
|
73
|
+
"version": "^18.0.25",
|
|
74
|
+
"alwaysAddToPackageJson": true
|
|
75
|
+
},
|
|
76
|
+
"isbot": {
|
|
77
|
+
"version": "^3.6.5",
|
|
78
|
+
"alwaysAddToPackageJson": true
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"15.9.6": {
|
|
83
|
+
"@remix-run/node": {
|
|
84
|
+
"version": "^1.15.0",
|
|
85
|
+
"alwaysAddToPackageJson": true
|
|
86
|
+
},
|
|
87
|
+
"@remix-run/react": {
|
|
88
|
+
"version": "^1.15.0",
|
|
89
|
+
"alwaysAddToPackageJson": true
|
|
90
|
+
},
|
|
91
|
+
"@remix-run/serve": {
|
|
92
|
+
"version": "^1.15.0",
|
|
93
|
+
"alwaysAddToPackageJson": true
|
|
94
|
+
},
|
|
95
|
+
"@remix-run/dev": {
|
|
96
|
+
"version": "^1.15.0",
|
|
97
|
+
"alwaysAddToPackageJson": true
|
|
98
|
+
},
|
|
99
|
+
"@remix-run/eslint-config": {
|
|
100
|
+
"version": "^1.15.0",
|
|
101
|
+
"alwaysAddToPackageJson": true
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
"generators": {
|
|
106
|
+
"update-tsconfig-and-remix-config-for-1-6-8": {
|
|
107
|
+
"version": "14.5.4",
|
|
108
|
+
"cli": "nx",
|
|
109
|
+
"description": "Update tsconfig.json and tsconfig.json to enable import of workspace libs",
|
|
110
|
+
"factory": "./src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8"
|
|
111
|
+
},
|
|
112
|
+
"update-remix-env-config": {
|
|
113
|
+
"version": "15.8.6",
|
|
114
|
+
"cli": "nx",
|
|
115
|
+
"description": "Update remix.env.d.ts for node types import",
|
|
116
|
+
"factory": "./src/migrations/update-15-8-6/update-remix-env-d"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nx/remix",
|
|
3
|
+
"version": "16.0.0-beta.0",
|
|
4
|
+
"main": "src/index.js",
|
|
5
|
+
"generators": "./generators.json",
|
|
6
|
+
"dependencies": {
|
|
7
|
+
"@nx/devkit": "^16.0.0",
|
|
8
|
+
"@nx/js": "^16.0.0",
|
|
9
|
+
"@nx/react": "^16.0.0",
|
|
10
|
+
"tslib": "^2.3.1"
|
|
11
|
+
},
|
|
12
|
+
"ng-update": {
|
|
13
|
+
"requirements": {},
|
|
14
|
+
"migrations": "./migrations.json"
|
|
15
|
+
},
|
|
16
|
+
"types": "./src/index.d.ts"
|
|
17
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/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 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
|
+
function default_1(tree, schema) {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
const routeFilePath = (0, remix_route_utils_1.resolveRemixRouteFile)(tree, schema.path, schema.project);
|
|
12
|
+
if (!tree.exists(routeFilePath)) {
|
|
13
|
+
throw new Error(`Route path does not exist: ${routeFilePath}. Please generate a Remix route first.`);
|
|
14
|
+
}
|
|
15
|
+
(0, insert_import_1.insertImport)(tree, routeFilePath, 'ActionArgs', '@remix-run/node', {
|
|
16
|
+
typeOnly: true,
|
|
17
|
+
});
|
|
18
|
+
(0, insert_import_1.insertImport)(tree, routeFilePath, 'json', '@remix-run/node');
|
|
19
|
+
(0, insert_import_1.insertImport)(tree, routeFilePath, 'useActionData', '@remix-run/react');
|
|
20
|
+
(0, insert_statement_after_imports_1.insertStatementAfterImports)(tree, routeFilePath, `
|
|
21
|
+
export const action = async ({ request }: ActionArgs) => {
|
|
22
|
+
let formData = await request.formData();
|
|
23
|
+
|
|
24
|
+
return json({message: formData.toString()}, { status: 200 });
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
`);
|
|
28
|
+
const statement = `\nconst actionMessage = useActionData<typeof action>();`;
|
|
29
|
+
try {
|
|
30
|
+
(0, insert_statement_in_default_function_1.insertStatementInDefaultFunction)(tree, routeFilePath, statement);
|
|
31
|
+
}
|
|
32
|
+
catch (err) {
|
|
33
|
+
// eslint-disable-next-line no-empty
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.default = default_1;
|
|
41
|
+
//# 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,uCAA+C;AAC/C,6DAAyD;AACzD,+FAAyF;AACzF,2GAAoG;AACpG,qEAAsE;AAGtE,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,YAAY,EAAE,iBAAiB,EAAE;YACjE,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,IAAA,4DAA2B,EACzB,IAAI,EACJ,aAAa,EACb;;;;;;;KAOC,CACF,CAAC;QAEF,MAAM,SAAS,GAAG,yDAAyD,CAAC;QAE5E,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;AAzCD,4BAyCC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "action",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"path": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The route path or path to the filename of the route.",
|
|
9
|
+
"$default": {
|
|
10
|
+
"$source": "argv",
|
|
11
|
+
"index": 0
|
|
12
|
+
},
|
|
13
|
+
"x-prompt": "What is the path of the route? (e.g. 'foo/bar')"
|
|
14
|
+
},
|
|
15
|
+
"project": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"description": "The name of the project.",
|
|
18
|
+
"$default": {
|
|
19
|
+
"$source": "projectName"
|
|
20
|
+
},
|
|
21
|
+
"x-prompt": "What project is this route for?",
|
|
22
|
+
"pattern": "^[a-zA-Z].*$"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": ["path", "project"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const create_ts_config_1 = require("@nx/js/src/utils/typescript/create-ts-config");
|
|
6
|
+
const versions_1 = require("../../utils/versions");
|
|
7
|
+
const normalize_options_1 = require("./lib/normalize-options");
|
|
8
|
+
function default_1(tree, _options) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
11
|
+
const tasks = [];
|
|
12
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
13
|
+
root: options.projectRoot,
|
|
14
|
+
sourceRoot: `${options.projectRoot}`,
|
|
15
|
+
projectType: 'application',
|
|
16
|
+
tags: options.parsedTags,
|
|
17
|
+
});
|
|
18
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
19
|
+
'@remix-run/node': versions_1.remixVersion,
|
|
20
|
+
'@remix-run/react': versions_1.remixVersion,
|
|
21
|
+
'@remix-run/serve': versions_1.remixVersion,
|
|
22
|
+
isbot: versions_1.isbotVersion,
|
|
23
|
+
react: versions_1.reactVersion,
|
|
24
|
+
'react-dom': versions_1.reactDomVersion,
|
|
25
|
+
}, {
|
|
26
|
+
'@remix-run/dev': versions_1.remixVersion,
|
|
27
|
+
'@remix-run/eslint-config': versions_1.remixVersion,
|
|
28
|
+
'@types/react': versions_1.typesReactVersion,
|
|
29
|
+
'@types/react-dom': versions_1.typesReactDomVersion,
|
|
30
|
+
eslint: versions_1.eslintVersion,
|
|
31
|
+
typescript: versions_1.typescriptVersion,
|
|
32
|
+
});
|
|
33
|
+
tasks.push(installTask);
|
|
34
|
+
const vars = Object.assign(Object.assign({}, options), { tmpl: '', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), remixVersion: versions_1.remixVersion,
|
|
35
|
+
isbotVersion: versions_1.isbotVersion,
|
|
36
|
+
reactVersion: versions_1.reactVersion,
|
|
37
|
+
reactDomVersion: versions_1.reactDomVersion,
|
|
38
|
+
typesReactVersion: versions_1.typesReactVersion,
|
|
39
|
+
typesReactDomVersion: versions_1.typesReactDomVersion,
|
|
40
|
+
eslintVersion: versions_1.eslintVersion,
|
|
41
|
+
typescriptVersion: versions_1.typescriptVersion });
|
|
42
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/common'), options.projectRoot, vars);
|
|
43
|
+
if (options.rootProject) {
|
|
44
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
45
|
+
json['scripts'] = {
|
|
46
|
+
build: 'nx exec -- remix build',
|
|
47
|
+
dev: 'nx exec -- remix dev',
|
|
48
|
+
start: 'nx exec -- remix-serve build',
|
|
49
|
+
typecheck: 'nx exec -- tsc',
|
|
50
|
+
};
|
|
51
|
+
return json;
|
|
52
|
+
});
|
|
53
|
+
const gitignore = tree.read('.gitignore', 'utf-8');
|
|
54
|
+
tree.write('.gitignore', `${gitignore}\n.cache\nbuild\npublic/build\n.env\n`);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/integrated'), options.projectRoot, vars);
|
|
58
|
+
}
|
|
59
|
+
if (options.rootProject && tree.exists('tsconfig.base.json')) {
|
|
60
|
+
// If this is a standalone project, merge tsconfig.json and tsconfig.base.json.
|
|
61
|
+
const tsConfigBaseJson = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
|
|
62
|
+
(0, devkit_1.updateJson)(tree, 'tsconfig.json', (json) => {
|
|
63
|
+
var _a, _b, _c, _d;
|
|
64
|
+
delete json.extends;
|
|
65
|
+
json.compilerOptions = Object.assign(Object.assign(Object.assign({}, tsConfigBaseJson.compilerOptions), json.compilerOptions), {
|
|
66
|
+
// Taken from remix default setup
|
|
67
|
+
// https://github.com/remix-run/remix/blob/68c8982/templates/remix/tsconfig.json#L15-L17
|
|
68
|
+
paths: {
|
|
69
|
+
'~/*': ['./app/*'],
|
|
70
|
+
} });
|
|
71
|
+
json.include = [
|
|
72
|
+
...((_a = tsConfigBaseJson.include) !== null && _a !== void 0 ? _a : []),
|
|
73
|
+
...((_b = json.include) !== null && _b !== void 0 ? _b : []),
|
|
74
|
+
];
|
|
75
|
+
json.exclude = [
|
|
76
|
+
...((_c = tsConfigBaseJson.exclude) !== null && _c !== void 0 ? _c : []),
|
|
77
|
+
...((_d = json.exclude) !== null && _d !== void 0 ? _d : []),
|
|
78
|
+
];
|
|
79
|
+
return json;
|
|
80
|
+
});
|
|
81
|
+
tree.delete('tsconfig.base.json');
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// Otherwise, extract the tsconfig.base.json from tsconfig.json so we can share settings.
|
|
85
|
+
(0, create_ts_config_1.extractTsConfigBase)(tree);
|
|
86
|
+
}
|
|
87
|
+
if (!options.skipFormat) {
|
|
88
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
89
|
+
}
|
|
90
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
exports.default = default_1;
|
|
94
|
+
//# sourceMappingURL=application.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/application/application.impl.ts"],"names":[],"mappings":";;;AAAA,uCAYoB;AACpB,mFAAmF;AACnF,mDAS8B;AAC9B,+DAA2D;AAG3D,mBAA+B,IAAU,EAAE,QAAgC;;QACzE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,IAAA,gCAAuB,EAAC,IAAI,EAAE,OAAO,CAAC,WAAW,EAAE;YACjD,IAAI,EAAE,OAAO,CAA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AAE,CAAC;iBACxB,CAAC;gBACF,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;SACnC;aAAM;YACL,yFAAyF;YACzF,IAAA,sCAAmB,EAAC,IAAI,CAAC,CAAC;SAC3B;QAED,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAjHD,4BAiHC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Welcome to Nx + Remix!
|
|
2
|
+
|
|
3
|
+
- [Remix Docs](https://remix.run/docs)
|
|
4
|
+
- [Nx Docs](https://nx.dev)
|
|
5
|
+
|
|
6
|
+
## Development
|
|
7
|
+
|
|
8
|
+
From your terminal:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npx nx dev <%= projectName %>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
This starts your app in development mode, rebuilding assets on file changes.
|
|
15
|
+
|
|
16
|
+
## Deployment
|
|
17
|
+
|
|
18
|
+
First, build your app for production:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npx nx build <%= projectName %>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then run the app in production mode:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npx nx start <%= projectName %>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Now you'll need to pick a host to deploy it to.
|
|
31
|
+
|
|
32
|
+
### DIY
|
|
33
|
+
|
|
34
|
+
If you're familiar with deploying node applications, the built-in Remix app server is production-ready.
|
|
35
|
+
|
|
36
|
+
Make sure to deploy the output of `remix build`
|
|
37
|
+
|
|
38
|
+
- `packages/<%= projectName %>/build/`
|
|
39
|
+
- `packages/<%= projectName %>/public/build/`
|
|
40
|
+
|
|
41
|
+
### Using a Template
|
|
42
|
+
|
|
43
|
+
When you ran `npx create-remix@latest` there were a few choices for hosting. You can run that again to create a new project, then copy over your `app/` folder to the new project that's pre-configured for your target server.
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
cd ..
|
|
47
|
+
# create a new project, and pick a pre-configured host
|
|
48
|
+
npx create-remix@latest
|
|
49
|
+
cd my-new-remix-app
|
|
50
|
+
# remove the new project's app (not the old one!)
|
|
51
|
+
rm -rf app
|
|
52
|
+
# copy your app over
|
|
53
|
+
cp -R ../my-old-remix-app/app app
|
|
54
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { MetaFunction } from "@remix-run/node";
|
|
2
|
+
import {
|
|
3
|
+
Links,
|
|
4
|
+
LiveReload,
|
|
5
|
+
Meta,
|
|
6
|
+
Outlet,
|
|
7
|
+
Scripts,
|
|
8
|
+
ScrollRestoration,
|
|
9
|
+
} from "@remix-run/react";
|
|
10
|
+
|
|
11
|
+
export const meta: MetaFunction = () => ({
|
|
12
|
+
charset: "utf-8",
|
|
13
|
+
title: "New Remix App",
|
|
14
|
+
viewport: "width=device-width,initial-scale=1",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default function App() {
|
|
18
|
+
return (
|
|
19
|
+
<html lang="en">
|
|
20
|
+
<head>
|
|
21
|
+
<Meta />
|
|
22
|
+
<Links />
|
|
23
|
+
</head>
|
|
24
|
+
<body>
|
|
25
|
+
<Outlet />
|
|
26
|
+
<ScrollRestoration />
|
|
27
|
+
<Scripts />
|
|
28
|
+
<LiveReload />
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default function Index() {
|
|
2
|
+
return (
|
|
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>
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {import('@remix-run/dev').AppConfig}
|
|
3
|
+
*/
|
|
4
|
+
module.exports = {
|
|
5
|
+
ignoredRouteFiles: ["**/.*"],
|
|
6
|
+
// appDirectory: "app",
|
|
7
|
+
// assetsBuildDirectory: "public/build",
|
|
8
|
+
// serverBuildPath: "build/index.js",
|
|
9
|
+
// publicPath: "/build/",
|
|
10
|
+
watchPaths: ["<%= offsetFromRoot %>libs"]
|
|
11
|
+
};
|