@nrwl/remix 1.0.0-alpha.8 → 1.0.0-beta.3
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 +53 -5
- package/generators.json +12 -2
- package/package.json +1 -1
- package/src/generators/application/application.impl.js.map +1 -1
- package/src/generators/application/lib/normalize-options.js +2 -1
- package/src/generators/application/lib/normalize-options.js.map +1 -1
- package/src/generators/application/schema.json +1 -1
- package/src/generators/library/library.impl.js +2 -1
- package/src/generators/library/library.impl.js.map +1 -1
- package/src/generators/preset/lib/normalize-options.d.ts +3 -3
- package/src/generators/preset/lib/normalize-options.js +7 -2
- package/src/generators/preset/lib/normalize-options.js.map +1 -1
- package/src/generators/preset/preset.impl.d.ts +2 -2
- package/src/generators/preset/preset.impl.js +5 -26
- package/src/generators/preset/preset.impl.js.map +1 -1
- package/src/generators/preset/schema.d.ts +1 -1
- package/src/generators/preset/schema.json +1 -1
- package/src/generators/route/route.impl.d.ts +3 -0
- package/src/generators/route/route.impl.js +78 -0
- package/src/generators/route/route.impl.js.map +1 -0
- package/src/generators/route/schema.d.ts +5 -0
- package/src/generators/route/schema.json +40 -0
- package/src/generators/setup/schema.json +14 -0
- package/src/generators/setup/setup.impl.d.ts +4 -0
- package/src/generators/setup/setup.impl.js +71 -0
- package/src/generators/setup/setup.impl.js.map +1 -0
- package/src/index.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
<p style="text-align: center;"><img src="https://github.com/nrwl/nx-labs/raw/main/packages/
|
|
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.
|
|
2
6
|
|
|
3
7
|
## Creating new Remix workspace
|
|
4
8
|
|
|
@@ -21,7 +25,51 @@ npx nx dev demo
|
|
|
21
25
|
|
|
22
26
|
**Note:** This command runs the `dev` script in `apps/demo/package.json`.
|
|
23
27
|
|
|
24
|
-
|
|
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.
|
|
25
73
|
|
|
26
74
|
## Workspace libraries
|
|
27
75
|
|
|
@@ -51,7 +99,7 @@ export default function App() {
|
|
|
51
99
|
}
|
|
52
100
|
```
|
|
53
101
|
|
|
54
|
-
Now, run the dev server again to see the new library in action
|
|
102
|
+
Now, run the dev server again to see the new library in action.
|
|
55
103
|
|
|
56
104
|
```bash
|
|
57
105
|
npx nx dev demo
|
|
@@ -63,10 +111,10 @@ npx nx dev demo
|
|
|
63
111
|
|
|
64
112
|
### Running unit tests
|
|
65
113
|
|
|
66
|
-
Run `nx test
|
|
114
|
+
Run `nx test remix` to execute the unit tests via [Jest](https://jestjs.io).
|
|
67
115
|
|
|
68
116
|
### Publishing
|
|
69
117
|
|
|
70
118
|
```bash
|
|
71
|
-
nx publish
|
|
119
|
+
nx publish remix --ver=[version]
|
|
72
120
|
```
|
package/generators.json
CHANGED
|
@@ -7,12 +7,17 @@
|
|
|
7
7
|
"preset": {
|
|
8
8
|
"factory": "./src/generators/preset/preset.impl",
|
|
9
9
|
"schema": "./src/generators/preset/schema.json",
|
|
10
|
-
"description": "Generate a new
|
|
10
|
+
"description": "Generate a new Remix workspace"
|
|
11
|
+
},
|
|
12
|
+
"setup": {
|
|
13
|
+
"factory": "./src/generators/setup/setup.impl",
|
|
14
|
+
"schema": "./src/generators/setup/schema.json",
|
|
15
|
+
"description": "Setup a Remix in an existing workspace"
|
|
11
16
|
},
|
|
12
17
|
"application": {
|
|
13
18
|
"factory": "./src/generators/application/application.impl",
|
|
14
19
|
"schema": "./src/generators/application/schema.json",
|
|
15
|
-
"description": "Generate a new
|
|
20
|
+
"description": "Generate a new Remix application",
|
|
16
21
|
"aliases": ["app"],
|
|
17
22
|
"x-type": "application"
|
|
18
23
|
},
|
|
@@ -22,6 +27,11 @@
|
|
|
22
27
|
"description": "Generate a new library",
|
|
23
28
|
"aliases": ["lib"],
|
|
24
29
|
"x-type": "library"
|
|
30
|
+
},
|
|
31
|
+
"route": {
|
|
32
|
+
"factory": "./src/generators/route/route.impl",
|
|
33
|
+
"schema": "./src/generators/route/schema.json",
|
|
34
|
+
"description": "Generate a new route"
|
|
25
35
|
}
|
|
26
36
|
}
|
|
27
37
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.impl.js","sourceRoot":"","sources":["../../../../../../packages/
|
|
1
|
+
{"version":3,"file":"application.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/application/application.impl.ts"],"names":[],"mappings":";;;AAAA,yCAQsB;AAEtB,+DAA2D;AAC3D,2FAAqF;AACrF,iDAAyC;AAEzC,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,kBAAkB,EAAE,QAAQ;YAC5B,KAAK,EAAE,SAAS;YAChB,WAAW,EAAE,SAAS;YACtB,KAAK,EAAE,QAAQ;YACf,kBAAkB,EAAE,QAAQ;SAC7B,EACD;YACE,gBAAgB,EAAE,QAAQ;YAC1B,cAAc,EAAE,UAAU;YAC1B,kBAAkB,EAAE,SAAS;YAC7B,UAAU,EAAE,QAAQ;SACrB,CACF,CAAC;QACF,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExB,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EACrC,OAAO,CAAC,WAAW,kCAEd,OAAO,KACV,IAAI,EAAE,EAAE,IAEX,CAAC;QAEF,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACd,IAAA,wBAAQ,EAAC,iBAAiB,EAAE;gBAC1B,GAAG,EAAE,OAAO,CAAC,WAAW;gBACxB,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;aACjB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAnDD,4BAmDC"}
|
|
@@ -3,9 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
5
|
function normalizeOptions(tree, options) {
|
|
6
|
+
const { appsDir } = (0, devkit_1.getWorkspaceLayout)(tree);
|
|
6
7
|
const name = (0, devkit_1.names)(options.name).fileName;
|
|
7
8
|
const projectName = name;
|
|
8
|
-
const projectRoot =
|
|
9
|
+
const projectRoot = (0, devkit_1.joinPathFragments)(appsDir, name);
|
|
9
10
|
const parsedTags = options.tags
|
|
10
11
|
? options.tags.split(',').map((s) => s.trim())
|
|
11
12
|
: [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAKsB;AAQtB,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;IAE/B,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IAC1C,MAAM,WAAW,GAAG,IAAI,CAAC;IACzB,MAAM,WAAW,GAAG,IAAA,0BAAiB,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IACrD,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI;QAC7B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,CAAC,CAAC,EAAE,CAAC;IAEP,uCACK,OAAO,KACV,WAAW;QACX,WAAW;QACX,UAAU,IACV;AACJ,CAAC;AAlBD,4CAkBC"}
|
|
@@ -11,7 +11,8 @@ function default_1(tree, options) {
|
|
|
11
11
|
const tasks = [];
|
|
12
12
|
const name = (0, devkit_1.names)(options.name).fileName;
|
|
13
13
|
const pm = (0, devkit_1.detectPackageManager)();
|
|
14
|
-
const
|
|
14
|
+
const { libsDir } = (0, devkit_1.getWorkspaceLayout)(tree);
|
|
15
|
+
const projectRoot = (0, devkit_1.joinPathFragments)(libsDir, name);
|
|
15
16
|
const libGenTask = yield (0, library_1.libraryGenerator)(tree, {
|
|
16
17
|
name,
|
|
17
18
|
// Remix can only work with buildable libs and yarn/npm workspaces
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.impl.js","sourceRoot":"","sources":["../../../../../../packages/
|
|
1
|
+
{"version":3,"file":"library.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/library/library.impl.ts"],"names":[],"mappings":";;;AAAA,yCAUsB;AACtB,wEAA8E;AAE9E,yCAAsC;AACtC,iDAAyC;AACzC,2FAAqF;AAErF,mBAA+B,IAAU,EAAE,OAA+B;;QACxE,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;QAC1C,MAAM,EAAE,GAAG,IAAA,6BAAoB,GAAE,CAAC;QAClC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,W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K,EAAE;gBAChB,OAAO,GAAG,iBAAiB,CAAC;aAC7B;iBAAM,IAAI,EAAE,KAAK,MAAM,EAAE;gBACxB,OAAO,GAAG,MAAM,CAAC;aAClB;iBAAM,IAAI,EAAE,KAAK,MAAM,EAAE;gBACxB,OAAO,GAAG,cAAc,CAAC;aAC1B;YACD,IAAA,wBAAQ,EAAC,OAAO,EAAE;gBAChB,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;aACjB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAzDD,4BAyDC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RemixGeneratorSchema } from '../schema';
|
|
2
2
|
import { Tree } from '@nrwl/devkit';
|
|
3
|
-
export interface NormalizedSchema extends
|
|
3
|
+
export interface NormalizedSchema extends RemixGeneratorSchema {
|
|
4
4
|
projectName: string;
|
|
5
5
|
projectRoot: string;
|
|
6
6
|
parsedTags: string[];
|
|
7
7
|
}
|
|
8
|
-
export declare function normalizeOptions(tree: Tree, options:
|
|
8
|
+
export declare function normalizeOptions(tree: Tree, options: RemixGeneratorSchema): NormalizedSchema;
|
|
@@ -3,8 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
5
|
function normalizeOptions(tree, options) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
// There is a bug in Nx core where custom preset args are not passed correctly for boolean values, thus causing the name to be "commit" or "nx-cloud" when not passed.
|
|
7
|
+
// TODO(jack): revert this hack once Nx core is fixed for custom preset args.
|
|
8
|
+
const name = (0, devkit_1.names)(options.project === 'commit' ||
|
|
9
|
+
options.project === 'nx-cloud' ||
|
|
10
|
+
!options.project
|
|
11
|
+
? 'webapp'
|
|
12
|
+
: options.project).fileName;
|
|
8
13
|
const projectName = name;
|
|
9
14
|
const projectRoot = `packages/${name}`;
|
|
10
15
|
const parsedTags = options.tags
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/remix/src/generators/preset/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAQ3C,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA6B;IAE7B,sKAAsK;IACtK,6EAA6E;IAC7E,MAAM,IAAI,GAAG,IAAA,cAAK,EAChB,OAAO,CAAC,OAAO,KAAK,QAAQ;QAC1B,OAAO,CAAC,OAAO,KAAK,UAAU;QAC9B,CAAC,OAAO,CAAC,OAAO;QAChB,CAAC,CAAC,QAAQ;QACV,CAAC,CAAC,OAAO,CAAC,OAAO,CACpB,CAAC,QAAQ,CAAC;IACX,MAAM,WAAW,GAAG,IAAI,CAAC;IACzB,MAAM,WAAW,GAAG,YAAY,IAAI,EAAE,CAAC;IACvC,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI;QAC7B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,CAAC,CAAC,EAAE,CAAC;IAEP,uCACK,OAAO,KACV,WAAW;QACX,WAAW;QACX,UAAU,IACV;AACJ,CAAC;AAzBD,4CAyBC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nrwl/devkit';
|
|
2
|
-
import {
|
|
3
|
-
export default function (tree: Tree, _options:
|
|
2
|
+
import { RemixGeneratorSchema } from './schema';
|
|
3
|
+
export default function (tree: Tree, _options: RemixGeneratorSchema): Promise<GeneratorCallback>;
|
|
@@ -4,45 +4,24 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
5
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
6
6
|
const application_impl_1 = require("../application/application.impl");
|
|
7
|
+
const setup_impl_1 = require("../setup/setup.impl");
|
|
7
8
|
const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
|
|
9
|
+
const set_default_collection_1 = require("@nrwl/workspace/src/utilities/set-default-collection");
|
|
8
10
|
function default_1(tree, _options) {
|
|
9
11
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
10
12
|
const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
11
13
|
const tasks = [];
|
|
12
|
-
const pm = (0, devkit_1.detectPackageManager)();
|
|
13
14
|
const appGenTask = yield (0, application_impl_1.default)(tree, {
|
|
14
15
|
name: options.projectName,
|
|
15
16
|
tags: options.tags,
|
|
16
17
|
skipFormat: true,
|
|
17
18
|
});
|
|
18
19
|
tasks.push(appGenTask);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
22
|
-
var _a;
|
|
23
|
-
(_a = json.workspaces) !== null && _a !== void 0 ? _a : (json.workspaces = ['libs/*']);
|
|
24
|
-
return json;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
tree.write('pnpm-workspace.yaml', `packages:
|
|
29
|
-
- 'libs/*`);
|
|
30
|
-
}
|
|
31
|
-
// Ignore nested project files
|
|
32
|
-
const ignoreFile = tree.read('.gitignore').toString();
|
|
33
|
-
tree.write('.gitignore', `${ignoreFile
|
|
34
|
-
.replace('/dist', 'dist')
|
|
35
|
-
.replace('/node_modules', 'node_modules')}
|
|
36
|
-
// Remix files
|
|
37
|
-
apps/**/build
|
|
38
|
-
apps/**/.cache
|
|
39
|
-
`);
|
|
40
|
-
const nxJson = (0, devkit_1.readJson)(tree, 'nx.json');
|
|
41
|
-
nxJson.targetDependencies.dev = [
|
|
42
|
-
{ target: 'build', projects: 'dependencies' },
|
|
43
|
-
];
|
|
20
|
+
const setupGenTask = yield (0, setup_impl_1.default)(tree, {});
|
|
21
|
+
tasks.push(setupGenTask);
|
|
44
22
|
// No need for workspace.json in latest Nx
|
|
45
23
|
tree.delete('workspace.json');
|
|
24
|
+
(0, set_default_collection_1.setDefaultCollection)(tree, '@nrwl/remix');
|
|
46
25
|
yield (0, devkit_1.formatFiles)(tree);
|
|
47
26
|
return (0, run_tasks_in_serial_1.runTasksInSerial)(...tasks);
|
|
48
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.impl.js","sourceRoot":"","sources":["../../../../../../packages/
|
|
1
|
+
{"version":3,"file":"preset.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/preset/preset.impl.ts"],"names":[],"mappings":";;;AAAA,yCAAoE;AAGpE,+DAA2D;AAC3D,sEAAmE;AACnE,oDAAiD;AACjD,2FAAqF;AACrF,iGAA4F;AAE5F,mBAA+B,IAAU,EAAE,QAA8B;;QACvE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,MAAM,UAAU,GAAG,MAAM,IAAA,0BAAoB,EAAC,IAAI,EAAE;YAClD,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEvB,MAAM,YAAY,GAAG,MAAM,IAAA,oBAAc,EAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACpD,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QAEzB,0CAA0C;QAC1C,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;QAE9B,IAAA,6CAAoB,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAE1C,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AAtBD,4BAsBC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function default_1(tree, options) {
|
|
6
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
7
|
+
const { fileName: routePath, className: componentName } = (0, devkit_1.names)(options.path.replace(/^\//, '').replace(/\/$/, ''));
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
9
|
+
const project = projects.get(options.project);
|
|
10
|
+
if (!project)
|
|
11
|
+
throw new Error(`Project does not exist: ${options.project}`);
|
|
12
|
+
const componentPath = (0, devkit_1.joinPathFragments)(project.root, 'app/routes', `${routePath}.tsx`);
|
|
13
|
+
if (tree.exists(componentPath))
|
|
14
|
+
throw new Error(`Path already exists: ${options.path}`);
|
|
15
|
+
tree.write(componentPath, (0, devkit_1.stripIndents) `
|
|
16
|
+
import { useEffect, useRef } from 'react';
|
|
17
|
+
${options.style === 'css'
|
|
18
|
+
? `import type { LinksFunction, LoaderFunction, MetaFunction } from 'remix';
|
|
19
|
+
`
|
|
20
|
+
: `import type { LoaderFunction, MetaFunction } from 'remix';`}
|
|
21
|
+
import { useActionData, useLoaderData, redirect } from 'remix';
|
|
22
|
+
|
|
23
|
+
${options.style === 'css'
|
|
24
|
+
? `import stylesUrl from '~/styles/${routePath}.css';`
|
|
25
|
+
: ''}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// Provide meta tags for this page.
|
|
29
|
+
// - https://remix.run/api/conventions#meta
|
|
30
|
+
export const meta: MetaFunction = () =>{
|
|
31
|
+
return { title: '${componentName}' };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
${options.style === 'css'
|
|
35
|
+
? (0, devkit_1.stripIndents) `
|
|
36
|
+
// Provide stylesheet for this page.
|
|
37
|
+
// - https://remix.run/api/conventions#links
|
|
38
|
+
export const links: LinksFunction = () => {
|
|
39
|
+
return [{ rel: 'stylesheet', href: stylesUrl }];
|
|
40
|
+
};
|
|
41
|
+
`
|
|
42
|
+
: ''}
|
|
43
|
+
|
|
44
|
+
// Use this function to provide data for the route.
|
|
45
|
+
// - https://remix.run/api/conventions#loader
|
|
46
|
+
export const loader: LoaderFunction = async () => {
|
|
47
|
+
return {
|
|
48
|
+
message: 'Hello, world!',
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default function ${componentName}() {
|
|
53
|
+
const data = useLoaderData();
|
|
54
|
+
return (
|
|
55
|
+
<p>
|
|
56
|
+
Message: {data.message}
|
|
57
|
+
</p>
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
`);
|
|
61
|
+
if (options.style === 'css') {
|
|
62
|
+
const stylesheetPath = (0, devkit_1.joinPathFragments)(project.root, 'app/styles', `${routePath}.css`);
|
|
63
|
+
tree.write(stylesheetPath, (0, devkit_1.stripIndents) `
|
|
64
|
+
:root {
|
|
65
|
+
--color-foreground: #fff;
|
|
66
|
+
--color-background: #143157;
|
|
67
|
+
--color-links: hsl(214, 73%, 69%);
|
|
68
|
+
--color-border: #275da8;
|
|
69
|
+
--font-body: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
|
|
70
|
+
Liberation Mono, Courier New, monospace;
|
|
71
|
+
}
|
|
72
|
+
`);
|
|
73
|
+
}
|
|
74
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
exports.default = default_1;
|
|
78
|
+
//# sourceMappingURL=route.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/route/route.impl.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AAGtB,mBAA+B,IAAU,EAAE,OAAyB;;QAClE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAA,cAAK,EAC7D,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CACnD,CAAC;QACF,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACnC,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAE9C,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;QAE5E,MAAM,aAAa,GAAG,IAAA,0BAAiB,EACrC,OAAO,CAAC,IAAI,EACZ,YAAY,EACZ,GAAG,SAAS,MAAM,CACnB,CAAC;QAEF,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,wBAAwB,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;QAE1D,IAAI,CAAC,KAAK,CACR,aAAa,EACb,IAAA,qBAAY,EAAA;;MAGV,OAAO,CAAC,KAAK,KAAK,KAAK;YACrB,CAAC,CAAC;OACH;YACC,CAAC,CAAC,4DACN;;;MAIE,OAAO,CAAC,KAAK,KAAK,KAAK;YACrB,CAAC,CAAC,mCAAmC,SAAS,QAAQ;YACtD,CAAC,CAAC,EACN;;;;;;yBAMqB,aAAa;;;MAIhC,OAAO,CAAC,KAAK,KAAK,KAAK;YACrB,CAAC,CAAC,IAAA,qBAAY,EAAA;;;;;;SAMb;YACD,CAAC,CAAC,EACN;;;;;;;;;;8BAU0B,aAAa;;;;;;;;GAQxC,CACA,CAAC;QAEF,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE;YAC3B,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,OAAO,CAAC,IAAI,EACZ,YAAY,EACZ,GAAG,SAAS,MAAM,CACnB,CAAC;YACF,IAAI,CAAC,KAAK,CACR,cAAc,EACd,IAAA,qBAAY,EAAA;;;;;;;;;KASb,CACA,CAAC;SACH;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAhGD,4BAgGC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"$id": "NxRemixRoute",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"title": "Create a Route",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"examples": [
|
|
8
|
+
{
|
|
9
|
+
"command": "g route 'path/to/page'",
|
|
10
|
+
"description": "Generate route at /path/to/page"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"properties": {
|
|
14
|
+
"project": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "The name of the project.",
|
|
17
|
+
"$default": {
|
|
18
|
+
"$source": "projectName"
|
|
19
|
+
},
|
|
20
|
+
"x-prompt": "What project is this route for?",
|
|
21
|
+
"pattern": "^[a-zA-Z].*$"
|
|
22
|
+
},
|
|
23
|
+
"path": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"description": "Route path",
|
|
26
|
+
"$default": {
|
|
27
|
+
"$source": "argv",
|
|
28
|
+
"index": 0
|
|
29
|
+
},
|
|
30
|
+
"x-prompt": "What is the path of the route? (e.g. 'foo/bar')"
|
|
31
|
+
},
|
|
32
|
+
"style": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Generate a stylesheet",
|
|
35
|
+
"enum": ["none", "css"],
|
|
36
|
+
"default": "css"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"required": ["project", "path"]
|
|
40
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"cli": "nx",
|
|
4
|
+
"$id": "NxRemixSetup",
|
|
5
|
+
"title": "",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"packageManager": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The package manager to setup for",
|
|
11
|
+
"enum": ["yarn", "npm", "pnpm"]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function default_1(tree, options) {
|
|
6
|
+
var _a;
|
|
7
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
8
|
+
const { libsDir } = (0, devkit_1.getWorkspaceLayout)(tree);
|
|
9
|
+
const pm = (_a = options.packageManager) !== null && _a !== void 0 ? _a : (0, devkit_1.detectPackageManager)();
|
|
10
|
+
// Enable yarn/npm/pnpm workspaces for buildable libs
|
|
11
|
+
if (pm !== 'pnpm') {
|
|
12
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (json) => {
|
|
13
|
+
var _a;
|
|
14
|
+
if (!json.workspaces) {
|
|
15
|
+
(_a = json.workspaces) !== null && _a !== void 0 ? _a : (json.workspaces = [(0, devkit_1.joinPathFragments)(libsDir, '*')]);
|
|
16
|
+
}
|
|
17
|
+
return json;
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
if (!tree.exists('pnpm-workspace.yaml')) {
|
|
22
|
+
tree.write('pnpm-workspace.yaml', `packages:
|
|
23
|
+
- '${(0, devkit_1.joinPathFragments)(libsDir, '*')}'`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
// Ignore nested project files
|
|
27
|
+
let ignoreFile = tree.read('.gitignore').toString();
|
|
28
|
+
if (ignoreFile.indexOf('/dist') !== -1) {
|
|
29
|
+
ignoreFile = ignoreFile.replace('/dist', 'dist');
|
|
30
|
+
}
|
|
31
|
+
if (ignoreFile.indexOf('/node_modules') !== -1) {
|
|
32
|
+
ignoreFile = ignoreFile.replace('/node_modules', 'node_modules');
|
|
33
|
+
}
|
|
34
|
+
if (ignoreFile.indexOf('# Remix files') === -1) {
|
|
35
|
+
ignoreFile = `${ignoreFile}
|
|
36
|
+
# Remix files
|
|
37
|
+
apps/**/build
|
|
38
|
+
apps/**/.cache
|
|
39
|
+
`;
|
|
40
|
+
}
|
|
41
|
+
tree.write('.gitignore', ignoreFile);
|
|
42
|
+
(0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
|
|
43
|
+
addTargetDependency(json, 'dev', {
|
|
44
|
+
target: 'build',
|
|
45
|
+
projects: 'dependencies',
|
|
46
|
+
});
|
|
47
|
+
addTargetDependency(json, 'start', { target: 'build', projects: 'self' });
|
|
48
|
+
return json;
|
|
49
|
+
});
|
|
50
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
51
|
+
return () => {
|
|
52
|
+
// Reserved for additional processing needed
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
exports.default = default_1;
|
|
57
|
+
function addTargetDependency(json, target, dep) {
|
|
58
|
+
var _a;
|
|
59
|
+
if (Array.isArray((_a = json.targetDependencies) === null || _a === void 0 ? void 0 : _a[target])) {
|
|
60
|
+
if (!json.targetDependencies[target].some((x) => x.target === dep.target && x.projects === dep.projects)) {
|
|
61
|
+
json.targetDependencies[target].push({
|
|
62
|
+
target: dep.target,
|
|
63
|
+
projects: dep.projects,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
json.targetDependencies = Object.assign(Object.assign({}, json.targetDependencies), { [target]: [dep] });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=setup.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.impl.js","sourceRoot":"","sources":["../../../../../../packages/remix/src/generators/setup/setup.impl.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AAEtB,mBACE,IAAU,EACV,OAEC;;;QAED,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,EAAE,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,IAAA,6BAAoB,GAAE,CAAC;QAE5D,qDAAqD;QACrD,IAAI,EAAE,KAAK,MAAM,EAAE;YACjB,IAAA,mBAAU,EAAC,IAAI,EAAE,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE;;gBACxC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;oBACpB,MAAA,IAAI,CAAC,UAAU,oCAAf,IAAI,CAAC,UAAU,GAAK,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,GAAG,CAAC,CAAC,EAAC;iBACvD;gBACD,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE;gBACvC,IAAI,CAAC,KAAK,CACR,qBAAqB,EACrB;OACD,IAAA,0BAAiB,EAAC,OAAO,EAAE,GAAG,CAAC,GAAG,CAClC,CAAC;aACH;SACF;QAED,8BAA8B;QAC9B,IAAI,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;QACpD,IAAI,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE;YACtC,UAAU,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAClD;QACD,IAAI,UAAU,CAAC,OAAO,CAAC,eAAe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,QAAQ,EAAE,GAAG,CAAC,QAAQ;aACvB,CAAC,CAAC;SACJ;KACF;SAAM;QACL,IAAI,CAAC,kBAAkB,mCAClB,IAAI,CAAC,kBAAkB,KAC1B,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,GAChB,CAAC;KACH;AACH,CAAC"}
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/remix/src/index.ts"],"names":[],"mappings":""}
|