@nrwl/remix 1.0.0-alpha.3 → 1.0.0-alpha.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.
- package/README.md +15 -15
- package/package.json +1 -1
- package/src/generators/application/files/app/root.tsx__tmpl__ +2 -2
- package/src/generators/application/files/app/routes/demos/about.tsx__tmpl__ +1 -1
- package/src/generators/application/files/tsconfig.json__tmpl__ +3 -2
- package/src/generators/library/library.impl.d.ts +2 -2
- package/src/generators/library/library.impl.js +27 -2
- package/src/generators/library/library.impl.js.map +1 -1
- package/src/generators/preset/preset.impl.d.ts +2 -2
- package/src/generators/preset/preset.impl.js +30 -7
- package/src/generators/preset/preset.impl.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
<p style="text-align: center;"><img src="https://github.com/nrwl/nx-labs/raw/main/packages/nx-remix/nx-remix.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
|
|
2
2
|
|
|
3
|
-
## Creating new workspace
|
|
3
|
+
## Creating new Remix workspace
|
|
4
|
+
|
|
5
|
+
Use `--project=@nrwl/remix` when creating new workspace.
|
|
6
|
+
|
|
7
|
+
e.g.
|
|
4
8
|
|
|
5
9
|
```bash
|
|
6
|
-
npx create-nx-workspace@latest acme
|
|
10
|
+
npx create-nx-workspace@latest acme \
|
|
11
|
+
--preset=@nrwl/remix \
|
|
12
|
+
--project=demo
|
|
7
13
|
```
|
|
8
14
|
|
|
9
15
|
Now, you can go into the `acme` folder and start development.
|
|
@@ -17,7 +23,9 @@ npx nx dev demo
|
|
|
17
23
|
|
|
18
24
|
You can also run `nx build demo` and `nx start demo`.
|
|
19
25
|
|
|
20
|
-
##
|
|
26
|
+
## Workspace libraries
|
|
27
|
+
|
|
28
|
+
The Remix setup leverages npm/yarn/pnpm workspaces and Nx buildable libraries.
|
|
21
29
|
|
|
22
30
|
```bash
|
|
23
31
|
npx nx g @nrwl/remix:lib mylib
|
|
@@ -35,7 +43,7 @@ export default function App() {
|
|
|
35
43
|
return (
|
|
36
44
|
<Document>
|
|
37
45
|
<Layout>
|
|
38
|
-
<Mylib/>
|
|
46
|
+
<Mylib />
|
|
39
47
|
<Outlet />
|
|
40
48
|
</Layout>
|
|
41
49
|
</Document>
|
|
@@ -43,22 +51,14 @@ export default function App() {
|
|
|
43
51
|
}
|
|
44
52
|
```
|
|
45
53
|
|
|
46
|
-
Now,
|
|
47
|
-
|
|
48
|
-
```bash
|
|
49
|
-
npx nx build mylib
|
|
50
|
-
yarn
|
|
51
|
-
|
|
52
|
-
# or with npm workspaces
|
|
53
|
-
npm install -ws
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Finally, serve the app again.
|
|
54
|
+
Now, run the dev server again to see the new library in action!
|
|
57
55
|
|
|
58
56
|
```bash
|
|
59
57
|
npx nx dev demo
|
|
60
58
|
```
|
|
61
59
|
|
|
60
|
+
**Note:** You must restart the server if you make any changes to your library. Luckily, with Nx cache this operation should be super fast.
|
|
61
|
+
|
|
62
62
|
## Contributing
|
|
63
63
|
|
|
64
64
|
### Running unit tests
|
package/package.json
CHANGED
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
} from "remix";
|
|
11
11
|
import type { LinksFunction } from "remix";
|
|
12
12
|
|
|
13
|
-
import globalStylesUrl from "
|
|
14
|
-
import darkStylesUrl from "
|
|
13
|
+
import globalStylesUrl from "~/styles/global.css";
|
|
14
|
+
import darkStylesUrl from "~/styles/dark.css";
|
|
15
15
|
|
|
16
16
|
// https://remix.run/api/app#links
|
|
17
17
|
export let links: LinksFunction = () => {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "../../tsconfig.base.json",
|
|
3
2
|
"include": ["remix.env.d.ts", "**/*.ts", "**/*.tsx"],
|
|
4
3
|
"compilerOptions": {
|
|
5
4
|
"lib": ["DOM", "DOM.Iterable", "ES2019"],
|
|
@@ -9,7 +8,9 @@
|
|
|
9
8
|
"resolveJsonModule": true,
|
|
10
9
|
"target": "ES2019",
|
|
11
10
|
"strict": true,
|
|
12
|
-
|
|
11
|
+
"paths": {
|
|
12
|
+
"~/*": ["./app/*"]
|
|
13
|
+
},
|
|
13
14
|
// Remix takes care of building everything in `remix build`.
|
|
14
15
|
"noEmit": true
|
|
15
16
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Tree } from '@nrwl/devkit';
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nrwl/devkit';
|
|
2
2
|
import { NxRemixGeneratorSchema } from './schema';
|
|
3
|
-
export default function (tree: Tree, options: NxRemixGeneratorSchema): Promise<
|
|
3
|
+
export default function (tree: Tree, options: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
|
|
@@ -4,10 +4,14 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
5
|
const library_1 = require("@nrwl/react/src/generators/library/library");
|
|
6
6
|
const linter_1 = require("@nrwl/linter");
|
|
7
|
+
const child_process_1 = require("child_process");
|
|
8
|
+
const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
|
|
7
9
|
function default_1(tree, options) {
|
|
8
10
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
11
|
+
const tasks = [];
|
|
9
12
|
const name = (0, devkit_1.names)(options.name).fileName;
|
|
10
|
-
const
|
|
13
|
+
const pm = (0, devkit_1.detectPackageManager)();
|
|
14
|
+
const libGenTask = yield (0, library_1.libraryGenerator)(tree, {
|
|
11
15
|
name,
|
|
12
16
|
// Remix can only work with buildable libs and yarn/npm workspaces
|
|
13
17
|
buildable: true,
|
|
@@ -21,7 +25,28 @@ function default_1(tree, options) {
|
|
|
21
25
|
linter: linter_1.Linter.EsLint,
|
|
22
26
|
component: true,
|
|
23
27
|
});
|
|
24
|
-
|
|
28
|
+
tasks.push(libGenTask);
|
|
29
|
+
// Nest dist under project root to we can link it
|
|
30
|
+
const project = (0, devkit_1.readProjectConfiguration)(tree, name);
|
|
31
|
+
project.targets.build.options = Object.assign(Object.assign({}, project.targets.build.options), { outputPath: `libs/${name}/dist` });
|
|
32
|
+
(0, devkit_1.updateProjectConfiguration)(tree, name, project);
|
|
33
|
+
// Link workspaces
|
|
34
|
+
tasks.push(() => {
|
|
35
|
+
let command;
|
|
36
|
+
if (pm === 'npm') {
|
|
37
|
+
command = `npm install -ws`;
|
|
38
|
+
}
|
|
39
|
+
else if (pm === 'yarn') {
|
|
40
|
+
command = `yarn`;
|
|
41
|
+
}
|
|
42
|
+
else if (pm === 'pnpm') {
|
|
43
|
+
command = `pnpm install`;
|
|
44
|
+
}
|
|
45
|
+
(0, child_process_1.execSync)(command, {
|
|
46
|
+
stdio: [0, 1, 2],
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
return (0, run_tasks_in_serial_1.runTasksInSerial)(...tasks);
|
|
25
50
|
});
|
|
26
51
|
}
|
|
27
52
|
exports.default = default_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/library/library.impl.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"library.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/library/library.impl.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;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;QAElC,MAAM,UAAU,GAAG,MAAM,IAAA,0BAAgB,EAAC,IAAI,EAAE;YAC9C,IAAI;YAEJ,kEAAkE;YAClE,SAAS,E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kit';
|
|
1
|
+
import { GeneratorCallback, Tree } from '@nrwl/devkit';
|
|
2
2
|
import { NxRemixGeneratorSchema } from './schema';
|
|
3
|
-
export default function (tree: Tree, _options: NxRemixGeneratorSchema): Promise<
|
|
3
|
+
export default function (tree: Tree, _options: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
|
|
@@ -4,24 +4,47 @@ 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 run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
|
|
7
8
|
function default_1(tree, _options) {
|
|
8
9
|
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
9
10
|
const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
|
|
10
|
-
const
|
|
11
|
+
const tasks = [];
|
|
12
|
+
const pm = (0, devkit_1.detectPackageManager)();
|
|
13
|
+
const appGenTask = yield (0, application_impl_1.default)(tree, {
|
|
11
14
|
name: options.projectName,
|
|
12
15
|
tags: options.tags,
|
|
13
16
|
skipFormat: true,
|
|
14
17
|
});
|
|
18
|
+
tasks.push(appGenTask);
|
|
15
19
|
// Enable yarn/npm/pnpm workspaces for buildable libs
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
if (pm !== 'pnpm') {
|
|
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
|
+
];
|
|
21
44
|
// No need for workspace.json in latest Nx
|
|
22
45
|
tree.delete('workspace.json');
|
|
23
46
|
yield (0, devkit_1.formatFiles)(tree);
|
|
24
|
-
return
|
|
47
|
+
return (0, run_tasks_in_serial_1.runTasksInSerial)(...tasks);
|
|
25
48
|
});
|
|
26
49
|
}
|
|
27
50
|
exports.default = default_1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preset.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/preset/preset.impl.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"preset.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/preset/preset.impl.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AAGtB,+DAA2D;AAC3D,sEAAmE;AACnE,2FAAqF;AAErF,mBAA+B,IAAU,EAAE,QAAgC;;QACzE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,MAAM,KAAK,GAAwB,EAAE,CAAC;QACtC,MAAM,EAAE,GAAG,IAAA,6BAAoB,GAAE,CAAC;QAElC,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,KAA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