@nrwl/remix 1.0.0-alpha.1 → 1.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +97 -3
  2. package/generators.json +20 -1
  3. package/package.json +4 -3
  4. package/src/generators/application/application.impl.js +2 -2
  5. package/src/generators/application/application.impl.js.map +1 -1
  6. package/src/generators/{preset/files/README.md → application/files/README.md__tmpl__} +7 -6
  7. package/src/generators/{preset → application}/files/app/entry.client.tsx__tmpl__ +0 -0
  8. package/src/generators/{preset → application}/files/app/entry.server.tsx__tmpl__ +0 -0
  9. package/src/generators/{preset → application}/files/app/root.tsx__tmpl__ +2 -2
  10. package/src/generators/{preset → application}/files/app/routes/demos/about/index.tsx__tmpl__ +0 -0
  11. package/src/generators/{preset → application}/files/app/routes/demos/about/whoa.tsx__tmpl__ +0 -0
  12. package/src/generators/{preset → application}/files/app/routes/demos/about.tsx__tmpl__ +1 -1
  13. package/src/generators/{preset → application}/files/app/routes/demos/actions.tsx__tmpl__ +0 -0
  14. package/src/generators/{preset → application}/files/app/routes/demos/correct.tsx__tmpl__ +0 -0
  15. package/src/generators/{preset → application}/files/app/routes/demos/params/$id.tsx__tmpl__ +0 -0
  16. package/src/generators/{preset → application}/files/app/routes/demos/params/index.tsx__tmpl__ +0 -0
  17. package/src/generators/{preset → application}/files/app/routes/demos/params.tsx__tmpl__ +0 -0
  18. package/src/generators/{preset → application}/files/app/routes/index.tsx__tmpl__ +0 -0
  19. package/src/generators/{preset → application}/files/app/styles/dark.css +0 -0
  20. package/src/generators/{preset → application}/files/app/styles/demos/about.css +0 -0
  21. package/src/generators/{preset → application}/files/app/styles/global.css +0 -0
  22. package/src/generators/{preset → application}/files/package.json__tmpl__ +0 -0
  23. package/src/generators/{preset → application}/files/public/favicon.ico +0 -0
  24. package/src/generators/{preset → application}/files/remix.config.js__tmpl__ +0 -0
  25. package/src/generators/{preset → application}/files/remix.env.d.ts__tmpl__ +0 -0
  26. package/src/generators/{preset → application}/files/tsconfig.json__tmpl__ +3 -2
  27. package/src/generators/application/lib/normalize-options.js +1 -1
  28. package/src/generators/application/lib/normalize-options.js.map +1 -1
  29. package/src/generators/application/schema.json +2 -2
  30. package/src/generators/library/library.impl.d.ts +3 -0
  31. package/src/generators/library/library.impl.js +60 -0
  32. package/src/generators/library/library.impl.js.map +1 -0
  33. package/src/generators/library/schema.d.ts +6 -0
  34. package/src/generators/library/schema.json +39 -0
  35. package/src/generators/preset/lib/normalize-options.js +2 -1
  36. package/src/generators/preset/lib/normalize-options.js.map +1 -1
  37. package/src/generators/preset/preset.impl.d.ts +2 -2
  38. package/src/generators/preset/preset.impl.js +10 -10
  39. package/src/generators/preset/preset.impl.js.map +1 -1
  40. package/src/generators/setup/schema.json +14 -0
  41. package/src/generators/setup/setup.impl.d.ts +4 -0
  42. package/src/generators/setup/setup.impl.js +65 -0
  43. package/src/generators/setup/setup.impl.js.map +1 -0
