@nrwl/remix 15.9.5 → 16.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +6 -115
- package/generators.json +2 -67
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/package.json +8 -10
- package/migrations.json +0 -96
- package/src/generators/action/action.impl.d.ts +0 -3
- package/src/generators/action/action.impl.js +0 -48
- package/src/generators/action/action.impl.js.map +0 -1
- package/src/generators/action/schema.d.ts +0 -4
- package/src/generators/action/schema.json +0 -27
- package/src/generators/application/application.impl.d.ts +0 -3
- package/src/generators/application/application.impl.js +0 -95
- package/src/generators/application/application.impl.js.map +0 -1
- package/src/generators/application/files/common/README.md__tmpl__ +0 -54
- package/src/generators/application/files/common/app/root.tsx__tmpl__ +0 -32
- package/src/generators/application/files/common/app/routes/index.tsx__tmpl__ +0 -32
- package/src/generators/application/files/common/public/favicon.ico +0 -0
- package/src/generators/application/files/common/remix.config.js__tmpl__ +0 -11
- package/src/generators/application/files/common/remix.env.d.ts__tmpl__ +0 -2
- package/src/generators/application/files/common/tsconfig.json__tmpl__ +0 -18
- package/src/generators/application/files/integrated/.gitignore__tmpl__ +0 -4
- package/src/generators/application/files/integrated/package.json__tmpl__ +0 -32
- package/src/generators/application/lib/normalize-options.d.ts +0 -8
- package/src/generators/application/lib/normalize-options.js +0 -20
- package/src/generators/application/lib/normalize-options.js.map +0 -1
- package/src/generators/application/schema.d.ts +0 -6
- package/src/generators/application/schema.json +0 -33
- package/src/generators/cypress/cypress.impl.d.ts +0 -2
- package/src/generators/cypress/cypress.impl.js +0 -27
- package/src/generators/cypress/cypress.impl.js.map +0 -1
- package/src/generators/cypress/schema.json +0 -56
- package/src/generators/library/library.impl.d.ts +0 -3
- package/src/generators/library/library.impl.js +0 -61
- package/src/generators/library/library.impl.js.map +0 -1
- package/src/generators/library/schema.d.ts +0 -6
- package/src/generators/library/schema.json +0 -39
- package/src/generators/loader/loader.impl.d.ts +0 -3
- package/src/generators/loader/loader.impl.js +0 -48
- package/src/generators/loader/loader.impl.js.map +0 -1
- package/src/generators/loader/schema.d.ts +0 -4
- package/src/generators/loader/schema.json +0 -27
- package/src/generators/meta/meta.impl.d.ts +0 -3
- package/src/generators/meta/meta.impl.js +0 -29
- package/src/generators/meta/meta.impl.js.map +0 -1
- package/src/generators/meta/schema.d.ts +0 -4
- package/src/generators/meta/schema.json +0 -27
- package/src/generators/preset/lib/normalize-options.d.ts +0 -8
- package/src/generators/preset/lib/normalize-options.js +0 -18
- package/src/generators/preset/lib/normalize-options.js.map +0 -1
- package/src/generators/preset/preset.impl.d.ts +0 -3
- package/src/generators/preset/preset.impl.js +0 -29
- package/src/generators/preset/preset.impl.js.map +0 -1
- package/src/generators/preset/schema.d.ts +0 -4
- package/src/generators/preset/schema.json +0 -14
- package/src/generators/resource-route/resource-route.impl.d.ts +0 -3
- package/src/generators/resource-route/resource-route.impl.js +0 -32
- package/src/generators/resource-route/resource-route.impl.js.map +0 -1
- package/src/generators/resource-route/schema.d.ts +0 -6
- package/src/generators/resource-route/schema.json +0 -44
- package/src/generators/route/route.impl.d.ts +0 -3
- package/src/generators/route/route.impl.js +0 -62
- package/src/generators/route/route.impl.js.map +0 -1
- package/src/generators/route/schema.d.ts +0 -8
- package/src/generators/route/schema.json +0 -55
- package/src/generators/setup/schema.json +0 -14
- package/src/generators/setup/setup.impl.d.ts +0 -2
- package/src/generators/setup/setup.impl.js +0 -35
- package/src/generators/setup/setup.impl.js.map +0 -1
- package/src/generators/style/schema.d.ts +0 -4
- package/src/generators/style/schema.json +0 -34
- package/src/generators/style/style.impl.d.ts +0 -3
- package/src/generators/style/style.impl.js +0 -41
- package/src/generators/style/style.impl.js.map +0 -1
- package/src/index.d.ts +0 -0
- package/src/index.js +0 -1
- package/src/index.js.map +0 -1
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.d.ts +0 -6
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js +0 -45
- package/src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8.js.map +0 -1
- package/src/migrations/update-15-8-6/update-remix-env-d.d.ts +0 -6
- package/src/migrations/update-15-8-6/update-remix-env-d.js +0 -27
- package/src/migrations/update-15-8-6/update-remix-env-d.js.map +0 -1
- package/src/utils/get-default-export-name.d.ts +0 -2
- package/src/utils/get-default-export-name.js +0 -10
- package/src/utils/get-default-export-name.js.map +0 -1
- package/src/utils/get-default-export.d.ts +0 -2
- package/src/utils/get-default-export.js +0 -16
- package/src/utils/get-default-export.js.map +0 -1
- package/src/utils/get-remix-projects.d.ts +0 -2
- package/src/utils/get-remix-projects.js +0 -15
- package/src/utils/get-remix-projects.js.map +0 -1
- package/src/utils/insert-import.d.ts +0 -4
- package/src/utils/insert-import.js +0 -55
- package/src/utils/insert-import.js.map +0 -1
- package/src/utils/insert-statement-after-imports.d.ts +0 -5
- package/src/utils/insert-statement-after-imports.js +0 -29
- package/src/utils/insert-statement-after-imports.js.map +0 -1
- package/src/utils/insert-statement-in-default-function.d.ts +0 -2
- package/src/utils/insert-statement-in-default-function.js +0 -24
- package/src/utils/insert-statement-in-default-function.js.map +0 -1
- package/src/utils/remix-route-utils.d.ts +0 -11
- package/src/utils/remix-route-utils.js +0 -53
- package/src/utils/remix-route-utils.js.map +0 -1
- package/src/utils/versions.d.ts +0 -8
- package/src/utils/versions.js +0 -12
- package/src/utils/versions.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2017-2023 Narwhal Technologies Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,120 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
## @nrwl/remix has been deprecated!
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
@nrwl/remix has been deprecated in favor of [@nx/remix](https://www.npmjs.com/package/@nx/remix). Please use that instead.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
@nrwl/remix will no longer be published in Nx v17.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
# Nx: Smart, Fast and Extensible Build System
|
|
10
10
|
|
|
11
|
-
|
|
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
|
-
```
|
|
11
|
+
Nx is a next generation build system with first class monorepo support and powerful integrations.
|
package/generators.json
CHANGED
|
@@ -1,69 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"version": "0.0.1",
|
|
5
|
-
"extends": ["@nrwl/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
|
-
}
|
|
2
|
+
"extends": ["@nx/remix"],
|
|
3
|
+
"schematics": {}
|
|
69
4
|
}
|
package/index.js
ADDED
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages-legacy/remix/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/remix",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "16.0.0-beta.1",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"generators": "./generators.json",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@
|
|
8
|
-
"@nrwl/js": "15.9.2",
|
|
9
|
-
"@nrwl/react": "15.9.2",
|
|
10
|
-
"@swc/core": "1.3.35",
|
|
11
|
-
"tslib": "2.3.1"
|
|
7
|
+
"@nx/remix": "file:../../packages/remix"
|
|
12
8
|
},
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"migrations": "./migrations.json"
|
|
9
|
+
"repository": {
|
|
10
|
+
"directory": "packages-legacy/remix"
|
|
16
11
|
},
|
|
17
|
-
"
|
|
12
|
+
"nx-migrations": {
|
|
13
|
+
"migrations": "@nx/remix/migrations.json"
|
|
14
|
+
},
|
|
15
|
+
"types": "./index.d.ts"
|
|
18
16
|
}
|
package/migrations.json
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"schematics": {
|
|
3
|
-
"update-tsconfig-and-remix-config-for-1-6-8": {
|
|
4
|
-
"version": "14.5.4",
|
|
5
|
-
"cli": "nx",
|
|
6
|
-
"description": "Update tsconfig.json and tsconfig.json to enable import of workspace libs",
|
|
7
|
-
"factory": "./src/migrations/update-14-5-4/update-tsconfig-and-remix-config-for-1-6-8"
|
|
8
|
-
},
|
|
9
|
-
"update-remix-env-config": {
|
|
10
|
-
"version": "15.8.6",
|
|
11
|
-
"cli": "nx",
|
|
12
|
-
"description": "Update remix.env.d.ts for node types import",
|
|
13
|
-
"factory": "./src/migrations/update-15-8-6/update-remix-env-d"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"packageJsonUpdates": {
|
|
17
|
-
"14.5.4": {
|
|
18
|
-
"version": "14.5.4",
|
|
19
|
-
"packages": {
|
|
20
|
-
"@remix-run/react": {
|
|
21
|
-
"version": "^1.6.8",
|
|
22
|
-
"alwaysAddToPackageJson": true
|
|
23
|
-
},
|
|
24
|
-
"@remix-run/node": {
|
|
25
|
-
"version": "^1.6.8",
|
|
26
|
-
"alwaysAddToPackageJson": true
|
|
27
|
-
},
|
|
28
|
-
"@remix-run/serve": {
|
|
29
|
-
"version": "^1.6.8",
|
|
30
|
-
"alwaysAddToPackageJson": true
|
|
31
|
-
},
|
|
32
|
-
"@remix-run/dev": {
|
|
33
|
-
"version": "^1.6.8",
|
|
34
|
-
"alwaysAddToPackageJson": true
|
|
35
|
-
},
|
|
36
|
-
"@remix-run/eslint-config": {
|
|
37
|
-
"version": "^1.6.8",
|
|
38
|
-
"alwaysAddToPackageJson": true
|
|
39
|
-
},
|
|
40
|
-
"react": {
|
|
41
|
-
"version": "^18.2.0",
|
|
42
|
-
"alwaysAddToPackageJson": true
|
|
43
|
-
},
|
|
44
|
-
"react-dom": {
|
|
45
|
-
"version": "^18.2.0",
|
|
46
|
-
"alwaysAddToPackageJson": true
|
|
47
|
-
},
|
|
48
|
-
"@types/react-dom": {
|
|
49
|
-
"version": "^18.0.6",
|
|
50
|
-
"alwaysAddToPackageJson": true
|
|
51
|
-
},
|
|
52
|
-
"@types/react": {
|
|
53
|
-
"version": "^18.0.15",
|
|
54
|
-
"alwaysAddToPackageJson": true
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"15.8.6": {
|
|
59
|
-
"version": "15.8.6",
|
|
60
|
-
"packages": {
|
|
61
|
-
"@remix-run/node": {
|
|
62
|
-
"version": "^1.14.0",
|
|
63
|
-
"alwaysAddToPackageJson": true
|
|
64
|
-
},
|
|
65
|
-
"@remix-run/react": {
|
|
66
|
-
"version": "^1.14.0",
|
|
67
|
-
"alwaysAddToPackageJson": true
|
|
68
|
-
},
|
|
69
|
-
"@remix-run/serve": {
|
|
70
|
-
"version": "^1.14.0",
|
|
71
|
-
"alwaysAddToPackageJson": true
|
|
72
|
-
},
|
|
73
|
-
"@remix-run/dev": {
|
|
74
|
-
"version": "^1.14.0",
|
|
75
|
-
"alwaysAddToPackageJson": true
|
|
76
|
-
},
|
|
77
|
-
"@remix-run/eslint-config": {
|
|
78
|
-
"version": "^1.14.0",
|
|
79
|
-
"alwaysAddToPackageJson": true
|
|
80
|
-
},
|
|
81
|
-
"@types/react-dom": {
|
|
82
|
-
"version": "^18.0.8",
|
|
83
|
-
"alwaysAddToPackageJson": true
|
|
84
|
-
},
|
|
85
|
-
"@types/react": {
|
|
86
|
-
"version": "^18.0.25",
|
|
87
|
-
"alwaysAddToPackageJson": true
|
|
88
|
-
},
|
|
89
|
-
"isbot": {
|
|
90
|
-
"version": "^3.6.5",
|
|
91
|
-
"alwaysAddToPackageJson": true
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
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 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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
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 create_ts_config_1 = require("@nrwl/js/src/utils/typescript/create-ts-config");
|
|
6
|
-
const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
|
|
7
|
-
const versions_1 = require("../../utils/versions");
|
|
8
|
-
const normalize_options_1 = require("./lib/normalize-options");
|
|
9
|
-
function default_1(tree, _options) {
|
|
10
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
12
|
-
const tasks = [];
|
|
13
|
-
(0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
|
|
14
|
-
root: options.projectRoot,
|
|
15
|
-
sourceRoot: `${options.projectRoot}`,
|
|
16
|
-
projectType: 'application',
|
|
17
|
-
tags: options.parsedTags,
|
|
18
|
-
});
|
|
19
|
-
const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
|
|
20
|
-
'@remix-run/node': versions_1.remixVersion,
|
|
21
|
-
'@remix-run/react': versions_1.remixVersion,
|
|
22
|
-
'@remix-run/serve': versions_1.remixVersion,
|
|
23
|
-
isbot: versions_1.isbotVersion,
|
|
24
|
-
react: versions_1.reactVersion,
|
|
25
|
-
'react-dom': versions_1.reactDomVersion,
|
|
26
|
-
}, {
|
|
27
|
-
'@remix-run/dev': versions_1.remixVersion,
|
|
28
|
-
'@remix-run/eslint-config': versions_1.remixVersion,
|
|
29
|
-
'@types/react': versions_1.typesReactVersion,
|
|
30
|
-
'@types/react-dom': versions_1.typesReactDomVersion,
|
|
31
|
-
eslint: versions_1.eslintVersion,
|
|
32
|
-
typescript: versions_1.typescriptVersion,
|
|
33
|
-
});
|
|
34
|
-
tasks.push(installTask);
|
|
35
|
-
const vars = Object.assign(Object.assign({}, options), { tmpl: '', offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot), remixVersion: versions_1.remixVersion,
|
|
36
|
-
isbotVersion: versions_1.isbotVersion,
|
|
37
|
-
reactVersion: versions_1.reactVersion,
|
|
38
|
-
reactDomVersion: versions_1.reactDomVersion,
|
|
39
|
-
typesReactVersion: versions_1.typesReactVersion,
|
|
40
|
-
typesReactDomVersion: versions_1.typesReactDomVersion,
|
|
41
|
-
eslintVersion: versions_1.eslintVersion,
|
|
42
|
-
typescriptVersion: versions_1.typescriptVersion });
|
|
43
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/common'), options.projectRoot, vars);
|
|
44
|
-
if (options.rootProject) {
|
|
45
|
-
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
46
|
-
json['scripts'] = {
|
|
47
|
-
build: 'nx exec -- remix build',
|
|
48
|
-
dev: 'nx exec -- remix dev',
|
|
49
|
-
start: 'nx exec -- remix-serve build',
|
|
50
|
-
typecheck: 'nx exec -- tsc',
|
|
51
|
-
};
|
|
52
|
-
return json;
|
|
53
|
-
});
|
|
54
|
-
const gitignore = tree.read('.gitignore', 'utf-8');
|
|
55
|
-
tree.write('.gitignore', `${gitignore}\n.cache\nbuild\npublic/build\n.env\n`);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/integrated'), options.projectRoot, vars);
|
|
59
|
-
}
|
|
60
|
-
if (options.rootProject && tree.exists('tsconfig.base.json')) {
|
|
61
|
-
// If this is a standalone project, merge tsconfig.json and tsconfig.base.json.
|
|
62
|
-
const tsConfigBaseJson = (0, devkit_1.readJson)(tree, 'tsconfig.base.json');
|
|
63
|
-
(0, devkit_1.updateJson)(tree, 'tsconfig.json', (json) => {
|
|
64
|
-
var _a, _b, _c, _d;
|
|
65
|
-
delete json.extends;
|
|
66
|
-
json.compilerOptions = Object.assign(Object.assign(Object.assign({}, tsConfigBaseJson.compilerOptions), json.compilerOptions), {
|
|
67
|
-
// Taken from remix default setup
|
|
68
|
-
// https://github.com/remix-run/remix/blob/68c8982/templates/remix/tsconfig.json#L15-L17
|
|
69
|
-
paths: {
|
|
70
|
-
'~/*': ['./app/*'],
|
|
71
|
-
} });
|
|
72
|
-
json.include = [
|
|
73
|
-
...((_a = tsConfigBaseJson.include) !== null && _a !== void 0 ? _a : []),
|
|
74
|
-
...((_b = json.include) !== null && _b !== void 0 ? _b : []),
|
|
75
|
-
];
|
|
76
|
-
json.exclude = [
|
|
77
|
-
...((_c = tsConfigBaseJson.exclude) !== null && _c !== void 0 ? _c : []),
|
|
78
|
-
...((_d = json.exclude) !== null && _d !== void 0 ? _d : []),
|
|
79
|
-
];
|
|
80
|
-
return json;
|
|
81
|
-
});
|
|
82
|
-
tree.delete('tsconfig.base.json');
|
|
83
|
-
}
|
|
84
|
-
else {
|
|
85
|
-
// Otherwise, extract the tsconfig.base.json from tsconfig.json so we can share settings.
|
|
86
|
-
(0, create_ts_config_1.extractTsConfigBase)(tree);
|
|
87
|
-
}
|
|
88
|
-
if (!options.skipFormat) {
|
|
89
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
90
|
-
}
|
|
91
|
-
return (0, run_tasks_in_serial_1.runTasksInSerial)(...tasks);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
exports.default = default_1;
|
|
95
|
-
//# sourceMappingURL=application.impl.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"application.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/application/application.impl.ts"],"names":[],"mappings":";;;AAAA,yCAWsB;AACtB,qFAAqF;AACrF,2FAAqF;AACrF,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,CAAC,WAAW;YACzB,UAAU,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE;YACpC,WAAW,EAAE,aAAa;YAC1B,IAAI,EAAE,OAAO,CAAC,UAAU;SACzB,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,IAAA,qCAA4B,EAC9C,IAAI,EACJ;YACE,iBAAiB,EAAE,uBAAY;YAC/B,kBAA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EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAjHD,4BAiHC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
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
|
-
```
|
|
@@ -1,32 +0,0 @@
|
|
|
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
|
-
}
|