package/README.md CHANGED
@@ -1,7 +1,101 @@
1
- # nx-remix
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
- This library was generated with [Nx](https://nx.dev).
3
+ Next generation full stack framework and build system together. Build better websites with [Remix](https://remix.run/) and [Nx](https://nx.dev).
4
4
 
5
- ## Running unit tests
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 `--project=@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
+ You can also run `nx build demo` and `nx start demo`.
29
+
30
+ ## Existing workspaces
31
+
32
+ You can add Remix to any existing Nx workspace.
33
+
34
+ First, install the plugin:
35
+
36
+ ```bash
37
+ npm install --save-dev @nrwl/remix
38
+
39
+ # Or with yarn
40
+ yarn add -D @nrwl/remix
41
+ ```
42
+
43
+ Then, run the setup generator:
44
+
45
+ ```bash
46
+ npx nx g @nrwl/remix:setup
47
+ ```
48
+
49
+ You can then add your first app and run it:
50
+
51
+ ```bash
52
+ npx nx g @nrwl/remix:app demo
53
+ ```
54
+
55
+ ## Workspace libraries
56
+
57
+ The Remix setup leverages npm/yarn/pnpm workspaces and Nx buildable libraries.
58
+
59
+ ```bash
60
+ npx nx g @nrwl/remix:lib mylib
61
+ ```
62
+
63
+ Import the new library in your app.
64
+
65
+ ```typescript jsx
66
+ // apps/demo/app/root.tsx
67
+ import { Mylib } from '@acme/mylib';
68
+
69
+ // ...
70
+
71
+ export default function App() {
72
+ return (
73
+ <Document>
74
+ <Layout>
75
+ <Mylib />
76
+ <Outlet />
77
+ </Layout>
78
+ </Document>
79
+ );
80
+ }
81
+ ```
82
+
83
+ Now, run the dev server again to see the new library in action.
84
+
85
+ ```bash
86
+ npx nx dev demo
87
+ ```
88
+
89
+ **Note:** You must restart the server if you make any changes to your library. Luckily, with Nx cache this operation should be super fast.
90
+
91
+ ## Contributing
92
+
93
+ ### Running unit tests
6
94
 
7
95
  Run `nx test nx-remix` to execute the unit tests via [Jest](https://jestjs.io).
96
+
97
+ ### Publishing
98
+
99
+ ```bash
100
+ nx publish nx-remix --ver=[version]
101
+ ```
package/generators.json CHANGED
@@ -7,7 +7,26 @@
7
7
  "preset": {
8
8
  "factory": "./src/generators/preset/preset.impl",
9
9
  "schema": "./src/generators/preset/schema.json",
10
- "description": "Generate a new remix workspace"
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 workspace"
16
+ },
17
+ "application": {
18
+ "factory": "./src/generators/application/application.impl",
19
+ "schema": "./src/generators/application/schema.json",
20
+ "description": "Generate a new Remix application",
21
+ "aliases": ["app"],
22
+ "x-type": "application"
23
+ },
24
+ "library": {
25
+ "factory": "./src/generators/library/library.impl",
26
+ "schema": "./src/generators/library/schema.json",
27
+ "description": "Generate a new library",
28
+ "aliases": ["lib"],
29
+ "x-type": "library"
11
30
  }
12
31
  }
13
32
  }
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@nrwl/remix",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.13",
4
4
  "main": "src/index.js",
5
5
  "generators": "./generators.json",
6
6
  "dependencies": {
7
- "@nrwl/devkit": "^13.3.9",
8
- "@nrwl/react": "^13.3.9",
7
+ "@nrwl/devkit": "^13.4.1",
8
+ "@nrwl/js": "^13.4.1",
9
+ "@nrwl/react": "^13.4.1",
9
10
  "tslib": "^2.3.1"
10
11
  },
11
12
  "typings": "./src/index.d.ts"
@@ -11,8 +11,8 @@ function default_1(tree, _options) {
11
11
  const tasks = [];
12
12
  (0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
13
13
  root: options.projectRoot,
14
- projectType: 'library',
15
- sourceRoot: `${options.projectRoot}/src`,
14
+ sourceRoot: `${options.projectRoot}`,
15
+ projectType: 'application',
16
16
  tags: options.parsedTags,
17
17
  });
18
18
  const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {
@@ -1 +1 @@
1
- {"version":3,"file":"application.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-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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AAC,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"}
@@ -1,13 +1,14 @@
1
- # Welcome to Remix!
1
+ # Welcome to Nx + Remix!
2
2
 
3
3
  - [Remix Docs](https://remix.run/docs)
4
+ - [Nx Docs](https://nx.dev)
4
5
 
5
6
  ## Development
6
7
 
7
8
  From your terminal:
8
9
 
9
10
  ```sh
10
- npm run dev
11
+ npx nx dev <%= projectName %>
11
12
  ```
12
13
 
13
14
  This starts your app in development mode, rebuilding assets on file changes.
@@ -17,13 +18,13 @@ This starts your app in development mode, rebuilding assets on file changes.
17
18
  First, build your app for production:
18
19
 
19
20
  ```sh
20
- npm run build
21
+ npx nx build <%= projectName %>
21
22
  ```
22
23
 
23
24
  Then run the app in production mode:
24
25
 
25
26
  ```sh
26
- npm start
27
+ npx nx start <%= projectName %>
27
28
  ```
28
29
 
29
30
  Now you'll need to pick a host to deploy it to.
@@ -34,8 +35,8 @@ If you're familiar with deploying node applications, the built-in Remix app serv
34
35
 
35
36
  Make sure to deploy the output of `remix build`
36
37
 
37
- - `build/`
38
- - `public/build/`
38
+ - `packages/<%= projectName %>/build/`
39
+ - `packages/<%= projectName %>/public/build/`
39
40
 
40
41
  ### Using a Template
41
42
 
@@ -10,8 +10,8 @@ import {
10
10
  } from "remix";
11
11
  import type { LinksFunction } from "remix";
12
12
 
13
- import globalStylesUrl from "./styles/global.css";
14
- import darkStylesUrl from "./styles/dark.css";
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,7 +1,7 @@
1
1
  import { Outlet } from "remix";
2
2
  import type { MetaFunction, LinksFunction } from "remix";
3
3
 
4
- import stylesUrl from "../../styles/demos/about.css";
4
+ import stylesUrl from "~/styles/demos/about.css";
5
5
 
6
6
  export let meta: MetaFunction = () => {
7
7
  return {
@@ -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
  }
@@ -5,7 +5,7 @@ const devkit_1 = require("@nrwl/devkit");
5
5
  function normalizeOptions(tree, options) {
6
6
  const name = (0, devkit_1.names)(options.name).fileName;
7
7
  const projectName = name;
8
- const projectRoot = `packages/${name}`;
8
+ const projectRoot = `apps/${name}`;
9
9
  const parsedTags = options.tags
10
10
  ? options.tags.split(',').map((s) => s.trim())
11
11
  : [];
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/nx-remix/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAQ3C,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;IAE/B,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IAC1C,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;AAjBD,4CAiBC"}
1
+ {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/nx-remix/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAAuE;AAQvE,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;IAE/B,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IAC1C,MAAM,WAAW,GAAG,IAAI,CAAC;IACzB,MAAM,WAAW,GAAG,QAAQ,IAAI,EAAE,CAAC;IACnC,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;AAjBD,4CAiBC"}
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "cli": "nx",
4
- "$id": "NxRemix",
5
- "title": "",
4
+ "$id": "NxRemixApplication",
5
+ "title": "Create an Application",
6
6
  "type": "object",
7
7
  "properties": {
8
8
  "name": {
@@ -0,0 +1,3 @@
1
+ import { GeneratorCallback, Tree } from '@nrwl/devkit';
2
+ import { NxRemixGeneratorSchema } from './schema';
3
+ export default function (tree: Tree, options: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
@@ -0,0 +1,60 @@
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 library_1 = require("@nrwl/react/src/generators/library/library");
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");
9
+ function default_1(tree, options) {
10
+ return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
11
+ const tasks = [];
12
+ const name = (0, devkit_1.names)(options.name).fileName;
13
+ const pm = (0, devkit_1.detectPackageManager)();
14
+ const projectRoot = (0, devkit_1.joinPathFragments)('libs', name);
15
+ const libGenTask = yield (0, library_1.libraryGenerator)(tree, {
16
+ name,
17
+ // Remix can only work with buildable libs and yarn/npm workspaces
18
+ buildable: true,
19
+ compiler: 'babel',
20
+ style: 'css',
21
+ unitTestRunner: 'jest',
22
+ tags: options.tags,
23
+ importPath: options.importPath,
24
+ skipFormat: false,
25
+ skipTsConfig: false,
26
+ linter: linter_1.Linter.EsLint,
27
+ component: true,
28
+ });
29
+ tasks.push(libGenTask);
30
+ // Nest dist under project root to we can link it
31
+ const project = (0, devkit_1.readProjectConfiguration)(tree, name);
32
+ project.targets.build.options = Object.assign(Object.assign({}, project.targets.build.options), { format: ['cjs'], outputPath: (0, devkit_1.joinPathFragments)(projectRoot, 'dist') });
33
+ (0, devkit_1.updateProjectConfiguration)(tree, name, project);
34
+ // Point to nested dist for yarn/npm/pnpm workspaces
35
+ (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(projectRoot, 'package.json'), (json) => {
36
+ json.main = './dist/index.cjs.js';
37
+ json.typings = './dist/index.d.ts';
38
+ return json;
39
+ });
40
+ // Link workspaces
41
+ tasks.push(() => {
42
+ let command;
43
+ if (pm === 'npm') {
44
+ command = `npm install -ws`;
45
+ }
46
+ else if (pm === 'yarn') {
47
+ command = `yarn`;
48
+ }
49
+ else if (pm === 'pnpm') {
50
+ command = `pnpm install`;
51
+ }
52
+ (0, child_process_1.execSync)(command, {
53
+ stdio: [0, 1, 2],
54
+ });
55
+ });
56
+ return (0, run_tasks_in_serial_1.runTasksInSerial)(...tasks);
57
+ });
58
+ }
59
+ exports.default = default_1;
60
+ //# sourceMappingURL=library.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"library.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-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,WAAW,GAAG,IAAA,0BAAiB,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAEpD,MAAM,UAAU,GAAG,MAAM,IAAA,0BAAgB,EAAC,IAAI,EAAE;YAC9C,IAAI;YAEJ,kEAAkE;YAClE,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,OAAO;YAEjB,KAAK,EAAE,KAAK;YACZ,cAAc,EAAE,MAAM;YACtB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,KAAK;YACnB,MAAM,EAAE,eAAM,CAAC,MAAM;YACrB,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;QACH,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAEvB,iDAAiD;QACjD,MAAM,OAAO,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACrD,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,mCACxB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,KAChC,MAAM,EAAE,CAAC,KAAK,CAAC,EACf,UAAU,EAAE,IAAA,0BAAiB,EAAC,WAAW,EAAE,MAAM,CAAC,GACnD,CAAC;QACF,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhD,oDAAoD;QACpD,IAAA,mBAAU,EAAC,IAAI,EAAE,IAAA,0BAAiB,EAAC,WAAW,EAAE,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE;YACxE,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;YAClC,IAAI,CAAC,OAAO,GAAG,mBAAmB,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,kBAAkB;QAClB,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE;YACd,IAAI,OAAe,CAAC;YACpB,IAAI,EAAE,KAAK,KAAK,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;AAxDD,4BAwDC"}
@@ -0,0 +1,6 @@
1
+ export interface NxRemixGeneratorSchema {
2
+ name: string;
3
+ tags?: string;
4
+ importPath?: string;
5
+ js?: boolean;
6
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "$schema": "http://json-schema.org/schema",
3
+ "$id": "NxRemixLibrary",
4
+ "cli": "nx",
5
+ "title": "Create a Library",
6
+ "type": "object",
7
+ "examples": [
8
+ {
9
+ "command": "g lib mylib --directory=myapp",
10
+ "description": "Generate libs/myapp/mylib"
11
+ }
12
+ ],
13
+ "properties": {
14
+ "name": {
15
+ "type": "string",
16
+ "description": "Library name",
17
+ "$default": {
18
+ "$source": "argv",
19
+ "index": 0
20
+ },
21
+ "x-prompt": "What name would you like to use for the library?",
22
+ "pattern": "^[a-zA-Z].*$"
23
+ },
24
+ "tags": {
25
+ "type": "string",
26
+ "description": "Add tags to the library (used for linting)"
27
+ },
28
+ "importPath": {
29
+ "type": "string",
30
+ "description": "The library name used to import it, like @myorg/my-awesome-lib"
31
+ },
32
+ "js": {
33
+ "type": "boolean",
34
+ "description": "Generate JavaScript files rather than TypeScript files",
35
+ "default": false
36
+ }
37
+ },
38
+ "required": ["name"]
39
+ }
@@ -3,7 +3,8 @@ 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 name = (0, devkit_1.names)(options.project).fileName;
6
+ var _a;
7
+ const name = (0, devkit_1.names)((_a = options.project) !== null && _a !== void 0 ? _a : 'webapp').fileName;
7
8
  const projectName = name;
8
9
  const projectRoot = `packages/${name}`;
9
10
  const parsedTags = options.tags
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/nx-remix/src/generators/preset/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAQ3C,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;IAE/B,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;IAC7C,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;AAjBD,4CAiBC"}
1
+ {"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/nx-remix/src/generators/preset/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAAyC;AAQzC,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAA+B;;IAE/B,MAAM,IAAI,GAAG,IAAA,cAAK,EAAC,MAAA,OAAO,CAAC,OAAO,mCAAI,QAAQ,CAAC,CAAC,QAAQ,CAAC;IACzD,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;AAjBD,4CAiBC"}
@@ -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<import("@nrwl/devkit").GeneratorCallback>;
3
+ export default function (tree: Tree, _options: NxRemixGeneratorSchema): Promise<GeneratorCallback>;
@@ -4,24 +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");
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* () {
9
11
  const options = (0, normalize_options_1.normalizeOptions)(tree, _options);
10
- const workspaceConfig = (0, devkit_1.readWorkspaceConfiguration)(tree);
11
- workspaceConfig.workspaceLayout = {
12
- appsDir: 'packages',
13
- libsDir: 'packages',
14
- };
15
- (0, devkit_1.updateWorkspaceConfiguration)(tree, workspaceConfig);
16
- const task = yield (0, application_impl_1.default)(tree, {
12
+ const tasks = [];
13
+ const appGenTask = yield (0, application_impl_1.default)(tree, {
17
14
  name: options.projectName,
18
15
  tags: options.tags,
19
16
  skipFormat: true,
20
17
  });
21
- tree.delete('apps');
22
- tree.delete('libs');
18
+ tasks.push(appGenTask);
19
+ const setupGenTask = yield (0, setup_impl_1.default)(tree, {});
20
+ tasks.push(setupGenTask);
21
+ // No need for workspace.json in latest Nx
22
+ tree.delete('workspace.json');
23
23
  yield (0, devkit_1.formatFiles)(tree);
24
- return task;
24
+ return (0, run_tasks_in_serial_1.runTasksInSerial)(...tasks);
25
25
  });
26
26
  }
27
27
  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,yCAKsB;AAGtB,+DAA2D;AAC3D,sEAAmE;AAEnE,mBAA+B,IAAU,EAAE,QAAgC;;QACzE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEjD,MAAM,eAAe,GAAG,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC;QACzD,eAAe,CAAC,eAAe,GAAG;YAChC,OAAO,EAAE,UAAU;YACnB,OAAO,EAAE,UAAU;SACpB,CAAC;QACF,IAAA,qCAA4B,EAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAEpD,MAAM,IAAI,GAAG,MAAM,IAAA,0BAAoB,EAAC,IAAI,EAAE;YAC5C,IAAI,EAAE,OAAO,CAAC,WAAW;YACzB,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACpB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEpB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,IAAI,CAAC;IACd,CAAC;CAAA;AAtBD,4BAsBC"}
1
+ {"version":3,"file":"preset.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/preset/preset.impl.ts"],"names":[],"mappings":";;;AAAA,yCAAoE;AAGpE,+DAA2D;AAC3D,sEAAmE;AACnE,oDAAiD;AACjD,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;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,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAExB,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AApBD,4BAoBC"}
@@ -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,4 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ export default function (tree: Tree, options: {
3
+ packageManager?: 'yarn' | 'npm' | 'pnpm';
4
+ }): Promise<() => void>;
@@ -0,0 +1,65 @@
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 pm = (_a = options.packageManager) !== null && _a !== void 0 ? _a : (0, devkit_1.detectPackageManager)();
9
+ // Enable yarn/npm/pnpm workspaces for buildable libs
10
+ if (pm !== 'pnpm') {
11
+ (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
12
+ var _a;
13
+ if (!json.workspaces) {
14
+ (_a = json.workspaces) !== null && _a !== void 0 ? _a : (json.workspaces = ['libs/*']);
15
+ }
16
+ return json;
17
+ });
18
+ }
19
+ else {
20
+ if (!tree.exists('pnpm-workspace.yaml')) {
21
+ tree.write('pnpm-workspace.yaml', `packages:
22
+ - 'libs/*`);
23
+ }
24
+ }
25
+ // Ignore nested project files
26
+ let ignoreFile = tree.read('.gitignore').toString();
27
+ if (ignoreFile.indexOf('/dist') !== -1) {
28
+ ignoreFile = ignoreFile.replace('/dist', 'dist');
29
+ }
30
+ if (ignoreFile.indexOf('/node_modules') !== -1) {
31
+ ignoreFile = ignoreFile.replace('/node_modules', 'node_modules');
32
+ }
33
+ if (ignoreFile.indexOf('# Remix files') === -1) {
34
+ ignoreFile = `${ignoreFile
35
+ .replace('/dist', 'dist')
36
+ .replace('/node_modules', 'node_modules')}
37
+ # Remix files
38
+ apps/**/build
39
+ apps/**/.cache
40
+ `;
41
+ }
42
+ tree.write('.gitignore', ignoreFile);
43
+ (0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
44
+ var _a;
45
+ if (Array.isArray((_a = json.targetDependencies) === null || _a === void 0 ? void 0 : _a.dev)) {
46
+ if (!json.targetDependencies.dev.some((x) => x.target === 'build' && x.projects === 'dependencies')) {
47
+ json.targetDependencies.dev.push({
48
+ target: 'build',
49
+ projects: 'dependencies',
50
+ });
51
+ }
52
+ }
53
+ else {
54
+ json.targetDependencies = Object.assign(Object.assign({}, json.targetDependencies), { dev: [{ target: 'build', projects: 'dependencies' }] });
55
+ }
56
+ return json;
57
+ });
58
+ yield (0, devkit_1.formatFiles)(tree);
59
+ return () => {
60
+ // Reserved for additional processing needed
61
+ };
62
+ });
63
+ }
64
+ exports.default = default_1;
65
+ //# sourceMappingURL=setup.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.impl.js","sourceRoot":"","sources":["../../../../../../packages/nx-remix/src/generators/setup/setup.impl.ts"],"names":[],"mappings":";;;AAAA,yCAKsB;AAEtB,mBACE,IAAU,EACV,OAEC;;;QAED,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,QAAQ,CAAC,EAAC;iBAChC;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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